diff options
author | manu <manu@138bc75d-0d04-0410-961f-82ee72b054a4> | 2012-05-09 21:14:15 +0000 |
---|---|---|
committer | manu <manu@138bc75d-0d04-0410-961f-82ee72b054a4> | 2012-05-09 21:14:15 +0000 |
commit | d834564a753973e8655f45010784562c65f8b340 (patch) | |
tree | 4b18ba8c78c4acdb7b3108123cdc3146cde30ec1 | |
parent | 72b48d28234141ef1c70f59a6d3564df8ab98624 (diff) | |
download | ppe42-gcc-d834564a753973e8655f45010784562c65f8b340.tar.gz ppe42-gcc-d834564a753973e8655f45010784562c65f8b340.zip |
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: svn+ssh://gcc.gnu.org/svn/gcc/trunk@187355 138bc75d-0d04-0410-961f-82ee72b054a4
-rw-r--r-- | gcc/ChangeLog | 7 | ||||
-rw-r--r-- | gcc/diagnostic.c | 5 | ||||
-rw-r--r-- | gcc/diagnostic.h | 3 |
3 files changed, 14 insertions, 1 deletions
diff --git a/gcc/ChangeLog b/gcc/ChangeLog index bd8b9b20992..40ff5a153c8 100644 --- a/gcc/ChangeLog +++ b/gcc/ChangeLog @@ -12,6 +12,13 @@ 2012-05-09 Manuel López-Ibáñez <manu@gcc.gnu.org> + PR c++/53289 + * diagnostic.h (diagnostic_context): Add last_location. + * diagnostic.c (diagnostic_initialize): Initialize it. + (diagnostic_show_locus): Use it. + +2012-05-09 Manuel López-Ibáñez <manu@gcc.gnu.org> + * doc/extend.texi (Function Attributes): Point xref to section about Pragmas. 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) diff --git a/gcc/diagnostic.h b/gcc/diagnostic.h index 63eb3852958..976754ef3f2 100644 --- a/gcc/diagnostic.h +++ b/gcc/diagnostic.h @@ -172,6 +172,9 @@ struct diagnostic_context /* Auxiliary data for client. */ void *x_data; + /* Used to detect that the last caret was printed at the same location. */ + location_t last_location; + /* Used to detect when the input file stack has changed since last described. */ const struct line_map *last_module; |