diff options
author | dj <dj@138bc75d-0d04-0410-961f-82ee72b054a4> | 2010-06-21 20:58:57 +0000 |
---|---|---|
committer | dj <dj@138bc75d-0d04-0410-961f-82ee72b054a4> | 2010-06-21 20:58:57 +0000 |
commit | 0955be6537c2fd3d21d5a0b385a21fdfc6b5634b (patch) | |
tree | bed45f50f0a58fddadbef5bd923786107ade4104 /gcc/diagnostic.h | |
parent | 99820dd9a9a14ed27bc7d1f2f452eb24ebfa6ebe (diff) | |
download | gcc-0955be6537c2fd3d21d5a0b385a21fdfc6b5634b.tar.gz |
* diagnostic.h (diagnostic_classification_change_t): New.
(diagnostic_context): Add history and push/pop list.
(diagnostic_push_diagnostics): Declare.
(diagnostic_pop_diagnostics): Declare.
* diagnostic.c (diagnostic_classify_diagnostic): Store changes
from pragmas in a history chain instead of the global table.
(diagnostic_push_diagnostics): New.
(diagnostic_pop_diagnostics): New.
(diagnostic_report_diagnostic): Scan history chain to find state
of diagnostics as of the diagnostic location.
* opts.c (set_option): Pass UNKNOWN_LOCATION to
diagnostic_classify_diagnostic.
(enable_warning_as_error): Likewise.
* diagnostic-core.h (DK_POP): Add after "real" diagnostics, for
use in the history chain.
* c-family/c-pragma.c (handle_pragma_diagnostic): Add push/pop,
allow these pragmas anywhere.
* doc/extend.texi: Document pragma GCC diagnostic changes.
* gcc.dg/pragma-diag-1.c: New.
git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@161115 138bc75d-0d04-0410-961f-82ee72b054a4
Diffstat (limited to 'gcc/diagnostic.h')
-rw-r--r-- | gcc/diagnostic.h | 29 |
1 files changed, 28 insertions, 1 deletions
diff --git a/gcc/diagnostic.h b/gcc/diagnostic.h index 062402fa3f9..d3840749e91 100644 --- a/gcc/diagnostic.h +++ b/gcc/diagnostic.h @@ -41,6 +41,16 @@ typedef struct diagnostic_info int option_index; } diagnostic_info; +/* Each time a diagnostic's classification is changed with a pragma, + we record the change and the location of the change in an array of + these structs. */ +typedef struct diagnostic_classification_change_t +{ + location_t location; + int option; + diagnostic_t kind; +} diagnostic_classification_change_t; + /* Forward declarations. */ typedef struct diagnostic_context diagnostic_context; typedef void (*diagnostic_starter_fn) (diagnostic_context *, @@ -76,6 +86,20 @@ struct diagnostic_context all. */ diagnostic_t *classify_diagnostic; + /* History of all changes to the classifications above. This list + is stored in location-order, so we can search it, either + binary-wise or end-to-front, to find the most recent + classification for a given diagnostic, given the location of the + diagnostic. */ + diagnostic_classification_change_t *classification_history; + + /* The size of the above array. */ + int n_classification_history; + + /* For pragma push/pop. */ + int *push_list; + int n_push; + /* True if we should print the command line option which controls each diagnostic, if known. */ bool show_option_requested; @@ -228,7 +252,10 @@ extern void diagnostic_report_current_module (diagnostic_context *); /* Force diagnostics controlled by OPTIDX to be kind KIND. */ extern diagnostic_t diagnostic_classify_diagnostic (diagnostic_context *, int /* optidx */, - diagnostic_t /* kind */); + diagnostic_t /* kind */, + location_t); +extern void diagnostic_push_diagnostics (diagnostic_context *, location_t); +extern void diagnostic_pop_diagnostics (diagnostic_context *, location_t); extern bool diagnostic_report_diagnostic (diagnostic_context *, diagnostic_info *); #ifdef ATTRIBUTE_GCC_DIAG |