summaryrefslogtreecommitdiffstats
path: root/contrib/libc++/src/exception.cpp
diff options
context:
space:
mode:
authordim <dim@FreeBSD.org>2012-10-22 18:25:04 +0000
committerdim <dim@FreeBSD.org>2012-10-22 18:25:04 +0000
commit708d8e446e991358da23bb52ec5320440221f12f (patch)
tree3a061d75674cd5b60d9f6df45d0b8d755da3782f /contrib/libc++/src/exception.cpp
parentb8c74d455d2690e710a0802a98a9d310995a52eb (diff)
parent13334223d751d249ccd6475b8cba36ff71ddc972 (diff)
downloadFreeBSD-src-708d8e446e991358da23bb52ec5320440221f12f.zip
FreeBSD-src-708d8e446e991358da23bb52ec5320440221f12f.tar.gz
Import libc++ trunk r165949. Among other improvements and bug fixes,
this has many visibility problems fixed, which should help with compiling certain ports that exercise C++11 mode (i.e. Firefox). Also, belatedly add the LICENSE.TXT and accompanying CREDITS.TXT files, which are referred to in all the source files. MFC after: 1 month
Diffstat (limited to 'contrib/libc++/src/exception.cpp')
-rw-r--r--contrib/libc++/src/exception.cpp27
1 files changed, 15 insertions, 12 deletions
diff --git a/contrib/libc++/src/exception.cpp b/contrib/libc++/src/exception.cpp
index 6a5803d..0dbb660 100644
--- a/contrib/libc++/src/exception.cpp
+++ b/contrib/libc++/src/exception.cpp
@@ -10,6 +10,10 @@
#include "exception"
+#ifndef __has_include
+#define __has_include(inc) 0
+#endif
+
#if __APPLE__
#include <cxxabi.h>
@@ -23,14 +27,16 @@
#define __terminate_handler __cxxabiapple::__cxa_terminate_handler
#define __unexpected_handler __cxxabiapple::__cxa_unexpected_handler
#endif // _LIBCPPABI_VERSION
-#elif defined(LIBCXXRT)
+#elif defined(LIBCXXRT) || __has_include(<cxxabi.h>)
#include <cxxabi.h>
using namespace __cxxabiv1;
- #define HAVE_DEPENDENT_EH_ABI 1
-#else // __APPLE__
+ #if defined(LIBCXXRT) || defined(_LIBCPPABI_VERSION)
+ #define HAVE_DEPENDENT_EH_ABI 1
+ #endif
+#else // __has_include(<cxxabi.h>)
static std::terminate_handler __terminate_handler;
static std::unexpected_handler __unexpected_handler;
-#endif // __APPLE__
+#endif // __has_include(<cxxabi.h>)
namespace std
{
@@ -50,7 +56,7 @@ get_unexpected() _NOEXCEPT
return __sync_fetch_and_add(&__unexpected_handler, (unexpected_handler)0);
}
-_ATTRIBUTE(noreturn)
+_LIBCPP_NORETURN
void
unexpected()
{
@@ -71,7 +77,7 @@ get_terminate() _NOEXCEPT
return __sync_fetch_and_add(&__terminate_handler, (terminate_handler)0);
}
-_ATTRIBUTE(noreturn)
+_LIBCPP_NORETURN
void
terminate() _NOEXCEPT
{
@@ -96,12 +102,9 @@ terminate() _NOEXCEPT
#ifndef LIBCXXRT
bool uncaught_exception() _NOEXCEPT
{
-#if __APPLE__
+#if __APPLE__ || defined(_LIBCPPABI_VERSION)
// on Darwin, there is a helper function so __cxa_get_globals is private
return __cxa_uncaught_exception();
-#elif LIBCXXRT
- __cxa_eh_globals * globals = __cxa_get_globals();
- return (globals->uncaughtExceptions != 0);
#else // __APPLE__
#warning uncaught_exception not yet implemented
::abort();
@@ -181,7 +184,7 @@ nested_exception::~nested_exception() _NOEXCEPT
{
}
-_ATTRIBUTE(noreturn)
+_LIBCPP_NORETURN
void
nested_exception::rethrow_nested() const
{
@@ -206,7 +209,7 @@ exception_ptr current_exception() _NOEXCEPT
#endif // __APPLE__
}
-_ATTRIBUTE(noreturn)
+_LIBCPP_NORETURN
void rethrow_exception(exception_ptr p)
{
#if HAVE_DEPENDENT_EH_ABI
OpenPOWER on IntegriCloud