https://gcc.gnu.org/bugzilla/show_bug.cgi?id=90682

--- Comment #6 from Jonathan Wakely <redi at gcc dot gnu.org> ---
Author: redi
Date: Thu Oct 24 12:55:27 2019
New Revision: 277393

URL: https://gcc.gnu.org/viewcvs?rev=277393&root=gcc&view=rev
Log:
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  <jwak...@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.

Added:
    branches/gcc-9-branch/libstdc++-v3/libsupc++/eh_term_handler.h
      - copied, changed from r277392,
branches/gcc-9-branch/libstdc++-v3/libsupc++/eh_term_handler.cc
    branches/gcc-9-branch/libstdc++-v3/testsuite/18_support/set_terminate.cc
    branches/gcc-9-branch/libstdc++-v3/testsuite/18_support/set_unexpected.cc
Modified:
    branches/gcc-9-branch/libstdc++-v3/ChangeLog
    branches/gcc-9-branch/libstdc++-v3/libsupc++/eh_term_handler.cc
    branches/gcc-9-branch/libstdc++-v3/libsupc++/eh_terminate.cc

Reply via email to