On 25 September 2015 at 23:24, David Malcolm <dmalc...@redhat.com> wrote: > On Fri, 2015-09-25 at 23:13 +0200, Manuel López-Ibáñez wrote: >> + If SHOW_CARET_P is true, then the range should be rendered with >> + a caret at its starting location. This >> + is for use by the Fortran frontend, for implementing the >> + "%C" and "%L" format codes. */ >> + >> +void >> +rich_location::set_range (unsigned int idx, source_range src_range, >> + bool show_caret_p, bool overwrite_loc_p) >> >> I do not understand when is this show_caret_p used by Fortran given >> the diagnostic_show_locus code mentioned earlier.
[...] > rich_location::set_range exists to ensure that the %C and %L codes used > by Fortran (and "+" in the C family of FEs) can write back into the > rich_location instance, faithfully emulating the old code that wrote > back to > struct text_info's: > location_t locations[MAX_LOCATIONS_PER_MESSAGE]; Why Fortran cannot use text->set_location like the other FEs? This way you do not need set_range at all. In fact, you do: + source_range range + = source_range::from_location ( + linemap_position_for_loc_and_offset (line_table, + loc->lb->location, + offset)); + text->set_range (loc_num, range, true); But I guess this doesn't actually create a range like ^~~~ but as single ^. The other issue that confuses me is that show_caret_p is always true when reaching this function via the pretty-printer. Thus, show_caret_p is also used by C/C++. In fact, I'm not sure when it can be false. Cheers, Manuel.