diff options
author | Howard Hinnant <hhinnant@apple.com> | 2013-10-04 21:14:44 +0000 |
---|---|---|
committer | Howard Hinnant <hhinnant@apple.com> | 2013-10-04 21:14:44 +0000 |
commit | 80b84d4c268b75994524b00db7a1437b070e98a8 (patch) | |
tree | 290334ccf2bb11bd0ef986802bc4e342269ecebc /libcxx/src/exception.cpp | |
parent | 217308086de51b02dc7e27f5aa04e13c30072b34 (diff) | |
download | bcm5719-llvm-80b84d4c268b75994524b00db7a1437b070e98a8.tar.gz bcm5719-llvm-80b84d4c268b75994524b00db7a1437b070e98a8.zip |
G M: Provides the _LIBCPP_WARNING macro, to be used for MSVC only, since that compiler doesn't support #warning.
llvm-svn: 191980
Diffstat (limited to 'libcxx/src/exception.cpp')
-rw-r--r-- | libcxx/src/exception.cpp | 74 |
1 files changed, 52 insertions, 22 deletions
diff --git a/libcxx/src/exception.cpp b/libcxx/src/exception.cpp index d3e1b292d34..dc6d04904bf 100644 --- a/libcxx/src/exception.cpp +++ b/libcxx/src/exception.cpp @@ -1,3 +1,5 @@ + + //===------------------------ exception.cpp -------------------------------===// // // The LLVM Compiler Infrastructure @@ -39,6 +41,13 @@ static std::unexpected_handler __unexpected_handler; #endif // __has_include(<cxxabi.h>) +_LIBCPP_NORETURN +static void _libcpp_abort(const char* msg) +{ + printf("%s\n", msg); + abort(); +} + namespace std { @@ -89,15 +98,13 @@ terminate() _NOEXCEPT #endif // _LIBCPP_NO_EXCEPTIONS (*get_terminate())(); // handler should not return - printf("terminate_handler unexpectedly returned\n"); - ::abort (); + _libcpp_abort("terminate_handler unexpectedly returned\n"); #ifndef _LIBCPP_NO_EXCEPTIONS } catch (...) { // handler should not throw exception - printf("terminate_handler unexpectedly threw an exception\n"); - ::abort (); + _libcpp_abort("terminate_handler unexpectedly threw an exception\n"); } #endif // _LIBCPP_NO_EXCEPTIONS } @@ -111,12 +118,16 @@ bool uncaught_exception() _NOEXCEPT // on Darwin, there is a helper function so __cxa_get_globals is private return __cxa_uncaught_exception(); #else // __APPLE__ - #warning uncaught_exception not yet implemented - printf("uncaught_exception not yet implemented\n"); - ::abort(); +# if defined(_MSC_VER) && ! defined(__clang__) + _LIBCPP_WARNING("uncaught_exception not yet implemented") +# else +# warning uncaught_exception not yet implemented +# endif + _libcpp_abort("uncaught_exception not yet implemented\n"); #endif // __APPLE__ } + #ifndef _LIBCPPABI_VERSION exception::~exception() _NOEXCEPT @@ -149,9 +160,12 @@ exception_ptr::~exception_ptr() _NOEXCEPT #if HAVE_DEPENDENT_EH_ABI __cxa_decrement_exception_refcount(__ptr_); #else - #warning exception_ptr not yet implemented - printf("exception_ptr not yet implemented\n"); - ::abort(); +# if defined(_MSC_VER) && ! defined(__clang__) + _LIBCPP_WARNING("exception_ptr not yet implemented") +# else +# warning exception_ptr not yet implemented +# endif + _libcpp_abort("exception_ptr not yet implemented\n"); #endif // __APPLE__ } @@ -161,9 +175,14 @@ exception_ptr::exception_ptr(const exception_ptr& other) _NOEXCEPT #if HAVE_DEPENDENT_EH_ABI __cxa_increment_exception_refcount(__ptr_); #else - #warning exception_ptr not yet implemented - printf("exception_ptr not yet implemented\n"); - ::abort(); + +# if defined(_MSC_VER) && ! defined(__clang__) + _LIBCPP_WARNING("exception_ptr not yet implemented") +# else +# warning exception_ptr not yet implemented +# endif + _libcpp_abort("exception_ptr not yet implemented\n"); + #endif // __APPLE__ } @@ -178,9 +197,14 @@ exception_ptr& exception_ptr::operator=(const exception_ptr& other) _NOEXCEPT } return *this; #else // __APPLE__ - #warning exception_ptr not yet implemented - printf("exception_ptr not yet implemented\n"); - ::abort(); + +# if defined(_MSC_VER) && ! defined(__clang__) + _LIBCPP_WARNING("exception_ptr not yet implemented") +# else +# warning exception_ptr not yet implemented +# endif + _libcpp_abort("exception_ptr not yet implemented\n"); + #endif // __APPLE__ } @@ -213,9 +237,12 @@ exception_ptr current_exception() _NOEXCEPT ptr.__ptr_ = __cxa_current_primary_exception(); return ptr; #else // __APPLE__ - #warning exception_ptr not yet implemented - printf("exception_ptr not yet implemented\n"); - ::abort(); +# if defined(_MSC_VER) && ! defined(__clang__) + _LIBCPP_WARNING( "exception_ptr not yet implemented" ) +# else +# warning exception_ptr not yet implemented +# endif + _libcpp_abort("exception_ptr not yet implemented\n"); #endif // __APPLE__ } @@ -227,9 +254,12 @@ void rethrow_exception(exception_ptr p) // if p.__ptr_ is NULL, above returns so we terminate terminate(); #else // __APPLE__ - #warning exception_ptr not yet implemented - printf("exception_ptr not yet implemented\n"); - ::abort(); +# if defined(_MSC_VER) && ! defined(__clang__) + _LIBCPP_WARNING("exception_ptr not yet implemented") +# else +# warning exception_ptr not yet implemented +# endif + _libcpp_abort("exception_ptr not yet implemented\n"); #endif // __APPLE__ } } // std |