new: move __new_hander to _STD.

This commit is contained in:
NAKAMURA Takumi
2011-04-21 16:40:57 +09:00
parent 17c8c462ae
commit 9055a62ed4
2 changed files with 15 additions and 1 deletions

View File

@@ -90,6 +90,18 @@ _LIBCPP_VISIBLE new_handler get_new_handler() throw();
} // std
#if __APPLE__
#include <cxxabi.h>
// On Darwin, there are two STL shared libraries and a lower level ABI
// shared libray. The global holding the current new handler is
// in the ABI library and named __cxa_new_handler.
#define __new_handler __cxxabiapple::__cxa_new_handler
#else // __APPLE__
_LIBCPP_BEGIN_NAMESPACE_STD
extern ::std::new_handler __new_handler;
_LIBCPP_END_NAMESPACE_STD
#endif
_LIBCPP_VISIBLE void* operator new(std::size_t) throw(std::bad_alloc);
_LIBCPP_VISIBLE void* operator new(std::size_t, const std::nothrow_t&) throw();
_LIBCPP_VISIBLE void operator delete(void*) throw();

View File

@@ -18,7 +18,9 @@
// in the ABI library and named __cxa_new_handler.
#define __new_handler __cxxabiapple::__cxa_new_handler
#else // __APPLE__
static std::new_handler __new_handler;
_LIBCPP_BEGIN_NAMESPACE_STD
::std::new_handler __new_handler;
_LIBCPP_END_NAMESPACE_STD
#endif
// Implement all new and delete operators as weak definitions