diff options
author | Manuel López-Ibáñez <manu@gcc.gnu.org> | 2010-04-14 16:08:23 +0000 |
---|---|---|
committer | Manuel López-Ibáñez <manu@gcc.gnu.org> | 2010-04-14 16:08:23 +0000 |
commit | 289fcbbd6e1e9683416f6a6380faa9471787e079 (patch) | |
tree | c0e6c2e2517c577f772c0ff6ae13b4cceb5ccea8 /gcc/diagnostic.c | |
parent | d58770e719cdc3c49707db835c5deeb7b35d1fb6 (diff) | |
download | gcc-289fcbbd6e1e9683416f6a6380faa9471787e079.zip gcc-289fcbbd6e1e9683416f6a6380faa9471787e079.tar.gz gcc-289fcbbd6e1e9683416f6a6380faa9471787e079.tar.bz2 |
re PR other/42966 (add some indication that a warning has been converted to an error)
2010-04-14 Manuel López-Ibáñez <manu@gcc.gnu.org>
PR 42966
* diagnostics.c (diagnostic_report_diagnostic): Mark specially
warnings converted to errors.
testsuite/
* gcc.dg/cpp/warn-undef-2.c: Update.
* gcc.dg/cpp/warn-traditional-2.c: Update.
* gcc.dg/cpp/warn-comments-2.c: Update.
* gcc.dg/cpp/warn-variadic-2.c: Update.
* gcc.dg/cpp/warn-long-long-2.c: Update.
* gcc.dg/cpp/warn-deprecated-2.c: Update.
* gcc.dg/cpp/warn-multichar-2.c: Update.
* gcc.dg/cpp/warn-normalized-3.c: Update.
* gcc.dg/cpp/warn-cxx-compat-2.c: Update.
* gcc.dg/cpp/warn-trigraphs-3.c: Update.
* gcc.dg/cpp/warn-unused-macros-2.c: Update.
* gcc.dg/cpp/warn-trigraphs-4.c: Update.
* gcc.dg/cpp/warn-redefined-2.c: Update.
* gfortran.dg/warning-directive-2.F90: Update.
* c-c++-common/cpp/warning-directive-2.c: Update.
From-SVN: r158349
Diffstat (limited to 'gcc/diagnostic.c')
-rw-r--r-- | gcc/diagnostic.c | 38 |
1 files changed, 34 insertions, 4 deletions
diff --git a/gcc/diagnostic.c b/gcc/diagnostic.c index 5df458b..ed14a21 100644 --- a/gcc/diagnostic.c +++ b/gcc/diagnostic.c @@ -426,11 +426,41 @@ diagnostic_report_diagnostic (diagnostic_context *context, ++diagnostic_kind_count (context, diagnostic->kind); saved_format_spec = diagnostic->message.format_spec; - if (context->show_option_requested && diagnostic->option_index) - diagnostic->message.format_spec - = ACONCAT ((diagnostic->message.format_spec, - " [", cl_options[diagnostic->option_index].opt_text, "]", NULL)); + if (context->show_option_requested) + { + const char * option_text = NULL; + if (diagnostic->option_index) + { + /* A warning classified as an error. */ + if ((orig_diag_kind == DK_WARNING || orig_diag_kind == DK_PEDWARN) + && diagnostic->kind == DK_ERROR) + option_text + = ACONCAT ((cl_options[OPT_Werror_].opt_text, + /* Skip over "-W". */ + cl_options[diagnostic->option_index].opt_text + 2, + NULL)); + /* A warning with option. */ + else + option_text = cl_options[diagnostic->option_index].opt_text; + } + /* A warning without option classified as an error. */ + else if (orig_diag_kind == DK_WARNING || orig_diag_kind == DK_PEDWARN + || diagnostic->kind == DK_WARNING) + { + if (context->warning_as_error_requested) + option_text = cl_options[OPT_Werror].opt_text; + else + option_text = _("enabled by default"); + } + + if (option_text) + diagnostic->message.format_spec + = ACONCAT ((diagnostic->message.format_spec, + " ", + "[", option_text, "]", + NULL)); + } diagnostic->message.locus = &diagnostic->location; diagnostic->message.abstract_origin = &diagnostic->abstract_origin; diagnostic->abstract_origin = NULL; |