summaryrefslogtreecommitdiff
path: root/src/cxa_default_handlers.cpp
diff options
context:
space:
mode:
authorDave Zarzycki <zarzycki@apple.com>2012-03-15 08:58:06 +0000
committerDave Zarzycki <zarzycki@apple.com>2012-03-15 08:58:06 +0000
commit2507beff620a5d748de01b83bb8f33adcb228c0e (patch)
tree02aeda9c49ff02834e4b666f75948bdd21e2446a /src/cxa_default_handlers.cpp
parent439ce87946c310a093f4d39a2636ce6b4682bdac (diff)
Be friendly to when dead_strip doesn't work
Apple Radar: 11053417 git-svn-id: https://llvm.org/svn/llvm-project/libcxxabi/trunk@152785 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'src/cxa_default_handlers.cpp')
-rw-r--r--src/cxa_default_handlers.cpp23
1 files changed, 21 insertions, 2 deletions
diff --git a/src/cxa_default_handlers.cpp b/src/cxa_default_handlers.cpp
index ae18b3e..79ac00d 100644
--- a/src/cxa_default_handlers.cpp
+++ b/src/cxa_default_handlers.cpp
@@ -94,5 +94,24 @@ void default_unexpected_handler()
//
std::terminate_handler __cxa_terminate_handler = default_terminate_handler;
std::unexpected_handler __cxa_unexpected_handler = default_unexpected_handler;
-std::new_handler __cxa_new_handler = 0;
-
+
+namespace std
+{
+
+unexpected_handler
+set_unexpected(unexpected_handler func) _NOEXCEPT
+{
+ if (func == 0)
+ func = default_unexpected_handler;
+ return __sync_lock_test_and_set(&__cxxabiapple::__cxa_unexpected_handler, func);
+}
+
+terminate_handler
+set_terminate(terminate_handler func) _NOEXCEPT
+{
+ if (func == 0)
+ func = default_terminate_handler;
+ return __sync_lock_test_and_set(&__cxxabiapple::__cxa_terminate_handler, func);
+}
+
+};