aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJason Merrill <jason@redhat.com>2017-03-04 19:21:38 +0000
committerJason Merrill <jason@redhat.com>2017-03-04 19:21:38 +0000
commitb7feb4a6e5c8f1d42c569a0d01f5b737af4f1ccf (patch)
tree1833d80a5c83857aa6da98b3a7d65dd30babf109
parent36dc22c77051754fce3d3390b519883013295f0a (diff)
* c.opt (Wnoexcept-type): New.
gcc/cp/ * mangle.c (mangle_decl): Check -Wnoexcept-type instead of -Wc++1z-compat. git-svn-id: https://gcc.gnu.org/svn/gcc/trunk@245894 138bc75d-0d04-0410-961f-82ee72b054a4
-rw-r--r--gcc/c-family/ChangeLog4
-rw-r--r--gcc/c-family/c.opt4
-rw-r--r--gcc/cp/ChangeLog3
-rw-r--r--gcc/cp/mangle.c2
-rw-r--r--gcc/doc/invoke.texi16
-rw-r--r--gcc/testsuite/g++.dg/cpp1z/noexcept-type11a.C3
6 files changed, 30 insertions, 2 deletions
diff --git a/gcc/c-family/ChangeLog b/gcc/c-family/ChangeLog
index d80844558f3..451cf387eca 100644
--- a/gcc/c-family/ChangeLog
+++ b/gcc/c-family/ChangeLog
@@ -1,3 +1,7 @@
+2017-03-03 Jason Merrill <jason@redhat.com>
+
+ * c.opt (Wnoexcept-type): New.
+
2017-03-02 Richard Biener <rguenther@suse.de>
PR c/79756
diff --git a/gcc/c-family/c.opt b/gcc/c-family/c.opt
index cf459ab4427..78fea61ef2a 100644
--- a/gcc/c-family/c.opt
+++ b/gcc/c-family/c.opt
@@ -780,6 +780,10 @@ Wnoexcept
C++ ObjC++ Var(warn_noexcept) Warning
Warn when a noexcept expression evaluates to false even though the expression can't actually throw.
+Wnoexcept-type
+C++ ObjC++ Warning Var(warn_noexcept_type) LangEnabledBy(C++ ObjC++,Wabi || Wc++1z-compat)
+Warn if C++1z noexcept function type will change the mangled name of a symbol.
+
Wnon-template-friend
C++ ObjC++ Var(warn_nontemplate_friend) Init(1) Warning
Warn when non-templatized friend functions are declared within a template.
diff --git a/gcc/cp/ChangeLog b/gcc/cp/ChangeLog
index b99a7746fb0..b5587fdfab3 100644
--- a/gcc/cp/ChangeLog
+++ b/gcc/cp/ChangeLog
@@ -1,5 +1,8 @@
2017-03-03 Jason Merrill <jason@redhat.com>
+ * mangle.c (mangle_decl): Check -Wnoexcept-type instead of
+ -Wc++1z-compat.
+
Core issues 2273 and 2277
* call.c (joust): Adjust using-declaration tiebreaker to handle
the intermediate base case.
diff --git a/gcc/cp/mangle.c b/gcc/cp/mangle.c
index 8b30f42b2f9..6f7e21c28a8 100644
--- a/gcc/cp/mangle.c
+++ b/gcc/cp/mangle.c
@@ -3856,7 +3856,7 @@ mangle_decl (const tree decl)
if (G.need_cxx1z_warning
&& (TREE_PUBLIC (decl) || DECL_REALLY_EXTERN (decl)))
- warning_at (DECL_SOURCE_LOCATION (decl), OPT_Wc__1z_compat,
+ warning_at (DECL_SOURCE_LOCATION (decl), OPT_Wnoexcept_type,
"mangled name for %qD will change in C++17 because the "
"exception specification is part of a function type",
decl);
diff --git a/gcc/doc/invoke.texi b/gcc/doc/invoke.texi
index 68174a14b76..15eb0e0289a 100644
--- a/gcc/doc/invoke.texi
+++ b/gcc/doc/invoke.texi
@@ -215,7 +215,7 @@ in the following sections.
-Wabi=@var{n} -Wabi-tag -Wconversion-null -Wctor-dtor-privacy @gol
-Wdelete-non-virtual-dtor -Wliteral-suffix -Wmultiple-inheritance @gol
-Wnamespaces -Wnarrowing @gol
--Wnoexcept -Wnon-virtual-dtor -Wreorder -Wregister @gol
+-Wnoexcept -Wnoexcept-type -Wnon-virtual-dtor -Wreorder -Wregister @gol
-Weffc++ -Wstrict-null-sentinel -Wtemplates @gol
-Wno-non-template-friend -Wold-style-cast @gol
-Woverloaded-virtual -Wno-pmf-conversions @gol
@@ -2897,6 +2897,20 @@ to a function that does not have a non-throwing exception
specification (i.e. @code{throw()} or @code{noexcept}) but is known by
the compiler to never throw an exception.
+@item -Wnoexcept @r{(C++ and Objective-C++ only)}
+@opindex Wnoexcept-type
+@opindex Wno-noexcept-type
+Warn if the C++1z feature making @code{noexcept} part of a function
+type changes the mangled name of a symbol relative to C++14. Enabled
+by @option{-Wabi} and @option{-Wc++1z-compat}.
+
+@smallexample
+template <class T> void f(T t) @{ t(); @};
+void g() noexcept;
+void h() @{ f(g); @} // in C++14 calls f<void(*)()>, in C++1z calls f<void(*)()noexcept>
+@end smallexample
+
+
@item -Wnon-virtual-dtor @r{(C++ and Objective-C++ only)}
@opindex Wnon-virtual-dtor
@opindex Wno-non-virtual-dtor
diff --git a/gcc/testsuite/g++.dg/cpp1z/noexcept-type11a.C b/gcc/testsuite/g++.dg/cpp1z/noexcept-type11a.C
new file mode 100644
index 00000000000..f5028d2f9a7
--- /dev/null
+++ b/gcc/testsuite/g++.dg/cpp1z/noexcept-type11a.C
@@ -0,0 +1,3 @@
+// { dg-options "-Wall -Wno-noexcept-type -std=c++14" }
+
+void f(int(*)() noexcept) { }