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

Jakub Jelinek jakub@redhat.com
Wed Dec 2 07:16:00 GMT 2015


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.

	Jakub



More information about the Gcc-patches mailing list