]> git.ipfire.org Git - thirdparty/gcc.git/commitdiff
diagnostic-show-locus: tweak rejection logic
authorDavid Malcolm <dmalcolm@redhat.com>
Fri, 2 Jul 2021 19:19:44 +0000 (15:19 -0400)
committerDavid Malcolm <dmalcolm@redhat.com>
Fri, 2 Jul 2021 19:19:44 +0000 (15:19 -0400)
gcc/ChangeLog:
* diagnostic-show-locus.c (diagnostic_show_locus): Don't reject
printing the same location twice if there are fix-it hints,
multiple locations, or a label.

Signed-off-by: David Malcolm <dmalcolm@redhat.com>
gcc/diagnostic-show-locus.c

index 4111cd6654431f4138020e645a7bc18ae55c7f39..24bd0313126fd6ede858c4f7c9702a1264391708 100644 (file)
@@ -2600,9 +2600,11 @@ diagnostic_show_locus (diagnostic_context * context,
     return;
 
   /* Don't print the same source location twice in a row, unless we have
-     fix-it hints.  */
+     fix-it hints, or multiple locations, or a label.  */
   if (loc == context->last_location
-      && richloc->get_num_fixit_hints () == 0)
+      && richloc->get_num_fixit_hints () == 0
+      && richloc->get_num_locations () == 1
+      && richloc->get_range (0)->m_label == NULL)
     return;
 
   context->last_location = loc;