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
This commit is contained in:
Manuel López-Ibáñez 2010-04-14 16:08:23 +00:00
parent d58770e719
commit 289fcbbd6e
18 changed files with 86 additions and 31 deletions

View File

@ -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

View File

@ -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;

View File

@ -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

View File

@ -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." }

View File

@ -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 }

View File

@ -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." }

View File

@ -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

View File

@ -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

View File

@ -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

View File

@ -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=." }

View File

@ -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 }

View File

@ -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." }

View File

@ -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." }

View File

@ -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." }

View File

@ -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

View File

@ -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." }

View File

@ -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." } */

View File

@ -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 }