diff options
Diffstat (limited to 'libcxxabi/src')
-rw-r--r-- | libcxxabi/src/CMakeLists.txt | 6 | ||||
-rw-r--r-- | libcxxabi/src/stdlib_exception.cpp | 66 | ||||
-rw-r--r-- | libcxxabi/src/stdlib_new_delete.cpp (renamed from libcxxabi/src/cxa_new_delete.cpp) | 66 |
3 files changed, 71 insertions, 67 deletions
diff --git a/libcxxabi/src/CMakeLists.txt b/libcxxabi/src/CMakeLists.txt index ed7e39e53e3..8eb28d43745 100644 --- a/libcxxabi/src/CMakeLists.txt +++ b/libcxxabi/src/CMakeLists.txt @@ -7,7 +7,6 @@ set(LIBCXXABI_SOURCES cxa_exception_storage.cpp cxa_guard.cpp cxa_handlers.cpp - cxa_new_delete.cpp cxa_unexpected.cpp cxa_vector.cpp cxa_virtual.cpp @@ -21,6 +20,11 @@ set(LIBCXXABI_SOURCES private_typeinfo.cpp ) +# FIXME: This file should only be compiled in special configurations such +# as building the Apple system dylib where libc++abi is expected to provide +# the new/delete definitions instead of libc++. +list(APPEND LIBCXXABI_SOURCES stdlib_new_delete.cpp) + if (LIBCXXABI_ENABLE_EXCEPTIONS) list(APPEND LIBCXXABI_SOURCES cxa_exception.cpp) list(APPEND LIBCXXABI_SOURCES cxa_personality.cpp) diff --git a/libcxxabi/src/stdlib_exception.cpp b/libcxxabi/src/stdlib_exception.cpp index fce6e8a7994..a8f71ab0ecc 100644 --- a/libcxxabi/src/stdlib_exception.cpp +++ b/libcxxabi/src/stdlib_exception.cpp @@ -7,6 +7,9 @@ // //===----------------------------------------------------------------------===// +#define _LIBCPP_BUILDING_LIBRARY +#define _LIBCPP_BUILDING_NEW +#include <new> #include <exception> namespace std @@ -34,4 +37,67 @@ const char* bad_exception::what() const _NOEXCEPT return "std::bad_exception"; } + +// bad_alloc + +bad_alloc::bad_alloc() _NOEXCEPT +{ +} + +bad_alloc::~bad_alloc() _NOEXCEPT +{ +} + +const char* +bad_alloc::what() const _NOEXCEPT +{ + return "std::bad_alloc"; +} + +// bad_array_new_length + +bad_array_new_length::bad_array_new_length() _NOEXCEPT +{ +} + +bad_array_new_length::~bad_array_new_length() _NOEXCEPT +{ +} + +const char* +bad_array_new_length::what() const _NOEXCEPT +{ + return "bad_array_new_length"; +} + +// bad_array_length + +#ifndef _LIBCPP_BAD_ARRAY_LENGTH_DEFINED + +class _LIBCPP_EXCEPTION_ABI bad_array_length + : public bad_alloc +{ +public: + bad_array_length() _NOEXCEPT; + virtual ~bad_array_length() _NOEXCEPT; + virtual const char* what() const _NOEXCEPT; +}; + +#endif // _LIBCPP_BAD_ARRAY_LENGTH_DEFINED + +bad_array_length::bad_array_length() _NOEXCEPT +{ +} + +bad_array_length::~bad_array_length() _NOEXCEPT +{ +} + +const char* +bad_array_length::what() const _NOEXCEPT +{ + return "bad_array_length"; +} + + } // std diff --git a/libcxxabi/src/cxa_new_delete.cpp b/libcxxabi/src/stdlib_new_delete.cpp index a96b97ad3c5..45c6b174a5c 100644 --- a/libcxxabi/src/cxa_new_delete.cpp +++ b/libcxxabi/src/stdlib_new_delete.cpp @@ -176,69 +176,3 @@ operator delete[] (void* ptr, const std::nothrow_t&) _NOEXCEPT { ::operator delete[](ptr); } - -namespace std -{ - -// bad_alloc - -bad_alloc::bad_alloc() _NOEXCEPT -{ -} - -bad_alloc::~bad_alloc() _NOEXCEPT -{ -} - -const char* -bad_alloc::what() const _NOEXCEPT -{ - return "std::bad_alloc"; -} - -// bad_array_new_length - -bad_array_new_length::bad_array_new_length() _NOEXCEPT -{ -} - -bad_array_new_length::~bad_array_new_length() _NOEXCEPT -{ -} - -const char* -bad_array_new_length::what() const _NOEXCEPT -{ - return "bad_array_new_length"; -} - -// bad_array_length - -#ifndef _LIBCPP_BAD_ARRAY_LENGTH_DEFINED - -class _LIBCPP_EXCEPTION_ABI bad_array_length - : public bad_alloc -{ -public: - bad_array_length() _NOEXCEPT; - virtual ~bad_array_length() _NOEXCEPT; - virtual const char* what() const _NOEXCEPT; -}; - -#endif // _LIBCPP_BAD_ARRAY_LENGTH_DEFINED - -bad_array_length::bad_array_length() _NOEXCEPT -{ -} - -bad_array_length::~bad_array_length() _NOEXCEPT -{ -} - -const char* -bad_array_length::what() const _NOEXCEPT -{ - return "bad_array_length"; -} - -} // std |