diff options
author | manu <manu@138bc75d-0d04-0410-961f-82ee72b054a4> | 2010-04-09 15:45:52 +0000 |
---|---|---|
committer | manu <manu@138bc75d-0d04-0410-961f-82ee72b054a4> | 2010-04-09 15:45:52 +0000 |
commit | 543725f3e0125e211ea53f275146ca2de3101cc1 (patch) | |
tree | 33d66ffcfaeb98cc4bfe250d9a22829ba7fb153c /gcc | |
parent | 9c719c74a549d518bc38965e0a48f78d3d02adf0 (diff) | |
download | gcc-543725f3e0125e211ea53f275146ca2de3101cc1.tar.gz |
2010-04-09 Manuel López-Ibáñez <manu@gcc.gnu.org>
PR 42965
* diagnostic.c (diagnostic_initialize): Initialize
some_warnings_are_errors.
(diagnostic_finish): New.
(diagnostic_action_after_output): Call it before exiting.
(diagnostic_report_diagnostic): Do not print message here. Set
some_warnings_are_errors.
* diagnostic.h (diagnostic_context): Delete
issue_warnings_are_errors_message. Add some_warnings_are_errors.
(diagnostic_finish): Declare.
* toplev.c (toplev_main): Call it before exit.
testsuite/
* gcc.dg/Werror-6.c: Adjust.
* gcc.dg/Werror-implicit-function-declaration.c: Likewise.
* gcc.dg/Werror-4.c: Likewise.
* gcc.dg/Wdeclaration-after-statement-3.c: Likewise.
* gcc.dg/Wswitch-enum-error.c: Likewise.
* gcc.dg/Wpointer-arith.c: Likewise.
* gcc.dg/Wfatal.c: Likewise.
* gcc.dg/Wswitch-error.c: Likewise.
* g++.dg/warn/unused-result1-Werror.c: Likewise.
* gcc.dg/Werror-9.c: Delete. Duplicate of Werror-4.c.
* gcc.dg/cpp/warn-undef-2.c: Likewise.
* gcc.dg/cpp/warn-traditional-2.c: Likewise.
* gcc.dg/cpp/warn-comments-2.c: Likewise.
* gcc.dg/cpp/warn-variadic-2.c: Likewise.
* gcc.dg/cpp/warning-directive-2.c: Likewise.
* gcc.dg/cpp/warn-long-long-2.c: Likewise.
* gcc.dg/cpp/warn-deprecated-2.c: Likewise.
* gcc.dg/cpp/warn-multichar-2.c: Likewise.
* gcc.dg/cpp/warn-normalized-3.c: Likewise.
* gcc.dg/cpp/warn-cxx-compat-2.c: Likewise.
* gcc.dg/cpp/warn-trigraphs-3.c: Likewise.
* gcc.dg/cpp/warn-unused-macros-2.c: Likewise.
* gcc.dg/cpp/warn-trigraphs-4.c: Likewise.
* gcc.dg/cpp/warn-redefined-2.c: Likewise.
* g++.dg/cpp/warning-directive-2.C: Likewise.
* gfortran.dg/warning-directive-2.F90: Likewise.
git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@158168 138bc75d-0d04-0410-961f-82ee72b054a4
Diffstat (limited to 'gcc')
31 files changed, 109 insertions, 57 deletions
diff --git a/gcc/ChangeLog b/gcc/ChangeLog index 2b3338e2c9a..e596c93c769 100644 --- a/gcc/ChangeLog +++ b/gcc/ChangeLog @@ -1,3 +1,17 @@ +2010-04-09 Manuel López-Ibáñez <manu@gcc.gnu.org> + + PR 42965 + * diagnostic.c (diagnostic_initialize): Initialize + some_warnings_are_errors. + (diagnostic_finish): New. + (diagnostic_action_after_output): Call it before exiting. + (diagnostic_report_diagnostic): Do not print message here. Set + some_warnings_are_errors. + * diagnostic.h (diagnostic_context): Delete + issue_warnings_are_errors_message. Add some_warnings_are_errors. + (diagnostic_finish): Declare. + * toplev.c (toplev_main): Call it before exit. + 2010-04-09 Jason Merrill <jason@redhat.com> PR c++/42623 diff --git a/gcc/diagnostic.c b/gcc/diagnostic.c index 791deacd636..5df458b465e 100644 --- a/gcc/diagnostic.c +++ b/gcc/diagnostic.c @@ -97,7 +97,7 @@ diagnostic_initialize (diagnostic_context *context) context->printer->wrapping.rule = DIAGNOSTICS_SHOW_PREFIX_ONCE; memset (context->diagnostic_count, 0, sizeof context->diagnostic_count); - context->issue_warnings_are_errors_message = true; + context->some_warnings_are_errors = false; context->warning_as_error_requested = false; memset (context->classify_diagnostic, DK_UNSPECIFIED, sizeof context->classify_diagnostic); @@ -112,6 +112,28 @@ diagnostic_initialize (diagnostic_context *context) context->inhibit_notes_p = false; } +/* Do any cleaning up required after the last diagnostic is emitted. */ + +void +diagnostic_finish (diagnostic_context *context) +{ + /* Some of the errors may actually have been warnings. */ + if (context->some_warnings_are_errors) + { + /* -Werror was given. */ + if (context->warning_as_error_requested) + pp_verbatim (context->printer, + _("%s: all warnings being treated as errors\n"), + progname); + /* At least one -Werror= was given. */ + else + pp_verbatim (context->printer, + _("%s: some warnings being treated as errors\n"), + progname); + pp_flush (context->printer); + } +} + /* Initialize DIAGNOSTIC, where the message MSG has already been translated. */ void @@ -184,6 +206,7 @@ diagnostic_action_after_output (diagnostic_context *context, if (flag_fatal_errors) { fnotice (stderr, "compilation terminated due to -Wfatal-errors.\n"); + diagnostic_finish (context); exit (FATAL_EXIT_CODE); } break; @@ -200,7 +223,7 @@ diagnostic_action_after_output (diagnostic_context *context, case DK_FATAL: if (context->abort_on_error) real_abort (); - + diagnostic_finish (context); fnotice (stderr, "compilation terminated.\n"); exit (FATAL_EXIT_CODE); @@ -309,7 +332,7 @@ diagnostic_report_diagnostic (diagnostic_context *context, diagnostic_info *diagnostic) { location_t location = diagnostic->location; - bool maybe_print_warnings_as_errors_message = false; + diagnostic_t orig_diag_kind = diagnostic->kind; const char *saved_format_spec; /* Give preference to being able to inhibit warnings, before they @@ -319,7 +342,11 @@ diagnostic_report_diagnostic (diagnostic_context *context, return false; if (diagnostic->kind == DK_PEDWARN) - diagnostic->kind = pedantic_warning_kind (); + { + diagnostic->kind = pedantic_warning_kind (); + /* We do this to avoid giving the message for -pedantic-errors. */ + orig_diag_kind = diagnostic->kind; + } if (diagnostic->kind == DK_NOTE && context->inhibit_notes_p) return false; @@ -343,7 +370,6 @@ diagnostic_report_diagnostic (diagnostic_context *context, && diagnostic->kind == DK_WARNING) { diagnostic->kind = DK_ERROR; - maybe_print_warnings_as_errors_message = true; } if (diagnostic->option_index) @@ -357,7 +383,6 @@ diagnostic_report_diagnostic (diagnostic_context *context, if (context->classify_diagnostic[diagnostic->option_index] != DK_UNSPECIFIED) { diagnostic->kind = context->classify_diagnostic[diagnostic->option_index]; - maybe_print_warnings_as_errors_message = false; } /* This allows for future extensions, like temporarily disabling warnings for ranges of source code. */ @@ -365,15 +390,8 @@ diagnostic_report_diagnostic (diagnostic_context *context, return false; } - /* If we changed the kind due to -Werror, and didn't override it, we - need to print this message. */ - if (context->issue_warnings_are_errors_message - && maybe_print_warnings_as_errors_message) - { - pp_verbatim (context->printer, - "%s: warnings being treated as errors\n", progname); - context->issue_warnings_are_errors_message = false; - } + if (orig_diag_kind == DK_WARNING && diagnostic->kind == DK_ERROR) + context->some_warnings_are_errors = true; context->lock++; diff --git a/gcc/diagnostic.h b/gcc/diagnostic.h index de76477baa7..65e8c7f0886 100644 --- a/gcc/diagnostic.h +++ b/gcc/diagnostic.h @@ -69,7 +69,7 @@ struct diagnostic_context /* True if we should display the "warnings are being tread as error" message, usually displayed once per compiler run. */ - bool issue_warnings_are_errors_message; + bool some_warnings_are_errors; /* True if it has been requested that warnings be treated as errors. */ bool warning_as_error_requested; @@ -206,6 +206,7 @@ extern diagnostic_context *global_dc; /* Diagnostic related functions. */ extern void diagnostic_initialize (diagnostic_context *); +extern void diagnostic_finish (diagnostic_context *); extern void diagnostic_report_current_module (diagnostic_context *); extern void diagnostic_report_current_function (diagnostic_context *, diagnostic_info *); diff --git a/gcc/testsuite/ChangeLog b/gcc/testsuite/ChangeLog index ea156f67b0d..b41206a5eec 100644 --- a/gcc/testsuite/ChangeLog +++ b/gcc/testsuite/ChangeLog @@ -1,3 +1,33 @@ +2010-04-09 Manuel López-Ibáñez <manu@gcc.gnu.org> + + PR 42965 + * gcc.dg/Werror-6.c: Adjust. + * gcc.dg/Werror-implicit-function-declaration.c: Likewise. + * gcc.dg/Werror-4.c: Likewise. + * gcc.dg/Wdeclaration-after-statement-3.c: Likewise. + * gcc.dg/Wswitch-enum-error.c: Likewise. + * gcc.dg/Wpointer-arith.c: Likewise. + * gcc.dg/Wfatal.c: Likewise. + * gcc.dg/Wswitch-error.c: Likewise. + * g++.dg/warn/unused-result1-Werror.c: Likewise. + * gcc.dg/Werror-9.c: Delete. Duplicate of Werror-4.c. + * gcc.dg/cpp/warn-undef-2.c: Likewise. + * gcc.dg/cpp/warn-traditional-2.c: Likewise. + * gcc.dg/cpp/warn-comments-2.c: Likewise. + * gcc.dg/cpp/warn-variadic-2.c: Likewise. + * gcc.dg/cpp/warning-directive-2.c: Likewise. + * gcc.dg/cpp/warn-long-long-2.c: Likewise. + * gcc.dg/cpp/warn-deprecated-2.c: Likewise. + * gcc.dg/cpp/warn-multichar-2.c: Likewise. + * gcc.dg/cpp/warn-normalized-3.c: Likewise. + * gcc.dg/cpp/warn-cxx-compat-2.c: Likewise. + * gcc.dg/cpp/warn-trigraphs-3.c: Likewise. + * gcc.dg/cpp/warn-unused-macros-2.c: Likewise. + * gcc.dg/cpp/warn-trigraphs-4.c: Likewise. + * gcc.dg/cpp/warn-redefined-2.c: Likewise. + * g++.dg/cpp/warning-directive-2.C: Likewise. + * gfortran.dg/warning-directive-2.F90: Likewise. + 2010-04-09 Jason Merrill <jason@redhat.com> PR c++/42623 diff --git a/gcc/testsuite/g++.dg/cpp/warning-directive-2.C b/gcc/testsuite/g++.dg/cpp/warning-directive-2.C index abd6427cd8a..c2efc172abe 100644 --- a/gcc/testsuite/g++.dg/cpp/warning-directive-2.C +++ b/gcc/testsuite/g++.dg/cpp/warning-directive-2.C @@ -1,4 +1,4 @@ // { dg-do preprocess } // { dg-options "-fdiagnostics-show-option -Werror=cpp" } - +/* { dg-message "some warnings being treated as errors" "" {target "*-*-*"} 0 } */ #warning "Printed" // { dg-error "\"Printed\" .-Wcpp." } diff --git a/gcc/testsuite/g++.dg/warn/unused-result1-Werror.c b/gcc/testsuite/g++.dg/warn/unused-result1-Werror.c index 033d707778c..fc14469c319 100644 --- a/gcc/testsuite/g++.dg/warn/unused-result1-Werror.c +++ b/gcc/testsuite/g++.dg/warn/unused-result1-Werror.c @@ -1,5 +1,6 @@ // PR 40614 // { dg-options "-Werror=unused-result" } +/* { dg-message "some warnings being treated as errors" "" {target "*-*-*"} 0 } */ class QByteArray { public: QByteArray(const QByteArray &); diff --git a/gcc/testsuite/gcc.dg/Wdeclaration-after-statement-3.c b/gcc/testsuite/gcc.dg/Wdeclaration-after-statement-3.c index 63b2bac5de8..f001edf203e 100644 --- a/gcc/testsuite/gcc.dg/Wdeclaration-after-statement-3.c +++ b/gcc/testsuite/gcc.dg/Wdeclaration-after-statement-3.c @@ -1,7 +1,7 @@ /* PR 35058: -Werror= works only with some warnings. */ /* { dg-do compile } */ /* { dg-options "-std=c99 -pedantic -Werror=declaration-after-statement" } */ - +/* { dg-message "some warnings being treated as errors" "" {target "*-*-*"} 0 } */ extern void abort (void); extern void exit (int); diff --git a/gcc/testsuite/gcc.dg/Werror-4.c b/gcc/testsuite/gcc.dg/Werror-4.c index 272f123c6b4..73687bef139 100644 --- a/gcc/testsuite/gcc.dg/Werror-4.c +++ b/gcc/testsuite/gcc.dg/Werror-4.c @@ -1,17 +1,17 @@ /* { dg-do compile } */ /* { dg-options "-Wattributes" } */ - +/* { dg-message "some warnings being treated as errors" "" {target "*-*-*"} 0 } */ /* Make sure the pragma enables the error. */ #pragma GCC diagnostic error "-Waddress" -void __attribute__((dj)) bar() { } /* { dg-warning ".* attribute directive ignored" } */ +void __attribute__((dj)) bar() { } /* { dg-warning "attribute directive ignored" } */ int i; void foo () { - if (&i) /* { dg-error ".* will always evaluate as 'true'" } */ + if (&i) /* { dg-error "will always evaluate as 'true'" } */ grill (); } diff --git a/gcc/testsuite/gcc.dg/Werror-6.c b/gcc/testsuite/gcc.dg/Werror-6.c index 2c37717168f..a99c13b08e0 100644 --- a/gcc/testsuite/gcc.dg/Werror-6.c +++ b/gcc/testsuite/gcc.dg/Werror-6.c @@ -1,7 +1,7 @@ /* { dg-do compile } */ /* { dg-options "-Wattributes -Werror=address" } */ - -/* Make sure -Werror-foo emits an error and not a warning */ +/* { dg-message "some warnings being treated as errors" "" {target "*-*-*"} 0 } */ +/* Make sure -Werror=foo emits an error and not a warning */ void __attribute__((dj)) bar() { } /* { dg-warning ".* attribute directive ignored" } */ diff --git a/gcc/testsuite/gcc.dg/Werror-9.c b/gcc/testsuite/gcc.dg/Werror-9.c deleted file mode 100644 index 87051146a5b..00000000000 --- a/gcc/testsuite/gcc.dg/Werror-9.c +++ /dev/null @@ -1,17 +0,0 @@ -/* { dg-do compile } */ -/* { dg-options "-Wattributes" } */ - -/* Make sure #pragma can enable a warning as an error. */ - -#pragma GCC diagnostic error "-Waddress" - -void __attribute__((dj)) bar() { } /* { dg-warning ".* attribute directive ignored" } */ - -int i; - -void -foo () -{ - if (&i) /* { dg-error ".* will always evaluate as 'true'" } */ - grill (); -} diff --git a/gcc/testsuite/gcc.dg/Werror-implicit-function-declaration.c b/gcc/testsuite/gcc.dg/Werror-implicit-function-declaration.c index 05b8c02968a..3261fc0d942 100644 --- a/gcc/testsuite/gcc.dg/Werror-implicit-function-declaration.c +++ b/gcc/testsuite/gcc.dg/Werror-implicit-function-declaration.c @@ -1,6 +1,7 @@ +/* Test the legacy option -Werror-implicit-function-declaration */ /* { dg-do compile } */ /* { dg-options "-std=c89 -Werror-implicit-function-declaration" } */ - +/* { dg-message "some warnings being treated as errors" "" {target "*-*-*"} 0 } */ void f(void) { puts("Hello"); /* { dg-error "implicit declaration of function" } */ diff --git a/gcc/testsuite/gcc.dg/Wfatal.c b/gcc/testsuite/gcc.dg/Wfatal.c index 3a101000dff..7ac260bfa6a 100644 --- a/gcc/testsuite/gcc.dg/Wfatal.c +++ b/gcc/testsuite/gcc.dg/Wfatal.c @@ -5,6 +5,7 @@ int i = INT_MAX + 1; /* { dg-warning "integer overflow in expression" } */ int k = 1 / 0; /* { dg-error "division by zero" } */ int j = INT_MIN - 1; +/* { dg-message "some warnings being treated as errors" "" {target "*-*-*"} 0 } */ /* { dg-message "terminated due to -Wfatal-errors" "" { target *-*-* } 0 } */ diff --git a/gcc/testsuite/gcc.dg/Wpointer-arith.c b/gcc/testsuite/gcc.dg/Wpointer-arith.c index d7a19079cc4..2d5b0cee3cd 100644 --- a/gcc/testsuite/gcc.dg/Wpointer-arith.c +++ b/gcc/testsuite/gcc.dg/Wpointer-arith.c @@ -8,3 +8,4 @@ void *test(){ if(a) a++; /* { dg-error "wrong type argument to increment" } */ return a+x; /* { dg-error "pointer of type" } */ } +/* { dg-message "some warnings being treated as errors" "" {target "*-*-*"} 0 } */ diff --git a/gcc/testsuite/gcc.dg/Wswitch-enum-error.c b/gcc/testsuite/gcc.dg/Wswitch-enum-error.c index 383a29fba9d..99268400750 100644 --- a/gcc/testsuite/gcc.dg/Wswitch-enum-error.c +++ b/gcc/testsuite/gcc.dg/Wswitch-enum-error.c @@ -1,7 +1,7 @@ /* { dg-do compile } */ /* { dg-options "-Werror=switch-enum -Wswitch" } */ - +/* { dg-message "some warnings being treated as errors" "" {target "*-*-*"} 0 } */ enum e { e1, e2 }; int diff --git a/gcc/testsuite/gcc.dg/Wswitch-error.c b/gcc/testsuite/gcc.dg/Wswitch-error.c index 31e32957963..2fcd1ddd5bd 100644 --- a/gcc/testsuite/gcc.dg/Wswitch-error.c +++ b/gcc/testsuite/gcc.dg/Wswitch-error.c @@ -61,3 +61,4 @@ foo (int i, int j, enum e ei, enum e ej, enum e ek, enum e el, } return 0; } +/* { dg-message "some warnings being treated as errors" "" {target "*-*-*"} 0 } */ diff --git a/gcc/testsuite/gcc.dg/cpp/warn-comments-2.c b/gcc/testsuite/gcc.dg/cpp/warn-comments-2.c index 5a17f2bdcf2..107e6bf1fa2 100644 --- a/gcc/testsuite/gcc.dg/cpp/warn-comments-2.c +++ b/gcc/testsuite/gcc.dg/cpp/warn-comments-2.c @@ -1,6 +1,6 @@ // { 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." } // \ 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 6bf7d555e14..91cad7cfbeb 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." } diff --git a/gcc/testsuite/gcc.dg/cpp/warn-deprecated-2.c b/gcc/testsuite/gcc.dg/cpp/warn-deprecated-2.c index b9cfffb9630..600e2f6a903 100644 --- a/gcc/testsuite/gcc.dg/cpp/warn-deprecated-2.c +++ b/gcc/testsuite/gcc.dg/cpp/warn-deprecated-2.c @@ -1,6 +1,6 @@ // { 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." } #if #x(x) // { dg-error "assertions are a deprecated extension .-Wdeprecated." } 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 11eb5fb2666..08fef13cdb4 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 } #endif diff --git a/gcc/testsuite/gcc.dg/cpp/warn-multichar-2.c b/gcc/testsuite/gcc.dg/cpp/warn-multichar-2.c index 31d33bb9bb8..38d3a983dba 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." } #endif diff --git a/gcc/testsuite/gcc.dg/cpp/warn-normalized-3.c b/gcc/testsuite/gcc.dg/cpp/warn-normalized-3.c index 380c670b8af..2040394a4ef 100644 --- a/gcc/testsuite/gcc.dg/cpp/warn-normalized-3.c +++ b/gcc/testsuite/gcc.dg/cpp/warn-normalized-3.c @@ -1,5 +1,5 @@ // { dg-do preprocess } // { 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=." } diff --git a/gcc/testsuite/gcc.dg/cpp/warn-redefined-2.c b/gcc/testsuite/gcc.dg/cpp/warn-redefined-2.c index 83cc3df7610..b943355c7ba 100644 --- a/gcc/testsuite/gcc.dg/cpp/warn-redefined-2.c +++ b/gcc/testsuite/gcc.dg/cpp/warn-redefined-2.c @@ -1,6 +1,6 @@ // { dg-do preprocess } // { dg-options "-std=gnu99 -fdiagnostics-show-option -Werror=builtin-macro-redefined" } - +/* { dg-message "some warnings being treated as errors" "" {target "*-*-*"} 0 } */ #ifndef __TIME__ #error "__TIME__ builtin is not defined" // { dg-bogus "__TIME__ builtin is not defined" "no-time" { target *-*-* } 5 } diff --git a/gcc/testsuite/gcc.dg/cpp/warn-traditional-2.c b/gcc/testsuite/gcc.dg/cpp/warn-traditional-2.c index cb5f690ccf7..5203c28d1e3 100644 --- a/gcc/testsuite/gcc.dg/cpp/warn-traditional-2.c +++ b/gcc/testsuite/gcc.dg/cpp/warn-traditional-2.c @@ -1,6 +1,6 @@ // { 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." } #define X X // { dg-error "traditional C ignores #define with the # indented .-Wtraditional." } diff --git a/gcc/testsuite/gcc.dg/cpp/warn-trigraphs-3.c b/gcc/testsuite/gcc.dg/cpp/warn-trigraphs-3.c index a993e2a190c..586c363c6e9 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." } diff --git a/gcc/testsuite/gcc.dg/cpp/warn-trigraphs-4.c b/gcc/testsuite/gcc.dg/cpp/warn-trigraphs-4.c index 240ae0f2175..ba0dd516492 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." } diff --git a/gcc/testsuite/gcc.dg/cpp/warn-undef-2.c b/gcc/testsuite/gcc.dg/cpp/warn-undef-2.c index 4eb80e0e945..c9f873174ff 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." } #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 58eeebfcdd9..4bd679c81a1 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." } diff --git a/gcc/testsuite/gcc.dg/cpp/warn-variadic-2.c b/gcc/testsuite/gcc.dg/cpp/warn-variadic-2.c index f43d96ab81b..8b6d165786b 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 G(X...) X /* { dg-error "ISO C does not permit named variadic macros .-Wvariadic-macros." } */ diff --git a/gcc/testsuite/gcc.dg/cpp/warning-directive-2.c b/gcc/testsuite/gcc.dg/cpp/warning-directive-2.c index 0889803cd11..753b84a692e 100644 --- a/gcc/testsuite/gcc.dg/cpp/warning-directive-2.c +++ b/gcc/testsuite/gcc.dg/cpp/warning-directive-2.c @@ -1,4 +1,4 @@ // { dg-do preprocess } // { dg-options "-std=gnu99 -fdiagnostics-show-option -Werror=cpp" } - +/* { dg-message "some warnings being treated as errors" "" {target "*-*-*"} 0 } */ #warning "Printed" // { dg-error "\"Printed\" .-Wcpp." } diff --git a/gcc/testsuite/gfortran.dg/warning-directive-2.F90 b/gcc/testsuite/gfortran.dg/warning-directive-2.F90 index 75b78bf6dd9..5b40d69f0f1 100644 --- a/gcc/testsuite/gfortran.dg/warning-directive-2.F90 +++ b/gcc/testsuite/gfortran.dg/warning-directive-2.F90 @@ -1,5 +1,5 @@ ! { dg-do preprocess } ! { 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 } diff --git a/gcc/toplev.c b/gcc/toplev.c index 798f0d493c6..996bd900e65 100644 --- a/gcc/toplev.c +++ b/gcc/toplev.c @@ -2466,6 +2466,7 @@ toplev_main (int argc, char **argv) if (warningcount || errorcount) print_ignored_options (); + diagnostic_finish (global_dc); /* Invoke registered plugin callbacks if any. */ invoke_plugin_callbacks (PLUGIN_FINISH, NULL); |