summaryrefslogtreecommitdiffstats
path: root/contrib/libc++/src/exception.cpp
diff options
context:
space:
mode:
authordim <dim@FreeBSD.org>2015-10-06 17:53:29 +0000
committerdim <dim@FreeBSD.org>2015-10-06 17:53:29 +0000
commita6f4f28b545e1f0632ba4b20b86a7ab487932373 (patch)
treee9dbc6d658415636ba47d28716ee528c8ab7c862 /contrib/libc++/src/exception.cpp
parent09f0c012db173aa7875b4d45fc67ef4d26c82548 (diff)
parent9ba87e73be0d01bbe1cf9547130ae12f9b15d7a7 (diff)
downloadFreeBSD-src-a6f4f28b545e1f0632ba4b20b86a7ab487932373.zip
FreeBSD-src-a6f4f28b545e1f0632ba4b20b86a7ab487932373.tar.gz
Upgrade our copies of clang, llvm, lldb, compiler-rt and libc++ to 3.7.0
release. Please note that from 3.5.0 onwards, clang, llvm and lldb require C++11 support to build; see UPDATING for more information. Release notes for llvm and clang can be found here: <http://llvm.org/releases/3.7.0/docs/ReleaseNotes.html> <http://llvm.org/releases/3.7.0/tools/clang/docs/ReleaseNotes.html> Thanks to Ed Maste, Andrew Turner and Antoine Brodin for their help. Exp-run: antoine Relnotes: yes
Diffstat (limited to 'contrib/libc++/src/exception.cpp')
-rw-r--r--contrib/libc++/src/exception.cpp32
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
}
OpenPOWER on IntegriCloud