aboutsummaryrefslogtreecommitdiff
path: root/gcc/diagnostic.c
diff options
context:
space:
mode:
authorManuel López-Ibáñez <manu@gcc.gnu.org>2012-05-09 21:14:15 +0000
committerManuel López-Ibáñez <manu@gcc.gnu.org>2012-05-09 21:14:15 +0000
commitd151b3d950ac9801f9d7e454cfe47f363831b66f (patch)
tree4b18ba8c78c4acdb7b3108123cdc3146cde30ec1 /gcc/diagnostic.c
parent2d88ea8b883dc79240c9fef7f8399b1db57a0b5d (diff)
2012-05-09 Manuel López-Ibáñez <manu@gcc.gnu.org>
PR c++/53289 gcc/ * diagnostic.h (diagnostic_context): Add last_location. * diagnostic.c (diagnostic_initialize): Initialize it. (diagnostic_show_locus): Use it. git-svn-id: https://gcc.gnu.org/svn/gcc/trunk@187355 138bc75d-0d04-0410-961f-82ee72b054a4
Diffstat (limited to 'gcc/diagnostic.c')
-rw-r--r--gcc/diagnostic.c5
1 files changed, 4 insertions, 1 deletions
diff --git a/gcc/diagnostic.c b/gcc/diagnostic.c
index 1e2712e59b1..4913eed9c67 100644
--- a/gcc/diagnostic.c
+++ b/gcc/diagnostic.c
@@ -147,6 +147,7 @@ diagnostic_initialize (diagnostic_context *context, int n_opts)
context->option_enabled = NULL;
context->option_state = NULL;
context->option_name = NULL;
+ context->last_location = UNKNOWN_LOCATION;
context->last_module = 0;
context->x_data = NULL;
context->lock = 0;
@@ -263,9 +264,11 @@ diagnostic_show_locus (diagnostic_context * context,
if (!context->show_caret
- || diagnostic->location <= BUILTINS_LOCATION)
+ || diagnostic->location <= BUILTINS_LOCATION
+ || diagnostic->location == context->last_location)
return;
+ context->last_location = diagnostic->location;
s = expand_location_to_spelling_point (diagnostic->location);
line = location_get_source_line (s);
if (line == NULL)