This is the mail archive of the gcc-patches@gcc.gnu.org mailing list for the GCC project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

Re: [C PATCH] Fix up location used in get_parm_info diagnostics (PR c/68533)


On 12/02/2015 12:16 AM, Jakub Jelinek wrote:
On Tue, Dec 01, 2015 at 08:57:39PM -0700, Jeff Law wrote:
On 12/01/2015 01:34 PM, Jakub Jelinek wrote:
Hi!

get_parm_info right now uses input_location as the diagnostics locus, but as
can be seen on the testcase, that is pretty random location at that point,
often the type of the last parameter.

This patch changes it to use the locus from the binding info.

Bootstrapped/regtested on x86_64-linux and i686-linux, ok for trunk?

2015-12-01  Jakub Jelinek  <jakub@redhat.com>

	PR c/68533
	* c-decl.c (get_parm_info): Use b->locus instead of input_location
	for diagnostics.

	* gcc.dg/pr68533.c: New test.
I think the change itself is fine.  My question is whether or not the C++
front-end gets this right.  ISTM we ought to be running the test on both the
C & C++ front-ends.  The C++ front-end may emit different messages, but we
ought to be able to account for that and ensure that we're getting them on
the right lines.

The warning does not exist at all in the C++ FE, it has instead
just an error on declaring anonymous types (not others) among parameters.
C++ does not have forward parameter declarations.  And for the void
among arguments diagnostics it uses slightly different locations and
completely different wording.  So I'm afraid there is basically nothing in
common between C and C++ FEs in this area, so a shared testcase does not
make sense.
In that case, it's fine as-is for the trunk.

Thanks for checking on the C++ side.

Jeff


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]