diff options
author | paolo <paolo@138bc75d-0d04-0410-961f-82ee72b054a4> | 2013-05-15 18:24:31 +0000 |
---|---|---|
committer | paolo <paolo@138bc75d-0d04-0410-961f-82ee72b054a4> | 2013-05-15 18:24:31 +0000 |
commit | be6494a83fcd4889680352d98c5b76ce0c1680b3 (patch) | |
tree | 78e0db04f507a690e13498e747a92dc48ea8231b /gcc/cp/name-lookup.c | |
parent | c27c28571f5dcd06cf32f4f539ac5747cdafd33e (diff) | |
download | ppe42-gcc-be6494a83fcd4889680352d98c5b76ce0c1680b3.tar.gz ppe42-gcc-be6494a83fcd4889680352d98c5b76ce0c1680b3.zip |
/cp
2013-05-15 Paolo Carlini <paolo.carlini@oracle.com>
* name-lookup.c (pushdecl_maybe_friend_1): Replace pairs of
warning_at and permerror with warning_at/inform and permerror/
inform, respectively.
/testsuite
2013-05-15 Paolo Carlini <paolo.carlini@oracle.com>
* g++.dg/cpp0x/lambda/lambda-shadow1.C: Replace dg-warnings with
dg-messages.
* g++.dg/warn/Wshadow-1.C: Likewise.
* g++.dg/warn/Wshadow-6.C: Likewise.
* g++.dg/warn/Wshadow-7.C: Likewise.
git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@198943 138bc75d-0d04-0410-961f-82ee72b054a4
Diffstat (limited to 'gcc/cp/name-lookup.c')
-rw-r--r-- | gcc/cp/name-lookup.c | 29 |
1 files changed, 18 insertions, 11 deletions
diff --git a/gcc/cp/name-lookup.c b/gcc/cp/name-lookup.c index a60504fafdf..17d5ca26516 100644 --- a/gcc/cp/name-lookup.c +++ b/gcc/cp/name-lookup.c @@ -943,8 +943,10 @@ pushdecl_maybe_friend_1 (tree x, bool is_friend) && TREE_CODE (decl) == TREE_CODE (x) && !same_type_p (TREE_TYPE (x), TREE_TYPE (decl))) { - permerror (input_location, "type mismatch with previous external decl of %q#D", x); - permerror (input_location, "previous external decl of %q+#D", decl); + if (permerror (input_location, "type mismatch with previous " + "external decl of %q#D", x)) + inform (input_location, "previous external decl of %q+#D", + decl); } } @@ -1161,19 +1163,23 @@ pushdecl_maybe_friend_1 (tree x, bool is_friend) if (warn_shadow && !nowarn) { + bool warned; + if (TREE_CODE (oldlocal) == PARM_DECL) - warning_at (input_location, OPT_Wshadow, + warned = warning_at (input_location, OPT_Wshadow, "declaration of %q#D shadows a parameter", x); else if (is_capture_proxy (oldlocal)) - warning_at (input_location, OPT_Wshadow, + warned = warning_at (input_location, OPT_Wshadow, "declaration of %qD shadows a lambda capture", x); else - warning_at (input_location, OPT_Wshadow, + warned = warning_at (input_location, OPT_Wshadow, "declaration of %qD shadows a previous local", x); - warning_at (DECL_SOURCE_LOCATION (oldlocal), OPT_Wshadow, - "shadowed declaration is here"); + + if (warned) + inform (DECL_SOURCE_LOCATION (oldlocal), + "shadowed declaration is here"); } } @@ -1213,10 +1219,11 @@ pushdecl_maybe_friend_1 (tree x, bool is_friend) || TREE_CODE (x) == TYPE_DECL)))) /* XXX shadow warnings in outer-more namespaces */ { - warning_at (input_location, OPT_Wshadow, - "declaration of %qD shadows a global declaration", x); - warning_at (DECL_SOURCE_LOCATION (oldglobal), OPT_Wshadow, - "shadowed declaration is here"); + if (warning_at (input_location, OPT_Wshadow, + "declaration of %qD shadows a " + "global declaration", x)) + inform (DECL_SOURCE_LOCATION (oldglobal), + "shadowed declaration is here"); } } } |