From 1d09844a1cff1a78d24eba41a1443903da0bacfd Mon Sep 17 00:00:00 2001 From: Jakub Jelinek Date: Thu, 8 Dec 2016 09:26:06 +0100 Subject: [PATCH] P0003R5 - removal of dynamic exception specification from C++17 P0003R5 - removal of dynamic exception specification from C++17 * parser.c (cp_parser_exception_specification_opt): For C++17 error out on throw ( type-id-list ), for C++11 and C++14 issue -Wdeprecated warning on it. Formatting fix. Treat throw() in C++17 as noexcept(true). * g++.dg/compat/eh/ctor1.h: Adjust for deprecation of throw (type-id-list) in C++11 and C++14 and removal in C++17. * g++.dg/compat/eh/ctor1_y.C: Likewise. * g++.dg/compat/eh/new1_x.C: Likewise. * g++.dg/compat/eh/new1_y.C: Likewise. * g++.dg/compat/eh/spec3_x.C: Likewise. * g++.dg/compat/eh/spec3_y.C: Likewise. * g++.dg/compat/eh/template1.h: Likewise. * g++.dg/compat/eh/template1_y.C: Likewise. * g++.dg/compat/eh/unexpected1_x.C: Likewise. * g++.dg/compat/eh/unexpected1_y.C: Likewise. * g++.dg/cpp0x/auto9.C: Likewise. * g++.dg/cpp0x/defaulted23.C: Likewise. * g++.dg/cpp0x/error5.C: Likewise. * g++.dg/cpp0x/lambda/lambda-eh2.C: Likewise. * g++.dg/cpp0x/noexcept02.C: Likewise. * g++.dg/cpp0x/noexcept07.C: Likewise. * g++.dg/cpp0x/noexcept08.C: Likewise. * g++.dg/cpp0x/noexcept19.C: Likewise. * g++.dg/cpp0x/variadic73.C: Likewise. * g++.dg/cpp0x/variadic-throw.C: Likewise. * g++.dg/cpp1z/noexcept-type1.C: Likewise. * g++.dg/eh/async-unwind2.C: Likewise. * g++.dg/eh/cond4.C: Likewise. * g++.dg/eh/delete1.C: Likewise. * g++.dg/eh/ehopt1.C: Likewise. * g++.dg/eh/forced3.C: Likewise. * g++.dg/eh/forced4.C: Likewise. * g++.dg/eh/init-temp2.C: Likewise. * g++.dg/eh/pr38662.C: Likewise. * g++.dg/eh/pr41819.C: Likewise. * g++.dg/eh/shadow1.C: Likewise. * g++.dg/eh/spec2.C: Likewise. * g++.dg/eh/spec3.C: Likewise. * g++.dg/eh/spec5.C: Likewise. * g++.dg/eh/spec6.C: Likewise. * g++.dg/eh/spec7.C: Likewise. * g++.dg/eh/spec8.C: Likewise. * g++.dg/eh/spec9.C: Likewise. * g++.dg/eh/template1.C: Likewise. * g++.dg/eh/unexpected1.C: Likewise. * g++.dg/ext/has_nothrow_assign.C: Likewise. * g++.dg/ext/has_nothrow_constructor.C: Likewise. * g++.dg/ext/has_nothrow_copy-1.C: Likewise. * g++.dg/ext/has_nothrow_copy-2.C: Likewise. * g++.dg/ext/has_nothrow_copy-4.C: Likewise. * g++.dg/ext/has_nothrow_copy-5.C: Likewise. * g++.dg/ext/has_nothrow_copy-6.C: Likewise. * g++.dg/ext/has_nothrow_copy-7.C: Likewise. * g++.dg/gcov/gcov-7.C: Likewise. * g++.dg/init/new13.C: Likewise. * g++.dg/init/new25.C: Likewise. * g++.dg/lookup/exception1.C: Likewise. * g++.dg/opt/noreturn-1.C: Likewise. * g++.dg/other/error3.C: Likewise. * g++.dg/rtti/crash3.C: Likewise. * g++.dg/template/eh2.C: Likewise. * g++.dg/template/error36.C: Likewise. * g++.dg/tm/pr46567.C: Likewise. * g++.dg/tm/pr47340.C: Likewise. * g++.dg/torture/pr46364.C: Likewise. * g++.dg/torture/pr49394.C: Likewise. * g++.dg/torture/pr52918-1.C: Likewise. * g++.dg/torture/pr57190.C: Likewise. * g++.dg/torture/stackalign/eh-alloca-1.C: Likewise. * g++.dg/torture/stackalign/eh-fastcall-1.C: Likewise. * g++.dg/torture/stackalign/eh-global-1.C: Likewise. * g++.dg/torture/stackalign/eh-inline-1.C: Likewise. * g++.dg/torture/stackalign/eh-inline-2.C: Likewise. * g++.dg/torture/stackalign/eh-thiscall-1.C: Likewise. * g++.dg/torture/stackalign/eh-vararg-1.C: Likewise. * g++.dg/torture/stackalign/eh-vararg-2.C: Likewise. * g++.dg/tree-ssa/pr45605.C: Likewise. * g++.dg/warn/Wreturn-type-3.C: Likewise. * g++.old-deja/g++.eh/badalloc1.C: Likewise. * g++.old-deja/g++.eh/cleanup2.C: Likewise. * g++.old-deja/g++.eh/spec1.C: Likewise. * g++.old-deja/g++.eh/spec2.C: Likewise. * g++.old-deja/g++.eh/spec3.C: Likewise. * g++.old-deja/g++.eh/spec4.C: Likewise. * g++.old-deja/g++.eh/spec6.C: Likewise. * g++.old-deja/g++.eh/throw1.C: Likewise. * g++.old-deja/g++.eh/throw2.C: Likewise. * g++.old-deja/g++.eh/tmpl1.C: Likewise. * g++.old-deja/g++.eh/tmpl3.C: Likewise. * g++.old-deja/g++.mike/eh15.C: Likewise. * g++.old-deja/g++.mike/eh25.C: Likewise. * g++.old-deja/g++.mike/eh33.C: Likewise. * g++.old-deja/g++.mike/eh34.C: Likewise. * g++.old-deja/g++.mike/eh50.C: Likewise. * g++.old-deja/g++.mike/eh51.C: Likewise. * g++.old-deja/g++.mike/eh55.C: Likewise. * g++.old-deja/g++.mike/p10416.C: Likewise. * g++.old-deja/g++.other/crash28.C: Likewise. * g++.old-deja/g++.other/crash30.C: Likewise. * g++.old-deja/g++.other/new7.C: Likewise. * g++.old-deja/g++.pt/ehspec1.C: Likewise. * g++.old-deja/g++.robertl/eb123.C: Likewise. * testsuite/util/testsuite_new_operators.h: Include testsuite_hooks.h. (operator new): Use THROW macro. From-SVN: r243429 --- gcc/cp/ChangeLog | 8 + gcc/cp/parser.c | 27 +++- gcc/testsuite/ChangeLog | 141 +++++++++++++++--- gcc/testsuite/g++.dg/compat/eh/ctor1.h | 8 +- gcc/testsuite/g++.dg/compat/eh/ctor1_y.C | 7 +- gcc/testsuite/g++.dg/compat/eh/new1_x.C | 6 +- gcc/testsuite/g++.dg/compat/eh/new1_y.C | 5 +- gcc/testsuite/g++.dg/compat/eh/spec3_x.C | 6 +- gcc/testsuite/g++.dg/compat/eh/spec3_y.C | 5 +- gcc/testsuite/g++.dg/compat/eh/template1.h | 6 +- gcc/testsuite/g++.dg/compat/eh/template1_y.C | 5 +- .../g++.dg/compat/eh/unexpected1_x.C | 2 + .../g++.dg/compat/eh/unexpected1_y.C | 2 + gcc/testsuite/g++.dg/cpp0x/auto9.C | 8 +- gcc/testsuite/g++.dg/cpp0x/defaulted23.C | 16 +- gcc/testsuite/g++.dg/cpp0x/error5.C | 6 +- .../g++.dg/cpp0x/lambda/lambda-eh2.C | 4 +- gcc/testsuite/g++.dg/cpp0x/noexcept02.C | 6 +- gcc/testsuite/g++.dg/cpp0x/noexcept07.C | 4 +- gcc/testsuite/g++.dg/cpp0x/noexcept08.C | 21 ++- gcc/testsuite/g++.dg/cpp0x/noexcept19.C | 6 +- gcc/testsuite/g++.dg/cpp0x/variadic-throw.C | 8 +- gcc/testsuite/g++.dg/cpp0x/variadic73.C | 6 +- gcc/testsuite/g++.dg/cpp1z/noexcept-type1.C | 2 +- gcc/testsuite/g++.dg/eh/async-unwind2.C | 22 ++- gcc/testsuite/g++.dg/eh/cond4.C | 8 +- gcc/testsuite/g++.dg/eh/delete1.C | 16 +- gcc/testsuite/g++.dg/eh/ehopt1.C | 16 +- gcc/testsuite/g++.dg/eh/forced3.C | 1 + gcc/testsuite/g++.dg/eh/forced4.C | 5 +- gcc/testsuite/g++.dg/eh/init-temp2.C | 24 ++- gcc/testsuite/g++.dg/eh/pr38662.C | 6 +- gcc/testsuite/g++.dg/eh/pr41819.C | 5 +- gcc/testsuite/g++.dg/eh/shadow1.C | 12 +- gcc/testsuite/g++.dg/eh/spec2.C | 13 +- gcc/testsuite/g++.dg/eh/spec3.C | 5 +- gcc/testsuite/g++.dg/eh/spec5.C | 12 +- gcc/testsuite/g++.dg/eh/spec6.C | 1 + gcc/testsuite/g++.dg/eh/spec7.C | 6 +- gcc/testsuite/g++.dg/eh/spec8.C | 2 + gcc/testsuite/g++.dg/eh/spec9.C | 5 +- gcc/testsuite/g++.dg/eh/template1.C | 6 +- gcc/testsuite/g++.dg/eh/unexpected1.C | 4 +- gcc/testsuite/g++.dg/ext/has_nothrow_assign.C | 22 ++- .../g++.dg/ext/has_nothrow_constructor.C | 12 +- gcc/testsuite/g++.dg/ext/has_nothrow_copy-1.C | 20 ++- gcc/testsuite/g++.dg/ext/has_nothrow_copy-2.C | 17 ++- gcc/testsuite/g++.dg/ext/has_nothrow_copy-4.C | 6 +- gcc/testsuite/g++.dg/ext/has_nothrow_copy-5.C | 6 +- gcc/testsuite/g++.dg/ext/has_nothrow_copy-6.C | 6 +- gcc/testsuite/g++.dg/ext/has_nothrow_copy-7.C | 6 +- gcc/testsuite/g++.dg/gcov/gcov-7.C | 5 +- gcc/testsuite/g++.dg/init/new13.C | 4 +- gcc/testsuite/g++.dg/init/new25.C | 4 + gcc/testsuite/g++.dg/lookup/exception1.C | 24 ++- gcc/testsuite/g++.dg/opt/noreturn-1.C | 26 +++- gcc/testsuite/g++.dg/other/error3.C | 3 +- gcc/testsuite/g++.dg/rtti/crash3.C | 5 +- gcc/testsuite/g++.dg/template/eh2.C | 4 +- gcc/testsuite/g++.dg/template/error36.C | 4 +- gcc/testsuite/g++.dg/tm/pr46567.C | 12 +- gcc/testsuite/g++.dg/tm/pr47340.C | 6 +- gcc/testsuite/g++.dg/torture/pr46364.C | 6 +- gcc/testsuite/g++.dg/torture/pr49394.C | 5 +- gcc/testsuite/g++.dg/torture/pr52918-1.C | 11 +- gcc/testsuite/g++.dg/torture/pr57190.C | 23 ++- .../g++.dg/torture/stackalign/eh-alloca-1.C | 5 +- .../g++.dg/torture/stackalign/eh-fastcall-1.C | 5 +- .../g++.dg/torture/stackalign/eh-global-1.C | 5 +- .../g++.dg/torture/stackalign/eh-inline-1.C | 5 +- .../g++.dg/torture/stackalign/eh-inline-2.C | 5 +- .../g++.dg/torture/stackalign/eh-thiscall-1.C | 5 +- .../g++.dg/torture/stackalign/eh-vararg-1.C | 5 +- .../g++.dg/torture/stackalign/eh-vararg-2.C | 5 +- gcc/testsuite/g++.dg/tree-ssa/pr45605.C | 6 +- gcc/testsuite/g++.dg/warn/Wreturn-type-3.C | 5 +- gcc/testsuite/g++.old-deja/g++.eh/badalloc1.C | 15 +- gcc/testsuite/g++.old-deja/g++.eh/cleanup2.C | 22 ++- gcc/testsuite/g++.old-deja/g++.eh/spec1.C | 4 +- gcc/testsuite/g++.old-deja/g++.eh/spec2.C | 4 +- gcc/testsuite/g++.old-deja/g++.eh/spec3.C | 4 +- gcc/testsuite/g++.old-deja/g++.eh/spec4.C | 4 +- gcc/testsuite/g++.old-deja/g++.eh/spec6.C | 3 +- gcc/testsuite/g++.old-deja/g++.eh/throw1.C | 5 +- gcc/testsuite/g++.old-deja/g++.eh/throw2.C | 5 +- gcc/testsuite/g++.old-deja/g++.eh/tmpl1.C | 5 +- gcc/testsuite/g++.old-deja/g++.eh/tmpl3.C | 11 +- gcc/testsuite/g++.old-deja/g++.mike/eh15.C | 4 +- gcc/testsuite/g++.old-deja/g++.mike/eh25.C | 8 +- gcc/testsuite/g++.old-deja/g++.mike/eh33.C | 3 +- gcc/testsuite/g++.old-deja/g++.mike/eh34.C | 1 + gcc/testsuite/g++.old-deja/g++.mike/eh50.C | 3 +- gcc/testsuite/g++.old-deja/g++.mike/eh51.C | 3 +- gcc/testsuite/g++.old-deja/g++.mike/eh55.C | 2 +- gcc/testsuite/g++.old-deja/g++.mike/p10416.C | 6 +- .../g++.old-deja/g++.other/crash28.C | 11 +- .../g++.old-deja/g++.other/crash30.C | 2 +- gcc/testsuite/g++.old-deja/g++.other/new7.C | 5 +- gcc/testsuite/g++.old-deja/g++.pt/ehspec1.C | 4 +- .../g++.old-deja/g++.robertl/eb123.C | 5 +- libstdc++-v3/ChangeLog | 5 + .../testsuite/util/testsuite_new_operators.h | 3 +- 102 files changed, 720 insertions(+), 199 deletions(-) diff --git a/gcc/cp/ChangeLog b/gcc/cp/ChangeLog index a59d25b7caa..e3251645051 100644 --- a/gcc/cp/ChangeLog +++ b/gcc/cp/ChangeLog @@ -1,3 +1,11 @@ +2016-12-08 Jakub Jelinek + + P0003R5 - removal of dynamic exception specification from C++17 + * parser.c (cp_parser_exception_specification_opt): For C++17 + error out on throw ( type-id-list ), for C++11 and C++14 issue + -Wdeprecated warning on it. Formatting fix. Treat throw() + in C++17 as noexcept(true). + 2016-12-07 Martin Jambor PR c++/78589 diff --git a/gcc/cp/parser.c b/gcc/cp/parser.c index 08f5f9e52ef..70e5fb33f7c 100644 --- a/gcc/cp/parser.c +++ b/gcc/cp/parser.c @@ -23786,8 +23786,8 @@ cp_parser_exception_specification_opt (cp_parser* parser) token = cp_lexer_peek_token (parser->lexer); /* Is it a noexcept-specification? */ - type_id_list = cp_parser_noexcept_specification_opt(parser, true, NULL, - false); + type_id_list = cp_parser_noexcept_specification_opt (parser, true, NULL, + false); if (type_id_list != NULL_TREE) return type_id_list; @@ -23795,12 +23795,7 @@ cp_parser_exception_specification_opt (cp_parser* parser) if (!cp_parser_is_keyword (token, RID_THROW)) return NULL_TREE; -#if 0 - /* Enable this once a lot of code has transitioned to noexcept? */ - if (cxx_dialect >= cxx11 && !in_system_header_at (input_location)) - warning (OPT_Wdeprecated, "dynamic exception specifications are " - "deprecated in C++0x; use % instead"); -#endif + location_t loc = token->location; /* Consume the `throw'. */ cp_lexer_consume_token (parser->lexer); @@ -23821,7 +23816,23 @@ cp_parser_exception_specification_opt (cp_parser* parser) type_id_list = cp_parser_type_id_list (parser); /* Restore the saved message. */ parser->type_definition_forbidden_message = saved_message; + + if (cxx_dialect >= cxx1z) + { + error_at (loc, "ISO C++1z does not allow dynamic exception " + "specifications"); + type_id_list = NULL_TREE; + } + else if (cxx_dialect >= cxx11 && !in_system_header_at (loc)) + warning_at (loc, OPT_Wdeprecated, + "dynamic exception specifications are deprecated in C++11;" + " use % instead"); } + /* In C++17, throw() is equivalent to noexcept (true). throw() + is deprecated in C++11 and above as well, but is still widely used, + so don't warn about it yet. */ + else if (cxx_dialect >= cxx1z) + type_id_list = noexcept_true_spec; else type_id_list = empty_except_spec; diff --git a/gcc/testsuite/ChangeLog b/gcc/testsuite/ChangeLog index bf6db373076..b6b00960420 100644 --- a/gcc/testsuite/ChangeLog +++ b/gcc/testsuite/ChangeLog @@ -1,17 +1,118 @@ +2016-12-08 Jakub Jelinek + + P0003R5 - removal of dynamic exception specification from C++17 + * g++.dg/compat/eh/ctor1.h: Adjust for deprecation of + throw (type-id-list) in C++11 and C++14 and removal in C++17. + * g++.dg/compat/eh/ctor1_y.C: Likewise. + * g++.dg/compat/eh/new1_x.C: Likewise. + * g++.dg/compat/eh/new1_y.C: Likewise. + * g++.dg/compat/eh/spec3_x.C: Likewise. + * g++.dg/compat/eh/spec3_y.C: Likewise. + * g++.dg/compat/eh/template1.h: Likewise. + * g++.dg/compat/eh/template1_y.C: Likewise. + * g++.dg/compat/eh/unexpected1_x.C: Likewise. + * g++.dg/compat/eh/unexpected1_y.C: Likewise. + * g++.dg/cpp0x/auto9.C: Likewise. + * g++.dg/cpp0x/defaulted23.C: Likewise. + * g++.dg/cpp0x/error5.C: Likewise. + * g++.dg/cpp0x/lambda/lambda-eh2.C: Likewise. + * g++.dg/cpp0x/noexcept02.C: Likewise. + * g++.dg/cpp0x/noexcept07.C: Likewise. + * g++.dg/cpp0x/noexcept08.C: Likewise. + * g++.dg/cpp0x/noexcept19.C: Likewise. + * g++.dg/cpp0x/variadic73.C: Likewise. + * g++.dg/cpp0x/variadic-throw.C: Likewise. + * g++.dg/cpp1z/noexcept-type1.C: Likewise. + * g++.dg/eh/async-unwind2.C: Likewise. + * g++.dg/eh/cond4.C: Likewise. + * g++.dg/eh/delete1.C: Likewise. + * g++.dg/eh/ehopt1.C: Likewise. + * g++.dg/eh/forced3.C: Likewise. + * g++.dg/eh/forced4.C: Likewise. + * g++.dg/eh/init-temp2.C: Likewise. + * g++.dg/eh/pr38662.C: Likewise. + * g++.dg/eh/pr41819.C: Likewise. + * g++.dg/eh/shadow1.C: Likewise. + * g++.dg/eh/spec2.C: Likewise. + * g++.dg/eh/spec3.C: Likewise. + * g++.dg/eh/spec5.C: Likewise. + * g++.dg/eh/spec6.C: Likewise. + * g++.dg/eh/spec7.C: Likewise. + * g++.dg/eh/spec8.C: Likewise. + * g++.dg/eh/spec9.C: Likewise. + * g++.dg/eh/template1.C: Likewise. + * g++.dg/eh/unexpected1.C: Likewise. + * g++.dg/ext/has_nothrow_assign.C: Likewise. + * g++.dg/ext/has_nothrow_constructor.C: Likewise. + * g++.dg/ext/has_nothrow_copy-1.C: Likewise. + * g++.dg/ext/has_nothrow_copy-2.C: Likewise. + * g++.dg/ext/has_nothrow_copy-4.C: Likewise. + * g++.dg/ext/has_nothrow_copy-5.C: Likewise. + * g++.dg/ext/has_nothrow_copy-6.C: Likewise. + * g++.dg/ext/has_nothrow_copy-7.C: Likewise. + * g++.dg/gcov/gcov-7.C: Likewise. + * g++.dg/init/new13.C: Likewise. + * g++.dg/init/new25.C: Likewise. + * g++.dg/lookup/exception1.C: Likewise. + * g++.dg/opt/noreturn-1.C: Likewise. + * g++.dg/other/error3.C: Likewise. + * g++.dg/rtti/crash3.C: Likewise. + * g++.dg/template/eh2.C: Likewise. + * g++.dg/template/error36.C: Likewise. + * g++.dg/tm/pr46567.C: Likewise. + * g++.dg/tm/pr47340.C: Likewise. + * g++.dg/torture/pr46364.C: Likewise. + * g++.dg/torture/pr49394.C: Likewise. + * g++.dg/torture/pr52918-1.C: Likewise. + * g++.dg/torture/pr57190.C: Likewise. + * g++.dg/torture/stackalign/eh-alloca-1.C: Likewise. + * g++.dg/torture/stackalign/eh-fastcall-1.C: Likewise. + * g++.dg/torture/stackalign/eh-global-1.C: Likewise. + * g++.dg/torture/stackalign/eh-inline-1.C: Likewise. + * g++.dg/torture/stackalign/eh-inline-2.C: Likewise. + * g++.dg/torture/stackalign/eh-thiscall-1.C: Likewise. + * g++.dg/torture/stackalign/eh-vararg-1.C: Likewise. + * g++.dg/torture/stackalign/eh-vararg-2.C: Likewise. + * g++.dg/tree-ssa/pr45605.C: Likewise. + * g++.dg/warn/Wreturn-type-3.C: Likewise. + * g++.old-deja/g++.eh/badalloc1.C: Likewise. + * g++.old-deja/g++.eh/cleanup2.C: Likewise. + * g++.old-deja/g++.eh/spec1.C: Likewise. + * g++.old-deja/g++.eh/spec2.C: Likewise. + * g++.old-deja/g++.eh/spec3.C: Likewise. + * g++.old-deja/g++.eh/spec4.C: Likewise. + * g++.old-deja/g++.eh/spec6.C: Likewise. + * g++.old-deja/g++.eh/throw1.C: Likewise. + * g++.old-deja/g++.eh/throw2.C: Likewise. + * g++.old-deja/g++.eh/tmpl1.C: Likewise. + * g++.old-deja/g++.eh/tmpl3.C: Likewise. + * g++.old-deja/g++.mike/eh15.C: Likewise. + * g++.old-deja/g++.mike/eh25.C: Likewise. + * g++.old-deja/g++.mike/eh33.C: Likewise. + * g++.old-deja/g++.mike/eh34.C: Likewise. + * g++.old-deja/g++.mike/eh50.C: Likewise. + * g++.old-deja/g++.mike/eh51.C: Likewise. + * g++.old-deja/g++.mike/eh55.C: Likewise. + * g++.old-deja/g++.mike/p10416.C: Likewise. + * g++.old-deja/g++.other/crash28.C: Likewise. + * g++.old-deja/g++.other/crash30.C: Likewise. + * g++.old-deja/g++.other/new7.C: Likewise. + * g++.old-deja/g++.pt/ehspec1.C: Likewise. + * g++.old-deja/g++.robertl/eb123.C: Likewise. + 2016-12-08 Naveen H.S - * gcc.target/aarch64/pr78382.c : New Testcase. + * gcc.target/aarch64/pr78382.c: New testcase. 2016-12-08 Andrew Pinski - * gcc.target/aarch64/pr71112.c : New Testcase. + * gcc.target/aarch64/pr71112.c: New testcase. 2016-12-07 Martin Sebor PR middle-end/77784 PR middle-end/78149 PR middle-end/78138 - * c-c++-common/Wsizeof-pointer-memaccess2.c: Adjust expected diagnostic. * g++.dg/ext/builtin-object-size3.C (bar): Same. * g++.dg/ext/strncpy-chk1.C: Same. @@ -84,7 +185,7 @@ 2016-12-07 Naveen H.S - * gcc.target/aarch64/pr71727.c : New Testcase. + * gcc.target/aarch64/pr71727.c: New testcase. 2016-12-06 Tom de Vries @@ -873,23 +974,23 @@ 2016-11-23 Naveen H.S - * gcc.target/aarch64/ldp_stp_1.c : Add -mcpu=generic. - * gcc.target/aarch64/store-pair-1.c : Likewise. + * gcc.target/aarch64/ldp_stp_1.c: Add -mcpu=generic. + * gcc.target/aarch64/store-pair-1.c: Likewise. 2016-11-23 Naveen H.S - * gcc.target/aarch64/fmaxmin.c : Add -fno-vect-cost-model. - * gcc.target/aarch64/fmul_fcvt_2.c : Likewise. - * gcc.target/aarch64/vect-abs-compile.c : Likewise. - * gcc.target/aarch64/vect-clz.c : Likewise. - * gcc.target/aarch64/vect-fcm-eq-d.c : Likewise. - * gcc.target/aarch64/vect-fcm-ge-d.c : Likewise. - * gcc.target/aarch64/vect-fcm-gt-d.c : Likewise. - * gcc.target/aarch64/vect-fmovd-zero.c : Likewise. - * gcc.target/aarch64/vect-fmovd.c : Likewise. - * gcc.target/aarch64/vect-fmovf-zero.c : Likewise. - * gcc.target/aarch64/vect-fmovf.c : Likewise. - * gcc.target/aarch64/vect_ctz_1.c : Likewise. + * gcc.target/aarch64/fmaxmin.c: Add -fno-vect-cost-model. + * gcc.target/aarch64/fmul_fcvt_2.c: Likewise. + * gcc.target/aarch64/vect-abs-compile.c: Likewise. + * gcc.target/aarch64/vect-clz.c: Likewise. + * gcc.target/aarch64/vect-fcm-eq-d.c: Likewise. + * gcc.target/aarch64/vect-fcm-ge-d.c: Likewise. + * gcc.target/aarch64/vect-fcm-gt-d.c: Likewise. + * gcc.target/aarch64/vect-fmovd-zero.c: Likewise. + * gcc.target/aarch64/vect-fmovd.c: Likewise. + * gcc.target/aarch64/vect-fmovf-zero.c: Likewise. + * gcc.target/aarch64/vect-fmovf.c: Likewise. + * gcc.target/aarch64/vect_ctz_1.c: Likewise. 2016-11-23 Peter Bergner @@ -7061,7 +7162,7 @@ 2016-07-28 Paul Thomas PR fortran/71883 - * gfortran.dg/pr71883.f90 : New test. + * gfortran.dg/pr71883.f90: New test. 2016-07-28 Yuri Rumyantsev @@ -14685,7 +14786,7 @@ 2016-02-20 Paul Thomas PR fortran/69423 - * gfortran.dg/deferred_character_15.f90 : New test. + * gfortran.dg/deferred_character_15.f90: New test. 2016-02-20 Dominique d'Humieres diff --git a/gcc/testsuite/g++.dg/compat/eh/ctor1.h b/gcc/testsuite/g++.dg/compat/eh/ctor1.h index 9ad186010be..e88a62d223a 100644 --- a/gcc/testsuite/g++.dg/compat/eh/ctor1.h +++ b/gcc/testsuite/g++.dg/compat/eh/ctor1.h @@ -5,6 +5,12 @@ struct Foo struct Bar { - ~Bar () throw(int); + ~Bar () +#if __cplusplus < 201103L + throw(int) +#else + noexcept(false) +#endif + ; Foo f; }; diff --git a/gcc/testsuite/g++.dg/compat/eh/ctor1_y.C b/gcc/testsuite/g++.dg/compat/eh/ctor1_y.C index ca1cf389caf..5478bb79c2d 100644 --- a/gcc/testsuite/g++.dg/compat/eh/ctor1_y.C +++ b/gcc/testsuite/g++.dg/compat/eh/ctor1_y.C @@ -7,7 +7,12 @@ Foo::~Foo() was_f_in_Bar_destroyed=true; } -Bar::~Bar() throw(int) +Bar::~Bar() +#if __cplusplus < 201103L +throw(int) +#else +noexcept(false) +#endif { throw 1; } diff --git a/gcc/testsuite/g++.dg/compat/eh/new1_x.C b/gcc/testsuite/g++.dg/compat/eh/new1_x.C index 12128717089..23ac80b87fc 100644 --- a/gcc/testsuite/g++.dg/compat/eh/new1_x.C +++ b/gcc/testsuite/g++.dg/compat/eh/new1_x.C @@ -4,7 +4,11 @@ extern "C" void exit (int); extern "C" void abort (void); -extern void * operator new[] (std::size_t s) throw (std::bad_alloc); +extern void * operator new[] (std::size_t s) +#if __cplusplus < 201103L +throw (std::bad_alloc) +#endif +; extern void operator delete[] (void *p) throw (); struct A diff --git a/gcc/testsuite/g++.dg/compat/eh/new1_y.C b/gcc/testsuite/g++.dg/compat/eh/new1_y.C index fbe0e214591..1dd373dd382 100644 --- a/gcc/testsuite/g++.dg/compat/eh/new1_y.C +++ b/gcc/testsuite/g++.dg/compat/eh/new1_y.C @@ -4,7 +4,10 @@ extern int ret; void *ptr; -void * operator new[] (std::size_t s) throw (std::bad_alloc) +void * operator new[] (std::size_t s) +#if __cplusplus < 201103L +throw (std::bad_alloc) +#endif { ptr = operator new (s); return ptr; diff --git a/gcc/testsuite/g++.dg/compat/eh/spec3_x.C b/gcc/testsuite/g++.dg/compat/eh/spec3_x.C index b8e5fbeaa1e..4c2aefd7c0e 100644 --- a/gcc/testsuite/g++.dg/compat/eh/spec3_x.C +++ b/gcc/testsuite/g++.dg/compat/eh/spec3_x.C @@ -1,6 +1,10 @@ #include "spec3.h" -extern void func () throw (B,A); +extern void func () +#if __cplusplus < 201103L +throw (B,A) +#endif +; void spec3_x (void) { diff --git a/gcc/testsuite/g++.dg/compat/eh/spec3_y.C b/gcc/testsuite/g++.dg/compat/eh/spec3_y.C index fef6b368c86..78b0914cdc5 100644 --- a/gcc/testsuite/g++.dg/compat/eh/spec3_y.C +++ b/gcc/testsuite/g++.dg/compat/eh/spec3_y.C @@ -2,7 +2,10 @@ A::A() {} -void func() throw (B,A) +void func() +#if __cplusplus < 201103L +throw (B,A) +#endif { throw A(); } diff --git a/gcc/testsuite/g++.dg/compat/eh/template1.h b/gcc/testsuite/g++.dg/compat/eh/template1.h index 93999a11d49..c807b4753b5 100644 --- a/gcc/testsuite/g++.dg/compat/eh/template1.h +++ b/gcc/testsuite/g++.dg/compat/eh/template1.h @@ -11,5 +11,9 @@ struct C { typedef B D; typedef typename D::E E; - void f() throw(E); + void f() +#if __cplusplus < 201103L + throw(E) +#endif + ; }; diff --git a/gcc/testsuite/g++.dg/compat/eh/template1_y.C b/gcc/testsuite/g++.dg/compat/eh/template1_y.C index 19425375c92..39559d917d1 100644 --- a/gcc/testsuite/g++.dg/compat/eh/template1_y.C +++ b/gcc/testsuite/g++.dg/compat/eh/template1_y.C @@ -1,6 +1,9 @@ #include "template1.h" -template void C::f (void) throw (E) +template void C::f (void) +#if __cplusplus < 201103L +throw (E) +#endif { throw E(); } diff --git a/gcc/testsuite/g++.dg/compat/eh/unexpected1_x.C b/gcc/testsuite/g++.dg/compat/eh/unexpected1_x.C index 61361a68d9f..e8f87f1bc42 100644 --- a/gcc/testsuite/g++.dg/compat/eh/unexpected1_x.C +++ b/gcc/testsuite/g++.dg/compat/eh/unexpected1_x.C @@ -1,3 +1,5 @@ +// { dg-options "-std=c++98" } + #include struct One { }; diff --git a/gcc/testsuite/g++.dg/compat/eh/unexpected1_y.C b/gcc/testsuite/g++.dg/compat/eh/unexpected1_y.C index 0c42c457953..182b956c5f8 100644 --- a/gcc/testsuite/g++.dg/compat/eh/unexpected1_y.C +++ b/gcc/testsuite/g++.dg/compat/eh/unexpected1_y.C @@ -1,3 +1,5 @@ +// { dg-options "-std=c++98" } + struct One { }; struct Two { }; diff --git a/gcc/testsuite/g++.dg/cpp0x/auto9.C b/gcc/testsuite/g++.dg/cpp0x/auto9.C index 771ce0ef9d3..d71e55f8c50 100644 --- a/gcc/testsuite/g++.dg/cpp0x/auto9.C +++ b/gcc/testsuite/g++.dg/cpp0x/auto9.C @@ -103,13 +103,13 @@ auto fnlate2 () -> auto *; // { dg-error "invalid use of|expected" "" { target void badthrow () throw (auto) // { dg-error "invalid use of" } -{ -} +{ // { dg-error "dynamic exception specification" "" { target c++1z } .-1 } +} // { dg-warning "deprecated" "" { target { ! c++1z } } .-2 } void badthrow2 () throw (auto &) // { dg-error "invalid use of|expected" } -{ -} +{ // { dg-error "dynamic exception specification" "" { target c++1z } .-1 } +} // { dg-warning "deprecated" "" { target { ! c++1z } } .-2 } template struct G {}; // { dg-error "auto" "" { target { ! c++1z } } } diff --git a/gcc/testsuite/g++.dg/cpp0x/defaulted23.C b/gcc/testsuite/g++.dg/cpp0x/defaulted23.C index 9e6cbc37d89..4d418873f31 100644 --- a/gcc/testsuite/g++.dg/cpp0x/defaulted23.C +++ b/gcc/testsuite/g++.dg/cpp0x/defaulted23.C @@ -10,22 +10,22 @@ A a; struct B { - B() throw (int) = default; // { dg-message "exception-specification" } -}; - -B b; // { dg-error "deleted" } + B() throw (int) = default; // { dg-message "exception-specification" "" { target { ! c++1z } } } +}; // { dg-error "dynamic exception specification" "" { target c++1z } .-1 } + // { dg-warning "deprecated" "" { target { ! c++1z } } .-2 } +B b; // { dg-error "deleted" "" { target { ! c++1z } } } struct C { - C() throw (int) { } -}; + C() throw (int) { } // { dg-error "dynamic exception specification" "" { target c++1z } } +}; // { dg-warning "deprecated" "" { target { ! c++1z } } .-1 } C c; struct D: C { - D() throw (int) = default; -}; + D() throw (int) = default; // { dg-error "dynamic exception specification" "" { target c++1z } } +}; // { dg-warning "deprecated" "" { target { ! c++1z } } .-1 } D d; diff --git a/gcc/testsuite/g++.dg/cpp0x/error5.C b/gcc/testsuite/g++.dg/cpp0x/error5.C index e46c46d9277..99fb8e0b709 100644 --- a/gcc/testsuite/g++.dg/cpp0x/error5.C +++ b/gcc/testsuite/g++.dg/cpp0x/error5.C @@ -39,7 +39,11 @@ namespace std struct bad_alloc { }; } -void* operator new(std::size_t) throw (std::bad_alloc); +void* operator new(std::size_t) +#if __cplusplus <= 201402L +throw (std::bad_alloc) // { dg-warning "deprecated" "" { target { ! c++1z } } } +#endif +; namespace std { diff --git a/gcc/testsuite/g++.dg/cpp0x/lambda/lambda-eh2.C b/gcc/testsuite/g++.dg/cpp0x/lambda/lambda-eh2.C index 1ef510a484a..330cf95c2d0 100644 --- a/gcc/testsuite/g++.dg/cpp0x/lambda/lambda-eh2.C +++ b/gcc/testsuite/g++.dg/cpp0x/lambda/lambda-eh2.C @@ -1,7 +1,7 @@ // PR c++/47263 // PR c++/49260 // { dg-options "-fno-asynchronous-unwind-tables -fno-dwarf2-cfi-asm" } -// { dg-do run { target c++11 } } +// { dg-do run { target { c++11 && { ! c++1z } } } } #include @@ -10,7 +10,7 @@ int main( void ) std::set_unexpected( []{ throw 0; } ); try { - []() throw( int ) { throw nullptr; }(); + []() throw( int ) { throw nullptr; }(); // { dg-warning "deprecated" } } catch( int ) { } diff --git a/gcc/testsuite/g++.dg/cpp0x/noexcept02.C b/gcc/testsuite/g++.dg/cpp0x/noexcept02.C index 14bb2829fb5..77195415fba 100644 --- a/gcc/testsuite/g++.dg/cpp0x/noexcept02.C +++ b/gcc/testsuite/g++.dg/cpp0x/noexcept02.C @@ -10,8 +10,10 @@ void f(); SA(!noexcept(f())); -void g() throw (int); // { dg-message "previous declaration" } -void g() noexcept(false); // { dg-error "different exception" } +void g() throw (int); // { dg-message "previous declaration" "" { target { ! c++1z } } } + // { dg-error "dynamic exception specification" "" { target c++1z } .-1 } + // { dg-warning "deprecated" "" { target { ! c++1z } } .-2 } +void g() noexcept(false); // { dg-error "different exception" "" { target { ! c++1z } } } void g(); void h() throw(); diff --git a/gcc/testsuite/g++.dg/cpp0x/noexcept07.C b/gcc/testsuite/g++.dg/cpp0x/noexcept07.C index 90c50a9c3b3..de16e016ff4 100644 --- a/gcc/testsuite/g++.dg/cpp0x/noexcept07.C +++ b/gcc/testsuite/g++.dg/cpp0x/noexcept07.C @@ -1,6 +1,6 @@ // Test that checking of a nothrow specification uses the one on the -// definition. -// { dg-do run { target c++11 } } +// definition. In C++17 throw() is equivalent to noexcept(true). +// { dg-do run { target { c++11 && c++14_down } } } #include #include diff --git a/gcc/testsuite/g++.dg/cpp0x/noexcept08.C b/gcc/testsuite/g++.dg/cpp0x/noexcept08.C index 96af0feb8eb..5a554b7379a 100644 --- a/gcc/testsuite/g++.dg/cpp0x/noexcept08.C +++ b/gcc/testsuite/g++.dg/cpp0x/noexcept08.C @@ -7,8 +7,8 @@ struct A virtual void g() throw(); virtual void h() noexcept; virtual void i() noexcept(false); - virtual void j() throw(int); -}; + virtual void j() throw(int); // { dg-error "dynamic exception specification" "" { target c++1z } } +}; // { dg-warning "deprecated" "" { target { ! c++1z } } .-1 } struct B: A { @@ -34,16 +34,23 @@ struct D: A void g() noexcept(false); // { dg-error "looser" } void h() noexcept(false); // { dg-error "looser" } void i() noexcept(false); - void j() noexcept(false); // { dg-error "looser" } + void j() noexcept(false); // { dg-error "looser" "" { target { ! c++1z } } } }; struct E: A { - void f() throw(int); + void f() throw(int); // { dg-error "dynamic exception specification" "" { target c++1z } } + // { dg-warning "deprecated" "" { target { ! c++1z } } .-1 } void g() throw(int); // { dg-error "looser" } + // { dg-error "dynamic exception specification" "" { target c++1z } .-1 } + // { dg-warning "deprecated" "" { target { ! c++1z } } .-2 } void h() throw(int); // { dg-error "looser" } - void i() throw(int); - void j() throw(int); + // { dg-error "dynamic exception specification" "" { target c++1z } .-1 } + // { dg-warning "deprecated" "" { target { ! c++1z } } .-2 } + void i() throw(int); // { dg-error "dynamic exception specification" "" { target c++1z } } + // { dg-warning "deprecated" "" { target { ! c++1z } } .-1 } + void j() throw(int); // { dg-error "dynamic exception specification" "" { target c++1z } } + // { dg-warning "deprecated" "" { target { ! c++1z } } .-1 } }; struct F: A @@ -52,5 +59,5 @@ struct F: A void g(); // { dg-error "looser" } void h(); // { dg-error "looser" } void i(); - void j(); // { dg-error "looser" } + void j(); // { dg-error "looser" "" { target { ! c++1z } } } }; diff --git a/gcc/testsuite/g++.dg/cpp0x/noexcept19.C b/gcc/testsuite/g++.dg/cpp0x/noexcept19.C index d303a8c60f2..8ec4d7df442 100644 --- a/gcc/testsuite/g++.dg/cpp0x/noexcept19.C +++ b/gcc/testsuite/g++.dg/cpp0x/noexcept19.C @@ -22,7 +22,11 @@ struct C struct D { - D () throw (int); + D () +#if __cplusplus <= 201402L + throw (int) // { dg-warning "deprecated" "" { target { ! c++1z } } } +#endif + ; }; C > c; diff --git a/gcc/testsuite/g++.dg/cpp0x/variadic-throw.C b/gcc/testsuite/g++.dg/cpp0x/variadic-throw.C index fc81e9d5d4a..368a67b5776 100644 --- a/gcc/testsuite/g++.dg/cpp0x/variadic-throw.C +++ b/gcc/testsuite/g++.dg/cpp0x/variadic-throw.C @@ -9,9 +9,9 @@ template struct pair template struct S { - template static int foo() throw (pair ...) // { dg-error "mismatched" } - { - return 1; + template static int foo() throw (pair ...) // { dg-error "mismatched" "" { target { ! c++1z } } } + { // { dg-error "dynamic exception specification" "" { target c++1z } .-1 } + return 1; // { dg-warning "deprecated" "" { target { ! c++1z } } .-2 } } }; @@ -22,5 +22,5 @@ int bar () int wibble() { - return S<0, 1, 2>::foo<0, 1> (); // { dg-error "no matching" } + return S<0, 1, 2>::foo<0, 1> (); // { dg-error "no matching" "" { target { ! c++1z } } } } diff --git a/gcc/testsuite/g++.dg/cpp0x/variadic73.C b/gcc/testsuite/g++.dg/cpp0x/variadic73.C index 533ed46f883..be998d2420c 100644 --- a/gcc/testsuite/g++.dg/cpp0x/variadic73.C +++ b/gcc/testsuite/g++.dg/cpp0x/variadic73.C @@ -3,7 +3,11 @@ struct A {}; struct B {}; struct C {}; -template void f(int idx) throw(Exceptions...) { +template void f(int idx) +#if __cplusplus <= 201402L +throw(Exceptions...) // { dg-warning "deprecated" "" { target { ! c++1z } } } +#endif +{ if (idx == 0) throw A(); else if (idx == 1) throw B(); else if (idx == 2) throw C(); diff --git a/gcc/testsuite/g++.dg/cpp1z/noexcept-type1.C b/gcc/testsuite/g++.dg/cpp1z/noexcept-type1.C index 62e1322e35a..dfe64e550e0 100644 --- a/gcc/testsuite/g++.dg/cpp1z/noexcept-type1.C +++ b/gcc/testsuite/g++.dg/cpp1z/noexcept-type1.C @@ -1,7 +1,7 @@ // Testcase from P0012r1 // { dg-options -std=c++1z } -void (*p)() throw(int); +void (*p)() throw(int); // { dg-error "dynamic exception specification" } void (**pp)() noexcept = &p; // { dg-error "" } cannot convert to pointer to noexcept function struct S { typedef void (*p)(); operator p(); }; diff --git a/gcc/testsuite/g++.dg/eh/async-unwind2.C b/gcc/testsuite/g++.dg/eh/async-unwind2.C index 0c31f80e5e7..0f84901fb6e 100644 --- a/gcc/testsuite/g++.dg/eh/async-unwind2.C +++ b/gcc/testsuite/g++.dg/eh/async-unwind2.C @@ -87,8 +87,16 @@ struct Y struct Z; -X baz1 (const S &) throw (E); -X baz2 (const X &) throw (E); +X baz1 (const S &) +#if __cplusplus <= 201402L +throw (E) // { dg-warning "deprecated" "" { target { c++11 && { ! c++1z } } } } +#endif +; +X baz2 (const X &) +#if __cplusplus <= 201402L +throw (E) // { dg-warning "deprecated" "" { target { c++11 && { ! c++1z } } } } +#endif +; template X::X () { @@ -112,7 +120,10 @@ template T *X::operator -> () const return &y; } -X baz1 (const S &) throw (E) +X baz1 (const S &) +#if __cplusplus <= 201402L +throw (E) // { dg-warning "deprecated" "" { target { c++11 && { ! c++1z } } } } +#endif { return X (); } @@ -125,7 +136,10 @@ E::~E () { } -X baz2 (const X &) throw (E) +X baz2 (const X &) +#if __cplusplus <= 201402L +throw (E) // { dg-warning "deprecated" "" { target { c++11 && { ! c++1z } } } } +#endif { throw E (); } diff --git a/gcc/testsuite/g++.dg/eh/cond4.C b/gcc/testsuite/g++.dg/eh/cond4.C index 4d312e478d4..17e9149b975 100644 --- a/gcc/testsuite/g++.dg/eh/cond4.C +++ b/gcc/testsuite/g++.dg/eh/cond4.C @@ -12,7 +12,13 @@ void my_terminate () struct A { A(int) { } - ~A() throw(int) { throw 1; }; + ~A() +#if __cplusplus <= 201402L + throw(int) // { dg-warning "deprecated" "" { target { c++11 && { ! c++1z } } } } +#else + noexcept(false) +#endif + { throw 1; }; }; struct B { B(A) { } diff --git a/gcc/testsuite/g++.dg/eh/delete1.C b/gcc/testsuite/g++.dg/eh/delete1.C index 64ccb50cbf7..46b5307e0b4 100644 --- a/gcc/testsuite/g++.dg/eh/delete1.C +++ b/gcc/testsuite/g++.dg/eh/delete1.C @@ -12,7 +12,13 @@ void operator delete (void *) throw () } struct Foo { - ~Foo() throw(int) {throw 1;} + ~Foo() +#if __cplusplus <= 201402L + throw(int) // { dg-warning "deprecated" "" { target { c++11 && { ! c++1z } } } } +#else + noexcept(false) +#endif + {throw 1;} }; struct Baz { @@ -20,7 +26,13 @@ struct Baz { { deleted = 2; } - virtual ~Baz() throw(int) {throw 1;} + virtual ~Baz() +#if __cplusplus <= 201402L + throw(int) // { dg-warning "deprecated" "" { target { c++11 && { ! c++1z } } } } +#else + noexcept(false) +#endif + {throw 1;} }; int non_virt () diff --git a/gcc/testsuite/g++.dg/eh/ehopt1.C b/gcc/testsuite/g++.dg/eh/ehopt1.C index b2fb4121d09..852d324cd9f 100644 --- a/gcc/testsuite/g++.dg/eh/ehopt1.C +++ b/gcc/testsuite/g++.dg/eh/ehopt1.C @@ -15,7 +15,13 @@ class A public: A(int) { ++count; if (b) throw 1; } A(const A&) { ++count; if (b) throw 1; } - ~A() throw(int) { --count; if (b) throw 1; } + ~A() +#if __cplusplus <= 201402L + throw(int) // { dg-warning "deprecated" "" { target { c++11 && { ! c++1z } } } } +#else + noexcept(false) +#endif + { --count; if (b) throw 1; } }; typedef A B; @@ -26,7 +32,13 @@ class A public: A() { if (b) throw 1; } A(const B&) { if (b) throw 1; } - ~A() throw(int) { if (b) throw 1; } + ~A() +#if __cplusplus <= 201402L + throw(int) // { dg-warning "deprecated" "" { target { c++11 && { ! c++1z } } } } +#else + noexcept(false) +#endif + { if (b) throw 1; } }; typedef A C; diff --git a/gcc/testsuite/g++.dg/eh/forced3.C b/gcc/testsuite/g++.dg/eh/forced3.C index b8f47df4a8e..9e92dafb08f 100644 --- a/gcc/testsuite/g++.dg/eh/forced3.C +++ b/gcc/testsuite/g++.dg/eh/forced3.C @@ -1,5 +1,6 @@ // HP-UX libunwind.so doesn't provide _UA_END_OF_STACK. // { dg-do run { xfail "ia64-hp-hpux11.*" } } +// { dg-require-effective-target c++14_down } // Test that forced unwinding calls std::unexpected going // through a nothrow function. diff --git a/gcc/testsuite/g++.dg/eh/forced4.C b/gcc/testsuite/g++.dg/eh/forced4.C index 17fd94a4064..96408d2592f 100644 --- a/gcc/testsuite/g++.dg/eh/forced4.C +++ b/gcc/testsuite/g++.dg/eh/forced4.C @@ -38,7 +38,10 @@ force_unwind () } static void -doit () throw(int) +doit () +#if __cplusplus <= 201402L +throw(int) // { dg-warning "deprecated" "" { target { c++11 && { ! c++1z } } } } +#endif { force_unwind (); } diff --git a/gcc/testsuite/g++.dg/eh/init-temp2.C b/gcc/testsuite/g++.dg/eh/init-temp2.C index 9cf87976e3b..127883ae197 100644 --- a/gcc/testsuite/g++.dg/eh/init-temp2.C +++ b/gcc/testsuite/g++.dg/eh/init-temp2.C @@ -8,18 +8,36 @@ template class AutoPtr public: explicit AutoPtr(_Tp* __p = 0) : _M_ptr(__p) {} - ~AutoPtr() throw(int) { delete _M_ptr; } + ~AutoPtr() +#if __cplusplus <= 201402L + throw(int) // { dg-warning "deprecated" "" { target { c++11 && { ! c++1z } } } } +#else + noexcept(false) +#endif + { delete _M_ptr; } }; struct A { A() { } - ~A() throw(int) { throw 1; } + ~A() +#if __cplusplus <= 201402L + throw(int) // { dg-warning "deprecated" "" { target { c++11 && { ! c++1z } } } } +#else + noexcept(false) +#endif + { throw 1; } }; struct B { - virtual ~B() throw(int); + virtual ~B() +#if __cplusplus <= 201402L + throw(int) // { dg-warning "deprecated" "" { target { c++11 && { ! c++1z } } } } +#else + noexcept(false) +#endif + ; }; B* f (const A &s) { throw 1; } diff --git a/gcc/testsuite/g++.dg/eh/pr38662.C b/gcc/testsuite/g++.dg/eh/pr38662.C index 294a12941f3..be3adbbd97d 100644 --- a/gcc/testsuite/g++.dg/eh/pr38662.C +++ b/gcc/testsuite/g++.dg/eh/pr38662.C @@ -2,7 +2,11 @@ class E { }; class T { - int foo(bool a) throw (E) __attribute__((regparm(1))); + int foo(bool a) +#if __cplusplus <= 201402L + throw (E) // { dg-warning "deprecated" "" { target { c++11 && { ! c++1z } } } } +#endif + __attribute__((regparm(1))); int bar(bool b) __attribute__((regparm(1))); }; diff --git a/gcc/testsuite/g++.dg/eh/pr41819.C b/gcc/testsuite/g++.dg/eh/pr41819.C index 07894a29953..61c65729c9d 100644 --- a/gcc/testsuite/g++.dg/eh/pr41819.C +++ b/gcc/testsuite/g++.dg/eh/pr41819.C @@ -15,7 +15,10 @@ void f1() try {} catch (...) {} // { dg-error "" } } -void f2() throw(int) +void f2() +#if __cplusplus <= 201402L +throw(int) // { dg-warning "deprecated" "" { target { c++11 && { ! c++1z } } } } +#endif { bar(); } diff --git a/gcc/testsuite/g++.dg/eh/shadow1.C b/gcc/testsuite/g++.dg/eh/shadow1.C index 15f666a2cfe..b96f65a92bb 100644 --- a/gcc/testsuite/g++.dg/eh/shadow1.C +++ b/gcc/testsuite/g++.dg/eh/shadow1.C @@ -13,14 +13,14 @@ struct D : private B friend class E; static B *baz (D *); - virtual void V () throw (B); // { dg-error "overriding" "" } -}; - + virtual void V () throw (B); // { dg-error "overriding" "" { target { ! c++1z } } } +}; // { dg-error "dynamic exception specification" "" { target c++1z } .-1 } + // { dg-warning "deprecated" "" { target { c++11 && { ! c++1z } } } .-2 } struct E : public D { - virtual void V () throw (D); // { dg-error "looser throw" "" } -}; - + virtual void V () throw (D); // { dg-error "looser throw" "" { target { ! c++1z } } } +}; // { dg-error "dynamic exception specification" "" { target c++1z } .-1 } + // { dg-warning "deprecated" "" { target { c++11 && { ! c++1z } } } .-2 } B* foo (D *); B *D::baz (D *p) diff --git a/gcc/testsuite/g++.dg/eh/spec2.C b/gcc/testsuite/g++.dg/eh/spec2.C index 8107f019eb7..0f512640fd3 100644 --- a/gcc/testsuite/g++.dg/eh/spec2.C +++ b/gcc/testsuite/g++.dg/eh/spec2.C @@ -3,8 +3,15 @@ struct S { void f (void); }; typedef void f1 (void) throw (int); // { dg-error "exception" "" { target c++14_down } } + // { dg-error "dynamic exception specification" "" { target c++1z } .-1 } + // { dg-warning "deprecated" "" { target { c++11 && { ! c++1z } } } .-2 } typedef void (*f2) (void) throw (int); // { dg-error "exception" "" { target c++14_down } } + // { dg-error "dynamic exception specification" "" { target c++1z } .-1 } + // { dg-warning "deprecated" "" { target { c++11 && { ! c++1z } } } .-2 } typedef void (S::*f3) (void) throw (int); // { dg-error "exception" "" { target c++14_down } } - -void (*f4) (void) throw (int); -void (S::*f5) (void) throw (int); + // { dg-error "dynamic exception specification" "" { target c++1z } .-1 } + // { dg-warning "deprecated" "" { target { c++11 && { ! c++1z } } } .-2 } +void (*f4) (void) throw (int); // { dg-error "dynamic exception specification" "" { target c++1z } } + // { dg-warning "deprecated" "" { target { c++11 && { ! c++1z } } } .-1 } +void (S::*f5) (void) throw (int); // { dg-error "dynamic exception specification" "" { target c++1z } } + // { dg-warning "deprecated" "" { target { c++11 && { ! c++1z } } } .-1 } diff --git a/gcc/testsuite/g++.dg/eh/spec3.C b/gcc/testsuite/g++.dg/eh/spec3.C index 20bcfc33ee8..49bbdc39427 100644 --- a/gcc/testsuite/g++.dg/eh/spec3.C +++ b/gcc/testsuite/g++.dg/eh/spec3.C @@ -12,7 +12,10 @@ struct A : virtual public Base struct B {}; -void func() throw (B,A) +void func() +#if __cplusplus <= 201402L +throw (B,A) // { dg-warning "deprecated" "" { target { c++11 && { ! c++1z } } } } +#endif { throw A(); } diff --git a/gcc/testsuite/g++.dg/eh/spec5.C b/gcc/testsuite/g++.dg/eh/spec5.C index be8f327c0b7..5735e8d2760 100644 --- a/gcc/testsuite/g++.dg/eh/spec5.C +++ b/gcc/testsuite/g++.dg/eh/spec5.C @@ -8,12 +8,20 @@ struct A; struct B { - void f () throw (A); + void f () +#if __cplusplus <= 201402L + throw (A) +#endif + ; }; struct A {}; -void B::f () throw (A) {} +void B::f () +#if __cplusplus <= 201402L +throw (A) +#endif +{} int main () { diff --git a/gcc/testsuite/g++.dg/eh/spec6.C b/gcc/testsuite/g++.dg/eh/spec6.C index d6d81762891..d08bd865a9b 100644 --- a/gcc/testsuite/g++.dg/eh/spec6.C +++ b/gcc/testsuite/g++.dg/eh/spec6.C @@ -1,6 +1,7 @@ // Test that we don't allow incomplete types in an exception-specification // for a definition, or at a call site. +// { dg-do compile { target c++14_down } } // { dg-options "-fpermissive -w" } struct A; // { dg-message "" } diff --git a/gcc/testsuite/g++.dg/eh/spec7.C b/gcc/testsuite/g++.dg/eh/spec7.C index 08586a2af75..37efedcc34c 100644 --- a/gcc/testsuite/g++.dg/eh/spec7.C +++ b/gcc/testsuite/g++.dg/eh/spec7.C @@ -19,7 +19,11 @@ struct D : public B { } o; struct Raiser { - Raiser() throw( int ) {throw 1;}; + Raiser() +#if __cplusplus <= 201402L + throw( int ) // { dg-warning "deprecated" "" { target { c++11 && { ! c++1z } } } } +#endif + {throw 1;}; } raiser; }; }; diff --git a/gcc/testsuite/g++.dg/eh/spec8.C b/gcc/testsuite/g++.dg/eh/spec8.C index c76032e3835..8967e8c4edd 100644 --- a/gcc/testsuite/g++.dg/eh/spec8.C +++ b/gcc/testsuite/g++.dg/eh/spec8.C @@ -1,8 +1,10 @@ // PR c++/24817 +// { dg-do compile { target c++14_down } } struct exception {}; template void foo() throw(exception); // { dg-message "declaration" } + // { dg-warning "deprecated" "" { target { c++11 && { ! c++1z } } } .-1 } template void foo(); // { dg-error "exception" } struct bar diff --git a/gcc/testsuite/g++.dg/eh/spec9.C b/gcc/testsuite/g++.dg/eh/spec9.C index 9e00d1c7535..cceb98f5585 100644 --- a/gcc/testsuite/g++.dg/eh/spec9.C +++ b/gcc/testsuite/g++.dg/eh/spec9.C @@ -4,7 +4,10 @@ typedef int IntArray[10]; IntArray i; -void test_array() throw (IntArray) +void test_array() +#if __cplusplus <= 201402L +throw (IntArray) // { dg-warning "deprecated" "" { target { c++11 && { ! c++1z } } } } +#endif { throw i; } diff --git a/gcc/testsuite/g++.dg/eh/template1.C b/gcc/testsuite/g++.dg/eh/template1.C index 2cbf9c698b0..fb471b2ac83 100644 --- a/gcc/testsuite/g++.dg/eh/template1.C +++ b/gcc/testsuite/g++.dg/eh/template1.C @@ -17,7 +17,11 @@ struct C { typedef B D; typedef typename D::E E; - void f() throw(E) { throw E(); } + void f() +#if __cplusplus <= 201402L + throw(E) // { dg-warning "deprecated" "" { target { c++11 && { ! c++1z } } } } +#endif + { throw E(); } }; int main() diff --git a/gcc/testsuite/g++.dg/eh/unexpected1.C b/gcc/testsuite/g++.dg/eh/unexpected1.C index e5982ffacc5..cd5585face8 100644 --- a/gcc/testsuite/g++.dg/eh/unexpected1.C +++ b/gcc/testsuite/g++.dg/eh/unexpected1.C @@ -1,6 +1,6 @@ // PR 3719 // Test that an unexpected handler can rethrow to categorize. -// { dg-do run } +// { dg-do run { target c++14_down } } #include @@ -23,7 +23,7 @@ handle_unexpected () } static void -doit () throw (Two) +doit () throw (Two) // { dg-warning "deprecated" "" { target { c++11 } } } { throw One (); } diff --git a/gcc/testsuite/g++.dg/ext/has_nothrow_assign.C b/gcc/testsuite/g++.dg/ext/has_nothrow_assign.C index e6e9fc6eda9..d84a81ca438 100644 --- a/gcc/testsuite/g++.dg/ext/has_nothrow_assign.C +++ b/gcc/testsuite/g++.dg/ext/has_nothrow_assign.C @@ -15,6 +15,12 @@ struct B struct C : public A { }; +#if __cplusplus > 201402L +#define THROW_INT +#else +#define THROW_INT throw(int) // { dg-warning "deprecated" "" { target { c++11 && { ! c++1z } } } } +#endif + struct D { D& operator=(const D&) throw() { return *this; } @@ -22,43 +28,43 @@ struct D struct E { - E& operator=(const E&) throw(int) { return *this; } + E& operator=(const E&) THROW_INT { return *this; } }; struct E1 { - E1& operator=(const E1&) throw(int) { throw int(); return *this; } + E1& operator=(const E1&) THROW_INT { throw int(); return *this; } }; struct F { - F() throw(int) { } + F() THROW_INT { } }; struct G { - G() throw(int) { throw int(); } + G() THROW_INT { throw int(); } }; struct H { - H& operator=(H&) throw(int) { return *this; } + H& operator=(H&) THROW_INT { return *this; } }; struct H1 { - H1& operator=(H1&) throw(int) { throw int(); return *this; } + H1& operator=(H1&) THROW_INT { throw int(); return *this; } }; struct I { - I& operator=(I&) throw(int) { return *this; } + I& operator=(I&) THROW_INT { return *this; } I& operator=(const I&) throw() { return *this; } }; struct I1 { - I1& operator=(I1&) throw(int) { throw int(); return *this; } + I1& operator=(I1&) THROW_INT { throw int(); return *this; } I1& operator=(const I1&) throw() { return *this; } }; diff --git a/gcc/testsuite/g++.dg/ext/has_nothrow_constructor.C b/gcc/testsuite/g++.dg/ext/has_nothrow_constructor.C index 1f1227c3011..d69b312a3a8 100644 --- a/gcc/testsuite/g++.dg/ext/has_nothrow_constructor.C +++ b/gcc/testsuite/g++.dg/ext/has_nothrow_constructor.C @@ -12,6 +12,12 @@ struct B A a; }; +#if __cplusplus > 201402L +#define THROW_INT +#else +#define THROW_INT throw(int) // { dg-warning "deprecated" "" { target { c++11 && { ! c++1z } } } } +#endif + struct C : public A { }; @@ -22,12 +28,12 @@ struct D struct E { - E() throw(int) { } + E() THROW_INT { } }; struct E1 { - E1() throw(int) { throw int(); } + E1() THROW_INT { throw int(); } }; struct F @@ -37,7 +43,7 @@ struct F struct G { - G(const G&) throw(int) { throw int(); } + G(const G&) THROW_INT { throw int(); } }; template diff --git a/gcc/testsuite/g++.dg/ext/has_nothrow_copy-1.C b/gcc/testsuite/g++.dg/ext/has_nothrow_copy-1.C index 87785ae5aba..0e5a9de46f9 100644 --- a/gcc/testsuite/g++.dg/ext/has_nothrow_copy-1.C +++ b/gcc/testsuite/g++.dg/ext/has_nothrow_copy-1.C @@ -15,6 +15,12 @@ struct B struct C : public A { }; +#if __cplusplus > 201402L +#define THROW_INT +#else +#define THROW_INT throw(int) // { dg-warning "deprecated" "" { target { c++11 && { ! c++1z } } } } +#endif + struct D { D(const D&) throw() { } @@ -22,12 +28,12 @@ struct D struct E { - E(const E&) throw(int) { } + E(const E&) THROW_INT { } }; struct E1 { - E1(const E1&) throw(int) { throw int(); } + E1(const E1&) THROW_INT { throw int(); } }; struct F @@ -37,28 +43,28 @@ struct F struct G { - G() throw(int) { throw int(); } + G() THROW_INT { throw int(); } }; struct H { - H(H&) throw(int) { } + H(H&) THROW_INT { } }; struct H1 { - H1(H1&) throw(int) { throw int(); } + H1(H1&) THROW_INT { throw int(); } }; struct I { - I(I&) throw(int) { } + I(I&) THROW_INT { } I(const I&) throw() { } }; struct I1 { - I1(I1&) throw(int) { throw int(); } + I1(I1&) THROW_INT { throw int(); } I1(const I1&) throw() { } }; diff --git a/gcc/testsuite/g++.dg/ext/has_nothrow_copy-2.C b/gcc/testsuite/g++.dg/ext/has_nothrow_copy-2.C index b2eb203f396..f15c417c2f9 100644 --- a/gcc/testsuite/g++.dg/ext/has_nothrow_copy-2.C +++ b/gcc/testsuite/g++.dg/ext/has_nothrow_copy-2.C @@ -2,8 +2,21 @@ // { dg-do run } #include -struct A { template A (T) throw (int); }; -struct B { B (B&) throw (); template B (T) throw (int); }; +struct A { + template A (T) +#if __cplusplus <= 201402L + throw(int) // { dg-warning "deprecated" "" { target { c++11 && { ! c++1z } } } } +#endif + ; +}; +struct B { + B (B&) throw (); + template B (T) +#if __cplusplus <= 201402L + throw(int) // { dg-warning "deprecated" "" { target { c++11 && { ! c++1z } } } } +#endif + ; +}; int main () { diff --git a/gcc/testsuite/g++.dg/ext/has_nothrow_copy-4.C b/gcc/testsuite/g++.dg/ext/has_nothrow_copy-4.C index 69e9a6bacdf..4c63b963f7c 100644 --- a/gcc/testsuite/g++.dg/ext/has_nothrow_copy-4.C +++ b/gcc/testsuite/g++.dg/ext/has_nothrow_copy-4.C @@ -4,7 +4,11 @@ struct S { S (const S&) throw (); - S (...) throw (int); + S (...) +#if __cplusplus <= 201402L + throw (int) // { dg-warning "deprecated" "" { target { c++11 && { ! c++1z } } } } +#endif + ; }; int main () diff --git a/gcc/testsuite/g++.dg/ext/has_nothrow_copy-5.C b/gcc/testsuite/g++.dg/ext/has_nothrow_copy-5.C index b94b338c386..768c9af84c0 100644 --- a/gcc/testsuite/g++.dg/ext/has_nothrow_copy-5.C +++ b/gcc/testsuite/g++.dg/ext/has_nothrow_copy-5.C @@ -4,7 +4,11 @@ struct S { S (const S&) throw (); - S (int) throw (int); + S (int) +#if __cplusplus <= 201402L + throw (int) // { dg-warning "deprecated" "" { target { c++11 && { ! c++1z } } } } +#endif + ; }; int main () diff --git a/gcc/testsuite/g++.dg/ext/has_nothrow_copy-6.C b/gcc/testsuite/g++.dg/ext/has_nothrow_copy-6.C index 6268ee29207..27f4c0ad63b 100644 --- a/gcc/testsuite/g++.dg/ext/has_nothrow_copy-6.C +++ b/gcc/testsuite/g++.dg/ext/has_nothrow_copy-6.C @@ -3,7 +3,11 @@ struct S { S (S&) throw (); - S (const S&, int) throw (int); + S (const S&, int) +#if __cplusplus <= 201402L + throw (int) // { dg-warning "deprecated" "" { target { c++11 && { ! c++1z } } } } +#endif + ; }; int main () diff --git a/gcc/testsuite/g++.dg/ext/has_nothrow_copy-7.C b/gcc/testsuite/g++.dg/ext/has_nothrow_copy-7.C index 10891b6b592..ac2dd8c13af 100644 --- a/gcc/testsuite/g++.dg/ext/has_nothrow_copy-7.C +++ b/gcc/testsuite/g++.dg/ext/has_nothrow_copy-7.C @@ -3,7 +3,11 @@ struct S { S (const S&) throw (); - S (S&&) throw (int); + S (S&&) +#if __cplusplus <= 201402L + throw (int) // { dg-warning "deprecated" "" { target { ! c++1z } } } +#endif + ; }; int main () diff --git a/gcc/testsuite/g++.dg/gcov/gcov-7.C b/gcc/testsuite/g++.dg/gcov/gcov-7.C index db3e95a07bc..bbc0f1046b5 100644 --- a/gcc/testsuite/g++.dg/gcov/gcov-7.C +++ b/gcc/testsuite/g++.dg/gcov/gcov-7.C @@ -7,7 +7,10 @@ struct foo { - foo () throw (int) + foo () +#if __cplusplus <= 201402L + throw (int) // { dg-warning "deprecated" "" { target { c++11 && { ! c++1z } } } } +#endif { /* count (-) */ throw (1); } diff --git a/gcc/testsuite/g++.dg/init/new13.C b/gcc/testsuite/g++.dg/init/new13.C index 2ced6e3fe02..832942e74af 100644 --- a/gcc/testsuite/g++.dg/init/new13.C +++ b/gcc/testsuite/g++.dg/init/new13.C @@ -6,6 +6,6 @@ struct A { void* operator new(__SIZE_TYPE__) throw(X); // { dg-error "expected|type" } -}; - +}; // { dg-error "dynamic exception specification" "" { target c++1z } .-1 } + // { dg-warning "deprecated" "" { target { c++11 && { ! c++1z } } } .-2 } A* p = new A; diff --git a/gcc/testsuite/g++.dg/init/new25.C b/gcc/testsuite/g++.dg/init/new25.C index 2d447f8f28a..754ac92ff4a 100644 --- a/gcc/testsuite/g++.dg/init/new25.C +++ b/gcc/testsuite/g++.dg/init/new25.C @@ -5,7 +5,11 @@ class C { public: void* operator new(std::size_t = 32) throw (std::bad_alloc); // { dg-error "first parameter" } + // { dg-error "dynamic exception specification" "" { target c++1z } .-1 } + // { dg-warning "deprecated" "" { target { c++11 && { ! c++1z } } } .-2 } void* operator new[](std::size_t = 32) throw (std::bad_alloc); // { dg-error "first parameter" } + // { dg-error "dynamic exception specification" "" { target c++1z } .-1 } + // { dg-warning "deprecated" "" { target { c++11 && { ! c++1z } } } .-2 } void* operator new(std::size_t = 32, const std::nothrow_t&) throw(); // { dg-error "first parameter" } void* operator new[](std::size_t = 32, const std::nothrow_t&) throw(); // { dg-error "first parameter" } }; diff --git a/gcc/testsuite/g++.dg/lookup/exception1.C b/gcc/testsuite/g++.dg/lookup/exception1.C index b5fcd0a6c4d..00ef817ecc9 100644 --- a/gcc/testsuite/g++.dg/lookup/exception1.C +++ b/gcc/testsuite/g++.dg/lookup/exception1.C @@ -11,8 +11,16 @@ namespace ns { class Test { public: - inline Test() throw( Exception ); - inline Test(int n ) throw( Exception ); + inline Test() +#if __cplusplus <= 201402L + throw( Exception ) // { dg-warning "deprecated" "" { target { c++11 && { ! c++1z } } } } +#endif + ; + inline Test(int n ) +#if __cplusplus <= 201402L + throw( Exception ) // { dg-warning "deprecated" "" { target { c++11 && { ! c++1z } } } } +#endif + ; private: int i; }; @@ -20,11 +28,19 @@ namespace ns // This line used to fail because Exception wasn't looked up in the // right scope. -ns::Test::Test() throw( Exception ) : i( 1 ) +ns::Test::Test() +#if __cplusplus <= 201402L +throw( Exception ) // { dg-warning "deprecated" "" { target { c++11 && { ! c++1z } } } } +#endif +: i( 1 ) { } -ns::Test::Test( int n ) throw( Exception ) : i( n ) +ns::Test::Test( int n ) +#if __cplusplus <= 201402L +throw( Exception ) // { dg-warning "deprecated" "" { target { c++11 && { ! c++1z } } } } +#endif +: i( n ) { } diff --git a/gcc/testsuite/g++.dg/opt/noreturn-1.C b/gcc/testsuite/g++.dg/opt/noreturn-1.C index 9b2fc0cf16a..8fe2db0d3e3 100644 --- a/gcc/testsuite/g++.dg/opt/noreturn-1.C +++ b/gcc/testsuite/g++.dg/opt/noreturn-1.C @@ -58,16 +58,34 @@ struct Egeneric { }; struct infinint { - void detruit() throw(Egeneric); - template void infinint_from(T a) throw(Egeneric); - infinint(long a = 0) throw(Egeneric) { + void detruit() +#if __cplusplus <= 201402L + throw(Egeneric) // { dg-warning "deprecated" "" { target { c++11 && { ! c++1z } } } } +#endif + ; + template void infinint_from(T a) +#if __cplusplus <= 201402L + throw(Egeneric) // { dg-warning "deprecated" "" { target { c++11 && { ! c++1z } } } } +#endif + ; + infinint(long a = 0) +#if __cplusplus <= 201402L + throw(Egeneric) // { dg-warning "deprecated" "" { target { c++11 && { ! c++1z } } } } +#endif + { try { infinint_from(a); } catch(Egeneric& e) { e.stack("infinint::infinint", "long"); } } - ~infinint() throw(Egeneric) { + ~infinint() +#if __cplusplus <= 201402L + throw(Egeneric) // { dg-warning "deprecated" "" { target { c++11 && { ! c++1z } } } } +#else + noexcept(false) +#endif + { try { detruit(); } catch(Egeneric& e) { } diff --git a/gcc/testsuite/g++.dg/other/error3.C b/gcc/testsuite/g++.dg/other/error3.C index 37ea51ea845..1e645630ab8 100644 --- a/gcc/testsuite/g++.dg/other/error3.C +++ b/gcc/testsuite/g++.dg/other/error3.C @@ -1,5 +1,6 @@ // Test for proper error message formatting; the throw() should go inside // the parens, as below. -void (*g() throw())(); // { dg-message "g\\(\\) throw" "" } +void (*g() throw())(); // { dg-message "g\\(\\) throw" "" { target { ! c++1z } } } + // { dg-message "g\\(\\) noexcept" "" { target c++1z } .-1 } void (*g())(); // { dg-error "" "" } diff --git a/gcc/testsuite/g++.dg/rtti/crash3.C b/gcc/testsuite/g++.dg/rtti/crash3.C index 076e36002d9..111d3b3965f 100644 --- a/gcc/testsuite/g++.dg/rtti/crash3.C +++ b/gcc/testsuite/g++.dg/rtti/crash3.C @@ -5,6 +5,9 @@ class A {}; class B {}; class C : public A, public B {}; class D : public C {}; -void f () throw (D) +void f () +#if __cplusplus <= 201402L +throw (D) // { dg-warning "deprecated" "" { target { c++11 && { ! c++1z } } } } +#endif { } diff --git a/gcc/testsuite/g++.dg/template/eh2.C b/gcc/testsuite/g++.dg/template/eh2.C index 9559b4eccc1..3ed80a46729 100644 --- a/gcc/testsuite/g++.dg/template/eh2.C +++ b/gcc/testsuite/g++.dg/template/eh2.C @@ -1,10 +1,10 @@ // PR c++/23191 // Origin: Volker Reichelt -// { dg-do compile } +// { dg-do compile { target c++14_down } } template struct A { void foo() throw(typename T::X); // { dg-error "not a class" } -}; +}; // { dg-warning "deprecated" "" { target c++11 } .-1 } A a; // { dg-message "required" } diff --git a/gcc/testsuite/g++.dg/template/error36.C b/gcc/testsuite/g++.dg/template/error36.C index 8d3dc63b730..d808c1430b1 100644 --- a/gcc/testsuite/g++.dg/template/error36.C +++ b/gcc/testsuite/g++.dg/template/error36.C @@ -1,9 +1,11 @@ // PR c++/37719.C +// { dg-do compile { target c++14_down } } template class foo { void bar() throw(int); // { dg-message "throw \\(int\\)" } -}; +}; // { dg-warning "deprecated" "" { target c++11 } .-1 } template <> void foo::bar() throw(float) {} // { dg-error "throw \\(float\\)" } + // { dg-warning "deprecated" "" { target c++11 } .-1 } diff --git a/gcc/testsuite/g++.dg/tm/pr46567.C b/gcc/testsuite/g++.dg/tm/pr46567.C index 2f0ef93f2d4..448c92cd0a2 100644 --- a/gcc/testsuite/g++.dg/tm/pr46567.C +++ b/gcc/testsuite/g++.dg/tm/pr46567.C @@ -1667,8 +1667,16 @@ namespace std typedef void (*new_handler)(); new_handler set_new_handler(new_handler) throw(); } -void* operator new(std::size_t) throw (std::bad_alloc); -void* operator new[](std::size_t) throw (std::bad_alloc); +void* operator new(std::size_t) +#if __cplusplus <= 201402L +throw (std::bad_alloc) // { dg-warning "deprecated" "" { target { c++11 && { ! c++1z } } } } +#endif +; +void* operator new[](std::size_t) +#if __cplusplus <= 201402L +throw (std::bad_alloc) // { dg-warning "deprecated" "" { target { c++11 && { ! c++1z } } } } +#endif +; void operator delete(void*) throw(); void operator delete[](void*) throw(); void* operator new(std::size_t, const std::nothrow_t&) throw(); diff --git a/gcc/testsuite/g++.dg/tm/pr47340.C b/gcc/testsuite/g++.dg/tm/pr47340.C index ead3361fae2..e5075e2c251 100644 --- a/gcc/testsuite/g++.dg/tm/pr47340.C +++ b/gcc/testsuite/g++.dg/tm/pr47340.C @@ -1,7 +1,11 @@ // { dg-do compile } // { dg-options "-fgnu-tm" } -void* operator new(__SIZE_TYPE__) throw (int); +void* operator new(__SIZE_TYPE__) +#if __cplusplus <= 201402L +throw (int) // { dg-warning "deprecated" "" { target { c++11 && { ! c++1z } } } } +#endif +; void *point; diff --git a/gcc/testsuite/g++.dg/torture/pr46364.C b/gcc/testsuite/g++.dg/torture/pr46364.C index 8098991ace0..0160e9a24d5 100644 --- a/gcc/testsuite/g++.dg/torture/pr46364.C +++ b/gcc/testsuite/g++.dg/torture/pr46364.C @@ -1,7 +1,11 @@ // { dg-do compile } #include -void a() throw (int); +void a() +#if __cplusplus <= 201402L +throw (int) // { dg-warning "deprecated" "" { target { c++11 && { ! c++1z } } } } +#endif +; void b(std::string const &); void c(std::string *e) diff --git a/gcc/testsuite/g++.dg/torture/pr49394.C b/gcc/testsuite/g++.dg/torture/pr49394.C index e471885b5e6..cd8cac33c3b 100644 --- a/gcc/testsuite/g++.dg/torture/pr49394.C +++ b/gcc/testsuite/g++.dg/torture/pr49394.C @@ -4,7 +4,10 @@ struct Mutex { bool locked; - ~Mutex () throw(int) + ~Mutex () +#if __cplusplus <= 201402L + throw(int) // { dg-warning "deprecated" "" { target { c++11 && { ! c++1z } } } } +#endif { if (locked) throw 0; diff --git a/gcc/testsuite/g++.dg/torture/pr52918-1.C b/gcc/testsuite/g++.dg/torture/pr52918-1.C index 9e7b21ba6a3..cb95048237b 100644 --- a/gcc/testsuite/g++.dg/torture/pr52918-1.C +++ b/gcc/testsuite/g++.dg/torture/pr52918-1.C @@ -21,9 +21,16 @@ public: class free_list { typedef __mutex __mutex_type; __mutex_type& _M_get_mutex(); - void _M_get(size_t __sz) throw(bad_alloc); + void _M_get(size_t __sz) +#if __cplusplus <= 201402L + throw(bad_alloc) // { dg-warning "deprecated" "" { target { c++11 && { ! c++1z } } } } +#endif + ; }; -void free_list::_M_get(size_t __sz) throw(bad_alloc) +void free_list::_M_get(size_t __sz) +#if __cplusplus <= 201402L +throw(bad_alloc) // { dg-warning "deprecated" "" { target { c++11 && { ! c++1z } } } } +#endif { __mutex_type& __bfl_mutex = _M_get_mutex(); __bfl_mutex.unlock(); diff --git a/gcc/testsuite/g++.dg/torture/pr57190.C b/gcc/testsuite/g++.dg/torture/pr57190.C index 9fa11cd26ba..f3b7ecc1d99 100644 --- a/gcc/testsuite/g++.dg/torture/pr57190.C +++ b/gcc/testsuite/g++.dg/torture/pr57190.C @@ -19,12 +19,24 @@ namespace std { class UIException { }; class PasswordDialog { - void run() throw (UIException); + void run() +#if __cplusplus <= 201402L + throw (UIException) // { dg-warning "deprecated" "" { target { c++11 && { ! c++1z } } } } +#endif + ; }; class MessageBox { public: - MessageBox (std::string t) throw (UIException); - virtual int run() throw (UIException) ; + MessageBox (std::string t) +#if __cplusplus <= 201402L + throw (UIException) // { dg-warning "deprecated" "" { target { c++11 && { ! c++1z } } } } +#endif + ; + virtual int run() +#if __cplusplus <= 201402L + throw (UIException) // { dg-warning "deprecated" "" { target { c++11 && { ! c++1z } } } } +#endif + ; }; extern "C" { struct __jmp_buf_tag { @@ -33,7 +45,10 @@ extern "C" { typedef struct __jmp_buf_tag sigjmp_buf[1]; } sigjmp_buf password_dialog_sig_jmp_buf; -void PasswordDialog::run() throw (UIException) +void PasswordDialog::run() +#if __cplusplus <= 201402L +throw (UIException) // { dg-warning "deprecated" "" { target { c++11 && { ! c++1z } } } } +#endif { __sigsetjmp (password_dialog_sig_jmp_buf, 1); MessageBox* errmsg = __null; diff --git a/gcc/testsuite/g++.dg/torture/stackalign/eh-alloca-1.C b/gcc/testsuite/g++.dg/torture/stackalign/eh-alloca-1.C index 89b0a6a6771..7c124fe330c 100644 --- a/gcc/testsuite/g++.dg/torture/stackalign/eh-alloca-1.C +++ b/gcc/testsuite/g++.dg/torture/stackalign/eh-alloca-1.C @@ -27,7 +27,10 @@ struct A : virtual public Base struct B {}; void -foo (int size) throw (B,A) +foo (int size) +#if __cplusplus <= 201402L +throw (B,A) // { dg-warning "deprecated" "" { target { c++11 && { ! c++1z } } } } +#endif { char *p = (char*) __builtin_alloca (size + 1); aligned i; diff --git a/gcc/testsuite/g++.dg/torture/stackalign/eh-fastcall-1.C b/gcc/testsuite/g++.dg/torture/stackalign/eh-fastcall-1.C index 2c24ea3bcf1..165e7cca14d 100644 --- a/gcc/testsuite/g++.dg/torture/stackalign/eh-fastcall-1.C +++ b/gcc/testsuite/g++.dg/torture/stackalign/eh-fastcall-1.C @@ -21,7 +21,10 @@ struct B {}; __attribute__ ((fastcall)) void -foo (int j, int k, int m, int n, int o) throw (B,A) +foo (int j, int k, int m, int n, int o) +#if __cplusplus <= 201402L +throw (B,A) // { dg-warning "deprecated" "" { target { c++11 && { ! c++1z } } } } +#endif { aligned i; diff --git a/gcc/testsuite/g++.dg/torture/stackalign/eh-global-1.C b/gcc/testsuite/g++.dg/torture/stackalign/eh-global-1.C index cc05ed04f30..48a59ebf22f 100644 --- a/gcc/testsuite/g++.dg/torture/stackalign/eh-global-1.C +++ b/gcc/testsuite/g++.dg/torture/stackalign/eh-global-1.C @@ -21,7 +21,10 @@ struct A : virtual public Base struct B {}; void -foo (void) throw (B,A) +foo (void) +#if __cplusplus <= 201402L +throw (B,A) // { dg-warning "deprecated" "" { target { c++11 && { ! c++1z } } } } +#endif { aligned i; diff --git a/gcc/testsuite/g++.dg/torture/stackalign/eh-inline-1.C b/gcc/testsuite/g++.dg/torture/stackalign/eh-inline-1.C index d2555f2e2c9..b8c04d95ddf 100644 --- a/gcc/testsuite/g++.dg/torture/stackalign/eh-inline-1.C +++ b/gcc/testsuite/g++.dg/torture/stackalign/eh-inline-1.C @@ -22,7 +22,10 @@ struct B {}; static void inline __attribute__((always_inline)) -foo (void) throw (B,A) +foo (void) +#if __cplusplus <= 201402L +throw (B,A) // { dg-warning "deprecated" "" { target { c++11 && { ! c++1z } } } } +#endif { aligned i; diff --git a/gcc/testsuite/g++.dg/torture/stackalign/eh-inline-2.C b/gcc/testsuite/g++.dg/torture/stackalign/eh-inline-2.C index 1cbc68cc493..53ff0ccf18b 100644 --- a/gcc/testsuite/g++.dg/torture/stackalign/eh-inline-2.C +++ b/gcc/testsuite/g++.dg/torture/stackalign/eh-inline-2.C @@ -28,7 +28,10 @@ struct B {}; static void inline __attribute__((always_inline)) -foo (int size) throw (B,A) +foo (int size) +#if __cplusplus <= 201402L +throw (B,A) // { dg-warning "deprecated" "" { target { c++11 && { ! c++1z } } } } +#endif { char *p = (char *) __builtin_alloca (size + 1); aligned i; diff --git a/gcc/testsuite/g++.dg/torture/stackalign/eh-thiscall-1.C b/gcc/testsuite/g++.dg/torture/stackalign/eh-thiscall-1.C index 403497a9a64..44f562aae13 100644 --- a/gcc/testsuite/g++.dg/torture/stackalign/eh-thiscall-1.C +++ b/gcc/testsuite/g++.dg/torture/stackalign/eh-thiscall-1.C @@ -21,7 +21,10 @@ struct B {}; __attribute__ ((thiscall)) void -foo (int j, int k, int m, int n, int o) throw (B,A) +foo (int j, int k, int m, int n, int o) +#if __cplusplus <= 201402L +throw (B,A) // { dg-warning "deprecated" "" { target { c++11 && { ! c++1z } } } } +#endif { aligned i; diff --git a/gcc/testsuite/g++.dg/torture/stackalign/eh-vararg-1.C b/gcc/testsuite/g++.dg/torture/stackalign/eh-vararg-1.C index b9ba81b1297..9c3c0f5db89 100644 --- a/gcc/testsuite/g++.dg/torture/stackalign/eh-vararg-1.C +++ b/gcc/testsuite/g++.dg/torture/stackalign/eh-vararg-1.C @@ -28,7 +28,10 @@ struct A : virtual public Base struct B {}; void -foo (const char *fmt, ...) throw (B,A) +foo (const char *fmt, ...) +#if __cplusplus <= 201402L +throw (B,A) // { dg-warning "deprecated" "" { target { c++11 && { ! c++1z } } } } +#endif { va_list arg; char *p; diff --git a/gcc/testsuite/g++.dg/torture/stackalign/eh-vararg-2.C b/gcc/testsuite/g++.dg/torture/stackalign/eh-vararg-2.C index 5e282179c63..aa9b2bda8fb 100644 --- a/gcc/testsuite/g++.dg/torture/stackalign/eh-vararg-2.C +++ b/gcc/testsuite/g++.dg/torture/stackalign/eh-vararg-2.C @@ -29,7 +29,10 @@ struct A : virtual public Base struct B {}; void -test (va_list arg) throw (B,A) +test (va_list arg) +#if __cplusplus <= 201402L +throw (B,A) // { dg-warning "deprecated" "" { target { c++11 && { ! c++1z } } } } +#endif { char *p; aligned i; diff --git a/gcc/testsuite/g++.dg/tree-ssa/pr45605.C b/gcc/testsuite/g++.dg/tree-ssa/pr45605.C index 4d832458a43..5460021ae62 100644 --- a/gcc/testsuite/g++.dg/tree-ssa/pr45605.C +++ b/gcc/testsuite/g++.dg/tree-ssa/pr45605.C @@ -15,7 +15,11 @@ struct D : public B { } o; struct Raiser { - Raiser() throw( int ) {throw 1;}; + Raiser() +#if __cplusplus <= 201402L + throw( int ) // { dg-warning "deprecated" "" { target { c++11 && { ! c++1z } } } } +#endif + {throw 1;}; } raiser; }; }; diff --git a/gcc/testsuite/g++.dg/warn/Wreturn-type-3.C b/gcc/testsuite/g++.dg/warn/Wreturn-type-3.C index f13d58745ca..78a3851550f 100644 --- a/gcc/testsuite/g++.dg/warn/Wreturn-type-3.C +++ b/gcc/testsuite/g++.dg/warn/Wreturn-type-3.C @@ -3,7 +3,10 @@ struct E{}; -inline int bar() throw(E) +inline int bar() +#if __cplusplus <= 201402L +throw(E) // { dg-warning "deprecated" "" { target { c++11 && { ! c++1z } } } } +#endif { return 0; } diff --git a/gcc/testsuite/g++.old-deja/g++.eh/badalloc1.C b/gcc/testsuite/g++.old-deja/g++.eh/badalloc1.C index f4f443bd325..31c7300c90b 100644 --- a/gcc/testsuite/g++.old-deja/g++.eh/badalloc1.C +++ b/gcc/testsuite/g++.old-deja/g++.eh/badalloc1.C @@ -93,19 +93,28 @@ extern "C" void *realloc (void *p, size_t size) return r; } -void fn_throw() throw(int) +void fn_throw() +#if __cplusplus <= 201402L +throw(int) // { dg-warning "deprecated" "" { target { c++11 && { ! c++1z } } } } +#endif { throw 1; } -void fn_rethrow() throw(int) +void fn_rethrow() +#if __cplusplus <= 201402L +throw(int) // { dg-warning "deprecated" "" { target { c++11 && { ! c++1z } } } } +#endif { try{fn_throw();} catch(int a){ throw;} } -void fn_catchthrow() throw(int) +void fn_catchthrow() +#if __cplusplus <= 201402L +throw(int) // { dg-warning "deprecated" "" { target { c++11 && { ! c++1z } } } } +#endif { try{fn_throw();} catch(int a){ diff --git a/gcc/testsuite/g++.old-deja/g++.eh/cleanup2.C b/gcc/testsuite/g++.old-deja/g++.eh/cleanup2.C index 9538de961b7..d6445124f88 100644 --- a/gcc/testsuite/g++.old-deja/g++.eh/cleanup2.C +++ b/gcc/testsuite/g++.old-deja/g++.eh/cleanup2.C @@ -18,11 +18,18 @@ static int thrower () struct X { - X (int) throw (int); + X (int) +#if __cplusplus <= 201402L + throw (int) // { dg-warning "deprecated" "" { target { c++11 && { ! c++1z } } } } +#endif + ; ~X () throw (); }; -X::X (int) throw (int) +X::X (int) +#if __cplusplus <= 201402L + throw (int) // { dg-warning "deprecated" "" { target { c++11 && { ! c++1z } } } } +#endif {printf ("in ctor X %s\n", __PRETTY_FUNCTION__); bad = true;} X::~X () throw () {printf ("in dtor X %s\n", __PRETTY_FUNCTION__); bad = true;} @@ -30,10 +37,17 @@ X::~X () throw () struct X1 {}; struct Y : X { - Y() throw (int); + Y() +#if __cplusplus <= 201402L + throw (int) // { dg-warning "deprecated" "" { target { c++11 && { ! c++1z } } } } +#endif + ; ~Y() throw (); }; -Y::Y() throw (int) +Y::Y() +#if __cplusplus <= 201402L + throw (int) // { dg-warning "deprecated" "" { target { c++11 && { ! c++1z } } } } +#endif : X(thrower ()) // throws, so X::X is never called {printf ("in ctor Y%s\n", __PRETTY_FUNCTION__); bad = true;} Y::~Y() throw () diff --git a/gcc/testsuite/g++.old-deja/g++.eh/spec1.C b/gcc/testsuite/g++.old-deja/g++.eh/spec1.C index 0ff888369f2..ea320451179 100644 --- a/gcc/testsuite/g++.old-deja/g++.eh/spec1.C +++ b/gcc/testsuite/g++.old-deja/g++.eh/spec1.C @@ -1,4 +1,4 @@ -// { dg-do run } +// { dg-do run { target c++14_down } } // Testing exception specifications. // Test 1: the original exception succeeds. @@ -9,7 +9,7 @@ void my_term () { exit (1); } void my_unexp () { throw 42; } void -f () throw (char, int, std::bad_exception) +f () throw (char, int, std::bad_exception) // { dg-warning "deprecated" "" { target c++11 } } { throw 'a'; } diff --git a/gcc/testsuite/g++.old-deja/g++.eh/spec2.C b/gcc/testsuite/g++.old-deja/g++.eh/spec2.C index 5c7a91399e9..d1aa6984f9f 100644 --- a/gcc/testsuite/g++.old-deja/g++.eh/spec2.C +++ b/gcc/testsuite/g++.old-deja/g++.eh/spec2.C @@ -1,4 +1,4 @@ -// { dg-do run } +// { dg-do run { target c++14_down } } // Testing exception specifications. // Test 2: the second throw succeeds. @@ -9,7 +9,7 @@ void my_term () { exit (1); } void my_unexp () { throw 42; } void -f () throw (int, std::bad_exception) +f () throw (int, std::bad_exception) // { dg-warning "deprecated" "" { target c++11 } } { throw 'a'; } diff --git a/gcc/testsuite/g++.old-deja/g++.eh/spec3.C b/gcc/testsuite/g++.old-deja/g++.eh/spec3.C index 6239270ee37..1d57df3c335 100644 --- a/gcc/testsuite/g++.old-deja/g++.eh/spec3.C +++ b/gcc/testsuite/g++.old-deja/g++.eh/spec3.C @@ -1,4 +1,4 @@ -// { dg-do run } +// { dg-do run { target c++14_down } } // Testing exception specifications. // Test 3: the bad_exception throw succeeds. @@ -9,7 +9,7 @@ void my_term () { exit (1); } void my_unexp () { throw 42; } void -f () throw (std::bad_exception) +f () throw (std::bad_exception) // { dg-warning "deprecated" "" { target c++11 } } { throw 'a'; } diff --git a/gcc/testsuite/g++.old-deja/g++.eh/spec4.C b/gcc/testsuite/g++.old-deja/g++.eh/spec4.C index e1f702e2039..e102239ed89 100644 --- a/gcc/testsuite/g++.old-deja/g++.eh/spec4.C +++ b/gcc/testsuite/g++.old-deja/g++.eh/spec4.C @@ -1,4 +1,4 @@ -// { dg-do run } +// { dg-do run { target c++14_down } } // Testing exception specifications. // Test 4: all throws fail, call terminate. @@ -9,7 +9,7 @@ void my_term () { exit (0); } void my_unexp () { throw 42; } void -f () throw (short) +f () throw (short) // { dg-warning "deprecated" "" { target c++11 } } { throw 'a'; } diff --git a/gcc/testsuite/g++.old-deja/g++.eh/spec6.C b/gcc/testsuite/g++.old-deja/g++.eh/spec6.C index 7aa474b12ab..ed485e299ec 100644 --- a/gcc/testsuite/g++.old-deja/g++.eh/spec6.C +++ b/gcc/testsuite/g++.old-deja/g++.eh/spec6.C @@ -1,4 +1,5 @@ -// { dg-do assemble } +// { dg-do assemble { target c++14_down } } +// { dg-additional-options "-Wno-deprecated" } // Copyright (C) 1999 Free Software Foundation, Inc. // Contributed by Nathan Sidwell 19 Jan 1999 diff --git a/gcc/testsuite/g++.old-deja/g++.eh/throw1.C b/gcc/testsuite/g++.old-deja/g++.eh/throw1.C index e5d234be3c3..3c4813e3f74 100644 --- a/gcc/testsuite/g++.old-deja/g++.eh/throw1.C +++ b/gcc/testsuite/g++.old-deja/g++.eh/throw1.C @@ -1,6 +1,9 @@ // { dg-do assemble } -void athrow(const int & e) throw(int) +void athrow(const int & e) +#if __cplusplus <= 201402L +throw(int) // { dg-warning "deprecated" "" { target { c++11 && { ! c++1z } } } } +#endif { throw e; } diff --git a/gcc/testsuite/g++.old-deja/g++.eh/throw2.C b/gcc/testsuite/g++.old-deja/g++.eh/throw2.C index 63bb029d906..b4296ac4501 100644 --- a/gcc/testsuite/g++.old-deja/g++.eh/throw2.C +++ b/gcc/testsuite/g++.old-deja/g++.eh/throw2.C @@ -4,7 +4,10 @@ #define ANY int // a class with a public constructor -void athrow(const ANY & e) throw(ANY) +void athrow(const ANY & e) +#if __cplusplus <= 201402L +throw(ANY) // { dg-warning "deprecated" "" { target { c++11 && { ! c++1z } } } } +#endif { throw e; // { dg-bogus "" } discarding const } diff --git a/gcc/testsuite/g++.old-deja/g++.eh/tmpl1.C b/gcc/testsuite/g++.old-deja/g++.eh/tmpl1.C index 985fcae6bc6..c64a5222b84 100644 --- a/gcc/testsuite/g++.old-deja/g++.eh/tmpl1.C +++ b/gcc/testsuite/g++.old-deja/g++.eh/tmpl1.C @@ -1,6 +1,9 @@ // { dg-do run } template -void f() throw (T) +void f() +#if __cplusplus <= 201402L +throw (T) // { dg-warning "deprecated" "" { target { c++11 && { ! c++1z } } } } +#endif { throw 7; } diff --git a/gcc/testsuite/g++.old-deja/g++.eh/tmpl3.C b/gcc/testsuite/g++.old-deja/g++.eh/tmpl3.C index 0ddf63c98be..4fc869d90b8 100644 --- a/gcc/testsuite/g++.old-deja/g++.eh/tmpl3.C +++ b/gcc/testsuite/g++.old-deja/g++.eh/tmpl3.C @@ -3,9 +3,16 @@ // Posted by Trevor Taylor template struct A { - void X() throw(T); + void X() +#if __cplusplus <= 201402L + throw(T) // { dg-warning "deprecated" "" { target { c++11 && { ! c++1z } } } } +#endif + ; }; template inline void A::X() -throw(T) { } +#if __cplusplus <= 201402L +throw(T) // { dg-warning "deprecated" "" { target { c++11 && { ! c++1z } } } } +#endif +{ } diff --git a/gcc/testsuite/g++.old-deja/g++.mike/eh15.C b/gcc/testsuite/g++.old-deja/g++.mike/eh15.C index 4418f160766..a8690be7ec3 100644 --- a/gcc/testsuite/g++.old-deja/g++.mike/eh15.C +++ b/gcc/testsuite/g++.old-deja/g++.mike/eh15.C @@ -1,6 +1,6 @@ -// { dg-do assemble } +// { dg-do assemble { target c++14_down } } // { dg-options "-fexceptions" } struct A { - A() throw (int); + A() throw (int); // { dg-warning "deprecated" "" { target c++11 } } }; diff --git a/gcc/testsuite/g++.old-deja/g++.mike/eh25.C b/gcc/testsuite/g++.old-deja/g++.mike/eh25.C index f3728cf126f..a6ffd3375b5 100644 --- a/gcc/testsuite/g++.old-deja/g++.mike/eh25.C +++ b/gcc/testsuite/g++.old-deja/g++.mike/eh25.C @@ -10,7 +10,13 @@ void my_terminate() { struct A { A() { } - ~A() throw(int) { + ~A() +#if __cplusplus <= 201402L + throw(int) // { dg-warning "deprecated" "" { target { c++11 && { ! c++1z } } } } +#else + noexcept(false) +#endif + { std::set_terminate (my_terminate); throw 1; // This throws from EH dtor, should call my_terminate } diff --git a/gcc/testsuite/g++.old-deja/g++.mike/eh33.C b/gcc/testsuite/g++.old-deja/g++.mike/eh33.C index b679991e463..cffb0c48cda 100644 --- a/gcc/testsuite/g++.old-deja/g++.mike/eh33.C +++ b/gcc/testsuite/g++.old-deja/g++.mike/eh33.C @@ -1,4 +1,5 @@ // { dg-do run { xfail sparc64-*-elf z8k-*-* arm-*-pe } } +// { dg-require-effective-target c++14_down } // { dg-options "-fexceptions" } #include @@ -7,7 +8,7 @@ void my_unexpected() { throw 42; } -void foo() throw (int) { throw "Hi"; } +void foo() throw (int) { throw "Hi"; } // { dg-warning "deprecated" "" { target c++11 } } int main() { std::set_unexpected (my_unexpected); diff --git a/gcc/testsuite/g++.old-deja/g++.mike/eh34.C b/gcc/testsuite/g++.old-deja/g++.mike/eh34.C index 056f6b8df74..3218dd9ef3e 100644 --- a/gcc/testsuite/g++.old-deja/g++.mike/eh34.C +++ b/gcc/testsuite/g++.old-deja/g++.mike/eh34.C @@ -1,4 +1,5 @@ // { dg-do run { xfail sparc64-*-elf arm-*-pe } } +// { dg-require-effective-target c++14_down } #include #include diff --git a/gcc/testsuite/g++.old-deja/g++.mike/eh50.C b/gcc/testsuite/g++.old-deja/g++.mike/eh50.C index de21dc2f402..0ebaab41fa6 100644 --- a/gcc/testsuite/g++.old-deja/g++.mike/eh50.C +++ b/gcc/testsuite/g++.old-deja/g++.mike/eh50.C @@ -1,4 +1,5 @@ // { dg-do run { xfail sparc64-*-elf z8k-*-* arm-*-pe } } +// { dg-require-effective-target c++14_down } // { dg-options "-fexceptions" } #include @@ -7,7 +8,7 @@ void my_unexpected() { throw 42; } -template void foo(T) throw (int) { throw "Hi"; } +template void foo(T) throw (int) { throw "Hi"; } // { dg-warning "deprecated" "" { target c++11 } } main() { std::set_unexpected (my_unexpected); diff --git a/gcc/testsuite/g++.old-deja/g++.mike/eh51.C b/gcc/testsuite/g++.old-deja/g++.mike/eh51.C index 073980a5346..7d3cd413ee7 100644 --- a/gcc/testsuite/g++.old-deja/g++.mike/eh51.C +++ b/gcc/testsuite/g++.old-deja/g++.mike/eh51.C @@ -1,4 +1,5 @@ // { dg-do run { xfail sparc64-*-elf z8k-*-* arm-*-pe } } +// { dg-require-effective-target c++14_down } // { dg-options "-fexceptions" } #include @@ -7,7 +8,7 @@ void my_unexpected() { throw 42; } -template void foo(T) throw (T) { throw "Hi"; } +template void foo(T) throw (T) { throw "Hi"; } // { dg-warning "deprecated" "" { target c++11 } } main() { std::set_unexpected (my_unexpected); diff --git a/gcc/testsuite/g++.old-deja/g++.mike/eh55.C b/gcc/testsuite/g++.old-deja/g++.mike/eh55.C index 1482680745f..8b574f57d7b 100644 --- a/gcc/testsuite/g++.old-deja/g++.mike/eh55.C +++ b/gcc/testsuite/g++.old-deja/g++.mike/eh55.C @@ -9,7 +9,7 @@ void my_terminate_handler() { } void throw_an_unexpected_exception() throw() { - throw 1; + throw 1; // { dg-warning "throw will always call terminate" "" { target c++1z } } } int main() { diff --git a/gcc/testsuite/g++.old-deja/g++.mike/p10416.C b/gcc/testsuite/g++.old-deja/g++.mike/p10416.C index 2d21d19dda3..766a27b4be7 100644 --- a/gcc/testsuite/g++.old-deja/g++.mike/p10416.C +++ b/gcc/testsuite/g++.old-deja/g++.mike/p10416.C @@ -5,5 +5,9 @@ class not_ok { public: - void f() throw(int) { } + void f() +#if __cplusplus <= 201402L + throw(int) // { dg-warning "deprecated" "" { target { c++11 && { ! c++1z } } } } +#endif + { } }; diff --git a/gcc/testsuite/g++.old-deja/g++.other/crash28.C b/gcc/testsuite/g++.old-deja/g++.other/crash28.C index c0f4bfa66e6..5ff84edafef 100644 --- a/gcc/testsuite/g++.old-deja/g++.other/crash28.C +++ b/gcc/testsuite/g++.old-deja/g++.other/crash28.C @@ -27,9 +27,16 @@ class foo bool b; public: foo(); - void x () throw(bar); + void x () +#if __cplusplus <= 201402L + throw(bar) // { dg-warning "deprecated" "" { target { c++11 && { ! c++1z } } } } +#endif + ; }; -void foo::x() throw(bar) +void foo::x() +#if __cplusplus <= 201402L +throw(bar) // { dg-warning "deprecated" "" { target { c++11 && { ! c++1z } } } } +#endif { if (!b) throw bar (static_cast<::N::X*>(this)); // { dg-error "lambda expressions|expected|invalid" } parse error } diff --git a/gcc/testsuite/g++.old-deja/g++.other/crash30.C b/gcc/testsuite/g++.old-deja/g++.other/crash30.C index 043d54fa4c9..50ecfd9d97f 100644 --- a/gcc/testsuite/g++.old-deja/g++.other/crash30.C +++ b/gcc/testsuite/g++.old-deja/g++.other/crash30.C @@ -8,7 +8,7 @@ struct foo }; void foo::x() throw(bar) // { dg-error "" } parse error -{ +{ // { dg-warning "deprecated" "" { target { c++11 && { ! c++1z } } } .-1 } } void bar() diff --git a/gcc/testsuite/g++.old-deja/g++.other/new7.C b/gcc/testsuite/g++.old-deja/g++.other/new7.C index 0c0643e62e8..82eabb6d7d8 100644 --- a/gcc/testsuite/g++.old-deja/g++.other/new7.C +++ b/gcc/testsuite/g++.old-deja/g++.other/new7.C @@ -13,7 +13,10 @@ struct X { { throw 1; } - void* operator new ( std::size_t n ) throw ( std::bad_alloc ) + void* operator new ( std::size_t n ) +#if __cplusplus <= 201402L + throw ( std::bad_alloc ) // { dg-warning "deprecated" "" { target { c++11 && { ! c++1z } } } } +#endif { new_flag = true; return ::operator new( n ); diff --git a/gcc/testsuite/g++.old-deja/g++.pt/ehspec1.C b/gcc/testsuite/g++.old-deja/g++.pt/ehspec1.C index e75704e776a..3630e1fbdda 100644 --- a/gcc/testsuite/g++.old-deja/g++.pt/ehspec1.C +++ b/gcc/testsuite/g++.old-deja/g++.pt/ehspec1.C @@ -1,6 +1,6 @@ -// { dg-do assemble } +// { dg-do assemble { target c++14_down } } // Bug: g++ forgets to instantiate A // Contributed by Jason Merrill template struct A { }; -void f () throw (A); +void f () throw (A); // { dg-warning "deprecated" "" { target c++11 } } diff --git a/gcc/testsuite/g++.old-deja/g++.robertl/eb123.C b/gcc/testsuite/g++.old-deja/g++.robertl/eb123.C index cb4505f7e0b..b22f4eb54bb 100644 --- a/gcc/testsuite/g++.old-deja/g++.robertl/eb123.C +++ b/gcc/testsuite/g++.old-deja/g++.robertl/eb123.C @@ -2,7 +2,10 @@ // { dg-options "-O2 -W " } #include "stdio.h" -void writeNote() throw( int ) +void writeNote() +#if __cplusplus <= 201402L +throw( int ) // { dg-warning "deprecated" "" { target { c++11 && { ! c++1z } } } } +#endif { printf( "hello world\n" ); try { } diff --git a/libstdc++-v3/ChangeLog b/libstdc++-v3/ChangeLog index 085b95a3d0c..15e1aafc2ef 100644 --- a/libstdc++-v3/ChangeLog +++ b/libstdc++-v3/ChangeLog @@ -1,3 +1,8 @@ +2016-12-08 Jakub Jelinek + + * testsuite/util/testsuite_new_operators.h: Include testsuite_hooks.h. + (operator new): Use THROW macro. + 2016-12-07 François Dumont * include/bits/stl_tree.h diff --git a/libstdc++-v3/testsuite/util/testsuite_new_operators.h b/libstdc++-v3/testsuite/util/testsuite_new_operators.h index 6713fb83ed8..dea6fbe9eab 100644 --- a/libstdc++-v3/testsuite/util/testsuite_new_operators.h +++ b/libstdc++-v3/testsuite/util/testsuite_new_operators.h @@ -23,6 +23,7 @@ #define _GLIBCXX_TESTSUITE_NEW_OPERATORS_H #include +#include namespace __gnu_test { @@ -38,7 +39,7 @@ namespace __gnu_test { get_new_limit() = l; } } -void* operator new(std::size_t size) throw(std::bad_alloc) +void* operator new(std::size_t size) THROW(std::bad_alloc) { if (size > __gnu_test::get_new_limit()) throw std::bad_alloc(); -- 2.30.2