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: PR 15236 pedantic switch modifies treatment of non-ISO compliant enumerations


2008/8/8 Tom Tromey <tromey@redhat.com>:
>>>>>> "Manuel" == Manuel López-Ibáñez <lopezibanez@gmail.com> writes:
>
> Manuel>   (build_enumerator): Take a location parameter. Give a pedwarn but do
> Manuel> not perform any conversion.
> Manuel>   * c-parser.c (c_parser_enum_specifier): Set correct location for enumerator.
>
> I just wanted to say -- I like the change to pass the location here
> and I think the C and C++ front ends need a bit more of this... not
> just for errors but also to set locations on exprs.
>

I actually would like this to be more invisible but at the same time
more reliable. If you look carefully, the location I pass there is
that of whatever is after '=', that is, the location of the "(tree)
value", that would be the wrong location for the declaration that is
build whitin build_enumerator. However, the location that is build
right now is even worse because it may occur in a totally different
line (I added a comment about it). So we would need to pass another
location, that corresponding to the "(tree) name".

However I think that instead of passing location variables around,
things (not sure whether custom front-end structures or some tree
types or how to properly do this without increasing memory) should
carry their own location information around and every time those
things are used to build new things (like a declaration or a
expression), the correct location would be used.

Still, without enabling -fshow-column by default it seems hard to
notice when we are getting the wrong location if it is in the same
line.

Cheers,

Manuel.


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