]> git.ipfire.org Git - thirdparty/gcc.git/commitdiff
re PR c++/60373 (half warning: visibility attribute ignored because it)
authorPaolo Carlini <paolo.carlini@oracle.com>
Tue, 20 May 2014 15:16:48 +0000 (15:16 +0000)
committerPaolo Carlini <paolo@gcc.gnu.org>
Tue, 20 May 2014 15:16:48 +0000 (15:16 +0000)
/cp
2014-05-20  Paolo Carlini  <paolo.carlini@oracle.com>

PR c++/60373
* decl.c (duplicate_decls): Replace pair of warning_at with
warning_at + inform.
(maybe_commonize_var): Likewise.

/testsuite
2014-05-20  Paolo Carlini  <paolo.carlini@oracle.com>

PR c++/60373
* g++.dg/cpp0x/Wattributes1.C: New.
* g++.dg/ext/visibility/redecl1.C: Adjust.
* g++.dg/ext/visibility/visibility-7.C: Likewise.

From-SVN: r210646

gcc/cp/ChangeLog
gcc/cp/decl.c
gcc/testsuite/ChangeLog
gcc/testsuite/g++.dg/cpp0x/Wattributes1.C [new file with mode: 0644]
gcc/testsuite/g++.dg/ext/visibility/redecl1.C
gcc/testsuite/g++.dg/ext/visibility/visibility-7.C

index 6886b965b27005deb4ea2577d1885d256a2825c5..b6d945ff53d126adb66507138fd8ab9377e5ae9a 100644 (file)
@@ -1,3 +1,10 @@
+2014-05-20  Paolo Carlini  <paolo.carlini@oracle.com>
+
+       PR c++/60373
+       * decl.c (duplicate_decls): Replace pair of warning_at with
+       warning_at + inform.
+       (maybe_commonize_var): Likewise.
+
 2014-05-20  Richard Sandiford  <rsandifo@linux.vnet.ibm.com>
 
        PR bootstrap/61210
index 81f127315ec8de687956f4066fbb9a31aa152b39..ab91928cf4294cb52ba5f7ba34b52a84d7d024a6 100644 (file)
@@ -2306,10 +2306,11 @@ duplicate_decls (tree newdecl, tree olddecl, bool newdecl_is_friend)
       && DECL_VISIBILITY_SPECIFIED (newdecl)
       && DECL_VISIBILITY (newdecl) != DECL_VISIBILITY (olddecl))
     {
-      warning_at (input_location, OPT_Wattributes,
-                 "%q+D: visibility attribute ignored because it", newdecl);
-      warning_at (DECL_SOURCE_LOCATION (olddecl), OPT_Wattributes,
-                 "conflicts with previous declaration here");
+      if (warning_at (DECL_SOURCE_LOCATION (newdecl), OPT_Wattributes,
+                     "%qD: visibility attribute ignored because it "
+                     "conflicts with previous declaration", newdecl))
+       inform (DECL_SOURCE_LOCATION (olddecl),
+               "previous declaration of %qD", olddecl);
     }
   /* Choose the declaration which specified visibility.  */
   if (DECL_VISIBILITY_SPECIFIED (olddecl))
@@ -5026,13 +5027,12 @@ maybe_commonize_var (tree decl)
                 be merged.  */
              TREE_PUBLIC (decl) = 0;
              DECL_COMMON (decl) = 0;
-             warning_at (input_location, 0,
-                         "sorry: semantics of inline function static "
-                         "data %q+#D are wrong (you%'ll wind up "
-                         "with multiple copies)", decl);
-             warning_at (DECL_SOURCE_LOCATION (decl), 0, 
-                         "  you can work around this by removing "
-                         "the initializer");
+             if (warning_at (DECL_SOURCE_LOCATION (decl), 0,
+                             "sorry: semantics of inline function static "
+                             "data %q#D are wrong (you%'ll wind up "
+                             "with multiple copies)", decl))
+               inform (DECL_SOURCE_LOCATION (decl),
+                       "you can work around this by removing the initializer");
            }
        }
     }
index 1440e049912c905033ba63d7b5abb0b314a5547f..be9a7def5c4c1141d20e28e5c95370c081623e0a 100644 (file)
@@ -1,3 +1,10 @@
+2014-05-20  Paolo Carlini  <paolo.carlini@oracle.com>
+
+       PR c++/60373
+       * g++.dg/cpp0x/Wattributes1.C: New.
+       * g++.dg/ext/visibility/redecl1.C: Adjust.
+       * g++.dg/ext/visibility/visibility-7.C: Likewise.
+
 2014-05-20  Bill Schmidt  <wschmidt@linux.vnet.ibm.com>
 
        * gcc.target/powerpc/vsxcopy.c: New test.
diff --git a/gcc/testsuite/g++.dg/cpp0x/Wattributes1.C b/gcc/testsuite/g++.dg/cpp0x/Wattributes1.C
new file mode 100644 (file)
index 0000000..4d3c29c
--- /dev/null
@@ -0,0 +1,8 @@
+// PR c++/60373
+// { dg-do compile { target c++11 } }
+// { dg-require-visibility "" }
+
+#include <new>
+__attribute__((visibility("hidden")))void*operator new(std::size_t); // { dg-warning "visibility attribute ignored" }
+
+// { dg-message "previous declaration" "" { target *-*-* } 128 }
index b53335ef583aca5196ed85a10094bc2504b827ff..a85e6c38e952f997ff20a96991e816d5cb2ded1a 100644 (file)
@@ -3,5 +3,5 @@
 struct __attribute((visibility("hidden"))) B;
 struct __attribute((visibility("default"))) B; // { dg-error "visibility" }
 
-__attribute ((visibility ("hidden"))) void f();        // { dg-warning "previous" }
+__attribute ((visibility ("hidden"))) void f();        // { dg-message "previous" }
 __attribute ((visibility ("default"))) void f(); // { dg-warning "visibility" }
index ae4589397b6121fa392ba9cebe530af23542dfcd..0a6e4ba637b8c36b92e13f8384e60ee364838a6a 100644 (file)
@@ -4,7 +4,7 @@
 
 extern int 
 __attribute__((visibility ("hidden")))
-xyzzy; /* { dg-warning "previous declaration here" "" } */
+xyzzy; /* { dg-message "previous declaration" "" } */
 
 int 
 __attribute__((visibility ("protected")))