This is the mail archive of the
gcc-patches@gcc.gnu.org
mailing list for the GCC project.
Re: [PR c/52952] More precise locations within format strings
- From: Manuel López-Ibáñez <lopezibanez at gmail dot com>
- To: Andreas Schwab <schwab at suse dot de>
- Cc: Gcc Patch List <gcc-patches at gcc dot gnu dot org>, "Joseph S. Myers" <joseph at codesourcery dot com>, Dodji Seketeli <dodji at redhat dot com>, Jason Merrill <jason at redhat dot com>
- Date: Wed, 12 Nov 2014 15:35:06 +0100
- Subject: Re: [PR c/52952] More precise locations within format strings
- Authentication-results: sourceware.org; auth=none
- References: <CAESRpQCBPF9n7yHz=UJ9ykA+tPsR5d26JM_c_C-fW3=ByU0RyA at mail dot gmail dot com> <mvm1tp87azi dot fsf at hawking dot suse dot de>
On 12 November 2014 15:24, Andreas Schwab <schwab@suse.de> wrote:
> Manuel López-Ibáñez <lopezibanez@gmail.com> writes:
>
>> Index: libcpp/line-map.c
>> ===================================================================
>> --- libcpp/line-map.c (revision 217191)
>> +++ libcpp/line-map.c (working copy)
>> @@ -631,10 +631,54 @@ linemap_position_for_line_and_column (co
>> + ((line - ORDINARY_MAP_STARTING_LINE_NUMBER (map))
>> << ORDINARY_MAP_NUMBER_OF_COLUMN_BITS (map))
>> + (column & ((1 << ORDINARY_MAP_NUMBER_OF_COLUMN_BITS (map)) - 1)));
>> }
>>
>> +/* Encode and return a source_location starting from location LOC and
>> + shifting it by OFFSET columns. This function does not support
>> + virtual locations. */
>> +
>> +source_location
>> +linemap_position_for_loc_and_offset (struct line_maps *set,
>> + source_location loc,
>> + unsigned int offset)
>> +{
>> + const struct line_map * map = NULL;
>> +
>> + /* This function does not support virtual locations yet. */
>> + linemap_assert (!linemap_location_from_macro_expansion_p (set, loc));
>> +
>> + if (offset == 0
>> + /* Adding an offset to a reserved location (like
>> + UNKNOWN_LOCATION for the C/C++ FEs) does not really make
>> + sense. So let's live the location intact in that case. */
>> + || loc < RESERVED_LOCATION_COUNT)
>> + return loc;
>> +
>> + /* First, we find the real location and shift it. */
>> + loc = linemap_resolve_location (set, loc, LRK_SPELLING_LOCATION, &map);
>> + /* The new location (loc + offset) should be higher than the first
>> + location encoded by MAP. */
>> + linemap_assert (MAP_START_LOCATION (map) < loc + offset);
>> +
>> + /* If MAP is not the last line map of its set, then the new location
>> + (loc + offset) should be less than the first location encoded by
>> + the next line map of the set. */
>> + if (map < LINEMAPS_LAST_ORDINARY_MAP (set))
>> + linemap_assert (MAP_START_LOCATION (&map[1]) < loc + offset);
>
> ../../libcpp/line-map.c:667:65: error: suggest braces around empty body in an 'if' statement [-Werror=empty-body]
I just (r217418) bootstrapped this code and it did not produce this
error (or warning). Could you give more details?
Cheers,
Manuel.