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, committed] Use protected_set_expr_location more


On Wed, Oct 7, 2015 at 1:02 PM, Marek Polacek <polacek@redhat.com> wrote:
> On Wed, Oct 07, 2015 at 10:14:54AM +0200, Richard Biener wrote:
>> > --- gcc/c/c-parser.c
>> > +++ gcc/c/c-parser.c
>> > @@ -5141,9 +5141,8 @@ c_parser_statement_after_labels (c_parser *parser, vec<tree> *chain)
>> >       (recursively) all of the component statements should already have
>> >       line numbers assigned.  ??? Can we discard no-op statements
>> >       earlier?  */
>> > -  if (CAN_HAVE_LOCATION_P (stmt)
>> > -      && EXPR_LOCATION (stmt) == UNKNOWN_LOCATION)
>> > -    SET_EXPR_LOCATION (stmt, loc);
>> > +  if (EXPR_LOCATION (stmt) == UNKNOWN_LOCATION)
>> > +    protected_set_expr_location (stmt, loc);
>>
>> This one doesn't look like an improvement though as EXPR_LOCATION tests
>> CAN_HAVE_LOCATION_P and returns UNKNOWN_LOCATION if not.
>
> Yeah, but protected_set_expr_location tests CAN_HAVE_LOCATION_P so we
> wouldn't set the location anyway.
>
> But I can surely revert that bit if you prefer.

Well, it's not my call but the original code is clearer if one looks
up EXPR_LOCATION.

Richard.

>         Marek


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