diff options
| author | joerg <joerg@NetBSD.org> | 2015-08-20 09:31:47 +0000 |
|---|---|---|
| committer | joerg <joerg@NetBSD.org> | 2015-08-20 09:31:47 +0000 |
| commit | b2e8b4bcac1662c35cd7d38149be011d22d4fa3a (patch) | |
| tree | e940ceb6c9e0446048768f5637a659d3ff0c74ba /external/bsd/libc++/dist/libcxx/src/exception.cpp | |
| parent | b8c252c8fd23d42032d89f7d220628592ca94935 (diff) | |
Import libc++ r245547. Various bugfixes, improvements to the C++14
support and some experimental features from the library standard track.
Diffstat (limited to 'external/bsd/libc++/dist/libcxx/src/exception.cpp')
| -rw-r--r-- | external/bsd/libc++/dist/libcxx/src/exception.cpp | 34 |
1 files changed, 20 insertions, 14 deletions
diff --git a/external/bsd/libc++/dist/libcxx/src/exception.cpp b/external/bsd/libc++/dist/libcxx/src/exception.cpp index 3ce6f2e1118..2c16060a758 100644 --- a/external/bsd/libc++/dist/libcxx/src/exception.cpp +++ b/external/bsd/libc++/dist/libcxx/src/exception.cpp @@ -16,7 +16,7 @@ #define __has_include(inc) 0 #endif -#ifdef __APPLE__ +#if defined(__APPLE__) && !defined(LIBCXXRT) #include <cxxabi.h> using namespace __cxxabiv1; @@ -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 } |
