summaryrefslogtreecommitdiffstats
path: root/contrib/libcxxrt/memory.cc
diff options
context:
space:
mode:
authordim <dim@FreeBSD.org>2016-05-05 22:40:07 +0000
committerdim <dim@FreeBSD.org>2016-05-05 22:40:07 +0000
commitcd441cb611883539e14becffc6ba847cf6b24f7a (patch)
tree981aba4368a927bfed005088ee808eae8f51272b /contrib/libcxxrt/memory.cc
parent68d7e14c1b8fc2f6a8c21ef0402dff5f42ae129b (diff)
downloadFreeBSD-src-cd441cb611883539e14becffc6ba847cf6b24f7a.zip
FreeBSD-src-cd441cb611883539e14becffc6ba847cf6b24f7a.tar.gz
Import libcxxrt master 516a65c109eb0a01e5e95fbef455eb3215135cef.
Interesting fixes: 3adaa2e Fix _Unwind_Exception cleanup functions 286776c Check exception cleanup function ptr before calling edda626 Correct exception specifications on new and delete operators
Diffstat (limited to 'contrib/libcxxrt/memory.cc')
-rw-r--r--contrib/libcxxrt/memory.cc30
1 files changed, 15 insertions, 15 deletions
diff --git a/contrib/libcxxrt/memory.cc b/contrib/libcxxrt/memory.cc
index c8d28fc..9fa9d2a 100644
--- a/contrib/libcxxrt/memory.cc
+++ b/contrib/libcxxrt/memory.cc
@@ -71,8 +71,17 @@ namespace std
}
+#if __cplusplus < 201103L
+#define NOEXCEPT throw()
+#define BADALLOC throw(std::bad_alloc)
+#else
+#define NOEXCEPT noexcept
+#define BADALLOC
+#endif
+
+
__attribute__((weak))
-void* operator new(size_t size)
+void* operator new(size_t size) BADALLOC
{
if (0 == size)
{
@@ -97,7 +106,7 @@ void* operator new(size_t size)
}
__attribute__((weak))
-void* operator new(size_t size, const std::nothrow_t &) throw()
+void* operator new(size_t size, const std::nothrow_t &) NOEXCEPT
{
try {
return :: operator new(size);
@@ -110,27 +119,21 @@ void* operator new(size_t size, const std::nothrow_t &) throw()
__attribute__((weak))
-void operator delete(void * ptr)
-#if __cplusplus < 201000L
-throw()
-#endif
+void operator delete(void * ptr) NOEXCEPT
{
free(ptr);
}
__attribute__((weak))
-void * operator new[](size_t size)
-#if __cplusplus < 201000L
-throw(std::bad_alloc)
-#endif
+void * operator new[](size_t size) BADALLOC
{
return ::operator new(size);
}
__attribute__((weak))
-void * operator new[](size_t size, const std::nothrow_t &) throw()
+void * operator new[](size_t size, const std::nothrow_t &) NOEXCEPT
{
try {
return ::operator new[](size);
@@ -143,10 +146,7 @@ void * operator new[](size_t size, const std::nothrow_t &) throw()
__attribute__((weak))
-void operator delete[](void * ptr)
-#if __cplusplus < 201000L
-throw()
-#endif
+void operator delete[](void * ptr) NOEXCEPT
{
::operator delete(ptr);
}
OpenPOWER on IntegriCloud