aboutsummaryrefslogtreecommitdiff
path: root/gcc
diff options
context:
space:
mode:
Diffstat (limited to 'gcc')
-rw-r--r--gcc/ChangeLog31
-rw-r--r--gcc/builtins.c10
-rw-r--r--gcc/c-decl.c102
-rw-r--r--gcc/c-errors.c4
-rw-r--r--gcc/c-typeck.c9
-rw-r--r--gcc/cp/ChangeLog26
-rw-r--r--gcc/cp/call.c32
-rw-r--r--gcc/cp/cp-tree.h43
-rw-r--r--gcc/cp/error.c2
-rw-r--r--gcc/cp/friend.c8
-rw-r--r--gcc/cp/init.c14
-rw-r--r--gcc/cp/parser.c13
-rw-r--r--gcc/cp/typeck.c2
-rw-r--r--gcc/cp/typeck2.c71
-rw-r--r--gcc/diagnostic.c111
-rw-r--r--gcc/diagnostic.def4
-rw-r--r--gcc/diagnostic.h10
-rw-r--r--gcc/errors.c3
-rw-r--r--gcc/errors.h2
-rw-r--r--gcc/fortran/ChangeLog6
-rw-r--r--gcc/fortran/f95-lang.c6
-rw-r--r--gcc/testsuite/ChangeLog56
-rw-r--r--gcc/testsuite/gcc.dg/20041213-1.c20
-rw-r--r--gcc/testsuite/gcc.dg/Wredundant-decls-2.c10
-rw-r--r--gcc/testsuite/gcc.dg/Wshadow-1.c2
-rw-r--r--gcc/testsuite/gcc.dg/array-5.c2
-rw-r--r--gcc/testsuite/gcc.dg/attr-noinline.c12
-rw-r--r--gcc/testsuite/gcc.dg/decl-2.c2
-rw-r--r--gcc/testsuite/gcc.dg/decl-3.c2
-rw-r--r--gcc/testsuite/gcc.dg/decl-4.c4
-rw-r--r--gcc/testsuite/gcc.dg/decl-8.c4
-rw-r--r--gcc/testsuite/gcc.dg/dll-2.c4
-rw-r--r--gcc/testsuite/gcc.dg/dll-3.c2
-rw-r--r--gcc/testsuite/gcc.dg/enum-compat-1.c2
-rw-r--r--gcc/testsuite/gcc.dg/funcdef-var-1.c2
-rw-r--r--gcc/testsuite/gcc.dg/funcdef-var-2.c2
-rw-r--r--gcc/testsuite/gcc.dg/inline-14.c4
-rw-r--r--gcc/testsuite/gcc.dg/inline1.c2
-rw-r--r--gcc/testsuite/gcc.dg/inline3.c2
-rw-r--r--gcc/testsuite/gcc.dg/inline4.c2
-rw-r--r--gcc/testsuite/gcc.dg/inline5.c2
-rw-r--r--gcc/testsuite/gcc.dg/label-decl-4.c4
-rw-r--r--gcc/testsuite/gcc.dg/nested-redef-1.c2
-rw-r--r--gcc/testsuite/gcc.dg/noncompile/20020220-1.c2
-rw-r--r--gcc/testsuite/gcc.dg/noncompile/label-1.c6
-rw-r--r--gcc/testsuite/gcc.dg/noncompile/label-lineno-1.c2
-rw-r--r--gcc/testsuite/gcc.dg/noncompile/redecl-1.c2
-rw-r--r--gcc/testsuite/gcc.dg/old-style-then-proto-1.c18
-rw-r--r--gcc/testsuite/gcc.dg/parm-mismatch-1.c8
-rw-r--r--gcc/testsuite/gcc.dg/pr15360-1.c4
-rw-r--r--gcc/testsuite/gcc.dg/pr27953.c2
-rw-r--r--gcc/testsuite/gcc.dg/pr35899.c2
-rw-r--r--gcc/testsuite/gcc.dg/pr36901-1.c7
-rw-r--r--gcc/testsuite/gcc.dg/pr36901-2.c7
-rw-r--r--gcc/testsuite/gcc.dg/pr36901-3.c10
-rw-r--r--gcc/testsuite/gcc.dg/pr36901-4.c11
-rw-r--r--gcc/testsuite/gcc.dg/pr36901-system.h3
-rw-r--r--gcc/testsuite/gcc.dg/pr36901.h2
-rw-r--r--gcc/testsuite/gcc.dg/proto-1.c2
-rw-r--r--gcc/testsuite/gcc.dg/qual-return-3.c2
-rw-r--r--gcc/testsuite/gcc.dg/redecl-1.c24
-rw-r--r--gcc/testsuite/gcc.dg/redecl-11.c2
-rw-r--r--gcc/testsuite/gcc.dg/redecl-12.c2
-rw-r--r--gcc/testsuite/gcc.dg/redecl-13.c2
-rw-r--r--gcc/testsuite/gcc.dg/redecl-15.c2
-rw-r--r--gcc/testsuite/gcc.dg/redecl-16.c2
-rw-r--r--gcc/testsuite/gcc.dg/redecl-2.c16
-rw-r--r--gcc/testsuite/gcc.dg/redecl-5.c2
-rw-r--r--gcc/testsuite/gcc.dg/tls/diag-3.c4
-rw-r--r--gcc/testsuite/gcc.dg/transparent-union-2.c8
-rw-r--r--gcc/testsuite/gcc.dg/visibility-7.c2
-rw-r--r--gcc/testsuite/gcc.dg/wtr-static-1.c2
-rw-r--r--gcc/testsuite/gcc.target/i386/regparm.c2
-rw-r--r--gcc/testsuite/gcc.target/powerpc/altivec-macros.c12
-rw-r--r--gcc/toplev.h12
-rw-r--r--gcc/tree-ssa.c14
76 files changed, 521 insertions, 330 deletions
diff --git a/gcc/ChangeLog b/gcc/ChangeLog
index 8ba80b2..9bc8214 100644
--- a/gcc/ChangeLog
+++ b/gcc/ChangeLog
@@ -1,5 +1,36 @@
2008-08-09 Manuel Lopez-Ibanez <manu@gcc.gnu.org>
+ PR 36901
+ * diagnostic.def (DK_PEDWARN, DK_PERMERROR): New.
+ * diagnostic.c (pedantic_warning_kind, permissive_error_kind):
+ Moved from diagnostic.h
+ (diagnostic_report_diagnostic): Return bool. Handle DK_PEDWARN and
+ DK_PERMERROR.
+ (emit_diagnostic): New.
+ (warning0, pedwarn0): Delete.
+ (warning, warning_at, pedwarn, permerror): Return bool.
+ * diagnostic.h (pedantic_warning_kind, permissive_error_kind):
+ Moved to diagnostic.c.
+ (struct diagnostic_context): Use correct type for
+ classify_diagnostic.
+ (diagnostic_report_diagnostic): Update declaration.
+ (emit_diagnostic): Declare.
+ * errors.c (warning): Return bool.
+ * errors.h (warning): Update declaration.
+ * toplev.h (warning0, pedwarn0): Delete.
+ (warning, warning_at, pedwarn, permerror): Return bool.
+ * c-errors.c (pedwarn_c99, pedwarn_c90): Use DK_PEDWARN.
+ * c-decl.c (locate_old_decl): Delete 'diag' argument. Always use
+ inform. Update all calls.
+ (diagnose_mismatched_decls): Check return value of warning/pedwarn
+ before giving informative note.
+ (implicit_decl_warning): Likewise.
+ * c-typeck.c (build_function_call): Likewise.
+ * tree-sssa.c (warn_uninit): Likewise.
+ * builtins.c (gimplify_va_arg_expr): Likewise.
+
+2008-08-09 Manuel Lopez-Ibanez <manu@gcc.gnu.org>
+
PR 7651
* doc/invoke.texi (-Wextra): Move warning from here...
(-Wuninitialized): ... to here.
diff --git a/gcc/builtins.c b/gcc/builtins.c
index 088c916..a5c55ad 100644
--- a/gcc/builtins.c
+++ b/gcc/builtins.c
@@ -4923,13 +4923,14 @@ gimplify_va_arg_expr (tree *expr_p, gimple_seq *pre_p, gimple_seq *post_p)
!= type)
{
static bool gave_help;
+ bool warned;
/* Unfortunately, this is merely undefined, rather than a constraint
violation, so we cannot make this an error. If this call is never
executed, the program is still strictly conforming. */
- warning (0, "%qT is promoted to %qT when passed through %<...%>",
- type, promoted_type);
- if (! gave_help)
+ warned = warning (0, "%qT is promoted to %qT when passed through %<...%>",
+ type, promoted_type);
+ if (!gave_help && warned)
{
gave_help = true;
inform ("(so you should pass %qT not %qT to %<va_arg%>)",
@@ -4938,7 +4939,8 @@ gimplify_va_arg_expr (tree *expr_p, gimple_seq *pre_p, gimple_seq *post_p)
/* We can, however, treat "undefined" any way we please.
Call abort to encourage the user to fix the program. */
- inform ("if this code is reached, the program will abort");
+ if (warned)
+ inform ("if this code is reached, the program will abort");
t = build_call_expr (implicit_built_in_decls[BUILT_IN_TRAP], 0);
gimplify_and_add (t, pre_p);
diff --git a/gcc/c-decl.c b/gcc/c-decl.c
index ff23f6e..e30defd 100644
--- a/gcc/c-decl.c
+++ b/gcc/c-decl.c
@@ -1115,16 +1115,16 @@ validate_proto_after_old_defn (tree newdecl, tree newtype, tree oldtype)
first in a pair of mismatched declarations, using the diagnostic
function DIAG. */
static void
-locate_old_decl (tree decl, void (*diag)(const char *, ...) ATTRIBUTE_GCC_CDIAG(1,2))
+locate_old_decl (tree decl)
{
if (TREE_CODE (decl) == FUNCTION_DECL && DECL_BUILT_IN (decl))
;
else if (DECL_INITIAL (decl))
- diag (G_("previous definition of %q+D was here"), decl);
+ inform ("previous definition of %q+D was here", decl);
else if (C_DECL_IMPLICIT (decl))
- diag (G_("previous implicit declaration of %q+D was here"), decl);
+ inform ("previous implicit declaration of %q+D was here", decl);
else
- diag (G_("previous declaration of %q+D was here"), decl);
+ inform ("previous declaration of %q+D was here", decl);
}
/* Subroutine of duplicate_decls. Compare NEWDECL to OLDDECL.
@@ -1165,7 +1165,7 @@ diagnose_mismatched_decls (tree newdecl, tree olddecl,
&& !C_DECL_DECLARED_BUILTIN (olddecl)))
{
error ("%q+D redeclared as different kind of symbol", newdecl);
- locate_old_decl (olddecl, error);
+ locate_old_decl (olddecl);
}
else if (TREE_PUBLIC (newdecl))
warning (0, "built-in function %q+D declared as non-function",
@@ -1181,7 +1181,7 @@ diagnose_mismatched_decls (tree newdecl, tree olddecl,
if (TREE_CODE (olddecl) == CONST_DECL)
{
error ("redeclaration of enumerator %q+D", newdecl);
- locate_old_decl (olddecl, error);
+ locate_old_decl (olddecl);
return false;
}
@@ -1225,11 +1225,10 @@ diagnose_mismatched_decls (tree newdecl, tree olddecl,
&& TYPE_MAIN_VARIANT (TREE_TYPE (newtype)) == integer_type_node
&& C_FUNCTION_IMPLICIT_INT (newdecl) && !DECL_INITIAL (olddecl))
{
- pedwarn (0, "conflicting types for %q+D", newdecl);
+ pedwarned = pedwarn (0, "conflicting types for %q+D", newdecl);
/* Make sure we keep void as the return type. */
TREE_TYPE (newdecl) = *newtypep = newtype = oldtype;
C_FUNCTION_IMPLICIT_INT (newdecl) = 0;
- pedwarned = true;
}
/* Permit void foo (...) to match an earlier call to foo (...) with
no declared type (thus, implicitly int). */
@@ -1238,10 +1237,9 @@ diagnose_mismatched_decls (tree newdecl, tree olddecl,
&& TYPE_MAIN_VARIANT (TREE_TYPE (oldtype)) == integer_type_node
&& C_DECL_IMPLICIT (olddecl) && !DECL_INITIAL (olddecl))
{
- pedwarn (0, "conflicting types for %q+D", newdecl);
+ pedwarned = pedwarn (0, "conflicting types for %q+D", newdecl);
/* Make sure we keep void as the return type. */
TREE_TYPE (olddecl) = *oldtypep = oldtype = newtype;
- pedwarned = true;
}
else
{
@@ -1250,7 +1248,7 @@ diagnose_mismatched_decls (tree newdecl, tree olddecl,
else
error ("conflicting types for %q+D", newdecl);
diagnose_arglist_conflict (newdecl, olddecl, newtype, oldtype);
- locate_old_decl (olddecl, error);
+ locate_old_decl (olddecl);
return false;
}
}
@@ -1267,7 +1265,7 @@ diagnose_mismatched_decls (tree newdecl, tree olddecl,
return true; /* Allow OLDDECL to continue in use. */
error ("redefinition of typedef %q+D", newdecl);
- locate_old_decl (olddecl, error);
+ locate_old_decl (olddecl);
return false;
}
@@ -1318,7 +1316,7 @@ diagnose_mismatched_decls (tree newdecl, tree olddecl,
&& same_translation_unit_p (newdecl, olddecl))
{
error ("redefinition of %q+D", newdecl);
- locate_old_decl (olddecl, error);
+ locate_old_decl (olddecl);
return false;
}
}
@@ -1330,7 +1328,7 @@ diagnose_mismatched_decls (tree newdecl, tree olddecl,
&& TYPE_ACTUAL_ARG_TYPES (oldtype)
&& !validate_proto_after_old_defn (newdecl, newtype, oldtype))
{
- locate_old_decl (olddecl, error);
+ locate_old_decl (olddecl);
return false;
}
/* A non-static declaration (even an "extern") followed by a
@@ -1354,7 +1352,7 @@ diagnose_mismatched_decls (tree newdecl, tree olddecl,
{
error ("static declaration of %q+D follows "
"non-static declaration", newdecl);
- locate_old_decl (olddecl, error);
+ locate_old_decl (olddecl);
}
return false;
}
@@ -1364,14 +1362,14 @@ diagnose_mismatched_decls (tree newdecl, tree olddecl,
{
error ("non-static declaration of %q+D follows "
"static declaration", newdecl);
- locate_old_decl (olddecl, error);
+ locate_old_decl (olddecl);
return false;
}
else if (warn_traditional)
{
- warning (OPT_Wtraditional, "non-static declaration of %q+D "
- "follows static declaration", newdecl);
- warned = true;
+ warned |= warning (OPT_Wtraditional,
+ "non-static declaration of %q+D "
+ "follows static declaration", newdecl);
}
}
@@ -1412,7 +1410,7 @@ diagnose_mismatched_decls (tree newdecl, tree olddecl,
error ("non-thread-local declaration of %q+D follows "
"thread-local declaration", newdecl);
- locate_old_decl (olddecl, error);
+ locate_old_decl (olddecl);
return false;
}
@@ -1420,7 +1418,7 @@ diagnose_mismatched_decls (tree newdecl, tree olddecl,
if (DECL_INITIAL (newdecl) && DECL_INITIAL (olddecl))
{
error ("redefinition of %q+D", newdecl);
- locate_old_decl (olddecl, error);
+ locate_old_decl (olddecl);
return false;
}
@@ -1441,14 +1439,14 @@ diagnose_mismatched_decls (tree newdecl, tree olddecl,
{
error ("extern declaration of %q+D follows "
"declaration with no linkage", newdecl);
- locate_old_decl (olddecl, error);
+ locate_old_decl (olddecl);
return false;
}
else if (warn_traditional)
{
- warning (OPT_Wtraditional, "non-static declaration of %q+D "
- "follows static declaration", newdecl);
- warned = true;
+ warned |= warning (OPT_Wtraditional,
+ "non-static declaration of %q+D "
+ "follows static declaration", newdecl);
}
}
else
@@ -1460,7 +1458,7 @@ diagnose_mismatched_decls (tree newdecl, tree olddecl,
error ("static declaration of %q+D follows "
"non-static declaration", newdecl);
- locate_old_decl (olddecl, error);
+ locate_old_decl (olddecl);
return false;
}
}
@@ -1477,12 +1475,12 @@ diagnose_mismatched_decls (tree newdecl, tree olddecl,
{
error ("declaration of %q+D with no linkage follows "
"extern declaration", newdecl);
- locate_old_decl (olddecl, error);
+ locate_old_decl (olddecl);
}
else
{
error ("redeclaration of %q+D with no linkage", newdecl);
- locate_old_decl (olddecl, error);
+ locate_old_decl (olddecl);
}
return false;
@@ -1495,9 +1493,8 @@ diagnose_mismatched_decls (tree newdecl, tree olddecl,
&& DECL_VISIBILITY_SPECIFIED (newdecl) && DECL_VISIBILITY_SPECIFIED (olddecl)
&& DECL_VISIBILITY (newdecl) != DECL_VISIBILITY (olddecl))
{
- warning (0, "redeclaration of %q+D with different visibility "
- "(old visibility preserved)", newdecl);
- warned = true;
+ warned |= warning (0, "redeclaration of %q+D with different visibility "
+ "(old visibility preserved)", newdecl);
}
if (TREE_CODE (newdecl) == FUNCTION_DECL)
@@ -1506,16 +1503,16 @@ diagnose_mismatched_decls (tree newdecl, tree olddecl,
if (DECL_DECLARED_INLINE_P (newdecl)
&& lookup_attribute ("noinline", DECL_ATTRIBUTES (olddecl)))
{
- warning (OPT_Wattributes, "inline declaration of %qD follows "
- "declaration with attribute noinline", newdecl);
- warned = true;
+ warned |= warning (OPT_Wattributes,
+ "inline declaration of %qD follows "
+ "declaration with attribute noinline", newdecl);
}
else if (DECL_DECLARED_INLINE_P (olddecl)
&& lookup_attribute ("noinline", DECL_ATTRIBUTES (newdecl)))
{
- warning (OPT_Wattributes, "declaration of %q+D with attribute "
- "noinline follows inline declaration ", newdecl);
- warned = true;
+ warned |= warning (OPT_Wattributes,
+ "declaration of %q+D with attribute "
+ "noinline follows inline declaration ", newdecl);
}
}
else /* PARM_DECL, VAR_DECL */
@@ -1533,7 +1530,7 @@ diagnose_mismatched_decls (tree newdecl, tree olddecl,
&& (!TREE_ASM_WRITTEN (olddecl) || TREE_ASM_WRITTEN (newdecl)))
{
error ("redefinition of parameter %q+D", newdecl);
- locate_old_decl (olddecl, error);
+ locate_old_decl (olddecl);
return false;
}
}
@@ -1559,14 +1556,13 @@ diagnose_mismatched_decls (tree newdecl, tree olddecl,
&& !(TREE_CODE (newdecl) == VAR_DECL
&& DECL_INITIAL (newdecl) && !DECL_INITIAL (olddecl)))
{
- warning (OPT_Wredundant_decls, "redundant redeclaration of %q+D",
- newdecl);
- warned = true;
+ warned = warning (OPT_Wredundant_decls, "redundant redeclaration of %q+D",
+ newdecl);
}
- /* Report location of previous decl/defn in a consistent manner. */
+ /* Report location of previous decl/defn. */
if (warned || pedwarned)
- locate_old_decl (olddecl, pedwarned ? pedwarn0 : warning0);
+ locate_old_decl (olddecl);
#undef DECL_EXTERN_INLINE
@@ -2330,14 +2326,16 @@ implicit_decl_warning (tree id, tree olddecl)
{
if (warn_implicit_function_declaration)
{
+ bool warned;
+
if (flag_isoc99)
- pedwarn (OPT_Wimplicit_function_declaration,
- G_("implicit declaration of function %qE"), id);
+ warned = pedwarn (OPT_Wimplicit_function_declaration,
+ G_("implicit declaration of function %qE"), id);
else
- warning (OPT_Wimplicit_function_declaration,
- G_("implicit declaration of function %qE"), id);
- if (olddecl)
- locate_old_decl (olddecl, inform);
+ warned = warning (OPT_Wimplicit_function_declaration,
+ G_("implicit declaration of function %qE"), id);
+ if (olddecl && warned)
+ locate_old_decl (olddecl);
}
}
@@ -2408,7 +2406,7 @@ implicitly_declare (tree functionid)
{
error ("incompatible implicit declaration of function %qD",
decl);
- locate_old_decl (decl, error);
+ locate_old_decl (decl);
}
}
b->type = TREE_TYPE (decl);
@@ -2550,7 +2548,7 @@ declare_label (tree name)
if (b && B_IN_CURRENT_SCOPE (b))
{
error ("duplicate label declaration %qE", name);
- locate_old_decl (b->decl, error);
+ locate_old_decl (b->decl);
/* Just use the previous declaration. */
return b->decl;
@@ -2586,7 +2584,7 @@ define_label (location_t location, tree name)
&& C_DECLARED_LABEL_FLAG (label))))
{
error ("%Hduplicate label %qD", &location, label);
- locate_old_decl (label, error);
+ locate_old_decl (label);
return 0;
}
else if (label && DECL_CONTEXT (label) == current_function_decl)
diff --git a/gcc/c-errors.c b/gcc/c-errors.c
index 8adeeeb..9997432 100644
--- a/gcc/c-errors.c
+++ b/gcc/c-errors.c
@@ -38,7 +38,7 @@ pedwarn_c99 (int opt, const char *gmsgid, ...)
va_start (ap, gmsgid);
diagnostic_set_info (&diagnostic, gmsgid, &ap, input_location,
- flag_isoc99 ? pedantic_warning_kind () : DK_WARNING);
+ flag_isoc99 ? DK_PEDWARN : DK_WARNING);
diagnostic.option_index = opt;
report_diagnostic (&diagnostic);
va_end (ap);
@@ -57,7 +57,7 @@ pedwarn_c90 (int opt, const char *gmsgid, ...)
va_start (ap, gmsgid);
diagnostic_set_info (&diagnostic, gmsgid, &ap, input_location,
- flag_isoc99 ? DK_WARNING : pedantic_warning_kind ());
+ flag_isoc99 ? DK_WARNING : DK_PEDWARN);
diagnostic.option_index = opt;
report_diagnostic (&diagnostic);
va_end (ap);
diff --git a/gcc/c-typeck.c b/gcc/c-typeck.c
index bacff90..61f385d 100644
--- a/gcc/c-typeck.c
+++ b/gcc/c-typeck.c
@@ -2408,11 +2408,10 @@ build_function_call (tree function, tree params)
/* This situation leads to run-time undefined behavior. We can't,
therefore, simply error unless we can prove that all possible
executions of the program must execute the code. */
- warning (0, "function called through a non-compatible type");
-
- /* We can, however, treat "undefined" any way we please.
- Call abort to encourage the user to fix the program. */
- inform ("if this code is reached, the program will abort");
+ if (warning (0, "function called through a non-compatible type"))
+ /* We can, however, treat "undefined" any way we please.
+ Call abort to encourage the user to fix the program. */
+ inform ("if this code is reached, the program will abort");
if (VOID_TYPE_P (return_type))
return trap;
diff --git a/gcc/cp/ChangeLog b/gcc/cp/ChangeLog
index 4637090..8fd8842 100644
--- a/gcc/cp/ChangeLog
+++ b/gcc/cp/ChangeLog
@@ -1,5 +1,31 @@
2008-08-09 Manuel Lopez-Ibanez <manu@gcc.gnu.org>
+ PR 36901
+ * cp-tree.h (struct diagnostic_context, struct diagnostic_info):
+ Delete forward declarations. Check that toplev.h has not been
+ included before this file. Include toplev.h and diagnostic.h.
+ * error.c (cp_cpp_error): Use DK_PEDWARN.
+ (cxx_incomplete_type_diagnostic): Update declaration.
+ (cxx_incomplete_type_error): Use DK_ERROR.
+ * typeck2.c (cxx_incomplete_type_diagnostic): Take a diagnostic_t
+ as argument. Use emit_diagnostic.
+ (cxx_incomplete_type_error): Use DK_ERROR.
+ (add_exception_specifier): Use diagnostic_t instead of custom
+ codes.
+ * typeck.c (complete_type_or_else): Update call to
+ cxx_incomplete_type_diagnostic.
+ * init.c (build_delete): Likewise.
+ * call.c (diagnostic_fn_t): Remove unused typedef.
+ (build_temp): Pass a pointer to diagnostic_t.
+ (convert_like_real): Use emit_diagnostic.
+ (joust): Check return value of warning before giving informative
+ note.
+ * friend.c (do_friend): Check return value of warning
+ before giving informative note.
+ * parser.c (cp_parser_template_id): Likewise.
+
+2008-08-09 Manuel Lopez-Ibanez <manu@gcc.gnu.org>
+
PR 7651
* class.c (check_bases_and_members): Warn with -Wuninitialized
instead of -Wextra.
diff --git a/gcc/cp/call.c b/gcc/cp/call.c
index cb07c82..2f67673 100644
--- a/gcc/cp/call.c
+++ b/gcc/cp/call.c
@@ -201,8 +201,7 @@ static void add_candidates (tree, tree, tree, bool, tree, tree,
int, struct z_candidate **);
static conversion *merge_conversion_sequences (conversion *, conversion *);
static bool magic_varargs_p (tree);
-typedef void (*diagnostic_fn_t) (const char *, ...) ATTRIBUTE_GCC_CXXDIAG(1,2);
-static tree build_temp (tree, tree, int, diagnostic_fn_t *);
+static tree build_temp (tree, tree, int, diagnostic_t *);
/* Returns nonzero iff the destructor name specified in NAME matches BASETYPE.
NAME can take many forms... */
@@ -4445,7 +4444,7 @@ enforce_access (tree basetype_path, tree decl, tree diag_decl)
static tree
build_temp (tree expr, tree type, int flags,
- diagnostic_fn_t *diagnostic_fn)
+ diagnostic_t *diagnostic_kind)
{
int savew, savee;
@@ -4455,11 +4454,11 @@ build_temp (tree expr, tree type, int flags,
build_tree_list (NULL_TREE, expr),
type, flags, tf_warning_or_error);
if (warningcount > savew)
- *diagnostic_fn = warning0;
+ *diagnostic_kind = DK_WARNING;
else if (errorcount > savee)
- *diagnostic_fn = error;
+ *diagnostic_kind = DK_ERROR;
else
- *diagnostic_fn = NULL;
+ *diagnostic_kind = 0;
return expr;
}
@@ -4505,7 +4504,7 @@ convert_like_real (conversion *convs, tree expr, tree fn, int argnum,
bool c_cast_p, tsubst_flags_t complain)
{
tree totype = convs->type;
- diagnostic_fn_t diagnostic_fn;
+ diagnostic_t diag_kind;
int flags;
if (convs->bad_p
@@ -4682,12 +4681,13 @@ convert_like_real (conversion *convs, tree expr, tree fn, int argnum,
conversion (i.e. the second step of copy-initialization), so
don't allow any more. */
flags |= LOOKUP_NO_CONVERSION;
- expr = build_temp (expr, totype, flags, &diagnostic_fn);
- if (diagnostic_fn && fn)
+ expr = build_temp (expr, totype, flags, &diag_kind);
+ if (diag_kind && fn)
{
if ((complain & tf_error))
- diagnostic_fn (" initializing argument %P of %qD", argnum, fn);
- else if (diagnostic_fn == error)
+ emit_diagnostic (diag_kind, input_location, 0,
+ " initializing argument %P of %qD", argnum, fn);
+ else if (diag_kind == DK_ERROR)
return error_mark_node;
}
return build_cplus_new (totype, expr);
@@ -6647,10 +6647,12 @@ joust (struct z_candidate *cand1, struct z_candidate *cand2, bool warn)
tree source = source_type (w->convs[0]);
if (! DECL_CONSTRUCTOR_P (w->fn))
source = TREE_TYPE (source);
- warning (OPT_Wconversion, "choosing %qD over %qD", w->fn, l->fn);
- warning (OPT_Wconversion, " for conversion from %qT to %qT",
- source, w->second_conv->type);
- inform (" because conversion sequence for the argument is better");
+ if (warning (OPT_Wconversion, "choosing %qD over %qD", w->fn, l->fn)
+ && warning (OPT_Wconversion, " for conversion from %qT to %qT",
+ source, w->second_conv->type))
+ {
+ inform (" because conversion sequence for the argument is better");
+ }
}
else
add_warning (w, l);
diff --git a/gcc/cp/cp-tree.h b/gcc/cp/cp-tree.h
index 02d358a..4b4bf33 100644
--- a/gcc/cp/cp-tree.h
+++ b/gcc/cp/cp-tree.h
@@ -31,8 +31,28 @@ along with GCC; see the file COPYING3. If not see
#include "varray.h"
#include "c-common.h"
#include "name-lookup.h"
-struct diagnostic_context;
-struct diagnostic_info;
+
+/* In order for the format checking to accept the C++ front end
+ diagnostic framework extensions, you must include this file before
+ toplev.h, not after. We override the definition of GCC_DIAG_STYLE
+ in c-common.h. */
+#undef GCC_DIAG_STYLE
+#define GCC_DIAG_STYLE __gcc_cxxdiag__
+#if GCC_VERSION >= 4001
+#define ATTRIBUTE_GCC_CXXDIAG(m, n) __attribute__ ((__format__ (GCC_DIAG_STYLE, m, n))) ATTRIBUTE_NONNULL(m)
+#else
+#define ATTRIBUTE_GCC_CXXDIAG(m, n) ATTRIBUTE_NONNULL(m)
+#endif
+extern void cp_cpp_error (cpp_reader *, int,
+ const char *, va_list *)
+ ATTRIBUTE_GCC_CXXDIAG(3,0);
+#ifdef GCC_TOPLEV_H
+#error \
+"In order for the format checking to accept the C++ front end diagnostic\n"
+"framework extensions, you must include this file before toplev.h, not after."
+#endif
+#include "toplev.h"
+#include "diagnostic.h"
/* Usage of TREE_LANG_FLAG_?:
0: IDENTIFIER_MARKED (IDENTIFIER_NODEs)
@@ -4887,11 +4907,11 @@ extern int lvalue_p (const_tree);
/* in typeck2.c */
extern void require_complete_eh_spec_types (tree, tree);
-extern void cxx_incomplete_type_diagnostic (const_tree, const_tree, int);
+extern void cxx_incomplete_type_diagnostic (const_tree, const_tree, diagnostic_t);
#undef cxx_incomplete_type_error
extern void cxx_incomplete_type_error (const_tree, const_tree);
#define cxx_incomplete_type_error(V,T) \
- (cxx_incomplete_type_diagnostic ((V), (T), 0))
+ (cxx_incomplete_type_diagnostic ((V), (T), DK_ERROR))
extern tree error_not_base_type (tree, tree);
extern tree binfo_or_else (tree, tree);
extern void readonly_error (tree, const char *);
@@ -4945,19 +4965,4 @@ extern void cp_genericize (tree);
/* -- end of C++ */
-/* In order for the format checking to accept the C++ front end
- diagnostic framework extensions, you must include this file before
- toplev.h, not after. We override the definition of GCC_DIAG_STYLE
- in c-common.h. */
-#undef GCC_DIAG_STYLE
-#define GCC_DIAG_STYLE __gcc_cxxdiag__
-#if GCC_VERSION >= 4001
-#define ATTRIBUTE_GCC_CXXDIAG(m, n) __attribute__ ((__format__ (GCC_DIAG_STYLE, m, n))) ATTRIBUTE_NONNULL(m)
-#else
-#define ATTRIBUTE_GCC_CXXDIAG(m, n) ATTRIBUTE_NONNULL(m)
-#endif
-extern void cp_cpp_error (cpp_reader *, int,
- const char *, va_list *)
- ATTRIBUTE_GCC_CXXDIAG(3,0);
-
#endif /* ! GCC_CP_TREE_H */
diff --git a/gcc/cp/error.c b/gcc/cp/error.c
index ef26ad9..03ceddf 100644
--- a/gcc/cp/error.c
+++ b/gcc/cp/error.c
@@ -2661,7 +2661,7 @@ cp_cpp_error (cpp_reader *pfile ATTRIBUTE_UNUSED, int level,
dlevel = DK_WARNING;
break;
case CPP_DL_PEDWARN:
- dlevel = pedantic_warning_kind ();
+ dlevel = DK_PEDWARN;
break;
case CPP_DL_ERROR:
dlevel = DK_ERROR;
diff --git a/gcc/cp/friend.c b/gcc/cp/friend.c
index 090f84d..4d9a14c 100644
--- a/gcc/cp/friend.c
+++ b/gcc/cp/friend.c
@@ -568,9 +568,11 @@ do_friend (tree ctype, tree declarator, tree decl,
if (warn)
{
static int explained;
- warning (OPT_Wnon_template_friend, "friend declaration "
- "%q#D declares a non-template function", decl);
- if (! explained)
+ bool warned;
+
+ warned = warning (OPT_Wnon_template_friend, "friend declaration "
+ "%q#D declares a non-template function", decl);
+ if (! explained && warned)
{
inform ("(if this is not what you intended, make sure "
"the function template has already been declared "
diff --git a/gcc/cp/init.c b/gcc/cp/init.c
index c6d63b8..df36c5e 100644
--- a/gcc/cp/init.c
+++ b/gcc/cp/init.c
@@ -3035,12 +3035,14 @@ build_delete (tree type, tree addr, special_function_kind auto_delete,
complete_type (type);
if (!COMPLETE_TYPE_P (type))
{
- warning (0, "possible problem detected in invocation of "
- "delete operator:");
- cxx_incomplete_type_diagnostic (addr, type, 1);
- inform ("neither the destructor nor the class-specific "
- "operator delete will be called, even if they are "
- "declared when the class is defined.");
+ if (warning (0, "possible problem detected in invocation of "
+ "delete operator:"))
+ {
+ cxx_incomplete_type_diagnostic (addr, type, DK_WARNING);
+ inform ("neither the destructor nor the class-specific "
+ "operator delete will be called, even if they are "
+ "declared when the class is defined.");
+ }
complete_p = false;
}
}
diff --git a/gcc/cp/parser.c b/gcc/cp/parser.c
index 7c1b04d..1bb52e5 100644
--- a/gcc/cp/parser.c
+++ b/gcc/cp/parser.c
@@ -9980,15 +9980,14 @@ cp_parser_template_id (cp_parser *parser,
}
/* Otherwise, emit an error about the invalid digraph, but continue
parsing because we got our argument list. */
- permerror ("%H%<<::%> cannot begin a template-argument list",
- &next_token->location);
- inform ("%H%<<:%> is an alternate spelling for %<[%>. Insert whitespace "
+ if (permerror ("%H%<<::%> cannot begin a template-argument list",
+ &next_token->location))
+ {
+ static bool hint = false;
+ inform ("%H%<<:%> is an alternate spelling for %<[%>. Insert whitespace "
"between %<<%> and %<::%>",
&next_token->location);
- if (!flag_permissive)
- {
- static bool hint;
- if (!hint)
+ if (!hint && !flag_permissive)
{
inform ("%H(if you use %<-fpermissive%> G++ will accept your code)",
&next_token->location);
diff --git a/gcc/cp/typeck.c b/gcc/cp/typeck.c
index 792a77c..a99526f 100644
--- a/gcc/cp/typeck.c
+++ b/gcc/cp/typeck.c
@@ -145,7 +145,7 @@ complete_type_or_else (tree type, tree value)
return NULL_TREE;
else if (!COMPLETE_TYPE_P (type))
{
- cxx_incomplete_type_diagnostic (value, type, 0);
+ cxx_incomplete_type_diagnostic (value, type, DK_ERROR);
return NULL_TREE;
}
else
diff --git a/gcc/cp/typeck2.c b/gcc/cp/typeck2.c
index 787f439..bca95e9 100644
--- a/gcc/cp/typeck2.c
+++ b/gcc/cp/typeck2.c
@@ -332,22 +332,18 @@ abstract_virtuals_error (tree decl, tree type)
/* Print an error message for invalid use of an incomplete type.
VALUE is the expression that was used (or 0 if that isn't known)
- and TYPE is the type that was invalid. DIAG_TYPE indicates the
- type of diagnostic: 0 for an error, 1 for a warning, 2 for a
- pedwarn. */
+ and TYPE is the type that was invalid. DIAG_KIND indicates the
+ type of diagnostic (see diagnostic.def). */
void
-cxx_incomplete_type_diagnostic (const_tree value, const_tree type, int diag_type)
+cxx_incomplete_type_diagnostic (const_tree value, const_tree type,
+ diagnostic_t diag_kind)
{
int decl = 0;
- void (*p_msg) (const char *, ...) ATTRIBUTE_GCC_CXXDIAG(1,2);
- if (diag_type == 1)
- p_msg = warning0;
- else if (diag_type == 2)
- p_msg = pedwarn0;
- else
- p_msg = error;
+ gcc_assert (diag_kind == DK_WARNING
+ || diag_kind == DK_PEDWARN
+ || diag_kind == DK_ERROR);
/* Avoid duplicate error message. */
if (TREE_CODE (type) == ERROR_MARK)
@@ -357,7 +353,8 @@ cxx_incomplete_type_diagnostic (const_tree value, const_tree type, int diag_type
|| TREE_CODE (value) == PARM_DECL
|| TREE_CODE (value) == FIELD_DECL))
{
- p_msg ("%q+D has incomplete type", value);
+ emit_diagnostic (diag_kind, input_location, 0,
+ "%q+D has incomplete type", value);
decl = 1;
}
retry:
@@ -369,15 +366,19 @@ cxx_incomplete_type_diagnostic (const_tree value, const_tree type, int diag_type
case UNION_TYPE:
case ENUMERAL_TYPE:
if (!decl)
- p_msg ("invalid use of incomplete type %q#T", type);
+ emit_diagnostic (diag_kind, input_location, 0,
+ "invalid use of incomplete type %q#T", type);
if (!TYPE_TEMPLATE_INFO (type))
- p_msg ("forward declaration of %q+#T", type);
+ emit_diagnostic (diag_kind, input_location, 0,
+ "forward declaration of %q+#T", type);
else
- p_msg ("declaration of %q+#T", type);
+ emit_diagnostic (diag_kind, input_location, 0,
+ "declaration of %q+#T", type);
break;
case VOID_TYPE:
- p_msg ("invalid use of %qT", type);
+ emit_diagnostic (diag_kind, input_location, 0,
+ "invalid use of %qT", type);
break;
case ARRAY_TYPE:
@@ -386,37 +387,45 @@ cxx_incomplete_type_diagnostic (const_tree value, const_tree type, int diag_type
type = TREE_TYPE (type);
goto retry;
}
- p_msg ("invalid use of array with unspecified bounds");
+ emit_diagnostic (diag_kind, input_location, 0,
+ "invalid use of array with unspecified bounds");
break;
case OFFSET_TYPE:
bad_member:
- p_msg ("invalid use of member (did you forget the %<&%> ?)");
+ emit_diagnostic (diag_kind, input_location, 0,
+ "invalid use of member (did you forget the %<&%> ?)");
break;
case TEMPLATE_TYPE_PARM:
- p_msg ("invalid use of template type parameter %qT", type);
+ emit_diagnostic (diag_kind, input_location, 0,
+ "invalid use of template type parameter %qT", type);
break;
case BOUND_TEMPLATE_TEMPLATE_PARM:
- p_msg ("invalid use of template template parameter %qT",
- TYPE_NAME (type));
+ emit_diagnostic (diag_kind, input_location, 0,
+ "invalid use of template template parameter %qT",
+ TYPE_NAME (type));
break;
case TYPENAME_TYPE:
- p_msg ("invalid use of dependent type %qT", type);
+ emit_diagnostic (diag_kind, input_location, 0,
+ "invalid use of dependent type %qT", type);
break;
case UNKNOWN_TYPE:
if (value && TREE_CODE (value) == COMPONENT_REF)
goto bad_member;
else if (value && TREE_CODE (value) == ADDR_EXPR)
- p_msg ("address of overloaded function with no contextual "
- "type information");
+ emit_diagnostic (diag_kind, input_location, 0,
+ "address of overloaded function with no contextual "
+ "type information");
else if (value && TREE_CODE (value) == OVERLOAD)
- p_msg ("overloaded function with no contextual type information");
+ emit_diagnostic (diag_kind, input_location, 0,
+ "overloaded function with no contextual type information");
else
- p_msg ("insufficient contextual information to determine type");
+ emit_diagnostic (diag_kind, input_location, 0,
+ "insufficient contextual information to determine type");
break;
default:
@@ -430,7 +439,7 @@ cxx_incomplete_type_diagnostic (const_tree value, const_tree type, int diag_type
void
cxx_incomplete_type_error (const_tree value, const_tree type)
{
- cxx_incomplete_type_diagnostic (value, type, 0);
+ cxx_incomplete_type_diagnostic (value, type, DK_ERROR);
}
@@ -1483,7 +1492,7 @@ add_exception_specifier (tree list, tree spec, int complain)
bool ok;
tree core = spec;
bool is_ptr;
- int diag_type = -1; /* none */
+ diagnostic_t diag_type = DK_UNSPECIFIED; /* none */
if (spec == error_mark_node)
return list;
@@ -1512,7 +1521,7 @@ add_exception_specifier (tree list, tree spec, int complain)
and calls. So just give a pedwarn at this point; we will give an
error later if we hit one of those two cases. */
if (!COMPLETE_TYPE_P (complete_type (core)))
- diag_type = 2; /* pedwarn */
+ diag_type = DK_PEDWARN; /* pedwarn */
}
if (ok)
@@ -1526,9 +1535,9 @@ add_exception_specifier (tree list, tree spec, int complain)
list = tree_cons (NULL_TREE, spec, list);
}
else
- diag_type = 0; /* error */
+ diag_type = DK_ERROR; /* error */
- if (diag_type >= 0 && complain)
+ if (diag_type != DK_UNSPECIFIED && complain)
cxx_incomplete_type_diagnostic (NULL_TREE, core, diag_type);
return list;
diff --git a/gcc/diagnostic.c b/gcc/diagnostic.c
index 69b7e4b..cb4c67a 100644
--- a/gcc/diagnostic.c
+++ b/gcc/diagnostic.c
@@ -41,6 +41,8 @@ along with GCC; see the file COPYING3. If not see
#include "langhooks-def.h"
#include "opts.h"
+#define pedantic_warning_kind() (flag_pedantic_errors ? DK_ERROR : DK_WARNING)
+#define permissive_error_kind() (flag_permissive ? DK_WARNING : DK_ERROR)
/* Prototypes. */
static char *build_message_string (const char *, ...) ATTRIBUTE_PRINTF_1;
@@ -293,9 +295,10 @@ diagnostic_classify_diagnostic (diagnostic_context *context,
DC. This function is *the* subroutine in terms of which front-ends
should implement their specific diagnostic handling modules. The
front-end independent format specifiers are exactly those described
- in the documentation of output_format. */
+ in the documentation of output_format.
+ Return true if a diagnostic was printed, false otherwise. */
-void
+bool
diagnostic_report_diagnostic (diagnostic_context *context,
diagnostic_info *diagnostic)
{
@@ -305,9 +308,12 @@ diagnostic_report_diagnostic (diagnostic_context *context,
/* Give preference to being able to inhibit warnings, before they
get reclassified to something else. */
- if (diagnostic->kind == DK_WARNING
+ if ((diagnostic->kind == DK_WARNING || diagnostic->kind == DK_PEDWARN)
&& !diagnostic_report_warnings_p (location))
- return;
+ return false;
+
+ if (diagnostic->kind == DK_PEDWARN)
+ diagnostic->kind = pedantic_warning_kind ();
if (context->lock > 0)
{
@@ -336,7 +342,7 @@ diagnostic_report_diagnostic (diagnostic_context *context,
/* This tests if the user provided the appropriate -Wfoo or
-Wno-foo option. */
if (! option_enabled (diagnostic->option_index))
- return;
+ return false;
/* This tests if the user provided the appropriate -Werror=foo
option. */
if (context->classify_diagnostic[diagnostic->option_index] != DK_UNSPECIFIED)
@@ -347,7 +353,7 @@ diagnostic_report_diagnostic (diagnostic_context *context,
/* This allows for future extensions, like temporarily disabling
warnings for ranges of source code. */
if (diagnostic->kind == DK_IGNORED)
- return;
+ return false;
}
/* If we changed the kind due to -Werror, and didn't override it, we
@@ -403,6 +409,8 @@ diagnostic_report_diagnostic (diagnostic_context *context,
diagnostic->abstract_origin = NULL;
context->lock--;
+
+ return true;
}
/* Given a partial pathname as input, return another pathname that
@@ -457,51 +465,66 @@ verbatim (const char *gmsgid, ...)
va_end (ap);
}
-/* An informative note. Use this for additional details on an error
- message. */
-void
-inform (const char *gmsgid, ...)
+bool
+emit_diagnostic (diagnostic_t kind, location_t location, int opt,
+ const char *gmsgid, ...)
{
diagnostic_info diagnostic;
va_list ap;
va_start (ap, gmsgid);
- diagnostic_set_info (&diagnostic, gmsgid, &ap, input_location, DK_NOTE);
- report_diagnostic (&diagnostic);
+ if (kind == DK_PERMERROR)
+ {
+ diagnostic_set_info (&diagnostic, gmsgid, &ap, location,
+ permissive_error_kind ());
+ diagnostic.option_index = OPT_fpermissive;
+ }
+ else {
+ diagnostic_set_info (&diagnostic, gmsgid, &ap, location, kind);
+ if (kind == DK_WARNING || kind == DK_PEDWARN)
+ diagnostic.option_index = opt;
+ }
va_end (ap);
+
+ return report_diagnostic (&diagnostic);
}
-/* A warning at INPUT_LOCATION. Use this for code which is correct according
- to the relevant language specification but is likely to be buggy anyway. */
+/* An informative note. Use this for additional details on an error
+ message. */
void
-warning (int opt, const char *gmsgid, ...)
+inform (const char *gmsgid, ...)
{
diagnostic_info diagnostic;
va_list ap;
va_start (ap, gmsgid);
- diagnostic_set_info (&diagnostic, gmsgid, &ap, input_location, DK_WARNING);
- diagnostic.option_index = opt;
-
+ diagnostic_set_info (&diagnostic, gmsgid, &ap, input_location, DK_NOTE);
report_diagnostic (&diagnostic);
va_end (ap);
}
-void
-warning0 (const char *gmsgid, ...)
+/* A warning at INPUT_LOCATION. Use this for code which is correct according
+ to the relevant language specification but is likely to be buggy anyway.
+ Returns true if the warning was printed, false if it was inhibited. */
+bool
+warning (int opt, const char *gmsgid, ...)
{
diagnostic_info diagnostic;
va_list ap;
va_start (ap, gmsgid);
diagnostic_set_info (&diagnostic, gmsgid, &ap, input_location, DK_WARNING);
- report_diagnostic (&diagnostic);
+ diagnostic.option_index = opt;
+
va_end (ap);
+ return report_diagnostic (&diagnostic);
}
/* A warning at LOCATION. Use this for code which is correct according to the
- relevant language specification but is likely to be buggy anyway. */
-void
+ relevant language specification but is likely to be buggy anyway.
+ Returns true if the warning was printed, false if it was inhibited. */
+
+bool
warning_at (location_t location, int opt, const char *gmsgid, ...)
{
diagnostic_info diagnostic;
@@ -510,9 +533,8 @@ warning_at (location_t location, int opt, const char *gmsgid, ...)
va_start (ap, gmsgid);
diagnostic_set_info (&diagnostic, gmsgid, &ap, location, DK_WARNING);
diagnostic.option_index = opt;
-
- report_diagnostic (&diagnostic);
va_end (ap);
+ return report_diagnostic (&diagnostic);
}
/* A "pedantic" warning: issues a warning unless -pedantic-errors was
@@ -524,42 +546,31 @@ warning_at (location_t location, int opt, const char *gmsgid, ...)
of the -pedantic command-line switch. To get a warning enabled
only with that switch, use either "if (pedantic) pedwarn
(OPT_pedantic,...)" or just "pedwarn (OPT_pedantic,..)". To get a
- pedwarn independently of the -pedantic switch use "pedwarn (0,...)". */
+ pedwarn independently of the -pedantic switch use "pedwarn (0,...)".
-void
+ Returns true if the warning was printed, false if it was inhibited. */
+
+bool
pedwarn (int opt, const char *gmsgid, ...)
{
diagnostic_info diagnostic;
va_list ap;
va_start (ap, gmsgid);
- diagnostic_set_info (&diagnostic, gmsgid, &ap, input_location,
- pedantic_warning_kind ());
+ diagnostic_set_info (&diagnostic, gmsgid, &ap, input_location, DK_PEDWARN);
diagnostic.option_index = opt;
-
- report_diagnostic (&diagnostic);
- va_end (ap);
-}
-
-void
-pedwarn0 (const char *gmsgid, ...)
-{
- diagnostic_info diagnostic;
- va_list ap;
-
- va_start (ap, gmsgid);
- diagnostic_set_info (&diagnostic, gmsgid, &ap, input_location,
- pedantic_warning_kind ());
- report_diagnostic (&diagnostic);
va_end (ap);
+ return report_diagnostic (&diagnostic);
}
/* A "permissive" error at LOCATION: issues an error unless
-fpermissive was given on the command line, in which case it issues
a warning. Use this for things that really should be errors but we
- want to support legacy code. */
+ want to support legacy code.
-void
+ Returns true if the warning was printed, false if it was inhibited. */
+
+bool
permerror_at (location_t location, const char *gmsgid, ...)
{
diagnostic_info diagnostic;
@@ -567,15 +578,15 @@ permerror_at (location_t location, const char *gmsgid, ...)
va_start (ap, gmsgid);
diagnostic_set_info (&diagnostic, gmsgid, &ap, location,
- permissive_error_kind ());
+ permissive_error_kind ());
diagnostic.option_index = OPT_fpermissive;
- report_diagnostic (&diagnostic);
va_end (ap);
+ return report_diagnostic (&diagnostic);
}
/* Equivalent to permerror_at (input_location, ...). */
-void
+bool
permerror (const char *gmsgid, ...)
{
diagnostic_info diagnostic;
@@ -585,8 +596,8 @@ permerror (const char *gmsgid, ...)
diagnostic_set_info (&diagnostic, gmsgid, &ap, input_location,
permissive_error_kind ());
diagnostic.option_index = OPT_fpermissive;
- report_diagnostic (&diagnostic);
va_end (ap);
+ return report_diagnostic (&diagnostic);
}
diff --git a/gcc/diagnostic.def b/gcc/diagnostic.def
index bbdba2f..3906419 100644
--- a/gcc/diagnostic.def
+++ b/gcc/diagnostic.def
@@ -20,4 +20,8 @@ DEFINE_DIAGNOSTIC_KIND (DK_WARNING, "warning: ")
DEFINE_DIAGNOSTIC_KIND (DK_ANACHRONISM, "anachronism: ")
DEFINE_DIAGNOSTIC_KIND (DK_NOTE, "note: ")
DEFINE_DIAGNOSTIC_KIND (DK_DEBUG, "debug: ")
+/* These two would be re-classified as DK_WARNING or DK_ERROR, so the
+prefix does not matter. */
+DEFINE_DIAGNOSTIC_KIND (DK_PEDWARN, "pedwarn: ")
+DEFINE_DIAGNOSTIC_KIND (DK_PERMERROR, "permerror: ")
diff --git a/gcc/diagnostic.h b/gcc/diagnostic.h
index 8906cc4..19bc5e9 100644
--- a/gcc/diagnostic.h
+++ b/gcc/diagnostic.h
@@ -50,10 +50,6 @@ typedef struct diagnostic_info
int option_index;
} diagnostic_info;
-#define pedantic_warning_kind() (flag_pedantic_errors ? DK_ERROR : DK_WARNING)
-#define permissive_error_kind() (flag_permissive ? DK_WARNING : DK_ERROR)
-
-
/* Forward declarations. */
typedef struct diagnostic_context diagnostic_context;
typedef void (*diagnostic_starter_fn) (diagnostic_context *,
@@ -82,7 +78,7 @@ struct diagnostic_context
the diagnostic should be changed to before reporting, or
DK_UNSPECIFIED to leave it as the reported kind, or DK_IGNORED to
not report it at all. N_OPTS is from <options.h>. */
- char classify_diagnostic[N_OPTS];
+ diagnostic_t classify_diagnostic[N_OPTS];
/* True if we should print the command line option which controls
each diagnostic, if known. */
@@ -199,7 +195,7 @@ extern void diagnostic_report_current_function (diagnostic_context *,
extern diagnostic_t diagnostic_classify_diagnostic (diagnostic_context *,
int /* optidx */,
diagnostic_t /* kind */);
-extern void diagnostic_report_diagnostic (diagnostic_context *,
+extern bool diagnostic_report_diagnostic (diagnostic_context *,
diagnostic_info *);
#ifdef ATTRIBUTE_GCC_DIAG
extern void diagnostic_set_info (diagnostic_info *, const char *, va_list *,
@@ -208,6 +204,8 @@ extern void diagnostic_set_info_translated (diagnostic_info *, const char *,
va_list *, location_t,
diagnostic_t)
ATTRIBUTE_GCC_DIAG(2,0);
+extern bool emit_diagnostic (diagnostic_t, location_t, int,
+ const char *, ...) ATTRIBUTE_GCC_DIAG(4,5);
#endif
extern char *diagnostic_build_prefix (diagnostic_info *);
diff --git a/gcc/errors.c b/gcc/errors.c
index ec70d55..a1ccfef 100644
--- a/gcc/errors.c
+++ b/gcc/errors.c
@@ -40,7 +40,7 @@ int have_error = 0;
/* Print a warning message - output produced, but there may be problems. */
-void
+bool
warning (int opt ATTRIBUTE_UNUSED, const char *format, ...)
{
va_list ap;
@@ -50,6 +50,7 @@ warning (int opt ATTRIBUTE_UNUSED, const char *format, ...)
vfprintf (stderr, format, ap);
va_end (ap);
fputc('\n', stderr);
+ return true;
}
diff --git a/gcc/errors.h b/gcc/errors.h
index 29c16f3..ec080da 100644
--- a/gcc/errors.h
+++ b/gcc/errors.h
@@ -33,7 +33,7 @@ along with GCC; see the file COPYING3. If not see
version of warning(). For those, you'd pass an OPT_W* value from
options.h, but in generator programs it has no effect, so it's OK
to just pass zero for calls from generator-only files. */
-extern void warning (int, const char *, ...) ATTRIBUTE_PRINTF_2 ATTRIBUTE_COLD;
+extern bool warning (int, const char *, ...) ATTRIBUTE_PRINTF_2 ATTRIBUTE_COLD;
extern void error (const char *, ...) ATTRIBUTE_PRINTF_1 ATTRIBUTE_COLD;
extern void fatal (const char *, ...) ATTRIBUTE_NORETURN ATTRIBUTE_PRINTF_1 ATTRIBUTE_COLD;
extern void internal_error (const char *, ...) ATTRIBUTE_NORETURN ATTRIBUTE_PRINTF_1 ATTRIBUTE_COLD;
diff --git a/gcc/fortran/ChangeLog b/gcc/fortran/ChangeLog
index ca2c2cd..3bdfb52 100644
--- a/gcc/fortran/ChangeLog
+++ b/gcc/fortran/ChangeLog
@@ -1,3 +1,9 @@
+2008-08-09 Manuel Lopez-Ibanez <manu@gcc.gnu.org>
+
+ PR 36901
+ * f95-lang.c (gfc_mark_addressable): Use "pedwarn (0," instead of
+ 'pedwarn0'.
+
2008-08-09 Paul Thomas <pault@gcc.gnu.org>
PR fortran/37011
diff --git a/gcc/fortran/f95-lang.c b/gcc/fortran/f95-lang.c
index d2768b1..5f39593 100644
--- a/gcc/fortran/f95-lang.c
+++ b/gcc/fortran/f95-lang.c
@@ -604,8 +604,8 @@ gfc_mark_addressable (tree exp)
IDENTIFIER_POINTER (DECL_NAME (x)));
return false;
}
- pedwarn0 ("register variable %qs used in nested function",
- IDENTIFIER_POINTER (DECL_NAME (x)));
+ pedwarn (0, "register variable %qs used in nested function",
+ IDENTIFIER_POINTER (DECL_NAME (x)));
}
else if (DECL_REGISTER (x) && !TREE_ADDRESSABLE (x))
{
@@ -629,7 +629,7 @@ gfc_mark_addressable (tree exp)
}
#endif
- pedwarn0 ("address of register variable %qs requested",
+ pedwarn (0, "address of register variable %qs requested",
IDENTIFIER_POINTER (DECL_NAME (x)));
}
diff --git a/gcc/testsuite/ChangeLog b/gcc/testsuite/ChangeLog
index 6be4d94..2603ac2 100644
--- a/gcc/testsuite/ChangeLog
+++ b/gcc/testsuite/ChangeLog
@@ -1,5 +1,61 @@
2008-08-09 Manuel Lopez-Ibanez <manu@gcc.gnu.org>
+ PR 36901
+ * gcc.dg/pr36901-1.c: New.
+ * gcc.dg/pr36901-3.c: New.
+ * gcc.dg/pr36901-2.c: New.
+ * gcc.dg/pr36901-4.c: New.
+ * gcc.dg/pr36901-system.h: New.
+ * gcc.dg/pr36901.h: New.
+ * gcc.target/powerpc/altivec-macros.c: Update.
+ * gcc.target/i386/regparm.c: Update.
+ * gcc.dg/funcdef-var-1.c: Update.
+ * gcc.dg/parm-mismatch-1.c: Update.
+ * gcc.dg/attr-noinline.c: Update.
+ * gcc.dg/wtr-static-1.c: Update.
+ * gcc.dg/redecl-11.c: Update.
+ * gcc.dg/pr27953.c: Update.
+ * gcc.dg/proto-1.c: Update.
+ * gcc.dg/decl-3.c: Update.
+ * gcc.dg/redecl-13.c: Update.
+ * gcc.dg/pr15360-1.c: Update.
+ * gcc.dg/redecl-15.c: Update.
+ * gcc.dg/enum-compat-1.c: Update.
+ * gcc.dg/dll-3.c: Update.
+ * gcc.dg/array-5.c: Update.
+ * gcc.dg/Wredundant-decls-2.c: Update.
+ * gcc.dg/inline4.c: Update.
+ * gcc.dg/redecl-2.c: Update.
+ * gcc.dg/inline-14.c: Update.
+ * gcc.dg/tls/diag-3.c: Update.
+ * gcc.dg/funcdef-var-2.c: Update.
+ * gcc.dg/20041213-1.c: Update.
+ * gcc.dg/old-style-then-proto-1.c: Update.
+ * gcc.dg/decl-2.c: Update.
+ * gcc.dg/redecl-12.c: Update.
+ * gcc.dg/decl-4.c: Update.
+ * gcc.dg/Wshadow-1.c: Update.
+ * gcc.dg/transparent-union-2.c: Update.
+ * gcc.dg/visibility-7.c: Update.
+ * gcc.dg/dll-2.c: Update.
+ * gcc.dg/redecl-16.c: Update.
+ * gcc.dg/inline1.c: Update.
+ * gcc.dg/decl-8.c: Update.
+ * gcc.dg/nested-redef-1.c: Update.
+ * gcc.dg/inline3.c: Update.
+ * gcc.dg/redecl-1.c: Update.
+ * gcc.dg/inline5.c: Update.
+ * gcc.dg/pr35899.c: Update.
+ * gcc.dg/noncompile/label-lineno-1.c: Update.
+ * gcc.dg/noncompile/label-1.c: Update.
+ * gcc.dg/noncompile/20020220-1.c: Update.
+ * gcc.dg/noncompile/redecl-1.c: Update.
+ * gcc.dg/redecl-5.c: Update.
+ * gcc.dg/qual-return-3.c: Update.
+ * gcc.dg/label-decl-4.c: Update.
+
+2008-08-09 Manuel Lopez-Ibanez <manu@gcc.gnu.org>
+
PR 7651
* g++.dg/warn/Wuninitializable-member.C: New.
* g++.dg/warn/Wuninitializable-member-no.C: New.
diff --git a/gcc/testsuite/gcc.dg/20041213-1.c b/gcc/testsuite/gcc.dg/20041213-1.c
index f7ef30a..be1ab00 100644
--- a/gcc/testsuite/gcc.dg/20041213-1.c
+++ b/gcc/testsuite/gcc.dg/20041213-1.c
@@ -1,33 +1,33 @@
/* { dg-do compile } */
/* { dg-options "" } */
/* test redeclarations with void and implicit int */
-extern foo1(); /* { dg-error "previous declaration" } */
+extern foo1(); /* { dg-message "note: previous declaration" } */
extern void foo1(); /* { dg-error "conflicting types" } */
-extern void foo2(); /* { dg-error "previous declaration" } */
+extern void foo2(); /* { dg-message "note: previous declaration" } */
extern foo2(); /* { dg-error "conflicting types" } */
-void foo3() {} /* { dg-error "previous definition" } */
+void foo3() {} /* { dg-message "note: previous definition" } */
extern foo3(); /* { dg-error "conflicting types" } */
-extern foo4(); /* { dg-error "previous declaration" } */
+extern foo4(); /* { dg-message "note: previous declaration" } */
void foo4() {} /* { dg-error "conflicting types" } */
-extern void foo5(); /* { dg-warning "previous declaration" } */
+extern void foo5(); /* { dg-message "note: previous declaration" } */
foo5() {} /* { dg-warning "conflicting types" } */
-foo6() {} /* { dg-error "previous definition" } */
+foo6() {} /* { dg-message "note: previous definition" } */
extern void foo6(); /* { dg-error "conflicting types" } */
-foo7() {} /* { dg-error "previous definition" } */
+foo7() {} /* { dg-message "note: previous definition" } */
void foo7() {} /* { dg-error "conflicting types" } */
-void foo8() {} /* { dg-error "previous definition" } */
+void foo8() {} /* { dg-message "note: previous definition" } */
foo8() {} /* { dg-error "conflicting types" } */
-int use9() { foo9(); } /* { dg-warning "previous implicit declaration" } */
+int use9() { foo9(); } /* { dg-message "note: previous implicit declaration" } */
extern void foo9(); /* { dg-warning "conflicting types" } */
-int use10() { foo10(); } /* { dg-warning "previous implicit declaration" } */
+int use10() { foo10(); } /* { dg-message "note: previous implicit declaration" } */
void foo10() {} /* { dg-warning "conflicting types" } */
diff --git a/gcc/testsuite/gcc.dg/Wredundant-decls-2.c b/gcc/testsuite/gcc.dg/Wredundant-decls-2.c
index b10840f..89f57b4 100644
--- a/gcc/testsuite/gcc.dg/Wredundant-decls-2.c
+++ b/gcc/testsuite/gcc.dg/Wredundant-decls-2.c
@@ -2,21 +2,21 @@
/* { dg-do compile } */
/* { dg-options "-Wredundant-decls" } */
-int j = 5; /* { dg-warning "previous" } */
+int j = 5; /* { dg-message "note: previous" } */
int j; /* { dg-warning "redundant" } */
static int k;
-static int k = 5; /* { dg-warning "previous" } */
+static int k = 5; /* { dg-message "note: previous" } */
static int k; /* { dg-warning "redundant" } */
-static int l = 5; /* { dg-warning "previous" } */
+static int l = 5; /* { dg-message "note: previous" } */
static int l; /* { dg-warning "redundant" } */
-static int m; /* { dg-warning "previous" } */
+static int m; /* { dg-message "note: previous" } */
static int m; /* { dg-warning "redundant" } */
static int m = 5;
-int n; /* { dg-warning "previous" } */
+int n; /* { dg-message "note: previous" } */
int n; /* { dg-warning "redundant" } */
int n = 5;
diff --git a/gcc/testsuite/gcc.dg/Wshadow-1.c b/gcc/testsuite/gcc.dg/Wshadow-1.c
index 6dd2eb6..40073f3 100644
--- a/gcc/testsuite/gcc.dg/Wshadow-1.c
+++ b/gcc/testsuite/gcc.dg/Wshadow-1.c
@@ -10,7 +10,7 @@ void foo (double decl1) /* { dg-warning "shadows a global decl" } */
{
}
-void foo1 (int d) /* { dg-error "previous definition" } */
+void foo1 (int d) /* { dg-message "note: previous definition" } */
{
double d; /* { dg-bogus "warning" "warning in place of error" } */
/* { dg-error "redeclared as different" "" { target *-*-* } 15 } */
diff --git a/gcc/testsuite/gcc.dg/array-5.c b/gcc/testsuite/gcc.dg/array-5.c
index a4053da..4083c92 100644
--- a/gcc/testsuite/gcc.dg/array-5.c
+++ b/gcc/testsuite/gcc.dg/array-5.c
@@ -13,7 +13,7 @@ extern char arr1[1];
char arr1[1];
extern char arr2[0];
char arr2[0];
-extern char arr3[0]; /* { dg-error "previous declaration" } */
+extern char arr3[0]; /* { dg-message "note: previous declaration" } */
char arr3[1]; /* { dg-error "conflicting types" } */
/* Variable size matches. */
diff --git a/gcc/testsuite/gcc.dg/attr-noinline.c b/gcc/testsuite/gcc.dg/attr-noinline.c
index 9124e4f..9f7abcd 100644
--- a/gcc/testsuite/gcc.dg/attr-noinline.c
+++ b/gcc/testsuite/gcc.dg/attr-noinline.c
@@ -13,19 +13,19 @@ static inline void __attribute__((__noinline__)) function_declaration_both_after
static void function_declaration_both_after(void) {}
-static void function_declaration_noinline_before(void) __attribute__((__noinline__)); /* { dg-warning "previous declaration" "" } */
+static void function_declaration_noinline_before(void) __attribute__((__noinline__)); /* { dg-message "note: previous declaration" "" } */
static inline void function_declaration_noinline_before(void) {} /* { dg-warning "follows declaration with attribute noinline" "" } */
-static inline void function_declaration_noinline_after(void) {} /* { dg-warning "previous definition" "" } */
+static inline void function_declaration_noinline_after(void) {} /* { dg-message "note: previous definition" "" } */
static void function_declaration_noinline_after(void) __attribute__((__noinline__)); /* { dg-warning "follows inline declaration" "" } */
-static inline void function_declaration_inline_before(void); /* { dg-warning "previous declaration" "" } */
+static inline void function_declaration_inline_before(void); /* { dg-message "note: previous declaration" "" } */
static void __attribute__((__noinline__)) function_declaration_inline_before(void) {} /* { dg-warning "follows inline declaration" "" } */
-static inline void function_declaration_inline_noinline_before(void); /* { dg-warning "previous declaration" "" } */
+static inline void function_declaration_inline_noinline_before(void); /* { dg-message "note: previous declaration" "" } */
static void function_declaration_inline_noinline_before(void) __attribute__((__noinline__)); /* { dg-warning "follows inline declaration" "" } */
@@ -33,11 +33,11 @@ static void function_declaration_inline_noinline_before(void) {}
static inline void function_declaration_inline_noinline_after(void);
-static void function_declaration_inline_noinline_after(void) {} /* { dg-warning "previous definition" "" } */
+static void function_declaration_inline_noinline_after(void) {} /* { dg-message "note: previous definition" "" } */
static void function_declaration_inline_noinline_after(void) __attribute__((__noinline__)); /* { dg-warning "follows inline declaration" "" } */
-static void function_declaration_noinline_inline_before(void) __attribute__((__noinline__)); /* { dg-warning "previous declaration" "" } */
+static void function_declaration_noinline_inline_before(void) __attribute__((__noinline__)); /* { dg-message "note: previous declaration" "" } */
static inline void function_declaration_noinline_inline_before(void); /* { dg-warning "follows declaration with attribute noinline" "" } */
diff --git a/gcc/testsuite/gcc.dg/decl-2.c b/gcc/testsuite/gcc.dg/decl-2.c
index ab1532e..40d744c9 100644
--- a/gcc/testsuite/gcc.dg/decl-2.c
+++ b/gcc/testsuite/gcc.dg/decl-2.c
@@ -7,7 +7,7 @@
void foo(void)
{
char
- c /* { dg-error "previous declaration" } */
+ c /* { dg-message "note: previous declaration" } */
;
int i;
int
diff --git a/gcc/testsuite/gcc.dg/decl-3.c b/gcc/testsuite/gcc.dg/decl-3.c
index 5bbe19c..cba0b90 100644
--- a/gcc/testsuite/gcc.dg/decl-3.c
+++ b/gcc/testsuite/gcc.dg/decl-3.c
@@ -1,5 +1,5 @@
/* PR c/9928 */
/* { dg-do compile } */
-enum { CODES }; /* { dg-error "previous definition" } */
+enum { CODES }; /* { dg-message "note: previous definition" } */
enum { CODES }; /* { dg-error "conflicting types|redeclaration of enumerator" } */
diff --git a/gcc/testsuite/gcc.dg/decl-4.c b/gcc/testsuite/gcc.dg/decl-4.c
index acc7e77..ce640c9 100644
--- a/gcc/testsuite/gcc.dg/decl-4.c
+++ b/gcc/testsuite/gcc.dg/decl-4.c
@@ -1,10 +1,10 @@
/* Redeclaration of parameters is an error. PR 13728. */
/* { dg-do compile } */
-void f (int fred, /* { dg-error "previous definition" "" } */
+void f (int fred, /* { dg-message "note: previous definition" "" } */
int fred); /* { dg-error "redefinition of parameter" "" } */
-void f2 (int fred, /* { dg-error "previous definition" "" } */
+void f2 (int fred, /* { dg-message "note: previous definition" "" } */
int fred) /* { dg-error "redefinition of parameter" "" } */
{
}
diff --git a/gcc/testsuite/gcc.dg/decl-8.c b/gcc/testsuite/gcc.dg/decl-8.c
index ba75719..d0da48f 100644
--- a/gcc/testsuite/gcc.dg/decl-8.c
+++ b/gcc/testsuite/gcc.dg/decl-8.c
@@ -3,8 +3,8 @@
/* { dg-do compile } */
/* { dg-options "" } */
-typedef int I; /* { dg-error "previous declaration of 'I' was here" } */
+typedef int I; /* { dg-message "note: previous declaration of 'I' was here" } */
typedef int I; /* { dg-error "redefinition of typedef 'I'" } */
-typedef int I1; /* { dg-error "previous declaration of 'I1' was here" } */
+typedef int I1; /* { dg-message "note: previous declaration of 'I1' was here" } */
typedef long I1; /* { dg-error "conflicting types for 'I1'" } */
diff --git a/gcc/testsuite/gcc.dg/dll-2.c b/gcc/testsuite/gcc.dg/dll-2.c
index 3b8b60e..334299f 100644
--- a/gcc/testsuite/gcc.dg/dll-2.c
+++ b/gcc/testsuite/gcc.dg/dll-2.c
@@ -11,12 +11,12 @@
/* { dg-require-dll "" } */
__declspec (dllimport) int foo1 ();
-__declspec (dllexport) int foo1 (); /* { dg-warning "previous dllimport ignored" } */
+__declspec (dllexport) int foo1 (); /* { dg-message "note: previous dllimport ignored" } */
__declspec (dllexport) int foo2 ();
__declspec (dllimport) int foo2 (); /* { dg-warning "dllimport ignored" } */
__declspec (dllimport) int bar1;
-__declspec (dllexport) int bar1; /* { dg-warning "previous dllimport ignored" } */
+__declspec (dllexport) int bar1; /* { dg-message "note: previous dllimport ignored" } */
__declspec (dllexport) int bar2;
__declspec (dllimport) int bar2; /* { dg-warning "dllimport ignored" } */
diff --git a/gcc/testsuite/gcc.dg/dll-3.c b/gcc/testsuite/gcc.dg/dll-3.c
index 0a3f7df..4272891 100644
--- a/gcc/testsuite/gcc.dg/dll-3.c
+++ b/gcc/testsuite/gcc.dg/dll-3.c
@@ -5,7 +5,7 @@
/* { dg-do compile { target i?86-pc-mingw* } } */
__declspec (dllimport) int foo1 ();
-__declspec (dllexport) int foo1 (); /* { dg-warning "previous dllimport ignored" } */
+__declspec (dllexport) int foo1 (); /* { dg-message "note: previous dllimport ignored" } */
__declspec (dllexport) int foo2 ();
__declspec (dllimport) int foo2 (); /* { dg-warning "dllimport ignored" } */
diff --git a/gcc/testsuite/gcc.dg/enum-compat-1.c b/gcc/testsuite/gcc.dg/enum-compat-1.c
index 04a6e75..18d1f7f 100644
--- a/gcc/testsuite/gcc.dg/enum-compat-1.c
+++ b/gcc/testsuite/gcc.dg/enum-compat-1.c
@@ -25,7 +25,7 @@ enum e3 v3;
enum e4 *p = &v3; /* { dg-warning "incompatible" "incompatible pointer" } */
enum e3 *q = &v3;
-void g(enum e3); /* { dg-error "declaration" "error at first decl" } */
+void g(enum e3); /* { dg-message "note: previous declaration" "error at first decl" } */
void g(enum e4); /* { dg-error "conflicting types" "error at second decl" } */
void h(enum e3);
diff --git a/gcc/testsuite/gcc.dg/funcdef-var-1.c b/gcc/testsuite/gcc.dg/funcdef-var-1.c
index a685af7..63a5683 100644
--- a/gcc/testsuite/gcc.dg/funcdef-var-1.c
+++ b/gcc/testsuite/gcc.dg/funcdef-var-1.c
@@ -5,6 +5,6 @@
/* { dg-options "-Wmissing-prototypes" } */
extern __typeof(foo) foo __asm__(""); /* { dg-error "undeclared" } */
-/* { dg-error "previous declaration" "previous declaration" { target *-*-* } 7 } */
+/* { dg-message "note: previous declaration" "previous declaration" { target *-*-* } 7 } */
void *foo (void) {} /* { dg-error "redeclared as different kind of symbol" } */
/* { dg-warning "no previous prototype" "no previous prototype" { target *-*-* } 9 } */
diff --git a/gcc/testsuite/gcc.dg/funcdef-var-2.c b/gcc/testsuite/gcc.dg/funcdef-var-2.c
index 744987e..b3eb2ce 100644
--- a/gcc/testsuite/gcc.dg/funcdef-var-2.c
+++ b/gcc/testsuite/gcc.dg/funcdef-var-2.c
@@ -6,6 +6,6 @@
/* { dg-options "-Wmissing-prototypes" } */
int foo;
-/* { dg-error "previous declaration" "previous declaration" { target *-*-* } 8 } */
+/* { dg-message "note: previous declaration" "previous declaration" { target *-*-* } 8 } */
void foo () {} /* { dg-error "redeclared as different kind of symbol" } */
/* { dg-warning "no previous prototype" "no previous prototype" { target *-*-* } 10 } */
diff --git a/gcc/testsuite/gcc.dg/inline-14.c b/gcc/testsuite/gcc.dg/inline-14.c
index cef6277..15b2d40 100644
--- a/gcc/testsuite/gcc.dg/inline-14.c
+++ b/gcc/testsuite/gcc.dg/inline-14.c
@@ -3,7 +3,7 @@
/* { dg-options "-std=c99" } */
extern inline int func1 (void)
-{ /* { dg-error "previous definition" } */
+{ /* { dg-message "note: previous definition" } */
return 1;
}
@@ -13,7 +13,7 @@ inline int func1 (void) /* { dg-error "redefinition" } */
}
inline int func2 (void)
-{ /* { dg-error "previous definition" } */
+{ /* { dg-message "note: previous definition" } */
return 2;
}
diff --git a/gcc/testsuite/gcc.dg/inline1.c b/gcc/testsuite/gcc.dg/inline1.c
index f7a7eb4..c660fe3 100644
--- a/gcc/testsuite/gcc.dg/inline1.c
+++ b/gcc/testsuite/gcc.dg/inline1.c
@@ -3,6 +3,6 @@
/* This test is expected to fail with an error for the redefinition of foo.
This violates the constraint of 6.9#3 (no more than one external definition
of an identifier with internal linkage in the same translation unit). */
-static inline int foo(void) { return 1; } /* { dg-error "previous definition of" } */
+static inline int foo(void) { return 1; } /* { dg-message "note: previous definition of" } */
static inline int foo(void) { return 0; } /* { dg-error "redefinition of" } */
diff --git a/gcc/testsuite/gcc.dg/inline3.c b/gcc/testsuite/gcc.dg/inline3.c
index 64f6d8b..d7fd8db 100644
--- a/gcc/testsuite/gcc.dg/inline3.c
+++ b/gcc/testsuite/gcc.dg/inline3.c
@@ -3,5 +3,5 @@
/* This testcase should fail since we're redefining foo in the same
translation unit. */
extern inline int foo(void) { return 0; }
-inline int foo (void) { return 1; } /* { dg-error "previous definition of" } */
+inline int foo (void) { return 1; } /* { dg-message "note: previous definition of" } */
int foo (void) { return 2; } /* { dg-error "redefinition of" } */
diff --git a/gcc/testsuite/gcc.dg/inline4.c b/gcc/testsuite/gcc.dg/inline4.c
index a5c7dda..64cea75 100644
--- a/gcc/testsuite/gcc.dg/inline4.c
+++ b/gcc/testsuite/gcc.dg/inline4.c
@@ -2,5 +2,5 @@
/* { dg-options "-Wall -std=gnu89" } */
/* This testcase should fail since we're redefining foo in the same
translation unit. */
-int foo (void) { return 2; } /* { dg-error "previous definition of" } */
+int foo (void) { return 2; } /* { dg-message "note: previous definition of" } */
extern inline int foo (void) { return 1; } /* { dg-error "redefinition of" } */
diff --git a/gcc/testsuite/gcc.dg/inline5.c b/gcc/testsuite/gcc.dg/inline5.c
index 86a2776..40fb7cd 100644
--- a/gcc/testsuite/gcc.dg/inline5.c
+++ b/gcc/testsuite/gcc.dg/inline5.c
@@ -2,5 +2,5 @@
/* { dg-options "-Wall -std=gnu89" } */
/* This testcase should fail since we're redefining foo in the same
translation unit. */
-extern inline int foo (void) { return 2; } /* { dg-error "previous definition of" } */
+extern inline int foo (void) { return 2; } /* { dg-message "note: previous definition of" } */
extern inline int foo (void) { return 1; } /* { dg-error "redefinition of" } */
diff --git a/gcc/testsuite/gcc.dg/label-decl-4.c b/gcc/testsuite/gcc.dg/label-decl-4.c
index 7b2a195..3cfe965 100644
--- a/gcc/testsuite/gcc.dg/label-decl-4.c
+++ b/gcc/testsuite/gcc.dg/label-decl-4.c
@@ -7,8 +7,8 @@ void
f (void)
{
__label__ a, b, a; /* { dg-error "duplicate label declaration 'a'" } */
- /* { dg-error "previous declaration of 'a' was here" "previous" { target *-*-* } 9 } */
- __label__ c; /* { dg-error "previous declaration of 'c' was here" } */
+ /* { dg-message "note: previous declaration of 'a' was here" "previous" { target *-*-* } 9 } */
+ __label__ c; /* { dg-message "note: previous declaration of 'c' was here" } */
__label__ c; /* { dg-error "duplicate label declaration 'c'" } */
return;
}
diff --git a/gcc/testsuite/gcc.dg/nested-redef-1.c b/gcc/testsuite/gcc.dg/nested-redef-1.c
index acc961d..a3786b0 100644
--- a/gcc/testsuite/gcc.dg/nested-redef-1.c
+++ b/gcc/testsuite/gcc.dg/nested-redef-1.c
@@ -36,7 +36,7 @@ enum e0 {
enum e1 {
E2 = sizeof(enum e2 { E2 }), /* { dg-error "redeclaration of enumerator 'E2'" } */
- /* { dg-error "previous definition" "previous E2" { target *-*-* } 38 } */
+ /* { dg-message "note: previous definition" "previous E2" { target *-*-* } 38 } */
E3
};
diff --git a/gcc/testsuite/gcc.dg/noncompile/20020220-1.c b/gcc/testsuite/gcc.dg/noncompile/20020220-1.c
index aa57dc3..3063f42 100644
--- a/gcc/testsuite/gcc.dg/noncompile/20020220-1.c
+++ b/gcc/testsuite/gcc.dg/noncompile/20020220-1.c
@@ -6,7 +6,7 @@ int foo (const char*, const char*);
void bar (void)
{
const char *s = "bar";
- int i; /* { dg-error "previous declaration" } */
+ int i; /* { dg-message "note: previous declaration" } */
int size = 2;
int i = foo (s, s + size); /* { dg-error "redeclaration of" } */
}
diff --git a/gcc/testsuite/gcc.dg/noncompile/label-1.c b/gcc/testsuite/gcc.dg/noncompile/label-1.c
index e9bde7b..58d212f 100644
--- a/gcc/testsuite/gcc.dg/noncompile/label-1.c
+++ b/gcc/testsuite/gcc.dg/noncompile/label-1.c
@@ -28,7 +28,7 @@ void c(void)
/* can't have two labels with the same name in the same function */
void d(void)
{
- l: dummy(); /* { dg-error "previous definition" "prev def same scope" } */
+ l: dummy(); /* { dg-message "note: previous definition" "prev def same scope" } */
l: dummy(); /* { dg-error "duplicate label" "dup label same scope" } */
goto l;
}
@@ -36,7 +36,7 @@ void d(void)
/* even at different scopes */
void e(void)
{
- l: dummy(); /* { dg-error "previous definition" "prev def diff scope" } */
+ l: dummy(); /* { dg-message "note: previous definition" "prev def diff scope" } */
{
l: dummy(); /* { dg-error "duplicate label" "dup label diff scope" } */
}
@@ -150,7 +150,7 @@ void m(void)
void n(void)
{
- __label__ l; /* { dg-error "previous declaration" "outer label decl" } */
+ __label__ l; /* { dg-message "note: previous declaration" "outer label decl" } */
void nest(void)
{
l: goto l; /* { dg-error "duplicate label" "inner label defn" } */
diff --git a/gcc/testsuite/gcc.dg/noncompile/label-lineno-1.c b/gcc/testsuite/gcc.dg/noncompile/label-lineno-1.c
index 76d4d96..6d4def7 100644
--- a/gcc/testsuite/gcc.dg/noncompile/label-lineno-1.c
+++ b/gcc/testsuite/gcc.dg/noncompile/label-lineno-1.c
@@ -4,7 +4,7 @@
void
foo(int i)
{
- my_label: /* { dg-error "previous definition" "prev label" } */
+ my_label: /* { dg-message "note: previous definition" "prev label" } */
i++;
diff --git a/gcc/testsuite/gcc.dg/noncompile/redecl-1.c b/gcc/testsuite/gcc.dg/noncompile/redecl-1.c
index 416c258..732db00 100644
--- a/gcc/testsuite/gcc.dg/noncompile/redecl-1.c
+++ b/gcc/testsuite/gcc.dg/noncompile/redecl-1.c
@@ -4,6 +4,6 @@
int
foo ()
{
- int bar; /* { dg-error "previous.*decl" "previous.*decl" } */
+ int bar; /* { dg-message "note: previous.*decl" "previous.*decl" } */
volatile int bar; /* { dg-error "conflicting type qualifiers" "conflicting type qualifiers" } */
}
diff --git a/gcc/testsuite/gcc.dg/old-style-then-proto-1.c b/gcc/testsuite/gcc.dg/old-style-then-proto-1.c
index 4d9c215..7d76287 100644
--- a/gcc/testsuite/gcc.dg/old-style-then-proto-1.c
+++ b/gcc/testsuite/gcc.dg/old-style-then-proto-1.c
@@ -7,38 +7,38 @@
void f1() {}
void f1(void); /* { dg-warning "prototype for 'f1' follows non-prototype definition" } */
-void f2() {} /* { dg-error "previous definition of 'f2' was here" } */
+void f2() {} /* { dg-message "note: previous definition of 'f2' was here" } */
void f2(int); /* { dg-error "prototype for 'f2' declares more arguments than previous old-style definition" } */
-void f3(a) int a; {} /* { dg-error "previous definition of 'f3' was here" } */
+void f3(a) int a; {} /* { dg-message "note: previous definition of 'f3' was here" } */
void f3(void); /* { dg-error "prototype for 'f3' declares fewer arguments than previous old-style definition" } */
void f4(a) int a; {}
void f4(int); /* { dg-warning "prototype for 'f4' follows non-prototype definition" } */
-void f5(a) int a; {} /* { dg-error "previous definition of 'f5' was here" } */
+void f5(a) int a; {} /* { dg-message "note: previous definition of 'f5' was here" } */
void f5(int, int); /* { dg-error "prototype for 'f5' declares more arguments than previous old-style definition" } */
-void f6(a) int a; {} /* { dg-error "previous definition of 'f6' was here" } */
+void f6(a) int a; {} /* { dg-message "note: previous definition of 'f6' was here" } */
void f6(int, ...); /* { dg-error "conflicting types for 'f6'" } */
-void f7(a, b) int a, b; {} /* { dg-error "previous definition of 'f7' was here" } */
+void f7(a, b) int a, b; {} /* { dg-message "note: previous definition of 'f7' was here" } */
void f7(int); /* { dg-error "prototype for 'f7' declares fewer arguments than previous old-style definition" } */
-void f8(a, b) int a, b; {} /* { dg-error "previous definition of 'f8' was here" } */
+void f8(a, b) int a, b; {} /* { dg-message "note: previous definition of 'f8' was here" } */
void f8(int, ...); /* { dg-error "conflicting types for 'f8'" } */
void f9(a, b) int a, b; {}
void f9(int, int); /* { dg-warning "prototype for 'f9' follows non-prototype definition" } */
-void f10(a, b) int a, b; {} /* { dg-error "previous definition of 'f10' was here" } */
+void f10(a, b) int a, b; {} /* { dg-message "note: previous definition of 'f10' was here" } */
void f10(int, long); /* { dg-error "prototype for 'f10' declares argument 2 with incompatible type" } */
-void f11(a, b) int a, b; {} /* { dg-error "previous definition of 'f11' was here" } */
+void f11(a, b) int a, b; {} /* { dg-message "note: previous definition of 'f11' was here" } */
void f11(long, int); /* { dg-error "prototype for 'f11' declares argument 1 with incompatible type" } */
void f12(a, b) const int a; volatile int b; {}
void f12(volatile int, const int); /* { dg-warning "prototype for 'f12' follows non-prototype definition" } */
-void f13(a) const int a[2][2]; {} /* { dg-error "previous definition of 'f13' was here" } */
+void f13(a) const int a[2][2]; {} /* { dg-message "note: previous definition of 'f13' was here" } */
void f13(volatile int [2][2]); /* { dg-error "prototype for 'f13' declares argument 1 with incompatible type" } */
diff --git a/gcc/testsuite/gcc.dg/parm-mismatch-1.c b/gcc/testsuite/gcc.dg/parm-mismatch-1.c
index ba8a538..8f62e12 100644
--- a/gcc/testsuite/gcc.dg/parm-mismatch-1.c
+++ b/gcc/testsuite/gcc.dg/parm-mismatch-1.c
@@ -4,15 +4,15 @@
/* { dg-do compile } */
/* { dg-options "" } */
-void f0(); /* { dg-error "previous declaration of 'f0' was here" } */
+void f0(); /* { dg-message "note: previous declaration of 'f0' was here" } */
void f0(int, ...); /* { dg-error "conflicting types for 'f0'" } */
/* { dg-message "note: a parameter list with an ellipsis can't match an empty parameter name list declaration" "note" { target *-*-* } 8 } */
-void f1(int, ...); /* { dg-error "previous declaration of 'f1' was here" } */
+void f1(int, ...); /* { dg-message "note: previous declaration of 'f1' was here" } */
void f1(); /* { dg-error "conflicting types for 'f1'" } */
/* { dg-message "note: a parameter list with an ellipsis can't match an empty parameter name list declaration" "note" { target *-*-* } 11 } */
-void f2(); /* { dg-error "previous declaration of 'f2' was here" } */
+void f2(); /* { dg-message "note: previous declaration of 'f2' was here" } */
void f2(char); /* { dg-error "conflicting types for 'f2'" } */
/* { dg-message "note: an argument type that has a default promotion can't match an empty parameter name list declaration" "note" { target *-*-* } 14 } */
-void f3(char); /* { dg-error "previous declaration of 'f3' was here" } */
+void f3(char); /* { dg-message "note: previous declaration of 'f3' was here" } */
void f3(); /* { dg-error "conflicting types for 'f3'" } */
/* { dg-message "note: an argument type that has a default promotion can't match an empty parameter name list declaration" "note" { target *-*-* } 17 } */
diff --git a/gcc/testsuite/gcc.dg/pr15360-1.c b/gcc/testsuite/gcc.dg/pr15360-1.c
index 6abb250..4f900d7 100644
--- a/gcc/testsuite/gcc.dg/pr15360-1.c
+++ b/gcc/testsuite/gcc.dg/pr15360-1.c
@@ -15,10 +15,10 @@ extern int b = 1; /* { dg-warning "initialized and declared" "extern init warnin
static int b;
static int b;
-static int c; /* { dg-error "previous declaration" "" } */
+static int c; /* { dg-message "note: previous declaration" "" } */
int c; /* { dg-error "non-static" "correct error" } */
-static int d; /* { dg-error "previous declaration" "" } */
+static int d; /* { dg-message "note: previous declaration" "" } */
int d = 1; /* { dg-error "non-static" "correct error" } */
void foo (void) { extern int e = 1; } /* { dg-error "has both" "extern init in function" } */
diff --git a/gcc/testsuite/gcc.dg/pr27953.c b/gcc/testsuite/gcc.dg/pr27953.c
index 7df46b1..245b59e 100644
--- a/gcc/testsuite/gcc.dg/pr27953.c
+++ b/gcc/testsuite/gcc.dg/pr27953.c
@@ -5,4 +5,4 @@ void foo(struct A a) {} /* { dg-warning "declared inside parameter list" } */
/* { dg-error "incomplete type" "" { target *-*-* } 3 } */
void foo() {} /* { dg-error "redefinition" } */
-/* { dg-error "previous definition" "" { target *-*-* } 3 } */
+/* { dg-message "note: previous definition" "" { target *-*-* } 3 } */
diff --git a/gcc/testsuite/gcc.dg/pr35899.c b/gcc/testsuite/gcc.dg/pr35899.c
index 113cbc8..4ce4ac5 100644
--- a/gcc/testsuite/gcc.dg/pr35899.c
+++ b/gcc/testsuite/gcc.dg/pr35899.c
@@ -5,7 +5,7 @@
int
foo (void)
{
- int a = bar (); /* { dg-warning "previous implicit declaration" } */
+ int a = bar (); /* { dg-message "note: previous implicit declaration" } */
return a;
}
diff --git a/gcc/testsuite/gcc.dg/pr36901-1.c b/gcc/testsuite/gcc.dg/pr36901-1.c
new file mode 100644
index 0000000..6343830
--- /dev/null
+++ b/gcc/testsuite/gcc.dg/pr36901-1.c
@@ -0,0 +1,7 @@
+/* { dg-do compile } */
+/* { dg-options "-pedantic-errors" } */
+#include "pr36901-system.h"
+void foo(void)
+{
+ int s = sc;
+}
diff --git a/gcc/testsuite/gcc.dg/pr36901-2.c b/gcc/testsuite/gcc.dg/pr36901-2.c
new file mode 100644
index 0000000..cee367d
--- /dev/null
+++ b/gcc/testsuite/gcc.dg/pr36901-2.c
@@ -0,0 +1,7 @@
+/* { dg-do compile } */
+/* { dg-options "-pedantic-errors -w" } */
+#include "pr36901.h"
+void foo(void)
+{
+ int s = sc;
+}
diff --git a/gcc/testsuite/gcc.dg/pr36901-3.c b/gcc/testsuite/gcc.dg/pr36901-3.c
new file mode 100644
index 0000000..50e0d72
--- /dev/null
+++ b/gcc/testsuite/gcc.dg/pr36901-3.c
@@ -0,0 +1,10 @@
+/* { dg-do compile } */
+/* { dg-options "-pedantic-errors" } */
+#include "pr36901.h"
+void foo(void)
+{
+ int s = sc;
+}
+/* { dg-message "file included" "In file included" { target *-*-* } 0 } */
+/* { dg-warning "overflow" "overflow" { target *-*-* } 0 } */
+/* { dg-error "overflow" "overflow" { target *-*-* } 0 } */
diff --git a/gcc/testsuite/gcc.dg/pr36901-4.c b/gcc/testsuite/gcc.dg/pr36901-4.c
new file mode 100644
index 0000000..319c2c2
--- /dev/null
+++ b/gcc/testsuite/gcc.dg/pr36901-4.c
@@ -0,0 +1,11 @@
+/* { dg-do compile } */
+/* { dg-options "-pedantic-errors -Wsystem-headers" } */
+#include "pr36901-system.h"
+void foo(void)
+{
+ int s = sc;
+}
+/* { dg-message "from " "In file included" { target *-*-* } 0 } */
+/* { dg-warning "overflow" "overflow" { target *-*-* } 0 } */
+/* { dg-error "overflow" "overflow" { target *-*-* } 0 } */
+/* { dg-error "#include_next is a GCC extension" "#include_next" { target *-*-* } 0 } */
diff --git a/gcc/testsuite/gcc.dg/pr36901-system.h b/gcc/testsuite/gcc.dg/pr36901-system.h
new file mode 100644
index 0000000..6cc1e80
--- /dev/null
+++ b/gcc/testsuite/gcc.dg/pr36901-system.h
@@ -0,0 +1,3 @@
+#pragma GCC system_header
+#include "pr36901.h"
+
diff --git a/gcc/testsuite/gcc.dg/pr36901.h b/gcc/testsuite/gcc.dg/pr36901.h
new file mode 100644
index 0000000..aff2cb3
--- /dev/null
+++ b/gcc/testsuite/gcc.dg/pr36901.h
@@ -0,0 +1,2 @@
+#include <limits.h>
+static int sc = INT_MAX + 1;
diff --git a/gcc/testsuite/gcc.dg/proto-1.c b/gcc/testsuite/gcc.dg/proto-1.c
index 13c59a8a..62d0209 100644
--- a/gcc/testsuite/gcc.dg/proto-1.c
+++ b/gcc/testsuite/gcc.dg/proto-1.c
@@ -1,5 +1,5 @@
/* PR c/28502 */
/* { dg-do compile } */
-void foo() {} /* { dg-error "previous" } */
+void foo() {} /* { dg-message "note: previous" } */
void foo(void[]); /* { dg-error "array of voids" } */
diff --git a/gcc/testsuite/gcc.dg/qual-return-3.c b/gcc/testsuite/gcc.dg/qual-return-3.c
index 7a92046..e65f86d 100644
--- a/gcc/testsuite/gcc.dg/qual-return-3.c
+++ b/gcc/testsuite/gcc.dg/qual-return-3.c
@@ -6,7 +6,7 @@
/* { dg-do compile } */
/* { dg-options "" } */
-int foo (); /* { dg-error "previous declaration" "different qualifiers" } */
+int foo (); /* { dg-message "note: previous declaration" "different qualifiers" } */
const int foo () { return 0; } /* { dg-error "conflicting types" "different qualifiers" } */
void bar (void);
diff --git a/gcc/testsuite/gcc.dg/redecl-1.c b/gcc/testsuite/gcc.dg/redecl-1.c
index 61d6e5b..6a7d8fa 100644
--- a/gcc/testsuite/gcc.dg/redecl-1.c
+++ b/gcc/testsuite/gcc.dg/redecl-1.c
@@ -9,8 +9,8 @@
/* Extern at function scope, clashing with extern at file scope */
-extern int foo1; /* { dg-error "previous" } */
-extern int bar1(int); /* { dg-error "previous" } */
+extern int foo1; /* { dg-message "note: previous" } */
+extern int bar1(int); /* { dg-message "note: previous" } */
void test1(void)
{
@@ -22,8 +22,8 @@ void test1(void)
void test2(void)
{
- extern double foo2; /* { dg-error "previous" } */
- extern double bar2(double); /* { dg-error "previous" } */
+ extern double foo2; /* { dg-message "note: previous" } */
+ extern double bar2(double); /* { dg-message "note: previous" } */
}
extern int foo2; /* { dg-error "conflict" } */
@@ -36,9 +36,9 @@ typedef float baz3; /* { dg-bogus } */
void prime3(void)
{
- extern int foo3; /* { dg-error "previous" } */
- extern int bar3(int); /* { dg-error "previous" } */
- extern int baz3; /* { dg-error "previous" } */
+ extern int foo3; /* { dg-message "note: previous" } */
+ extern int bar3(int); /* { dg-message "note: previous" } */
+ extern int baz3; /* { dg-message "note: previous" } */
}
void test3(void)
@@ -58,7 +58,7 @@ void prime4(void)
void test4(void)
{
extern double bar4(double); /* { dg-error "conflict" } */
-/* { dg-error "previous implicit declaration" "" { target *-*-* } 55 } */
+/* { dg-message "note: previous implicit declaration" "" { target *-*-* } 55 } */
}
/* Implicit decl, clashing with extern at previous function scope. */
@@ -66,7 +66,7 @@ void test4(void)
void prime5(void)
{
extern double bar5(double); /* { dg-message "note: previous declaration" "" } */
-} /* { dg-error "previous implicit declaration" "" { target *-*-* } 68 } */
+} /* { dg-message "note: previous implicit declaration" "" { target *-*-* } 68 } */
void test5(void)
{
@@ -75,7 +75,7 @@ void test5(void)
/* Extern then static, both at file scope. */
-extern int test6(int); /* { dg-error "previous" "" } */
+extern int test6(int); /* { dg-message "note: previous" "" } */
static int test6(int x) /* { dg-error "follows non-static" } */
{ return x; }
@@ -84,7 +84,7 @@ static int test6(int x) /* { dg-error "follows non-static" } */
void prime7(void)
{
- extern int test7(int); /* { dg-error "previous" "" } */
+ extern int test7(int); /* { dg-message "note: previous" "" } */
}
static int test7(int x) /* { dg-error "follows non-static" } */
@@ -94,7 +94,7 @@ static int test7(int x) /* { dg-error "follows non-static" } */
void prime8(void)
{
- test8(); /* { dg-error "previous" "" } */
+ test8(); /* { dg-message "note: previous" "" } */
/* { dg-warning "implicit" "implicit" { target *-*-* } 97 } */
}
diff --git a/gcc/testsuite/gcc.dg/redecl-11.c b/gcc/testsuite/gcc.dg/redecl-11.c
index e4ce0b8..5540e40 100644
--- a/gcc/testsuite/gcc.dg/redecl-11.c
+++ b/gcc/testsuite/gcc.dg/redecl-11.c
@@ -5,5 +5,5 @@
/* { dg-options "" } */
int f(int (*)[]);
-void g() { int f(int (*)[2]); } /* { dg-error "previous declaration of 'f' was here" } */
+void g() { int f(int (*)[2]); } /* { dg-message "note: previous declaration of 'f' was here" } */
int f(int (*)[3]); /* { dg-error "conflicting types for 'f'" } */
diff --git a/gcc/testsuite/gcc.dg/redecl-12.c b/gcc/testsuite/gcc.dg/redecl-12.c
index 58041ef..711b8a3 100644
--- a/gcc/testsuite/gcc.dg/redecl-12.c
+++ b/gcc/testsuite/gcc.dg/redecl-12.c
@@ -5,5 +5,5 @@
/* { dg-options "" } */
extern int a[];
-void f(void) { extern int a[]; extern int a[10]; } /* { dg-error "previous declaration of 'a' was here" } */
+void f(void) { extern int a[]; extern int a[10]; } /* { dg-message "note: previous declaration of 'a' was here" } */
extern int a[5]; /* { dg-error "conflicting types for 'a'" } */
diff --git a/gcc/testsuite/gcc.dg/redecl-13.c b/gcc/testsuite/gcc.dg/redecl-13.c
index 84eeb4e..3f05d0f 100644
--- a/gcc/testsuite/gcc.dg/redecl-13.c
+++ b/gcc/testsuite/gcc.dg/redecl-13.c
@@ -5,5 +5,5 @@
/* { dg-options "" } */
extern int a[];
-void f(void) { extern int a[10]; } /* { dg-error "previous declaration of 'a' was here" } */
+void f(void) { extern int a[10]; } /* { dg-message "note: previous declaration of 'a' was here" } */
extern int a[5]; /* { dg-error "conflicting types for 'a'" } */
diff --git a/gcc/testsuite/gcc.dg/redecl-15.c b/gcc/testsuite/gcc.dg/redecl-15.c
index 5ed0eac..d2f48bd 100644
--- a/gcc/testsuite/gcc.dg/redecl-15.c
+++ b/gcc/testsuite/gcc.dg/redecl-15.c
@@ -7,7 +7,7 @@
void
f (void)
{
- g(); /* { dg-warning "previous implicit declaration of 'g' was here" } */
+ g(); /* { dg-message "note: previous implicit declaration of 'g' was here" } */
{
void g(); /* { dg-warning "conflicting types for 'g'" } */
}
diff --git a/gcc/testsuite/gcc.dg/redecl-16.c b/gcc/testsuite/gcc.dg/redecl-16.c
index 52941cb..560b373 100644
--- a/gcc/testsuite/gcc.dg/redecl-16.c
+++ b/gcc/testsuite/gcc.dg/redecl-16.c
@@ -14,5 +14,5 @@ f (void)
{
extern IA5P a[];
}
-IAP a[] = { 0 }; /* { dg-error "previous definition" } */
+IAP a[] = { 0 }; /* { dg-message "note: previous definition" } */
extern IA10P a[]; /* { dg-error "conflicting types" } */
diff --git a/gcc/testsuite/gcc.dg/redecl-2.c b/gcc/testsuite/gcc.dg/redecl-2.c
index b1b7dc9..fa0d5e4 100644
--- a/gcc/testsuite/gcc.dg/redecl-2.c
+++ b/gcc/testsuite/gcc.dg/redecl-2.c
@@ -7,56 +7,56 @@
void
fa0 (void)
{
- int a0; /* { dg-error "previous declaration" } */
+ int a0; /* { dg-message "note: previous declaration" } */
int a0; /* { dg-error "redeclaration" } */
}
void
fa1 (void)
{
- int a1; /* { dg-error "previous declaration" } */
+ int a1; /* { dg-message "note: previous declaration" } */
static int a1; /* { dg-error "redeclaration" } */
}
void
fa2 (void)
{
- int a2; /* { dg-error "previous declaration" } */
+ int a2; /* { dg-message "note: previous declaration" } */
extern int a2; /* { dg-error "follows declaration with no linkage" } */
}
void
fa3 (void)
{
- static int a3; /* { dg-error "previous declaration" } */
+ static int a3; /* { dg-message "note: previous declaration" } */
int a3; /* { dg-error "redeclaration" } */
}
void
fa4 (void)
{
- static int a4; /* { dg-error "previous declaration" } */
+ static int a4; /* { dg-message "note: previous declaration" } */
static int a4; /* { dg-error "redeclaration" } */
}
void
fa5 (void)
{
- static int a5; /* { dg-error "previous declaration" } */
+ static int a5; /* { dg-message "note: previous declaration" } */
extern int a5; /* { dg-error "follows declaration with no linkage" } */
}
void
fa6 (void)
{
- extern int a6; /* { dg-error "previous declaration" } */
+ extern int a6; /* { dg-message "note: previous declaration" } */
int a6; /* { dg-error "follows extern declaration" } */
}
void
fa7 (void)
{
- extern int a7; /* { dg-error "previous declaration" } */
+ extern int a7; /* { dg-message "note: previous declaration" } */
static int a7; /* { dg-error "follows extern declaration" } */
}
diff --git a/gcc/testsuite/gcc.dg/redecl-5.c b/gcc/testsuite/gcc.dg/redecl-5.c
index a689295..15b1f8c 100644
--- a/gcc/testsuite/gcc.dg/redecl-5.c
+++ b/gcc/testsuite/gcc.dg/redecl-5.c
@@ -7,7 +7,7 @@
void
f (void)
{
- long z(); /* { dg-error "previous implicit declaration" } */
+ long z(); /* { dg-message "note: previous implicit declaration" } */
}
void
diff --git a/gcc/testsuite/gcc.dg/tls/diag-3.c b/gcc/testsuite/gcc.dg/tls/diag-3.c
index 45d89b4..1a7994c 100644
--- a/gcc/testsuite/gcc.dg/tls/diag-3.c
+++ b/gcc/testsuite/gcc.dg/tls/diag-3.c
@@ -1,10 +1,10 @@
/* Report invalid extern and __thread combinations. */
/* { dg-require-effective-target tls } */
-extern int j; /* { dg-error "previous declaration" } */
+extern int j; /* { dg-message "note: previous declaration" } */
__thread int j; /* { dg-error "follows non-thread-local" } */
-extern __thread int i; /* { dg-error "previous declaration" } */
+extern __thread int i; /* { dg-message "note: previous declaration" } */
int i; /* { dg-error "follows thread-local" } */
extern __thread int k; /* This is fine. */
diff --git a/gcc/testsuite/gcc.dg/transparent-union-2.c b/gcc/testsuite/gcc.dg/transparent-union-2.c
index f466c4a..09fbb4d 100644
--- a/gcc/testsuite/gcc.dg/transparent-union-2.c
+++ b/gcc/testsuite/gcc.dg/transparent-union-2.c
@@ -5,14 +5,14 @@
typedef union { int *i; long *l; } U
__attribute__((transparent_union));
-extern void f0 (U); /* { dg-error "previous declaration" } */
+extern void f0 (U); /* { dg-message "note: previous declaration" } */
extern void f0 (void *); /* { dg-error "conflicting types" } */
-extern void f1 (U); /* { dg-error "previous declaration" } */
+extern void f1 (U); /* { dg-message "note: previous declaration" } */
extern void f1 (unsigned long); /* { dg-error "conflicting types" } */
-extern void f2 (void *); /* { dg-error "previous declaration" } */
+extern void f2 (void *); /* { dg-message "note: previous declaration" } */
extern void f2 (U); /* { dg-error "conflicting types" } */
-extern void f3 (unsigned long); /* { dg-error "previous declaration" } */
+extern void f3 (unsigned long); /* { dg-message "note: previous declaration" } */
extern void f3 (U); /* { dg-error "conflicting types" } */
diff --git a/gcc/testsuite/gcc.dg/visibility-7.c b/gcc/testsuite/gcc.dg/visibility-7.c
index aaa8165..016f3dd 100644
--- a/gcc/testsuite/gcc.dg/visibility-7.c
+++ b/gcc/testsuite/gcc.dg/visibility-7.c
@@ -5,7 +5,7 @@
extern int
__attribute__((visibility ("hidden")))
-xyzzy; /* { dg-warning "previous declaration" "" } */
+xyzzy; /* { dg-message "note: previous declaration" "" } */
int
__attribute__((visibility ("protected")))
diff --git a/gcc/testsuite/gcc.dg/wtr-static-1.c b/gcc/testsuite/gcc.dg/wtr-static-1.c
index 42760e8..318b2f3 100644
--- a/gcc/testsuite/gcc.dg/wtr-static-1.c
+++ b/gcc/testsuite/gcc.dg/wtr-static-1.c
@@ -4,7 +4,7 @@
/* { dg-do compile } */
/* { dg-options "-Wtraditional" } */
-static void testfunc1(void); /* { dg-warning "previous declaration" } */
+static void testfunc1(void); /* { dg-message "note: previous declaration" } */
void testfunc1() {} /* { dg-warning "non-static.*follows static" "non-static follows static" } */
# 11 "sys-header.h" 3
diff --git a/gcc/testsuite/gcc.target/i386/regparm.c b/gcc/testsuite/gcc.target/i386/regparm.c
index 7334c97..9db191c 100644
--- a/gcc/testsuite/gcc.target/i386/regparm.c
+++ b/gcc/testsuite/gcc.target/i386/regparm.c
@@ -3,7 +3,7 @@
/* { dg-options "-W -Wall" } */
/* Verify that GCC correctly detects non-matching regparm attributes. */
-int __attribute__((regparm(3))) f (void); /* { dg-error "previous" } */
+int __attribute__((regparm(3))) f (void); /* { dg-message "note: previous" } */
int __attribute__((regparm(2))) f (void) { /* { dg-error "conflicting" } */
return 0;
diff --git a/gcc/testsuite/gcc.target/powerpc/altivec-macros.c b/gcc/testsuite/gcc.target/powerpc/altivec-macros.c
index d95a68d..ef497a4 100644
--- a/gcc/testsuite/gcc.target/powerpc/altivec-macros.c
+++ b/gcc/testsuite/gcc.target/powerpc/altivec-macros.c
@@ -55,9 +55,9 @@ _Pragma ("__vector")
/* { dg-warning "redefined" "pixel redefined" { target *-*-* } 48 } */
/* { dg-warning "redefined" "bool redefined" { target *-*-* } 49 } */
-/* { dg-warning "previous" "prev __vector defn" { target *-*-* } 24 } */
-/* { dg-warning "previous" "prev __pixel defn" { target *-*-* } 27 } */
-/* { dg-warning "previous" "prev __bool defn" { target *-*-* } 30 } */
-/* { dg-warning "previous" "prev vector defn" { target *-*-* } 33 } */
-/* { dg-warning "previous" "prev pixel defn" { target *-*-* } 36 } */
-/* { dg-warning "previous" "prev bool defn" { target *-*-* } 39 } */
+/* { dg-message "note: previous" "prev __vector defn" { target *-*-* } 24 } */
+/* { dg-message "note: previous" "prev __pixel defn" { target *-*-* } 27 } */
+/* { dg-message "note: previous" "prev __bool defn" { target *-*-* } 30 } */
+/* { dg-message "note: previous" "prev vector defn" { target *-*-* } 33 } */
+/* { dg-message "note: previous" "prev pixel defn" { target *-*-* } 36 } */
+/* { dg-message "note: previous" "prev bool defn" { target *-*-* } 39 } */
diff --git a/gcc/toplev.h b/gcc/toplev.h
index 1a015e6..76718a1 100644
--- a/gcc/toplev.h
+++ b/gcc/toplev.h
@@ -56,19 +56,17 @@ extern void _fatal_insn (const char *, const_rtx, const char *, int, const char
#endif
extern void internal_error (const char *, ...) ATTRIBUTE_GCC_DIAG(1,2)
ATTRIBUTE_NORETURN;
-extern void warning0 (const char *, ...) ATTRIBUTE_GCC_DIAG(1,2);
/* Pass one of the OPT_W* from options.h as the first parameter. */
-extern void warning (int, const char *, ...) ATTRIBUTE_GCC_DIAG(2,3);
-extern void warning_at (location_t, int, const char *, ...)
+extern bool warning (int, const char *, ...) ATTRIBUTE_GCC_DIAG(2,3);
+extern bool warning_at (location_t, int, const char *, ...)
ATTRIBUTE_GCC_DIAG(3,4);
extern void error (const char *, ...) ATTRIBUTE_GCC_DIAG(1,2);
extern void fatal_error (const char *, ...) ATTRIBUTE_GCC_DIAG(1,2)
ATTRIBUTE_NORETURN;
-extern void pedwarn0 (const char *, ...) ATTRIBUTE_GCC_DIAG(1,2);
/* Pass one of the OPT_W* from options.h as the first parameter. */
-extern void pedwarn (int, const char *, ...) ATTRIBUTE_GCC_DIAG(2,3);
-extern void permerror (const char *, ...) ATTRIBUTE_GCC_DIAG(1,2);
-extern void permerror_at (location_t, const char *, ...)
+extern bool pedwarn (int, const char *, ...) ATTRIBUTE_GCC_DIAG(2,3);
+extern bool permerror (const char *, ...) ATTRIBUTE_GCC_DIAG(1,2);
+extern bool permerror_at (location_t, const char *, ...)
ATTRIBUTE_GCC_DIAG(2,3);
extern void sorry (const char *, ...) ATTRIBUTE_GCC_DIAG(1,2);
extern void inform (const char *, ...) ATTRIBUTE_GCC_DIAG(1,2);
diff --git a/gcc/tree-ssa.c b/gcc/tree-ssa.c
index c308a35..4c7592e 100644
--- a/gcc/tree-ssa.c
+++ b/gcc/tree-ssa.c
@@ -1414,15 +1414,17 @@ warn_uninit (tree t, const char *gmsgid, void *data)
location = (context != NULL && gimple_has_location (context))
? gimple_location (context)
: DECL_SOURCE_LOCATION (var);
- warning_at (location, OPT_Wuninitialized, gmsgid, var);
xloc = expand_location (location);
floc = expand_location (DECL_SOURCE_LOCATION (cfun->decl));
- if (xloc.file != floc.file
- || xloc.line < floc.line
- || xloc.line > LOCATION_LINE (cfun->function_end_locus))
- inform ("%J%qD was declared here", var, var);
+ if (warning_at (location, OPT_Wuninitialized, gmsgid, var))
+ {
+ TREE_NO_WARNING (var) = 1;
- TREE_NO_WARNING (var) = 1;
+ if (xloc.file != floc.file
+ || xloc.line < floc.line
+ || xloc.line > LOCATION_LINE (cfun->function_end_locus))
+ inform ("%J%qD was declared here", var, var);
+ }
}
struct walk_data {