diff options
author | Ed Maste <emaste@FreeBSD.org> | 2024-10-31 15:48:07 +0000 |
---|---|---|
committer | Ed Maste <emaste@FreeBSD.org> | 2024-10-31 15:48:07 +0000 |
commit | f177240452aa5577d9089fe982c1514136c68a2d (patch) | |
tree | 602477aad5ab5ff4aa2d940d839fecbee3bf795b | |
parent | 5a07cb04925d79523b5cf1cb11edfbc74b828af7 (diff) |
-rw-r--r-- | exception.cc | 26 |
1 files changed, 16 insertions, 10 deletions
diff --git a/exception.cc b/exception.cc index c87fe5ac4468..5034809a1380 100644 --- a/exception.cc +++ b/exception.cc @@ -237,7 +237,7 @@ static_assert(offsetof(__cxa_dependent_exception, unwindHeader) == namespace std { - void unexpected(); + [[noreturn]] void unexpected(); class exception { public: @@ -1530,28 +1530,34 @@ namespace std if (0 != info && 0 != info->terminateHandler) { info->terminateHandler(); - // Should not be reached - a terminate handler is not expected to - // return. - abort(); } - terminateHandler.load()(); + else + { + terminateHandler.load()(); + } + // Should not be reached - a terminate handler is not expected + // to return. + abort(); } /** * Called when an unexpected exception is encountered (i.e. an exception * violates an exception specification). This calls abort() unless a * custom handler has been set.. */ - void unexpected() + [[noreturn]] void unexpected() { static __cxa_thread_info *info = thread_info(); if (0 != info && 0 != info->unexpectedHandler) { info->unexpectedHandler(); - // Should not be reached - a terminate handler is not expected to - // return. - abort(); } - unexpectedHandler.load()(); + else + { + unexpectedHandler.load()(); + } + // Should not be reached - a unexpected handler is not expected + // to return. + abort(); } /** * Returns whether there are any exceptions currently being thrown that |