]> git.ipfire.org Git - thirdparty/gcc.git/commitdiff
mangle.c (mangle_decl): Only emit -Wc++1z-compat warnings for public or external...
authorJakub Jelinek <jakub@redhat.com>
Thu, 10 Nov 2016 17:04:06 +0000 (18:04 +0100)
committerJakub Jelinek <jakub@gcc.gnu.org>
Thu, 10 Nov 2016 17:04:06 +0000 (18:04 +0100)
* mangle.c (mangle_decl): Only emit -Wc++1z-compat warnings for
public or external symbols.

* g++.dg/cpp1z/noexcept-type14.C: New test.
* g++.dg/asan/asan_test.C: Remove -Wno-c++1z-compat from dg-options.

From-SVN: r242042

gcc/cp/ChangeLog
gcc/cp/mangle.c
gcc/testsuite/ChangeLog
gcc/testsuite/g++.dg/asan/asan_test.C
gcc/testsuite/g++.dg/cpp1z/noexcept-type14.C [new file with mode: 0644]

index 49561fc68329ced0587c50b0eab8c218d962f2e9..b19a236f21597804eaf53eba112085257eb687af 100644 (file)
@@ -1,3 +1,8 @@
+2016-11-10  Jakub Jelinek  <jakub@redhat.com>
+
+       * mangle.c (mangle_decl): Only emit -Wc++1z-compat warnings for
+       public or external symbols.
+
 2016-11-09  Jakub Jelinek  <jakub@redhat.com>
 
        PR c++/78283
index 2dcec3b1968f5df36e6d696c5681fa5c50f044cc..be7b72b532e67482d2fd20220c09b70b28a39d3c 100644 (file)
@@ -3836,7 +3836,8 @@ mangle_decl (const tree decl)
     }
   SET_DECL_ASSEMBLER_NAME (decl, id);
 
-  if (G.need_cxx1z_warning)
+  if (G.need_cxx1z_warning
+      && (TREE_PUBLIC (decl) || DECL_REALLY_EXTERN (decl)))
     warning_at (DECL_SOURCE_LOCATION (decl), OPT_Wc__1z_compat,
                "mangled name for %qD will change in C++17 because the "
                "exception specification is part of a function type",
index 50281572ec562f9b191407ac5237145a3fcfd285..7c131725f5ac24131b9c95f1c868ad4d238ecd5c 100644 (file)
@@ -1,3 +1,8 @@
+2016-11-10  Jakub Jelinek  <jakub@redhat.com>
+
+       * g++.dg/cpp1z/noexcept-type14.C: New test.
+       * g++.dg/asan/asan_test.C: Remove -Wno-c++1z-compat from dg-options.
+
 2016-11-10  James Greenhalgh  <james.greenhalgh@arm.com>
 
        * gcc.dg/torture/fp-int-convert.h (M_OK2): New, use it in
index ba6f6a34e0b79a21d5d96543ea58dcd69f4f2078..5c24260b7fd60afd3015e985920a4272a6706a10 100644 (file)
@@ -2,7 +2,7 @@
 // { dg-skip-if "" { *-*-* } { "*" } { "-O2" } }
 // { dg-skip-if "" { *-*-* } { "-flto" } { "" } }
 // { dg-additional-sources "asan_globals_test-wrapper.cc" }
-// { dg-options "-std=c++11 -fsanitize=address -fno-builtin -Wall -Wno-c++1z-compat -Werror -g -DASAN_UAR=0 -DASAN_HAS_EXCEPTIONS=1 -DASAN_HAS_BLACKLIST=0 -DSANITIZER_USE_DEJAGNU_GTEST=1 -lasan -lpthread -ldl" }
+// { dg-options "-std=c++11 -fsanitize=address -fno-builtin -Wall -Werror -g -DASAN_UAR=0 -DASAN_HAS_EXCEPTIONS=1 -DASAN_HAS_BLACKLIST=0 -DSANITIZER_USE_DEJAGNU_GTEST=1 -lasan -lpthread -ldl" }
 // { dg-additional-options "-DASAN_NEEDS_SEGV=1" { target { ! arm*-*-* } } }
 // { dg-additional-options "-DASAN_LOW_MEMORY=1 -DASAN_NEEDS_SEGV=0" { target arm*-*-* } }
 // { dg-additional-options "-DASAN_AVOID_EXPENSIVE_TESTS=1" { target { ! run_expensive_tests } } }
diff --git a/gcc/testsuite/g++.dg/cpp1z/noexcept-type14.C b/gcc/testsuite/g++.dg/cpp1z/noexcept-type14.C
new file mode 100644 (file)
index 0000000..a6aeb1c
--- /dev/null
@@ -0,0 +1,26 @@
+// { dg-do compile { target c++11 } }
+// { dg-options "-Wall" }
+
+#define A asm volatile ("" : : : "memory")
+void foo () throw () {}
+extern void f1 (decltype (foo) *);     // { dg-bogus "mangled name" }
+void f2 (decltype (foo) *);            // { dg-bogus "mangled name" }
+extern void f3 (decltype (foo) *);     // { dg-warning "mangled name" "" { target c++14_down } }
+void f4 (decltype (foo) *);            // { dg-warning "mangled name" "" { target c++14_down } }
+void f5 (decltype (foo) *) { A; }      // { dg-warning "mangled name" "" { target c++14_down } }
+static void f6 (decltype (foo) *) { A; }// { dg-bogus "mangled name" }
+namespace N {
+void f7 (decltype (foo) *) { A; }      // { dg-warning "mangled name" "" { target c++14_down } }
+}
+namespace {
+void f8 (decltype (foo) *) { A; }      // { dg-bogus "mangled name" }
+}
+void bar ()
+{
+  f3 (foo);
+  f4 (foo);
+  f5 (foo);
+  f6 (foo);
+  N::f7 (foo);
+  f8 (foo);
+}