[libcxxabi] r290847 - Fix new/delete exception specifications to match libc++ after r290845

Eric Fiselier via cfe-commits cfe-commits at lists.llvm.org
Mon Jan 2 16:16:18 PST 2017


Author: ericwf
Date: Mon Jan  2 18:16:18 2017
New Revision: 290847

URL: http://llvm.org/viewvc/llvm-project?rev=290847&view=rev
Log:
Fix new/delete exception specifications to match libc++ after r290845

Modified:
    libcxxabi/trunk/src/cxa_new_delete.cpp

Modified: libcxxabi/trunk/src/cxa_new_delete.cpp
URL: http://llvm.org/viewvc/llvm-project/libcxxabi/trunk/src/cxa_new_delete.cpp?rev=290847&r1=290846&r2=290847&view=diff
==============================================================================
--- libcxxabi/trunk/src/cxa_new_delete.cpp (original)
+++ libcxxabi/trunk/src/cxa_new_delete.cpp Mon Jan  2 18:16:18 2017
@@ -14,6 +14,11 @@
 #include <new>
 #include <cstdlib>
 
+#if !defined(_THROW_BAD_ALLOC) || !defined(_NOEXCEPT)
+#error _THROW_BAD_ALLOC and _NOEXCEPT libc++ macros must already be defined \
+       by libc++.
+#endif
+
 /*
 [new.delete.single]
 
@@ -33,10 +38,7 @@
 */
 __attribute__((__weak__, __visibility__("default")))
 void *
-operator new(std::size_t size)
-#if !__has_feature(cxx_noexcept)
-    throw(std::bad_alloc)
-#endif
+operator new(std::size_t size) _THROW_BAD_ALLOC
 {
     if (size == 0)
         size = 1;
@@ -70,12 +72,7 @@ that call. Otherwise, returns a null poi
 */
 __attribute__((__weak__, __visibility__("default")))
 void*
-operator new(size_t size, const std::nothrow_t&)
-#if __has_feature(cxx_noexcept)
-    noexcept
-#else
-    throw()
-#endif
+operator new(size_t size, const std::nothrow_t&) _NOEXCEPT
 {
     void* p = 0;
 #ifndef _LIBCXXABI_NO_EXCEPTIONS
@@ -99,10 +96,7 @@ Returns operator new(size).
 */
 __attribute__((__weak__, __visibility__("default")))
 void*
-operator new[](size_t size)
-#if !__has_feature(cxx_noexcept)
-    throw(std::bad_alloc)
-#endif
+operator new[](size_t size) _THROW_BAD_ALLOC
 {
     return ::operator new(size);
 }
@@ -115,12 +109,7 @@ of that call. Otherwise, returns a null
 */
 __attribute__((__weak__, __visibility__("default")))
 void*
-operator new[](size_t size, const std::nothrow_t&)
-#if __has_feature(cxx_noexcept)
-    noexcept
-#else
-    throw()
-#endif
+operator new[](size_t size, const std::nothrow_t&) _NOEXCEPT
 {
     void* p = 0;
 #ifndef _LIBCXXABI_NO_EXCEPTIONS
@@ -145,12 +134,7 @@ earlier call to operator new.
 */
 __attribute__((__weak__, __visibility__("default")))
 void
-operator delete(void* ptr)
-#if __has_feature(cxx_noexcept)
-    noexcept
-#else
-    throw()
-#endif
+operator delete(void* ptr) _NOEXCEPT
 {
     if (ptr)
         std::free(ptr);
@@ -163,12 +147,7 @@ calls operator delete(ptr)
 */
 __attribute__((__weak__, __visibility__("default")))
 void
-operator delete(void* ptr, const std::nothrow_t&)
-#if __has_feature(cxx_noexcept)
-    noexcept
-#else
-    throw()
-#endif
+operator delete(void* ptr, const std::nothrow_t&) _NOEXCEPT
 {
     ::operator delete(ptr);
 }
@@ -180,12 +159,7 @@ Calls operator delete(ptr)
 */
 __attribute__((__weak__, __visibility__("default")))
 void
-operator delete[] (void* ptr)
-#if __has_feature(cxx_noexcept)
-    noexcept
-#else
-    throw()
-#endif
+operator delete[] (void* ptr) _NOEXCEPT
 {
     ::operator delete(ptr);
 }
@@ -197,12 +171,7 @@ calls operator delete[](ptr)
 */
 __attribute__((__weak__, __visibility__("default")))
 void
-operator delete[] (void* ptr, const std::nothrow_t&)
-#if __has_feature(cxx_noexcept)
-    noexcept
-#else
-    throw()
-#endif
+operator delete[] (void* ptr, const std::nothrow_t&) _NOEXCEPT
 {
     ::operator delete[](ptr);
 }




More information about the cfe-commits mailing list