diff options
author | paolo <paolo@138bc75d-0d04-0410-961f-82ee72b054a4> | 2013-12-05 09:51:11 +0000 |
---|---|---|
committer | paolo <paolo@138bc75d-0d04-0410-961f-82ee72b054a4> | 2013-12-05 09:51:11 +0000 |
commit | 9520b2cbffb76cd313aa55f4dba5f4e39653d485 (patch) | |
tree | 7c7d1d4feeb566fbce7696663f4f2da9cf9439da /gcc/cp | |
parent | e5cf72b97715c45b545740bccac206eb360dc98c (diff) | |
download | gcc-9520b2cbffb76cd313aa55f4dba5f4e39653d485.tar.gz |
/cp
2013-12-05 Paolo Carlini <paolo.carlini@oracle.com>
* decl.c (duplicate_decls): Replace pairs of errors and permerrors
with error + inform (permerror + inform, respectively).
/testsuite
2013-12-05 Paolo Carlini <paolo.carlini@oracle.com>
* g++.dg/cpp0x/constexpr-46336.C: Adjust expected messages.
* g++.dg/cpp0x/defaulted2.C: Likewise.
* g++.dg/cpp1y/auto-fn8.C: Likewise.
* g++.dg/gomp/udr-3.C: Likewise.
* g++.dg/lookup/extern-c-redecl5.C: Likewise.
* g++.dg/lookup/linkage1.C: Likewise.
* g++.dg/overload/new1.C: Likewise.
* g++.dg/parse/friend5.C: Likewise.
* g++.dg/parse/namespace-alias-1.C: Likewise.
* g++.dg/parse/namespace10.C: Likewise.
* g++.dg/parse/redef2.C: Likewise.
* g++.dg/template/friend44.C: Likewise.
* g++.old-deja/g++.brendan/crash42.C: Likewise.
* g++.old-deja/g++.brendan/crash52.C: Likewise.
* g++.old-deja/g++.brendan/crash55.C: Likewise.
* g++.old-deja/g++.jason/overload21.C: Likewise.
* g++.old-deja/g++.jason/overload5.C: Likewise.
* g++.old-deja/g++.jason/redecl1.C: Likewise.
* g++.old-deja/g++.law/arm8.C: Likewise.
* g++.old-deja/g++.other/main1.C: Likewise.
git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@205697 138bc75d-0d04-0410-961f-82ee72b054a4
Diffstat (limited to 'gcc/cp')
-rw-r--r-- | gcc/cp/ChangeLog | 5 | ||||
-rw-r--r-- | gcc/cp/decl.c | 97 |
2 files changed, 57 insertions, 45 deletions
diff --git a/gcc/cp/ChangeLog b/gcc/cp/ChangeLog index 2583e5e47aa..2d5617a35cc 100644 --- a/gcc/cp/ChangeLog +++ b/gcc/cp/ChangeLog @@ -1,3 +1,8 @@ +2013-12-05 Paolo Carlini <paolo.carlini@oracle.com> + + * decl.c (duplicate_decls): Replace pairs of errors and permerrors + with error + inform (permerror + inform, respectively). + 2013-12-04 Joseph Myers <joseph@codesourcery.com> PR c/52023 diff --git a/gcc/cp/decl.c b/gcc/cp/decl.c index 820d9c08f7b..a6744c77cba 100644 --- a/gcc/cp/decl.c +++ b/gcc/cp/decl.c @@ -1299,8 +1299,9 @@ duplicate_decls (tree newdecl, tree olddecl, bool newdecl_is_friend) { if (warning (OPT_Wattributes, "function %q+D redeclared as inline", newdecl)) - inform (input_location, "previous declaration of %q+D " - "with attribute noinline", olddecl); + inform (DECL_SOURCE_LOCATION (olddecl), + "previous declaration of %qD with attribute noinline", + olddecl); } else if (DECL_DECLARED_INLINE_P (olddecl) && DECL_UNINLINABLE (newdecl) @@ -1308,7 +1309,8 @@ duplicate_decls (tree newdecl, tree olddecl, bool newdecl_is_friend) { if (warning (OPT_Wattributes, "function %q+D redeclared with " "attribute noinline", newdecl)) - inform (input_location, "previous declaration of %q+D was inline", + inform (DECL_SOURCE_LOCATION (olddecl), + "previous declaration of %qD was inline", olddecl); } } @@ -1343,11 +1345,8 @@ duplicate_decls (tree newdecl, tree olddecl, bool newdecl_is_friend) warning (0, "library function %q#D redeclared as non-function %q#D", olddecl, newdecl); else - { - error ("declaration of %q#D", newdecl); - error ("conflicts with built-in declaration %q#D", - olddecl); - } + error ("declaration of %q#D conflicts with built-in " + "declaration %q#D", newdecl, olddecl); return NULL_TREE; } else if (DECL_OMP_DECLARE_REDUCTION_P (olddecl)) @@ -1355,8 +1354,8 @@ duplicate_decls (tree newdecl, tree olddecl, bool newdecl_is_friend) gcc_assert (DECL_OMP_DECLARE_REDUCTION_P (newdecl)); error_at (DECL_SOURCE_LOCATION (newdecl), "redeclaration of %<pragma omp declare reduction%>"); - error_at (DECL_SOURCE_LOCATION (olddecl), - "previous %<pragma omp declare reduction%> declaration"); + inform (DECL_SOURCE_LOCATION (olddecl), + "previous %<pragma omp declare reduction%> declaration"); return error_mark_node; } else if (!types_match) @@ -1407,11 +1406,8 @@ duplicate_decls (tree newdecl, tree olddecl, bool newdecl_is_friend) /* A near match; override the builtin. */ if (TREE_PUBLIC (newdecl)) - { - warning (0, "new declaration %q#D", newdecl); - warning (0, "ambiguates built-in declaration %q#D", - olddecl); - } + warning (0, "new declaration %q#D ambiguates built-in " + "declaration %q#D", newdecl, olddecl); else warning (OPT_Wshadow, DECL_BUILT_IN (olddecl) @@ -1504,7 +1500,8 @@ duplicate_decls (tree newdecl, tree olddecl, bool newdecl_is_friend) error ("%q#D redeclared as different kind of symbol", newdecl); if (TREE_CODE (olddecl) == TREE_LIST) olddecl = TREE_VALUE (olddecl); - inform (input_location, "previous declaration of %q+#D", olddecl); + inform (DECL_SOURCE_LOCATION (olddecl), + "previous declaration %q#D", olddecl); return error_mark_node; } @@ -1523,8 +1520,9 @@ duplicate_decls (tree newdecl, tree olddecl, bool newdecl_is_friend) if (TREE_CODE (DECL_TEMPLATE_RESULT (olddecl)) == TYPE_DECL || TREE_CODE (DECL_TEMPLATE_RESULT (newdecl)) == TYPE_DECL) { - error ("declaration of template %q#D", newdecl); - error ("conflicts with previous declaration %q+#D", olddecl); + error ("conflicting declaration of template %q#D", newdecl); + inform (DECL_SOURCE_LOCATION (olddecl), + "previous declaration %q#D", olddecl); return error_mark_node; } else if (TREE_CODE (DECL_TEMPLATE_RESULT (olddecl)) == FUNCTION_DECL @@ -1538,8 +1536,9 @@ duplicate_decls (tree newdecl, tree olddecl, bool newdecl_is_friend) && same_type_p (TREE_TYPE (TREE_TYPE (newdecl)), TREE_TYPE (TREE_TYPE (olddecl)))) { - error ("new declaration %q#D", newdecl); - error ("ambiguates old declaration %q+#D", olddecl); + error ("ambiguating new declaration %q#D", newdecl); + inform (DECL_SOURCE_LOCATION (olddecl), + "old declaration %q#D", olddecl); } return NULL_TREE; } @@ -1547,9 +1546,10 @@ duplicate_decls (tree newdecl, tree olddecl, bool newdecl_is_friend) { if (DECL_EXTERN_C_P (newdecl) && DECL_EXTERN_C_P (olddecl)) { - error ("declaration of C function %q#D conflicts with", + error ("conflicting declaration of C function %q#D", newdecl); - error ("previous declaration %q+#D here", olddecl); + inform (DECL_SOURCE_LOCATION (olddecl), + "previous declaration %q#D", olddecl); return NULL_TREE; } /* For function versions, params and types match, but they @@ -1559,8 +1559,9 @@ duplicate_decls (tree newdecl, tree olddecl, bool newdecl_is_friend) && compparms (TYPE_ARG_TYPES (TREE_TYPE (newdecl)), TYPE_ARG_TYPES (TREE_TYPE (olddecl)))) { - error ("new declaration %q#D", newdecl); - error ("ambiguates old declaration %q+#D", olddecl); + error ("ambiguating new declaration of %q#D", newdecl); + inform (DECL_SOURCE_LOCATION (olddecl), + "old declaration %q#D", olddecl); return error_mark_node; } else @@ -1569,8 +1570,8 @@ duplicate_decls (tree newdecl, tree olddecl, bool newdecl_is_friend) else { error ("conflicting declaration %q#D", newdecl); - inform (input_location, - "%q+D has a previous declaration as %q#D", olddecl, olddecl); + inform (DECL_SOURCE_LOCATION (olddecl), + "previous declaration as %q#D", olddecl); return error_mark_node; } } @@ -1622,8 +1623,9 @@ duplicate_decls (tree newdecl, tree olddecl, bool newdecl_is_friend) A namespace-name defined at global scope shall not be declared as the name of any other entity in any global scope of the program. */ - error ("declaration of namespace %qD conflicts with", newdecl); - error ("previous declaration of namespace %q+D here", olddecl); + error ("conflicting declaration of namespace %qD", newdecl); + inform (DECL_SOURCE_LOCATION (olddecl), + "previous declaration of namespace %qD here", olddecl); return error_mark_node; } else @@ -1645,9 +1647,10 @@ duplicate_decls (tree newdecl, tree olddecl, bool newdecl_is_friend) && prototype_p (TREE_TYPE (newdecl))) { /* Prototype decl follows defn w/o prototype. */ - warning_at (input_location, 0, "prototype for %q+#D", newdecl); - warning_at (DECL_SOURCE_LOCATION (olddecl), 0, - "follows non-prototype definition here"); + warning_at (DECL_SOURCE_LOCATION (newdecl), 0, + "prototype specified for %q#D", newdecl); + inform (DECL_SOURCE_LOCATION (olddecl), + "previous non-prototype definition here"); } else if (VAR_OR_FUNCTION_DECL_P (olddecl) && DECL_LANGUAGE (newdecl) != DECL_LANGUAGE (olddecl)) @@ -1686,10 +1689,11 @@ duplicate_decls (tree newdecl, tree olddecl, bool newdecl_is_friend) } else { - error ("previous declaration of %q+#D with %qL linkage", - olddecl, DECL_LANGUAGE (olddecl)); - error ("conflicts with new declaration with %qL linkage", - DECL_LANGUAGE (newdecl)); + error ("conflicting declaration of %q#D with %qL linkage", + newdecl, DECL_LANGUAGE (newdecl)); + inform (DECL_SOURCE_LOCATION (olddecl), + "previous declaration with %qL linkage", + DECL_LANGUAGE (olddecl)); } } @@ -1729,19 +1733,20 @@ duplicate_decls (tree newdecl, tree olddecl, bool newdecl_is_friend) if (1 == simple_cst_equal (TREE_PURPOSE (t1), TREE_PURPOSE (t2))) { - permerror (input_location, - "default argument given for parameter %d " - "of %q#D", i, newdecl); - permerror (input_location, - "after previous specification in %q+#D", - olddecl); + if (permerror (input_location, + "default argument given for parameter " + "%d of %q#D", i, newdecl)) + permerror (DECL_SOURCE_LOCATION (olddecl), + "previous specification in %q#D here", + olddecl); } else { error ("default argument given for parameter %d " "of %q#D", i, newdecl); - error ("after previous specification in %q+#D", - olddecl); + inform (DECL_SOURCE_LOCATION (olddecl), + "previous specification in %q#D here", + olddecl); } } } @@ -1805,7 +1810,8 @@ duplicate_decls (tree newdecl, tree olddecl, bool newdecl_is_friend) if (warning (OPT_Wredundant_decls, "redundant redeclaration of %qD in same scope", newdecl)) - inform (input_location, "previous declaration of %q+D", olddecl); + inform (DECL_SOURCE_LOCATION (olddecl), + "previous declaration of %qD", olddecl); } if (!(DECL_TEMPLATE_INSTANTIATION (olddecl) @@ -1814,7 +1820,8 @@ duplicate_decls (tree newdecl, tree olddecl, bool newdecl_is_friend) if (DECL_DELETED_FN (newdecl)) { error ("deleted definition of %qD", newdecl); - error ("after previous declaration %q+D", olddecl); + inform (DECL_SOURCE_LOCATION (olddecl), + "previous declaration of %qD", olddecl); } DECL_DELETED_FN (newdecl) |= DECL_DELETED_FN (olddecl); } |