aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorDavid Malcolm <dmalcolm@redhat.com>2021-06-03 10:32:40 -0400
committerDavid Malcolm <dmalcolm@redhat.com>2021-06-03 10:32:40 -0400
commit4bdc6e17c9dc621f9502a84abceb2e17ae0418f8 (patch)
treef94e0d53d763354a8b26aa30b04d1ad68d35ed36
parent57ed620ebfa4275d04efeec973e88f506b0e3ba8 (diff)
downloadgcc-4bdc6e17c9dc621f9502a84abceb2e17ae0418f8.zip
gcc-4bdc6e17c9dc621f9502a84abceb2e17ae0418f8.tar.gz
gcc-4bdc6e17c9dc621f9502a84abceb2e17ae0418f8.tar.bz2
diagnostic-show-locus: tweak rejection logic
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>
-rw-r--r--gcc/diagnostic-show-locus.c6
1 files changed, 4 insertions, 2 deletions
diff --git a/gcc/diagnostic-show-locus.c b/gcc/diagnostic-show-locus.c
index 4111cd6..24bd031 100644
--- a/gcc/diagnostic-show-locus.c
+++ b/gcc/diagnostic-show-locus.c
@@ -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;