diff options
author | manu <manu@138bc75d-0d04-0410-961f-82ee72b054a4> | 2010-04-14 16:08:23 +0000 |
---|---|---|
committer | manu <manu@138bc75d-0d04-0410-961f-82ee72b054a4> | 2010-04-14 16:08:23 +0000 |
commit | 61c21070d7886fba3eacc39e7a55689d12ddda25 (patch) | |
tree | c0e6c2e2517c577f772c0ff6ae13b4cceb5ccea8 /gcc/diagnostic.c | |
parent | f5e8a4bc696b84b87b1a832b665de29f0deeb435 (diff) | |
download | gcc-61c21070d7886fba3eacc39e7a55689d12ddda25.tar.gz |
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.
git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@158349 138bc75d-0d04-0410-961f-82ee72b054a4
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 5df458b465e..ed14a213933 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; |