summaryrefslogtreecommitdiffstats
path: root/contrib/libcxxrt/memory.cc
diff options
context:
space:
mode:
authortheraven <theraven@FreeBSD.org>2011-11-26 18:46:33 +0000
committertheraven <theraven@FreeBSD.org>2011-11-26 18:46:33 +0000
commite3f9be528dde7c4a83c9e7a8baa6679993fee5c9 (patch)
treeebc9bad9ffdc334d25791808d9695bce7381a70b /contrib/libcxxrt/memory.cc
parent259c5471acdbbc6b8e0bcbda06891abebb89bdf1 (diff)
parentd1f68bb7aa603f1fa1323c4198b83c0b9f330d39 (diff)
downloadFreeBSD-src-e3f9be528dde7c4a83c9e7a8baa6679993fee5c9.zip
FreeBSD-src-e3f9be528dde7c4a83c9e7a8baa6679993fee5c9.tar.gz
Update libcxxrt to remove the pthread dependency.
Also add the license from upstream to contrib. Approved by: dim (mentor)
Diffstat (limited to 'contrib/libcxxrt/memory.cc')
-rw-r--r--contrib/libcxxrt/memory.cc8
1 files changed, 6 insertions, 2 deletions
diff --git a/contrib/libcxxrt/memory.cc b/contrib/libcxxrt/memory.cc
index 655c761..027bc3f 100644
--- a/contrib/libcxxrt/memory.cc
+++ b/contrib/libcxxrt/memory.cc
@@ -11,6 +11,10 @@
#include <stdlib.h>
#include "stdexcept.h"
+#if !__has_builtin(__sync_swap)
+#define __sync_swap __sync_lock_test_and_set
+#endif
+
namespace std
{
struct nothrow_t {};
@@ -33,7 +37,7 @@ namespace std
__attribute__((weak))
new_handler set_new_handler(new_handler handler)
{
- return __sync_lock_test_and_set(&new_handl, handler);
+ return __sync_swap(&new_handl, handler);
}
}
@@ -103,7 +107,7 @@ void * operator new[](size_t size)
__attribute__((weak))
-void operator delete[](void * ptr)
+void operator delete[](void * ptr) throw()
{
::operator delete(ptr);
}
OpenPOWER on IntegriCloud