This is the mail archive of the
gcc-patches@gcc.gnu.org
mailing list for the GCC project.
Re: [C PATCH, committed] Use protected_set_expr_location more
- From: Richard Biener <richard dot guenther at gmail dot com>
- To: Marek Polacek <polacek at redhat dot com>
- Cc: GCC Patches <gcc-patches at gcc dot gnu dot org>
- Date: Wed, 7 Oct 2015 15:59:09 +0200
- Subject: Re: [C PATCH, committed] Use protected_set_expr_location more
- Authentication-results: sourceware.org; auth=none
- References: <20151006172959 dot GT6184 at redhat dot com> <CAFiYyc0W_enhP1KJM9vVLccG7hZ7mnH+TbGXeyLBrDiO+F=zCw at mail dot gmail dot com> <20151007110200 dot GX6184 at redhat dot com>
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