summaryrefslogtreecommitdiffstats
path: root/libcxx/src/stdexcept.cpp
diff options
context:
space:
mode:
authorHoward Hinnant <hhinnant@apple.com>2012-08-08 16:17:31 +0000
committerHoward Hinnant <hhinnant@apple.com>2012-08-08 16:17:31 +0000
commitd79842c2bf12565d3792b7deda74838553fd35c6 (patch)
tree20e2b6277ef1fafaa7553c10661adc97b062043f /libcxx/src/stdexcept.cpp
parent2c2b55f27f92793e8901f0f5cc70ff470236ccb4 (diff)
downloadbcm5719-llvm-d79842c2bf12565d3792b7deda74838553fd35c6.tar.gz
bcm5719-llvm-d79842c2bf12565d3792b7deda74838553fd35c6.zip
Change size of reference count field in __libcpp_nmstr from 32 bits to 64 bits for 64 bit targets. This is controls the data layout of all exceptions defined in <stdexcept>. This aligns the ABI with that of gcc-4.2.
llvm-svn: 161497
Diffstat (limited to 'libcxx/src/stdexcept.cpp')
-rw-r--r--libcxx/src/stdexcept.cpp6
1 files changed, 3 insertions, 3 deletions
diff --git a/libcxx/src/stdexcept.cpp b/libcxx/src/stdexcept.cpp
index 9fa4f593137..5f4d6b52a4d 100644
--- a/libcxx/src/stdexcept.cpp
+++ b/libcxx/src/stdexcept.cpp
@@ -34,7 +34,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 +72,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 +80,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