On 12/03/2015 09:33 PM, David Malcolm wrote:
The attached patch updates the handling of %q+D, simplifying
the implementation, and ensuring that it retains the range
information of the decl, giving:

diagnostic-ranges-1.c:6:7: warning: unused variable ‘redundant’ 
[-Wunused-variable]
    int redundant;
        ^~~~~~~~~

For most of it I've convinced myself that it looks OK.

  void
-rich_location::set_range (unsigned int idx, source_range src_range,
-                         bool show_caret_p, bool overwrite_loc_p)
+rich_location::set_range (line_maps *set, unsigned int idx,
+                         source_location loc, bool show_caret_p)
  {

Here you need to update the function comment.

This is a bit of a strange function. As far as I can tell, it's called from only two places, one in c-common.c (which overwrites idx 0, i.e. the entire range, and therefore is uninteresting), and one in text_info::set_location. I wonder about the use of "idx" in the latter. As far as I can tell, that's used by the Fortran frontend to keep track of two separate ranges for their diagnostics - correct? Is that really related to the normal function of rich_location and how it keeps track of multiple ranges, or would that be better expressed by keeping two rich_locations in text_info?


Bernd

Reply via email to