summaryrefslogtreecommitdiffstats
path: root/contrib/libc++/src/stdexcept.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/stdexcept.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/stdexcept.cpp')
-rw-r--r--contrib/libc++/src/stdexcept.cpp15
1 files changed, 10 insertions, 5 deletions
diff --git a/contrib/libc++/src/stdexcept.cpp b/contrib/libc++/src/stdexcept.cpp
index 9fa4f59..660ebfe 100644
--- a/contrib/libc++/src/stdexcept.cpp
+++ b/contrib/libc++/src/stdexcept.cpp
@@ -16,8 +16,13 @@
#include <cstddef>
#include "system_error"
-// Use <cxxabi.h> to determine whether we're linking against libc++abi.
-#if __has_include(<cxxabi.h>)
+#ifndef __has_include
+#define __has_include(inc) 0
+#endif
+
+#if __APPLE__
+#include <cxxabi.h>
+#elif defined(LIBCXXRT) || __has_include(<cxxabi.h>)
#include <cxxabi.h>
#endif
@@ -34,7 +39,7 @@ private:
const char* str_;
typedef std::size_t unused_t;
- typedef std::int32_t count_t;
+ typedef std::ptrdiff_t count_t;
static const std::ptrdiff_t offset = static_cast<std::ptrdiff_t>(2*sizeof(unused_t) +
sizeof(count_t));
@@ -72,7 +77,7 @@ __libcpp_nmstr::operator=(const __libcpp_nmstr& s)
const char* p = str_;
str_ = s.str_;
__sync_add_and_fetch(&count(), 1);
- if (__sync_add_and_fetch((count_t*)(p-sizeof(count_t)), -1) < 0)
+ if (__sync_add_and_fetch((count_t*)(p-sizeof(count_t)), count_t(-1)) < 0)
delete [] (p-offset);
return *this;
}
@@ -80,7 +85,7 @@ __libcpp_nmstr::operator=(const __libcpp_nmstr& s)
inline
__libcpp_nmstr::~__libcpp_nmstr()
{
- if (__sync_add_and_fetch(&count(), -1) < 0)
+ if (__sync_add_and_fetch(&count(), count_t(-1)) < 0)
delete [] (str_ - offset);
}
OpenPOWER on IntegriCloud