aboutsummaryrefslogtreecommitdiff
path: root/gcc
diff options
context:
space:
mode:
authorPaolo Carlini <paolo.carlini@oracle.com>2013-05-15 18:24:31 +0000
committerPaolo Carlini <paolo@gcc.gnu.org>2013-05-15 18:24:31 +0000
commit1e6cf26ea81901fb00daef06d74966bcacbd99eb (patch)
tree78e0db04f507a690e13498e747a92dc48ea8231b /gcc
parente7208ea3ec9f656a45ed7eb5eeb18fdbf6c51242 (diff)
downloadgcc-1e6cf26ea81901fb00daef06d74966bcacbd99eb.zip
gcc-1e6cf26ea81901fb00daef06d74966bcacbd99eb.tar.gz
gcc-1e6cf26ea81901fb00daef06d74966bcacbd99eb.tar.bz2
name-lookup.c (pushdecl_maybe_friend_1): Replace pairs of warning_at and permerror with warning_at/inform and permerror/...
/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. From-SVN: r198943
Diffstat (limited to 'gcc')
-rw-r--r--gcc/cp/ChangeLog6
-rw-r--r--gcc/cp/name-lookup.c29
-rw-r--r--gcc/testsuite/ChangeLog8
-rw-r--r--gcc/testsuite/g++.dg/cpp0x/lambda/lambda-shadow1.C2
-rw-r--r--gcc/testsuite/g++.dg/warn/Wshadow-1.C6
-rw-r--r--gcc/testsuite/g++.dg/warn/Wshadow-6.C12
-rw-r--r--gcc/testsuite/g++.dg/warn/Wshadow-7.C10
7 files changed, 47 insertions, 26 deletions
diff --git a/gcc/cp/ChangeLog b/gcc/cp/ChangeLog
index cf91769..a602af3 100644
--- a/gcc/cp/ChangeLog
+++ b/gcc/cp/ChangeLog
@@ -1,5 +1,11 @@
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.
+
+2013-05-15 Paolo Carlini <paolo.carlini@oracle.com>
+
PR c++/31952
* name-lookup.c (pushdecl_maybe_friend_1): Diagnose illegal
redeclarations.
diff --git a/gcc/cp/name-lookup.c b/gcc/cp/name-lookup.c
index a60504f..17d5ca2 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");
}
}
}
diff --git a/gcc/testsuite/ChangeLog b/gcc/testsuite/ChangeLog
index 55315f4..be7ccec 100644
--- a/gcc/testsuite/ChangeLog
+++ b/gcc/testsuite/ChangeLog
@@ -1,5 +1,13 @@
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.
+
+2013-05-15 Paolo Carlini <paolo.carlini@oracle.com>
+
PR c++/31952
* g++.dg/parse/pr31952-1.C: New.
* g++.dg/parse/pr31952-2.C: Likewise.
diff --git a/gcc/testsuite/g++.dg/cpp0x/lambda/lambda-shadow1.C b/gcc/testsuite/g++.dg/cpp0x/lambda/lambda-shadow1.C
index bb06bfe..f4433fa 100644
--- a/gcc/testsuite/g++.dg/cpp0x/lambda/lambda-shadow1.C
+++ b/gcc/testsuite/g++.dg/cpp0x/lambda/lambda-shadow1.C
@@ -2,7 +2,7 @@
// { dg-options "-std=c++11 -Wshadow" }
int main() {
- int x = 1; // { dg-warning "shadowed" }
+ int x = 1; // { dg-message "shadowed" }
auto const lambda = [](int x) { // { dg-warning "shadows" }
return x;
};
diff --git a/gcc/testsuite/g++.dg/warn/Wshadow-1.C b/gcc/testsuite/g++.dg/warn/Wshadow-1.C
index 1647a01..aec6bca 100644
--- a/gcc/testsuite/g++.dg/warn/Wshadow-1.C
+++ b/gcc/testsuite/g++.dg/warn/Wshadow-1.C
@@ -18,8 +18,8 @@ struct status // { dg-bogus "shadowed declaration" }
}
};
-int decl1; // { dg-warning "shadowed declaration" }
-int decl2; // { dg-warning "shadowed declaration" }
+int decl1; // { dg-message "shadowed declaration" }
+int decl2; // { dg-message "shadowed declaration" }
void foo (struct status &status,// { dg-bogus "shadows a global decl" }
double decl1) // { dg-warning "shadows a global decl" }
{
@@ -34,7 +34,7 @@ void status::foo2 ()
{
int member; // { dg-warning "shadows a member" }
int decl2; // { dg-warning "shadows a global decl" }
- int local; // { dg-warning "shadowed declaration" }
+ int local; // { dg-message "shadowed declaration" }
{
int local; // { dg-warning "shadows a previous local" }
}
diff --git a/gcc/testsuite/g++.dg/warn/Wshadow-6.C b/gcc/testsuite/g++.dg/warn/Wshadow-6.C
index fdc37df..7827574 100644
--- a/gcc/testsuite/g++.dg/warn/Wshadow-6.C
+++ b/gcc/testsuite/g++.dg/warn/Wshadow-6.C
@@ -4,10 +4,10 @@
// { dg-options "-std=c++0x -Wshadow" }
struct S {};
-int f1(int x) // { dg-warning "shadowed declaration" }
+int f1(int x) // { dg-message "shadowed declaration" }
{
int t = 0;
- int m = 0; // { dg-warning "shadowed declaration" }
+ int m = 0; // { dg-message "shadowed declaration" }
[&t] (int x) { // { dg-warning "shadows a parameter" }
int m = 1; // { dg-warning "shadows a previous local" }
t = t + x + m;
@@ -18,9 +18,9 @@ int f1(int x) // { dg-warning "shadowed declaration" }
void f2(struct S i, int j) {
struct A {
struct S x;
- void g(struct S i) { // { dg-warning "shadowed declaration" }
+ void g(struct S i) { // { dg-message "shadowed declaration" }
struct S x; // { dg-warning "shadows a member of" }
- struct S y; // { dg-warning "shadowed declaration" }
+ struct S y; // { dg-message "shadowed declaration" }
int t;
[&t](struct S i){ // { dg-warning "shadows a parameter" }
int j = 1; // { dg-bogus "shadows" }
@@ -33,7 +33,7 @@ void f2(struct S i, int j) {
void f3(int i) {
[=]{
- int j = i; // { dg-warning "shadowed declaration" }
+ int j = i; // { dg-message "shadowed declaration" }
int i; // { dg-warning "shadows a lambda capture" }
i = 1;
};
@@ -42,7 +42,7 @@ void f3(int i) {
template <class T>
void f4(int i) {
[=]{
- int j = i; // { dg-warning "shadowed declaration" }
+ int j = i; // { dg-message "shadowed declaration" }
int i; // { dg-warning "shadows a lambda capture" }
i = 1;
};
diff --git a/gcc/testsuite/g++.dg/warn/Wshadow-7.C b/gcc/testsuite/g++.dg/warn/Wshadow-7.C
index 5de952e..d354d04 100644
--- a/gcc/testsuite/g++.dg/warn/Wshadow-7.C
+++ b/gcc/testsuite/g++.dg/warn/Wshadow-7.C
@@ -1,18 +1,18 @@
// PR c++/44128
// { dg-options "-Wshadow" }
-typedef long My_ssize_t; // { dg-warning "shadowed declaration" }
-typedef int Foo; // { dg-warning "shadowed declaration" }
+typedef long My_ssize_t; // { dg-message "shadowed declaration" }
+typedef int Foo; // { dg-message "shadowed declaration" }
struct Bar1 { // { dg-bogus "shadowed declaration" }
int a;
};
-struct Bar2 { // { dg-warning "shadowed declaration" }
+struct Bar2 { // { dg-message "shadowed declaration" }
int a;
};
void func() {
typedef int My_ssize_t; // { dg-warning "shadows a global" }
- typedef char My_Num; // { dg-warning "shadowed declaration" }
+ typedef char My_Num; // { dg-message "shadowed declaration" }
{
typedef short My_Num; // { dg-warning "shadows a previous local" }
}
@@ -21,7 +21,7 @@ void func() {
struct Bar2 { // { dg-warning "shadows a global" }
int a;
};
- struct Bar3 { // { dg-warning "shadowed declaration" }
+ struct Bar3 { // { dg-message "shadowed declaration" }
int a;
};
struct Bar4 { // { dg-bogus "shadowed declaration" }