From cd7fe53b723e8f24dc2efc21bc68a2ac174ee882 Mon Sep 17 00:00:00 2001 From: DJ Delorie Date: Mon, 21 Jun 2010 16:58:57 -0400 Subject: diagnostic.h (diagnostic_classification_change_t): New. * 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. From-SVN: r161115 --- gcc/opts.c | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) (limited to 'gcc/opts.c') diff --git a/gcc/opts.c b/gcc/opts.c index 006e0f1..55f8c77 100644 --- a/gcc/opts.c +++ b/gcc/opts.c @@ -2396,7 +2396,8 @@ set_option (int opt_index, int value, const char *arg, int kind) } if ((diagnostic_t)kind != DK_UNSPECIFIED) - diagnostic_classify_diagnostic (global_dc, opt_index, (diagnostic_t)kind); + diagnostic_classify_diagnostic (global_dc, opt_index, (diagnostic_t)kind, + UNKNOWN_LOCATION); } @@ -2434,7 +2435,8 @@ enable_warning_as_error (const char *arg, int value, unsigned int lang_mask) { const diagnostic_t kind = value ? DK_ERROR : DK_WARNING; - diagnostic_classify_diagnostic (global_dc, option_index, kind); + diagnostic_classify_diagnostic (global_dc, option_index, kind, + UNKNOWN_LOCATION); if (kind == DK_ERROR) { const struct cl_option * const option = cl_options + option_index; -- cgit v1.1