[PATCH] C++: show location of problematic extern "C" specifications

Jason Merrill jason@redhat.com
Wed Oct 11 21:22:00 GMT 2017


On Wed, Oct 11, 2017 at 4:50 PM, David Malcolm <dmalcolm@redhat.com> wrote:
> On Wed, 2017-10-11 at 15:51 -0400, Jason Merrill wrote:
>> On Tue, Sep 26, 2017 at 3:27 PM, David Malcolm <dmalcolm@redhat.com>
>> wrote:
>> >         * cp-tree.h (struct saved_scope): Add "location" field.
>>
>> saved_scope seems like the wrong place for this; it's only
>> interesting
>> at parse time, so having it saved during template instantiation
>> doesn't seem useful.  I'd prefer to put it in cp_parser and have
>> maybe_show_extern_c_location look in the_parser.
>
> Thanks.
>
> I have a new version of the patch *mostly* working that way, but one of
> the uses of maybe_show_extern_c_location is within decl.c:grokfndecl
> (when complaining about user-defined literal operators within C
> linkage), and there doesn't seem to be access to the cp_parser * from
> there.
>
> I could fix this by adding a cp_parser * for this to grokfndecl, which
> would mean adding it to grokdeclarator, but I get the impression that
> the code is structured so that the decl-handling isn't meant to know
> about the parser.

That's why I was thinking to look at "the_parser", which functions in
parser.c can get at directly.

Jason



More information about the Gcc-patches mailing list