diff options
| -rw-r--r-- | libcxxabi/include/cxxabi.h | 17 | ||||
| -rw-r--r-- | libcxxabi/src/cxa_default_handlers.cpp | 13 | ||||
| -rw-r--r-- | libcxxabi/src/cxa_default_handlers.hpp | 19 | ||||
| -rw-r--r-- | libcxxabi/src/cxa_exception.hpp | 5 | ||||
| -rw-r--r-- | libcxxabi/src/cxa_handlers.cpp | 13 | ||||
| -rw-r--r-- | libcxxabi/src/cxa_handlers.hpp | 14 | 
6 files changed, 31 insertions, 50 deletions
| diff --git a/libcxxabi/include/cxxabi.h b/libcxxabi/include/cxxabi.h index f769b86fe20..66ef6d46a2a 100644 --- a/libcxxabi/include/cxxabi.h +++ b/libcxxabi/include/cxxabi.h @@ -172,21 +172,4 @@ extern bool __cxa_uncaught_exception() throw();  namespace abi = __cxxabiv1; -// Below are Apple extensions to support implementing C++ ABI in a seperate dylib -namespace __cxxabiapple -{ -extern "C" -{ - -// Apple additions to support multiple STL stacks that share common  -// terminate, unexpected, and new handlers -//   But touching these is a bad idea.  It is not thread safe. -//   Use get_terminate, set_terminate, etc. instead. -extern void (*__cxa_terminate_handler)(); -extern void (*__cxa_unexpected_handler)(); -extern void (*__cxa_new_handler)(); - -} // extern "C" -} // namespace __cxxabiv1 -  #endif // __CXXABI_H  diff --git a/libcxxabi/src/cxa_default_handlers.cpp b/libcxxabi/src/cxa_default_handlers.cpp index 403ed04429a..726f7eb0e0a 100644 --- a/libcxxabi/src/cxa_default_handlers.cpp +++ b/libcxxabi/src/cxa_default_handlers.cpp @@ -17,7 +17,6 @@  #include "cxa_handlers.hpp"  #include "cxa_exception.hpp"  #include "private_typeinfo.h" -#include "cxa_default_handlers.hpp"  __attribute__((noreturn))  static void default_handler(const char* cause) @@ -76,14 +75,14 @@ static void default_handler(const char* cause)  } -__attribute__((visibility("hidden"), noreturn)) -void default_terminate_handler()  +__attribute__((noreturn)) +static void default_terminate_handler()   {  	default_handler("terminate");  } -__attribute__((visibility("hidden"), noreturn)) -void default_unexpected_handler()  +__attribute__((noreturn)) +static void default_unexpected_handler()   {  	default_handler("unexpected");  } @@ -103,7 +102,7 @@ set_unexpected(unexpected_handler func) _NOEXCEPT  {  	if (func == 0)  		func = default_unexpected_handler; -	return __sync_swap(&__cxxabiapple::__cxa_unexpected_handler, func); +	return __sync_swap(&__cxa_unexpected_handler, func);  }  terminate_handler @@ -111,7 +110,7 @@ set_terminate(terminate_handler func) _NOEXCEPT  {  	if (func == 0)  		func = default_terminate_handler; -	return __sync_swap(&__cxxabiapple::__cxa_terminate_handler, func); +	return __sync_swap(&__cxa_terminate_handler, func);  }  }; diff --git a/libcxxabi/src/cxa_default_handlers.hpp b/libcxxabi/src/cxa_default_handlers.hpp deleted file mode 100644 index 6b02e97c7e7..00000000000 --- a/libcxxabi/src/cxa_default_handlers.hpp +++ /dev/null @@ -1,19 +0,0 @@ -//===------------------------- cxa_default_handlers.cpp -------------------===// -// -//                     The LLVM Compiler Infrastructure -// -// This file is dual licensed under the MIT and the University of Illinois Open -// Source Licenses. See LICENSE.TXT for details. -// -// -// This file declares the default terminate_handler and unexpected_handler. -//===----------------------------------------------------------------------===// - - -__attribute__((visibility("hidden"), noreturn)) -void -default_terminate_handler(); - -__attribute__((visibility("hidden"), noreturn)) -void -default_unexpected_handler(); diff --git a/libcxxabi/src/cxa_exception.hpp b/libcxxabi/src/cxa_exception.hpp index cf019d4cd6b..66f05c45f87 100644 --- a/libcxxabi/src/cxa_exception.hpp +++ b/libcxxabi/src/cxa_exception.hpp @@ -11,6 +11,9 @@  //    //===----------------------------------------------------------------------===// +#ifndef _CXA_EXCEPTION_H +#define _CXA_EXCEPTION_H +  #include <exception> // for std::unexpected_handler and std::terminate_handler  #include <cxxabi.h>  #include "unwind.h" @@ -116,3 +119,5 @@ static const uint64_t get_vendor_and_language =     0xFFFFFFFFFFFFFF00; // mask  #pragma GCC visibility pop  } + +#endif  // _CXA_EXCEPTION_H diff --git a/libcxxabi/src/cxa_handlers.cpp b/libcxxabi/src/cxa_handlers.cpp index 97f1347010e..3150c0a6de0 100644 --- a/libcxxabi/src/cxa_handlers.cpp +++ b/libcxxabi/src/cxa_handlers.cpp @@ -17,18 +17,15 @@  #include "cxxabi.h"  #include "cxa_handlers.hpp"  #include "cxa_exception.hpp" -#include "cxa_default_handlers.hpp"  #include "private_typeinfo.h" -std::new_handler __cxa_new_handler = 0; -  namespace std  {  unexpected_handler  get_unexpected() _NOEXCEPT  { -    return __cxxabiapple::__cxa_unexpected_handler; +    return __cxa_unexpected_handler;  }  __attribute__((visibility("hidden"), noreturn)) @@ -50,7 +47,7 @@ unexpected()  terminate_handler  get_terminate() _NOEXCEPT  { -    return __cxxabiapple::__cxa_terminate_handler; +    return __cxa_terminate_handler;  }  __attribute__((visibility("hidden"), noreturn)) @@ -98,16 +95,18 @@ terminate() _NOEXCEPT      __terminate(get_terminate());  } +new_handler __cxa_new_handler = 0; +  new_handler  set_new_handler(new_handler handler) _NOEXCEPT  { -    return __sync_swap(&__cxxabiapple::__cxa_new_handler, handler); +    return __sync_swap(&__cxa_new_handler, handler);  }  new_handler  get_new_handler() _NOEXCEPT  { -    return __cxxabiapple::__cxa_new_handler; +    return __cxa_new_handler;  }  }  // std diff --git a/libcxxabi/src/cxa_handlers.hpp b/libcxxabi/src/cxa_handlers.hpp index a7f582c0085..95a320df3ae 100644 --- a/libcxxabi/src/cxa_handlers.hpp +++ b/libcxxabi/src/cxa_handlers.hpp @@ -10,6 +10,9 @@  //   unexpected_handler, and new_handler.  //===----------------------------------------------------------------------===// +#ifndef _CXA_HANDLERS_H +#define _CXA_HANDLERS_H +  #include <exception>  namespace std @@ -24,3 +27,14 @@ void  __terminate(terminate_handler func) _NOEXCEPT;  }  // std + +extern "C" +{ + +extern void (*__cxa_terminate_handler)(); +extern void (*__cxa_unexpected_handler)(); +extern void (*__cxa_new_handler)(); + +} // extern "C" + +#endif  // _CXA_HANDLERS_H | 

