From acbeab898d6a7f4036c55962a2460aab3e0eda3f Mon Sep 17 00:00:00 2001 From: David Chisnall Date: Wed, 14 Mar 2012 14:33:36 +0000 Subject: [PATCH] New version of libc++ with some bug fixes. Approved by: dim (mentor) --- include/__config | 4 ++++ include/cstdlib | 4 ++++ src/exception.cpp | 16 ++++++++++------ src/new.cpp | 7 ++----- 4 files changed, 20 insertions(+), 11 deletions(-) diff --git a/include/__config b/include/__config index e0b9582cd08e..6b2901458587 100644 --- a/include/__config +++ b/include/__config @@ -245,6 +245,10 @@ typedef __char32_t char32_t; #define _LIBCPP_HAS_NO_CONSTEXPR #endif +#if __FreeBSD__ +#define _LIBCPP_HAS_QUICK_EXIT +#endif + #if (__has_feature(cxx_noexcept)) # define _NOEXCEPT noexcept # define _NOEXCEPT_(x) noexcept(x) diff --git a/include/cstdlib b/include/cstdlib index 1158db2c0aca..a5c78e98274f 100644 --- a/include/cstdlib +++ b/include/cstdlib @@ -131,6 +131,10 @@ using ::mbtowc; using ::wctomb; using ::mbstowcs; using ::wcstombs; +#ifdef _LIBCPP_HAS_QUICK_EXIT +using ::at_quick_exit; +using ::quick_exit; +#endif // MSVC already has the correct prototype in #ifdef __cplusplus #if !defined(_MSC_VER) && !defined(__sun__) diff --git a/src/exception.cpp b/src/exception.cpp index 6b5e6984a606..6a5803d37745 100644 --- a/src/exception.cpp +++ b/src/exception.cpp @@ -114,22 +114,26 @@ exception::~exception() _NOEXCEPT { } -bad_exception::~bad_exception() _NOEXCEPT -{ -} - const char* exception::what() const _NOEXCEPT { return "std::exception"; } +#endif // _LIBCPPABI_VERSION +#endif //LIBCXXRT +#ifndef _LIBCPPABI_VERSION + +bad_exception::~bad_exception() _NOEXCEPT +{ +} + const char* bad_exception::what() const _NOEXCEPT { return "std::bad_exception"; } -#endif // _LIBCPPABI_VERSION -#endif //LIBCXXRT +#endif + exception_ptr::~exception_ptr() _NOEXCEPT { diff --git a/src/new.cpp b/src/new.cpp index 1c171a871b9b..1fb4b2da40d7 100644 --- a/src/new.cpp +++ b/src/new.cpp @@ -24,8 +24,6 @@ static std::new_handler __new_handler; #endif -#if !defined (LIBCXXRT) // && !defined(_LIBCPPABI_VERSION) - // Implement all new and delete operators as weak definitions // in this shared library, so that they can be overriden by programs // that define non-weak copies of the functions. @@ -134,8 +132,6 @@ operator delete[] (void* ptr, const std::nothrow_t&) _NOEXCEPT ::operator delete[](ptr); } -#endif // !_LIBCPPABI_VERSION && !LIBCXXRT - namespace std { @@ -171,6 +167,8 @@ bad_alloc::what() const _NOEXCEPT return "std::bad_alloc"; } +#endif //LIBCXXRT + bad_array_new_length::bad_array_new_length() _NOEXCEPT { } @@ -186,7 +184,6 @@ bad_array_new_length::what() const _NOEXCEPT } #endif -#endif //LIBCXXRT void __throw_bad_alloc()