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 | |
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')
-rw-r--r-- | gcc/ChangeLog | 6 | ||||
-rw-r--r-- | gcc/diagnostic.c | 38 | ||||
-rw-r--r-- | gcc/testsuite/ChangeLog | 19 | ||||
-rw-r--r-- | gcc/testsuite/c-c++-common/cpp/warning-directive-2.c | 2 | ||||
-rw-r--r-- | gcc/testsuite/gcc.dg/cpp/warn-comments-2.c | 4 | ||||
-rw-r--r-- | gcc/testsuite/gcc.dg/cpp/warn-cxx-compat-2.c | 2 | ||||
-rw-r--r-- | gcc/testsuite/gcc.dg/cpp/warn-deprecated-2.c | 4 | ||||
-rw-r--r-- | gcc/testsuite/gcc.dg/cpp/warn-long-long-2.c | 4 | ||||
-rw-r--r-- | gcc/testsuite/gcc.dg/cpp/warn-multichar-2.c | 2 | ||||
-rw-r--r-- | gcc/testsuite/gcc.dg/cpp/warn-normalized-3.c | 2 | ||||
-rw-r--r-- | gcc/testsuite/gcc.dg/cpp/warn-redefined-2.c | 2 | ||||
-rw-r--r-- | gcc/testsuite/gcc.dg/cpp/warn-traditional-2.c | 18 | ||||
-rw-r--r-- | gcc/testsuite/gcc.dg/cpp/warn-trigraphs-3.c | 2 | ||||
-rw-r--r-- | gcc/testsuite/gcc.dg/cpp/warn-trigraphs-4.c | 2 | ||||
-rw-r--r-- | gcc/testsuite/gcc.dg/cpp/warn-undef-2.c | 2 | ||||
-rw-r--r-- | gcc/testsuite/gcc.dg/cpp/warn-unused-macros-2.c | 2 | ||||
-rw-r--r-- | gcc/testsuite/gcc.dg/cpp/warn-variadic-2.c | 4 | ||||
-rw-r--r-- | gcc/testsuite/gfortran.dg/warning-directive-2.F90 | 2 |
18 files changed, 86 insertions, 31 deletions
diff --git a/gcc/ChangeLog b/gcc/ChangeLog index 884217c..9819326 100644 --- a/gcc/ChangeLog +++ b/gcc/ChangeLog @@ -1,3 +1,9 @@ +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. + 2010-04-14 Uros Bizjak <ubizjak@gmail.com> * config/alpha/alpha.c (alpha_adjust_cost): Remove set but not 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; diff --git a/gcc/testsuite/ChangeLog b/gcc/testsuite/ChangeLog index 13ef39f..5f46fd5 100644 --- a/gcc/testsuite/ChangeLog +++ b/gcc/testsuite/ChangeLog @@ -1,3 +1,22 @@ +2010-04-14 Manuel López-Ibáñez <manu@gcc.gnu.org> + + PR 42966 + * 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. + 2010-04-14 Michael Matz <matz@suse.de> PR tree-optimization/42963 diff --git a/gcc/testsuite/c-c++-common/cpp/warning-directive-2.c b/gcc/testsuite/c-c++-common/cpp/warning-directive-2.c index 15c74d2..65edd7b 100644 --- a/gcc/testsuite/c-c++-common/cpp/warning-directive-2.c +++ b/gcc/testsuite/c-c++-common/cpp/warning-directive-2.c @@ -2,4 +2,4 @@ // { dg-options "-std=gnu99 -fdiagnostics-show-option -Werror=cpp" { target c } } // { dg-options "-fdiagnostics-show-option -Werror=cpp" { target c++ } } /* { dg-message "some warnings being treated as errors" "" {target "*-*-*"} 0 } */ -#warning "Printed" // { dg-error "\"Printed\" .-Wcpp." } +#warning "Printed" // { dg-error "\"Printed\" .-Werror=cpp." } diff --git a/gcc/testsuite/gcc.dg/cpp/warn-comments-2.c b/gcc/testsuite/gcc.dg/cpp/warn-comments-2.c index 107e6bf..17cc9f1 100644 --- a/gcc/testsuite/gcc.dg/cpp/warn-comments-2.c +++ b/gcc/testsuite/gcc.dg/cpp/warn-comments-2.c @@ -1,7 +1,7 @@ // { dg-do preprocess } // { dg-options "-std=gnu99 -fdiagnostics-show-option -Werror=comments" } /* { dg-message "some warnings being treated as errors" "" {target "*-*-*"} 0 } */ -/* /* */ // { dg-error "\"\.\*\" within comment .-Wcomments." } +/* /* */ // { dg-error "\"\.\*\" within comment .-Werror=comments." } // \ - // { dg-error "multi-line comment .-Wcomments." "multi-line" { target *-*-* } 6 } + // { dg-error "multi-line comment .-Werror=comments." "multi-line" { target *-*-* } 6 } diff --git a/gcc/testsuite/gcc.dg/cpp/warn-cxx-compat-2.c b/gcc/testsuite/gcc.dg/cpp/warn-cxx-compat-2.c index 91cad7c..69c4cfa 100644 --- a/gcc/testsuite/gcc.dg/cpp/warn-cxx-compat-2.c +++ b/gcc/testsuite/gcc.dg/cpp/warn-cxx-compat-2.c @@ -1,4 +1,4 @@ // { dg-do preprocess } // { dg-options "-std=gnu99 -fdiagnostics-show-option -Werror=c++-compat" } /* { dg-message "some warnings being treated as errors" "" {target "*-*-*"} 0 } */ -#define not ! // { dg-error "identifier \"not\" is a special operator name in C\\+\\+ .-Wc\\+\\+-compat." } +#define not ! // { dg-error "identifier \"not\" is a special operator name in C\\+\\+ .-Werror=c\\+\\+-compat." } diff --git a/gcc/testsuite/gcc.dg/cpp/warn-deprecated-2.c b/gcc/testsuite/gcc.dg/cpp/warn-deprecated-2.c index 600e2f6..8bd608a 100644 --- a/gcc/testsuite/gcc.dg/cpp/warn-deprecated-2.c +++ b/gcc/testsuite/gcc.dg/cpp/warn-deprecated-2.c @@ -1,7 +1,7 @@ // { dg-do preprocess } // { dg-options "-std=gnu99 -fdiagnostics-show-option -Werror=deprecated" } /* { dg-message "some warnings being treated as errors" "" {target "*-*-*"} 0 } */ -#assert x(x) // { dg-error "#assert is a deprecated GCC extension .-Wdeprecated." } +#assert x(x) // { dg-error "#assert is a deprecated GCC extension .-Werror=deprecated." } -#if #x(x) // { dg-error "assertions are a deprecated extension .-Wdeprecated." } +#if #x(x) // { dg-error "assertions are a deprecated extension .-Werror=deprecated." } #endif diff --git a/gcc/testsuite/gcc.dg/cpp/warn-long-long-2.c b/gcc/testsuite/gcc.dg/cpp/warn-long-long-2.c index 08fef13..7b074a3 100644 --- a/gcc/testsuite/gcc.dg/cpp/warn-long-long-2.c +++ b/gcc/testsuite/gcc.dg/cpp/warn-long-long-2.c @@ -1,6 +1,6 @@ // { dg-do preprocess } // { dg-options "-std=gnu99 -fdiagnostics-show-option -Wtraditional -Werror=long-long" } /* { dg-message "some warnings being treated as errors" "" {target "*-*-*"} 0 } */ -#if 0LL // { dg-error "traditional C rejects the \"LL\" suffix .-Wlong-long." } - // { dg-error "use of C99 long long integer constant .-Wlong-long." "use long long" { target *-*-* } 4 } +#if 0LL // { dg-error "traditional C rejects the \"LL\" suffix .-Werror=long-long." } + // { dg-error "use of C99 long long integer constant .-Werror=long-long." "use long long" { target *-*-* } 4 } #endif diff --git a/gcc/testsuite/gcc.dg/cpp/warn-multichar-2.c b/gcc/testsuite/gcc.dg/cpp/warn-multichar-2.c index 38d3a98..f9fd4f6 100644 --- a/gcc/testsuite/gcc.dg/cpp/warn-multichar-2.c +++ b/gcc/testsuite/gcc.dg/cpp/warn-multichar-2.c @@ -1,5 +1,5 @@ // { dg-do preprocess } // { dg-options "-std=gnu99 -fdiagnostics-show-option -Werror=multichar" } /* { dg-message "some warnings being treated as errors" "" {target "*-*-*"} 0 } */ -#if 'abc' // { dg-error "multi-character character constant .-Wmultichar." } +#if 'abc' // { dg-error "multi-character character constant .-Werror=multichar." } #endif diff --git a/gcc/testsuite/gcc.dg/cpp/warn-normalized-3.c b/gcc/testsuite/gcc.dg/cpp/warn-normalized-3.c index 2040394..24eaea0 100644 --- a/gcc/testsuite/gcc.dg/cpp/warn-normalized-3.c +++ b/gcc/testsuite/gcc.dg/cpp/warn-normalized-3.c @@ -2,4 +2,4 @@ // { dg-options "-std=gnu99 -fdiagnostics-show-option -fextended-identifiers -Werror=normalized=" } /* { dg-message "some warnings being treated as errors" "" {target "*-*-*"} 0 } */ // { dg-prune-output ".*-Werror=normalized=: Set -Wnormalized=nfc.*" } -\u0F43 // { dg-error "`.U00000f43' is not in NFC .-Wnormalized=." } +\u0F43 // { dg-error "`.U00000f43' is not in NFC .-Werror=normalized=." } diff --git a/gcc/testsuite/gcc.dg/cpp/warn-redefined-2.c b/gcc/testsuite/gcc.dg/cpp/warn-redefined-2.c index b943355..e6b209c 100644 --- a/gcc/testsuite/gcc.dg/cpp/warn-redefined-2.c +++ b/gcc/testsuite/gcc.dg/cpp/warn-redefined-2.c @@ -6,7 +6,7 @@ // { dg-bogus "__TIME__ builtin is not defined" "no-time" { target *-*-* } 5 } #endif -#define __TIME__ "X" // { dg-error "\"__TIME__\" redefined .-Wbuiltin-macro-redefined." } +#define __TIME__ "X" // { dg-error "\"__TIME__\" redefined .-Werror=builtin-macro-redefined." } #define __TIME__ "Y" // { dg-bogus "-Wbuiltin-macro-redefined" } // { dg-warning "\"__TIME__\" redefined" "not-builtin-1" { target *-*-* } 11 } diff --git a/gcc/testsuite/gcc.dg/cpp/warn-traditional-2.c b/gcc/testsuite/gcc.dg/cpp/warn-traditional-2.c index 5203c28..05477af 100644 --- a/gcc/testsuite/gcc.dg/cpp/warn-traditional-2.c +++ b/gcc/testsuite/gcc.dg/cpp/warn-traditional-2.c @@ -1,23 +1,23 @@ // { dg-do compile } // { dg-options "-std=gnu99 -fdiagnostics-show-option -Werror=traditional -Wno-deprecated -Wno-long-long" } /* { dg-message "some warnings being treated as errors" "" {target "*-*-*"} 0 } */ -#assert x(x) // { dg-error "suggest hiding #assert from traditional C with an indented # .-Wtraditional." } +#assert x(x) // { dg-error "suggest hiding #assert from traditional C with an indented # .-Werror=traditional." } - #define X X // { dg-error "traditional C ignores #define with the # indented .-Wtraditional." } + #define X X // { dg-error "traditional C ignores #define with the # indented .-Werror=traditional." } #if 0 -#elif 1 // { dg-error "suggest not using #elif in traditional C .-Wtraditional." } +#elif 1 // { dg-error "suggest not using #elif in traditional C .-Werror=traditional." } #endif #define f(X) X -int f; // { dg-error "function-like macro \"f\" must be used with arguments in traditional C .-Wtraditional." } +int f; // { dg-error "function-like macro \"f\" must be used with arguments in traditional C .-Werror=traditional." } -#if 0U // { dg-error "traditional C rejects the \"U\" suffix .-Wtraditional." } +#if 0U // { dg-error "traditional C rejects the \"U\" suffix .-Werror=traditional." } #endif -#if +1 // { dg-error " traditional C rejects the unary plus operator .-Wtraditional." } +#if +1 // { dg-error " traditional C rejects the unary plus operator .-Werror=traditional." } #endif -char *x = "\x0"; // { dg-error "the meaning of '.x' is different in traditional C .-Wtraditional." } -char *y = "\a"; // { dg-error "the meaning of '.a' is different in traditional C .-Wtraditional." } -char *z = "\u0F43"; // { dg-error "the meaning of '.u' is different in traditional C .-Wtraditional." } +char *x = "\x0"; // { dg-error "the meaning of '.x' is different in traditional C .-Werror=traditional." } +char *y = "\a"; // { dg-error "the meaning of '.a' is different in traditional C .-Werror=traditional." } +char *z = "\u0F43"; // { dg-error "the meaning of '.u' is different in traditional C .-Werror=traditional." } diff --git a/gcc/testsuite/gcc.dg/cpp/warn-trigraphs-3.c b/gcc/testsuite/gcc.dg/cpp/warn-trigraphs-3.c index 586c363..e7537c8 100644 --- a/gcc/testsuite/gcc.dg/cpp/warn-trigraphs-3.c +++ b/gcc/testsuite/gcc.dg/cpp/warn-trigraphs-3.c @@ -1,4 +1,4 @@ // { dg-do preprocess } // { dg-options "-std=gnu99 -fdiagnostics-show-option -trigraphs -Werror=trigraphs" } /* { dg-message "some warnings being treated as errors" "" {target "*-*-*"} 0 } */ -??= // { dg-error "trigraph \\?\\?= converted to # .-Wtrigraphs." } +??= // { dg-error "trigraph \\?\\?= converted to # .-Werror=trigraphs." } diff --git a/gcc/testsuite/gcc.dg/cpp/warn-trigraphs-4.c b/gcc/testsuite/gcc.dg/cpp/warn-trigraphs-4.c index ba0dd51..d8333d4 100644 --- a/gcc/testsuite/gcc.dg/cpp/warn-trigraphs-4.c +++ b/gcc/testsuite/gcc.dg/cpp/warn-trigraphs-4.c @@ -1,4 +1,4 @@ // { dg-do preprocess } // { dg-options "-std=gnu99 -fdiagnostics-show-option -Werror=trigraphs" } /* { dg-message "some warnings being treated as errors" "" {target "*-*-*"} 0 } */ -??= // { dg-error "trigraph \\?\\?= ignored, use -trigraphs to enable .-Wtrigraphs." } +??= // { dg-error "trigraph \\?\\?= ignored, use -trigraphs to enable .-Werror=trigraphs." } diff --git a/gcc/testsuite/gcc.dg/cpp/warn-undef-2.c b/gcc/testsuite/gcc.dg/cpp/warn-undef-2.c index c9f8731..15fdde9 100644 --- a/gcc/testsuite/gcc.dg/cpp/warn-undef-2.c +++ b/gcc/testsuite/gcc.dg/cpp/warn-undef-2.c @@ -1,5 +1,5 @@ // { dg-do preprocess } // { dg-options "-std=gnu99 -fdiagnostics-show-option -Werror=undef" } /* { dg-message "some warnings being treated as errors" "" {target "*-*-*"} 0 } */ -#if x // { dg-error "\"x\" is not defined .-Wundef." } +#if x // { dg-error "\"x\" is not defined .-Werror=undef." } #endif diff --git a/gcc/testsuite/gcc.dg/cpp/warn-unused-macros-2.c b/gcc/testsuite/gcc.dg/cpp/warn-unused-macros-2.c index 4bd679c..d7fe145 100644 --- a/gcc/testsuite/gcc.dg/cpp/warn-unused-macros-2.c +++ b/gcc/testsuite/gcc.dg/cpp/warn-unused-macros-2.c @@ -1,4 +1,4 @@ // { dg-do preprocess } // { dg-options "-std=gnu99 -fdiagnostics-show-option -Werror=unused-macros" } /* { dg-message "some warnings being treated as errors" "" {target "*-*-*"} 0 } */ -#define X X // { dg-error "macro \"X\" is not used .-Wunused-macros." } +#define X X // { dg-error "macro \"X\" is not used .-Werror=unused-macros." } diff --git a/gcc/testsuite/gcc.dg/cpp/warn-variadic-2.c b/gcc/testsuite/gcc.dg/cpp/warn-variadic-2.c index 8b6d165..1a266cd 100644 --- a/gcc/testsuite/gcc.dg/cpp/warn-variadic-2.c +++ b/gcc/testsuite/gcc.dg/cpp/warn-variadic-2.c @@ -1,6 +1,6 @@ /* { dg-do preprocess } */ /* { dg-options "-ansi -fdiagnostics-show-option -pedantic -Werror=variadic-macros" } */ /* { dg-message "some warnings being treated as errors" "" {target "*-*-*"} 0 } */ -#define F(...) X /* { dg-error "anonymous variadic macros were introduced in C99 .-Wvariadic-macros." } */ +#define F(...) X /* { dg-error "anonymous variadic macros were introduced in C99 .-Werror=variadic-macros." } */ -#define G(X...) X /* { dg-error "ISO C does not permit named variadic macros .-Wvariadic-macros." } */ +#define G(X...) X /* { dg-error "ISO C does not permit named variadic macros .-Werror=variadic-macros." } */ diff --git a/gcc/testsuite/gfortran.dg/warning-directive-2.F90 b/gcc/testsuite/gfortran.dg/warning-directive-2.F90 index 5b40d69f..fa9460a 100644 --- a/gcc/testsuite/gfortran.dg/warning-directive-2.F90 +++ b/gcc/testsuite/gfortran.dg/warning-directive-2.F90 @@ -2,4 +2,4 @@ ! { dg-options "-std=f95 -fdiagnostics-show-option -Werror=cpp" } ! { dg-warning "some warnings being treated as errors" "" {target "*-*-*"} 0 } #warning "Printed" -! { dg-error "\"Printed\" .-Wcpp." "" { target *-*-* } 4 } +! { dg-error "\"Printed\" .-Werror=cpp." "" { target *-*-* } 4 } |