aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorDimitry Andric <dim@FreeBSD.org>2013-04-27 17:19:07 +0000
committerDimitry Andric <dim@FreeBSD.org>2013-04-27 17:19:07 +0000
commitaf04c9e2c0dfdb2172241883c7b9130e63fec0be (patch)
tree63fcd3383d82296e148a8ab21c14dd5db17400ec
parenta694e2e49638733fdcb3aeb649a074daf5410e8e (diff)
downloadsrc-af04c9e2c0dfdb2172241883c7b9130e63fec0be.tar.gz
src-af04c9e2c0dfdb2172241883c7b9130e63fec0be.zip
Import c812a07cd2f95c1403baf0bbe0366e7618d1d6d3 of libcxxrt:vendor/libcxxrt/2013-04-22-c812a07cd2f95c1403baf0bbe0366e7618d1d6d3
* Fix a copy-and-paste error when setting the unexpected exception handler (actually set the terminate handler by mistake). * Fix some warnings. Patch by Joerg Sonnenberger! * Don't call the _fast version of the TLS accessor in terminate() or unexpected(). 1) TLS may not have been set up yet. 2) When we're in one of these functions, Really Bad Stuff has happened and potentially saving a few cycles really isn't important. * Merge in fixes from FreeBSD trunk to make atomics work with recent clang.
Notes
Notes: svn path=/vendor/libcxxrt/dist/; revision=249987 svn path=/vendor/libcxxrt/2013-04-22-c812a07cd2f95c1403baf0bbe0366e7618d1d6d3/; revision=249988; tag=vendor/libcxxrt/2013-04-22-c812a07cd2f95c1403baf0bbe0366e7618d1d6d3
-rw-r--r--atomic.h8
-rw-r--r--exception.cc6
2 files changed, 7 insertions, 7 deletions
diff --git a/atomic.h b/atomic.h
index bcd8a47ac89d..f68faf325826 100644
--- a/atomic.h
+++ b/atomic.h
@@ -9,9 +9,9 @@
* Swap macro that enforces a happens-before relationship with a corresponding
* ATOMIC_LOAD.
*/
-#if __has_feature(cxx_atomic)
+#if __has_builtin(__c11_atomic_exchange)
#define ATOMIC_SWAP(addr, val)\
- __atomic_exchange(addr, val, __ATOMIC_ACQ_REL)
+ __c11_atomic_exchange((_Atomic(__typeof__(val))*)addr, val, __ATOMIC_ACQ_REL)
#elif __has_builtin(__sync_swap)
#define ATOMIC_SWAP(addr, val)\
__sync_swap(addr, val)
@@ -20,9 +20,9 @@
__sync_lock_test_and_set(addr, val)
#endif
-#if __has_feature(cxx_atomic)
+#if __has_builtin(__c11_atomic_load)
#define ATOMIC_LOAD(addr)\
- __atomic_load(addr, __ATOMIC_ACQUIRE)
+ __c11_atomic_load((_Atomic(__typeof__(*addr))*)addr, __ATOMIC_ACQUIRE)
#else
#define ATOMIC_LOAD(addr)\
(__sync_synchronize(), *addr)
diff --git a/exception.cc b/exception.cc
index 4ccf38eba7ac..50ee582ae6f5 100644
--- a/exception.cc
+++ b/exception.cc
@@ -1387,7 +1387,7 @@ namespace std
{
if (thread_local_handlers) { return pathscale::set_unexpected(f); }
- return ATOMIC_SWAP(&terminateHandler, f);
+ return ATOMIC_SWAP(&unexpectedHandler, f);
}
/**
* Sets the function that is called to terminate the program.
@@ -1404,7 +1404,7 @@ namespace std
*/
void terminate()
{
- static __cxa_thread_info *info = thread_info_fast();
+ static __cxa_thread_info *info = thread_info();
if (0 != info && 0 != info->terminateHandler)
{
info->terminateHandler();
@@ -1421,7 +1421,7 @@ namespace std
*/
void unexpected()
{
- static __cxa_thread_info *info = thread_info_fast();
+ static __cxa_thread_info *info = thread_info();
if (0 != info && 0 != info->unexpectedHandler)
{
info->unexpectedHandler();