name-lookup.c (pushdecl_maybe_friend_1): Replace pairs of warning_at and permerror...
authorPaolo Carlini <paolo.carlini@oracle.com>
Wed, 15 May 2013 18:24:31 +0000 (18:24 +0000)
committerPaolo Carlini <paolo@gcc.gnu.org>
Wed, 15 May 2013 18:24:31 +0000 (18:24 +0000)
/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

gcc/cp/ChangeLog
gcc/cp/name-lookup.c
gcc/testsuite/ChangeLog
gcc/testsuite/g++.dg/cpp0x/lambda/lambda-shadow1.C
gcc/testsuite/g++.dg/warn/Wshadow-1.C
gcc/testsuite/g++.dg/warn/Wshadow-6.C
gcc/testsuite/g++.dg/warn/Wshadow-7.C

index cf91769b72f6a9cd9165b215847f8ba5f42060fb..a602af3addbcb9417f46b251763f6b6f914e1fc4 100644 (file)
@@ -1,3 +1,9 @@
+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
index a60504fafdfef610b559d35fd82b430ce316edd4..17d5ca2651650f4c6db00e3257fb90fff88b2dee 100644 (file)
@@ -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");
                }
            }
        }
index 55315f49faa627d324bd5a8244bb528260928a38..be7ccece6a40aa4be433a74970abb66d5df5ad21 100644 (file)
@@ -1,3 +1,11 @@
+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
index bb06bfe4afaef584b1bde44b21aee61128d0edf2..f4433faec92804d48277d9c2aa725302b0d37ec7 100644 (file)
@@ -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;
   };
index 1647a010d12289ba4bbeadc8bc87dfe3918a8c3c..aec6bca54184fd6be1285d5c4f22e7b4d2264829 100644 (file)
@@ -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" }
   }
index fdc37df31b4966242e351daa101f68bb249f13aa..78275743115649f22a8492bc7b13f5cd2f936020 100644 (file)
@@ -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;
  };
index 5de952ee79033494e22364399e8653fee3f8ff94..d354d0499f4002ef9ddf949c4e947dd12d81789b 100644 (file)
@@ -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" }