diff options
author | Jonathan Wakely <jwakely@redhat.com> | 2021-09-29 21:18:42 +0100 |
---|---|---|
committer | Jonathan Wakely <jwakely@redhat.com> | 2021-11-04 20:53:29 +0000 |
commit | f4130a3eb545ab1aaf3ecb44f3d06b43e3751e04 (patch) | |
tree | 9216f737dfea5c6ac5d76f21b1232c8878e16aa7 /libstdc++-v3/testsuite/18_support | |
parent | 79fe28d2c4b78562de095c1843d8d3b1a1e7d2d7 (diff) | |
download | gcc-f4130a3eb545ab1aaf3ecb44f3d06b43e3751e04.zip gcc-f4130a3eb545ab1aaf3ecb44f3d06b43e3751e04.tar.gz gcc-f4130a3eb545ab1aaf3ecb44f3d06b43e3751e04.tar.bz2 |
libstdc++: Deprecate std::unexpected and handler functions
These functions have been deprecated since C++11, and were removed in
C++17. The proposal P0323 wants to reuse the name std::unexpected for a
class template, so we will need to stop defining the current function
for C++23 anyway.
This marks them as deprecated for C++11 and up, to warn users they won't
continue to be available. It disables them for C++17 and up, unless the
_GLIBCXX_USE_DEPRECATED macro is defined.
The <unwind-cxx.h> header uses std::unexpected_handler in the public
API, but since that type is the same as std::terminate_handler we can
just use that instead, to avoid warnings about it being deprecated.
libstdc++-v3/ChangeLog:
* doc/xml/manual/evolution.xml: Document deprecations.
* doc/html/*: Regenerate.
* libsupc++/exception (unexpected_handler, unexpected)
(get_unexpected, set_unexpected): Add deprecated attribute.
Do not define without _GLIBCXX_USE_DEPRECATED for C++17 and up.
* libsupc++/eh_personality.cc (PERSONALITY_FUNCTION): Disable
deprecated warnings.
* libsupc++/eh_ptr.cc (std::rethrow_exception): Likewise.
* libsupc++/eh_terminate.cc: Likewise.
* libsupc++/eh_throw.cc (__cxa_init_primary_exception):
Likewise.
* libsupc++/unwind-cxx.h (struct __cxa_exception): Use
terminate_handler instead of unexpected_handler.
(struct __cxa_dependent_exception): Likewise.
(__unexpected): Likewise.
* testsuite/18_support/headers/exception/synopsis.cc: Add
dg-warning for deprecated warning.
* testsuite/18_support/exception_ptr/60612-unexpected.cc:
Disable deprecated warnings.
* testsuite/18_support/set_unexpected.cc: Likewise.
* testsuite/18_support/unexpected_handler.cc: Likewise.
gcc/testsuite/ChangeLog:
* g++.dg/cpp0x/lambda/lambda-eh2.C: Add dg-warning for new
deprecation warnings.
* g++.dg/cpp0x/noexcept06.C: Likewise.
* g++.dg/cpp0x/noexcept07.C: Likewise.
* g++.dg/eh/forced3.C: Likewise.
* g++.dg/eh/unexpected1.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++.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.
Diffstat (limited to 'libstdc++-v3/testsuite/18_support')
4 files changed, 4 insertions, 2 deletions
diff --git a/libstdc++-v3/testsuite/18_support/exception_ptr/60612-unexpected.cc b/libstdc++-v3/testsuite/18_support/exception_ptr/60612-unexpected.cc index 600ccb5..18bd1fe 100644 --- a/libstdc++-v3/testsuite/18_support/exception_ptr/60612-unexpected.cc +++ b/libstdc++-v3/testsuite/18_support/exception_ptr/60612-unexpected.cc @@ -1,3 +1,4 @@ +// { dg-options "-Wno-deprecated-declarations" } // { dg-do run { target { c++11_only || c++14_only } } } // Copyright (C) 2014-2021 Free Software Foundation, Inc. diff --git a/libstdc++-v3/testsuite/18_support/headers/exception/synopsis.cc b/libstdc++-v3/testsuite/18_support/headers/exception/synopsis.cc index 2f0bae4..de35ec4 100644 --- a/libstdc++-v3/testsuite/18_support/headers/exception/synopsis.cc +++ b/libstdc++-v3/testsuite/18_support/headers/exception/synopsis.cc @@ -24,7 +24,7 @@ namespace std { class bad_exception; typedef void (*unexpected_handler)(); - unexpected_handler set_unexpected(unexpected_handler f ) throw(); + unexpected_handler set_unexpected(unexpected_handler f ) throw(); // { dg-warning "deprecated" { target c++11 } } unexpected_handler get_unexpected() noexcept; void unexpected(); diff --git a/libstdc++-v3/testsuite/18_support/set_unexpected.cc b/libstdc++-v3/testsuite/18_support/set_unexpected.cc index 3f38431..6cedc7d 100644 --- a/libstdc++-v3/testsuite/18_support/set_unexpected.cc +++ b/libstdc++-v3/testsuite/18_support/set_unexpected.cc @@ -15,7 +15,7 @@ // with this library; see the file COPYING3. If not see // <http://www.gnu.org/licenses/>. -// { dg-options "-std=gnu++11" } +// { dg-options "-std=gnu++11 -Wno-deprecated-declarations" } // { dg-do run { target { c++11_only || c++14_only } } } #include <exception> diff --git a/libstdc++-v3/testsuite/18_support/unexpected_handler.cc b/libstdc++-v3/testsuite/18_support/unexpected_handler.cc index 509bb5c..551b0e7 100644 --- a/libstdc++-v3/testsuite/18_support/unexpected_handler.cc +++ b/libstdc++-v3/testsuite/18_support/unexpected_handler.cc @@ -15,6 +15,7 @@ // with this library; see the file COPYING3. If not see // <http://www.gnu.org/licenses/>. +// { dg-options "-Wno-deprecated-declarations" } // { dg-do run { target c++11 } } // D.11 Violating exception-specifications |