diff options
author | Jonathan Wakely <jwakely@redhat.com> | 2019-10-24 12:55:27 +0000 |
---|---|---|
committer | Jonathan Wakely <jwakely@redhat.com> | 2019-10-24 12:55:27 +0000 |
commit | e6dec63873e579dc4c40c9104d75f30a066e064f (patch) | |
tree | 12f78f2258b0d0af1b171d9183d85776f30a515d /libstdc++-v3/libsupc++/eh_term_handler.cc | |
parent | 8fb3c7589ea0dc64e62976b611b2a0f63e250295 (diff) |
PR libstdc++/90682 allow set_terminate(0) and set_unexpected(0)
Make these functions restore the default handlers when passed a null
pointer. This is consistent with std::pmr::set_default_resource(0), and
also matches the current behaviour of libc++.
In order to avoid duplicating the preprocessor condition from
eh_term_handler.cc more that into a new eh_term_handler.h header and
define a macro that can be used in both eh_term_handler.cc and
eh_terminate.cc.
Backport from mainline
2019-05-31 Jonathan Wakely <jwakely@redhat.com>
PR libstdc++/90682
* libsupc++/eh_term_handler.cc: Include eh_term_handler.h to get
definition of _GLIBCXX_DEFAULT_TERM_HANDLER.
* libsupc++/eh_term_handler.h: New header defining
_GLIBCXX_DEFAULT_TERM_HANDLER.
* libsupc++/eh_terminate.cc: Include eh_term_handler.h.
(set_terminate): Restore default handler when argument is null.
(set_unexpected): Likewise.
* testsuite/18_support/set_terminate.cc: New test.
* testsuite/18_support/set_unexpected.cc: New test.
git-svn-id: https://gcc.gnu.org/svn/gcc/branches/gcc-9-branch@277393 138bc75d-0d04-0410-961f-82ee72b054a4
Diffstat (limited to 'libstdc++-v3/libsupc++/eh_term_handler.cc')
-rw-r--r-- | libstdc++-v3/libsupc++/eh_term_handler.cc | 17 |
1 files changed, 2 insertions, 15 deletions
diff --git a/libstdc++-v3/libsupc++/eh_term_handler.cc b/libstdc++-v3/libsupc++/eh_term_handler.cc index 6a368c0699e..4b330bc9177 100644 --- a/libstdc++-v3/libsupc++/eh_term_handler.cc +++ b/libstdc++-v3/libsupc++/eh_term_handler.cc @@ -24,21 +24,8 @@ #include <bits/c++config.h> #include "unwind-cxx.h" +#include "eh_term_handler.h" -/* We default to the talkative, informative handler in a normal hosted - library. This pulls in the demangler, the dyn-string utilities, and - elements of the I/O library. For a low-memory environment, you can return - to the earlier "silent death" handler by configuring GCC with - --disable-libstdcxx-verbose and rebuilding the library. - In a freestanding environment, we default to this latter approach. */ - -#if _GLIBCXX_HOSTED && _GLIBCXX_VERBOSE && __cpp_exceptions /* The current installed user handler. */ std::terminate_handler __cxxabiv1::__terminate_handler = - __gnu_cxx::__verbose_terminate_handler; -#else -# include <cstdlib> -/* The current installed user handler. */ -std::terminate_handler __cxxabiv1::__terminate_handler = std::abort; -#endif - + _GLIBCXX_DEFAULT_TERM_HANDLER; |