]> git.ipfire.org Git - thirdparty/gcc.git/commit
libstdc++: Deprecate std::unexpected and handler functions
authorJonathan Wakely <jwakely@redhat.com>
Wed, 29 Sep 2021 20:18:42 +0000 (21:18 +0100)
committerJonathan Wakely <jwakely@redhat.com>
Thu, 4 Nov 2021 20:53:29 +0000 (20:53 +0000)
commitf4130a3eb545ab1aaf3ecb44f3d06b43e3751e04
tree9216f737dfea5c6ac5d76f21b1232c8878e16aa7
parent79fe28d2c4b78562de095c1843d8d3b1a1e7d2d7
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.
25 files changed:
gcc/testsuite/g++.dg/cpp0x/lambda/lambda-eh2.C
gcc/testsuite/g++.dg/cpp0x/noexcept06.C
gcc/testsuite/g++.dg/cpp0x/noexcept07.C
gcc/testsuite/g++.dg/eh/forced3.C
gcc/testsuite/g++.dg/eh/unexpected1.C
gcc/testsuite/g++.old-deja/g++.eh/spec1.C
gcc/testsuite/g++.old-deja/g++.eh/spec2.C
gcc/testsuite/g++.old-deja/g++.eh/spec3.C
gcc/testsuite/g++.old-deja/g++.eh/spec4.C
gcc/testsuite/g++.old-deja/g++.mike/eh33.C
gcc/testsuite/g++.old-deja/g++.mike/eh34.C
gcc/testsuite/g++.old-deja/g++.mike/eh50.C
gcc/testsuite/g++.old-deja/g++.mike/eh51.C
libstdc++-v3/doc/html/manual/api.html
libstdc++-v3/doc/xml/manual/evolution.xml
libstdc++-v3/libsupc++/eh_personality.cc
libstdc++-v3/libsupc++/eh_ptr.cc
libstdc++-v3/libsupc++/eh_terminate.cc
libstdc++-v3/libsupc++/eh_throw.cc
libstdc++-v3/libsupc++/exception
libstdc++-v3/libsupc++/unwind-cxx.h
libstdc++-v3/testsuite/18_support/exception_ptr/60612-unexpected.cc
libstdc++-v3/testsuite/18_support/headers/exception/synopsis.cc
libstdc++-v3/testsuite/18_support/set_unexpected.cc
libstdc++-v3/testsuite/18_support/unexpected_handler.cc