diff options
author | dim <dim@FreeBSD.org> | 2015-09-16 22:26:52 +0000 |
---|---|---|
committer | dim <dim@FreeBSD.org> | 2015-09-16 22:26:52 +0000 |
commit | ea5248cdc11d47e16b420831d52143ca4afb904a (patch) | |
tree | aaccdba1a8c990ea730287a164e76e70733b424a /contrib/libc++/src/exception.cpp | |
parent | 5cc32d7f18f18fb3a5f4155b7f748cc7be60d2da (diff) | |
parent | 50ffe587e08aebe69879f2e5b67ba1304ff781b3 (diff) | |
download | FreeBSD-src-ea5248cdc11d47e16b420831d52143ca4afb904a.zip FreeBSD-src-ea5248cdc11d47e16b420831d52143ca4afb904a.tar.gz |
Update libc++ to 3.7.0 release.
Diffstat (limited to 'contrib/libc++/src/exception.cpp')
-rw-r--r-- | contrib/libc++/src/exception.cpp | 32 |
1 files changed, 19 insertions, 13 deletions
diff --git a/contrib/libc++/src/exception.cpp b/contrib/libc++/src/exception.cpp index b5c46c0..2c16060 100644 --- a/contrib/libc++/src/exception.cpp +++ b/contrib/libc++/src/exception.cpp @@ -29,7 +29,7 @@ #define __terminate_handler __cxxabiapple::__cxa_terminate_handler #define __unexpected_handler __cxxabiapple::__cxa_unexpected_handler #endif // _LIBCPPABI_VERSION -#elif defined(LIBCXXRT) || __has_include(<cxxabi.h>) +#elif defined(LIBCXXRT) || defined(LIBCXX_BUILDING_LIBCXXABI) || __has_include(<cxxabi.h>) #include <cxxabi.h> using namespace __cxxabiv1; #if defined(LIBCXXRT) || defined(_LIBCPPABI_VERSION) @@ -90,14 +90,14 @@ terminate() _NOEXCEPT #endif // _LIBCPP_NO_EXCEPTIONS (*get_terminate())(); // handler should not return - printf("terminate_handler unexpectedly returned\n"); + fprintf(stderr, "terminate_handler unexpectedly returned\n"); ::abort(); #ifndef _LIBCPP_NO_EXCEPTIONS } catch (...) { // handler should not throw exception - printf("terminate_handler unexpectedly threw an exception\n"); + fprintf(stderr, "terminate_handler unexpectedly threw an exception\n"); ::abort(); } #endif // _LIBCPP_NO_EXCEPTIONS @@ -106,18 +106,24 @@ terminate() _NOEXCEPT #endif // !defined(LIBCXXRT) && !defined(_LIBCPPABI_VERSION) #if !defined(LIBCXXRT) && !defined(__GLIBCXX__) && !defined(__EMSCRIPTEN__) -bool uncaught_exception() _NOEXCEPT +bool uncaught_exception() _NOEXCEPT { return uncaught_exceptions() > 0; } + +int uncaught_exceptions() _NOEXCEPT { #if defined(__APPLE__) || defined(_LIBCPPABI_VERSION) - // on Darwin, there is a helper function so __cxa_get_globals is private - return __cxa_uncaught_exception(); + // on Darwin, there is a helper function so __cxa_get_globals is private +# if _LIBCPPABI_VERSION > 1101 + return __cxa_uncaught_exceptions(); +# else + return __cxa_uncaught_exception() ? 1 : 0; +# endif #else // __APPLE__ # if defined(_MSC_VER) && ! defined(__clang__) - _LIBCPP_WARNING("uncaught_exception not yet implemented") + _LIBCPP_WARNING("uncaught_exceptions not yet implemented") # else # warning uncaught_exception not yet implemented # endif - printf("uncaught_exception not yet implemented\n"); + fprintf(stderr, "uncaught_exceptions not yet implemented\n"); ::abort(); #endif // __APPLE__ } @@ -190,7 +196,7 @@ exception_ptr::~exception_ptr() _NOEXCEPT # else # warning exception_ptr not yet implemented # endif - printf("exception_ptr not yet implemented\n"); + fprintf(stderr, "exception_ptr not yet implemented\n"); ::abort(); #endif } @@ -209,7 +215,7 @@ exception_ptr::exception_ptr(const exception_ptr& other) _NOEXCEPT # else # warning exception_ptr not yet implemented # endif - printf("exception_ptr not yet implemented\n"); + fprintf(stderr, "exception_ptr not yet implemented\n"); ::abort(); #endif } @@ -234,7 +240,7 @@ exception_ptr& exception_ptr::operator=(const exception_ptr& other) _NOEXCEPT # else # warning exception_ptr not yet implemented # endif - printf("exception_ptr not yet implemented\n"); + fprintf(stderr, "exception_ptr not yet implemented\n"); ::abort(); #endif } @@ -278,7 +284,7 @@ exception_ptr current_exception() _NOEXCEPT # else # warning exception_ptr not yet implemented # endif - printf("exception_ptr not yet implemented\n"); + fprintf(stderr, "exception_ptr not yet implemented\n"); ::abort(); #endif } @@ -300,7 +306,7 @@ void rethrow_exception(exception_ptr p) # else # warning exception_ptr not yet implemented # endif - printf("exception_ptr not yet implemented\n"); + fprintf(stderr, "exception_ptr not yet implemented\n"); ::abort(); #endif } |