From: Jakub Jelinek Date: Thu, 10 Nov 2016 17:04:06 +0000 (+0100) Subject: mangle.c (mangle_decl): Only emit -Wc++1z-compat warnings for public or external... X-Git-Tag: upstream/12.2.0~43421 X-Git-Url: http://review.tizen.org/git/?a=commitdiff_plain;h=0569479efa2b65ce9e08e24d452d0619d60afd95;p=platform%2Fupstream%2Fgcc.git mangle.c (mangle_decl): Only emit -Wc++1z-compat warnings for public or external symbols. * 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 --- diff --git a/gcc/cp/ChangeLog b/gcc/cp/ChangeLog index 49561fc..b19a236 100644 --- a/gcc/cp/ChangeLog +++ b/gcc/cp/ChangeLog @@ -1,3 +1,8 @@ +2016-11-10 Jakub Jelinek + + * mangle.c (mangle_decl): Only emit -Wc++1z-compat warnings for + public or external symbols. + 2016-11-09 Jakub Jelinek PR c++/78283 diff --git a/gcc/cp/mangle.c b/gcc/cp/mangle.c index 2dcec3b..be7b72b 100644 --- a/gcc/cp/mangle.c +++ b/gcc/cp/mangle.c @@ -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", diff --git a/gcc/testsuite/ChangeLog b/gcc/testsuite/ChangeLog index 5028157..7c13172 100644 --- a/gcc/testsuite/ChangeLog +++ b/gcc/testsuite/ChangeLog @@ -1,3 +1,8 @@ +2016-11-10 Jakub Jelinek + + * 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 * gcc.dg/torture/fp-int-convert.h (M_OK2): New, use it in diff --git a/gcc/testsuite/g++.dg/asan/asan_test.C b/gcc/testsuite/g++.dg/asan/asan_test.C index ba6f6a3..5c24260 100644 --- a/gcc/testsuite/g++.dg/asan/asan_test.C +++ b/gcc/testsuite/g++.dg/asan/asan_test.C @@ -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 index 0000000..a6aeb1c --- /dev/null +++ b/gcc/testsuite/g++.dg/cpp1z/noexcept-type14.C @@ -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); +}