Fix more uses of dynamic exception specifications in C++17
git-svn-id: https://llvm.org/svn/llvm-project/libcxx/trunk@289356 91177308-0d34-0410-b5e6-96231b3b80d8
This commit is contained in:
@@ -22,6 +22,8 @@
|
||||
#include <cstdlib>
|
||||
#include <cassert>
|
||||
|
||||
#include "test_macros.h"
|
||||
|
||||
constexpr auto OverAligned = alignof(std::max_align_t) * 2;
|
||||
|
||||
int unsized_delete_called = 0;
|
||||
@@ -34,19 +36,19 @@ void reset() {
|
||||
aligned_delete_called = 0;
|
||||
}
|
||||
|
||||
void operator delete(void* p) throw()
|
||||
void operator delete(void* p) TEST_NOEXCEPT
|
||||
{
|
||||
++unsized_delete_called;
|
||||
std::free(p);
|
||||
}
|
||||
|
||||
void operator delete(void* p, const std::nothrow_t&) throw()
|
||||
void operator delete(void* p, const std::nothrow_t&) TEST_NOEXCEPT
|
||||
{
|
||||
++unsized_delete_nothrow_called;
|
||||
std::free(p);
|
||||
}
|
||||
|
||||
void operator delete [] (void* p, std::align_val_t a) throw()
|
||||
void operator delete [] (void* p, std::align_val_t a) TEST_NOEXCEPT
|
||||
{
|
||||
++aligned_delete_called;
|
||||
std::free(p);
|
||||
|
||||
@@ -20,6 +20,8 @@
|
||||
#include <cassert>
|
||||
#include <limits>
|
||||
|
||||
#include "test_macros.h"
|
||||
|
||||
constexpr auto OverAligned = alignof(std::max_align_t) * 2;
|
||||
|
||||
int A_constructed = 0;
|
||||
@@ -41,7 +43,7 @@ struct B {
|
||||
int new_called = 0;
|
||||
alignas(OverAligned) char Buff[OverAligned * 3];
|
||||
|
||||
void* operator new[](std::size_t s, std::align_val_t a) throw(std::bad_alloc)
|
||||
void* operator new[](std::size_t s, std::align_val_t a) TEST_THROW_SPEC(std::bad_alloc)
|
||||
{
|
||||
assert(!new_called);
|
||||
assert(s <= sizeof(Buff));
|
||||
@@ -50,7 +52,7 @@ void* operator new[](std::size_t s, std::align_val_t a) throw(std::bad_alloc)
|
||||
return Buff;
|
||||
}
|
||||
|
||||
void operator delete[](void* p, std::align_val_t a) throw()
|
||||
void operator delete[](void* p, std::align_val_t a) TEST_NOEXCEPT
|
||||
{
|
||||
assert(p == Buff);
|
||||
assert(static_cast<std::size_t>(a) == OverAligned);
|
||||
|
||||
@@ -21,6 +21,8 @@
|
||||
#include <cassert>
|
||||
#include <limits>
|
||||
|
||||
#include "test_macros.h"
|
||||
|
||||
constexpr auto OverAligned = alignof(std::max_align_t) * 2;
|
||||
|
||||
int A_constructed = 0;
|
||||
@@ -44,7 +46,7 @@ int new_called = 0;
|
||||
|
||||
alignas(OverAligned) char DummyData[OverAligned * 4];
|
||||
|
||||
void* operator new[](std::size_t s, std::align_val_t a) throw(std::bad_alloc)
|
||||
void* operator new[](std::size_t s, std::align_val_t a) TEST_THROW_SPEC(std::bad_alloc)
|
||||
{
|
||||
assert(new_called == 0); // We already allocated
|
||||
assert(s <= sizeof(DummyData));
|
||||
@@ -53,7 +55,7 @@ void* operator new[](std::size_t s, std::align_val_t a) throw(std::bad_alloc)
|
||||
return DummyData;
|
||||
}
|
||||
|
||||
void operator delete[](void* p, std::align_val_t a) throw()
|
||||
void operator delete[](void* p, std::align_val_t a) TEST_NOEXCEPT
|
||||
{
|
||||
assert(new_called == 1);
|
||||
--new_called;
|
||||
|
||||
@@ -17,9 +17,11 @@
|
||||
#include <cassert>
|
||||
#include <limits>
|
||||
|
||||
#include "test_macros.h"
|
||||
|
||||
int new_called = 0;
|
||||
|
||||
void* operator new(std::size_t s) throw(std::bad_alloc)
|
||||
void* operator new(std::size_t s) TEST_THROW_SPEC(std::bad_alloc)
|
||||
{
|
||||
++new_called;
|
||||
void* ret = std::malloc(s);
|
||||
@@ -27,7 +29,7 @@ void* operator new(std::size_t s) throw(std::bad_alloc)
|
||||
return ret;
|
||||
}
|
||||
|
||||
void operator delete(void* p) throw()
|
||||
void operator delete(void* p) TEST_NOEXCEPT
|
||||
{
|
||||
--new_called;
|
||||
std::free(p);
|
||||
|
||||
@@ -18,9 +18,11 @@
|
||||
#include <cassert>
|
||||
#include <limits>
|
||||
|
||||
#include "test_macros.h"
|
||||
|
||||
volatile int new_called = 0;
|
||||
|
||||
void* operator new(std::size_t s) throw(std::bad_alloc)
|
||||
void* operator new(std::size_t s) TEST_THROW_SPEC(std::bad_alloc)
|
||||
{
|
||||
++new_called;
|
||||
void* ret = std::malloc(s);
|
||||
@@ -28,7 +30,7 @@ void* operator new(std::size_t s) throw(std::bad_alloc)
|
||||
return ret;
|
||||
}
|
||||
|
||||
void operator delete(void* p) throw()
|
||||
void operator delete(void* p) TEST_NOEXCEPT
|
||||
{
|
||||
--new_called;
|
||||
std::free(p);
|
||||
|
||||
@@ -20,23 +20,25 @@
|
||||
#include <cstdlib>
|
||||
#include <cassert>
|
||||
|
||||
#include "test_macros.h"
|
||||
|
||||
int unsized_delete_called = 0;
|
||||
int unsized_delete_nothrow_called = 0;
|
||||
int sized_delete_called = 0;
|
||||
|
||||
void operator delete[](void* p) throw()
|
||||
void operator delete[](void* p) TEST_NOEXCEPT
|
||||
{
|
||||
++unsized_delete_called;
|
||||
std::free(p);
|
||||
}
|
||||
|
||||
void operator delete[](void* p, const std::nothrow_t&) throw()
|
||||
void operator delete[](void* p, const std::nothrow_t&) TEST_NOEXCEPT
|
||||
{
|
||||
++unsized_delete_nothrow_called;
|
||||
std::free(p);
|
||||
}
|
||||
|
||||
void operator delete[](void* p, std::size_t) throw()
|
||||
void operator delete[](void* p, std::size_t) TEST_NOEXCEPT
|
||||
{
|
||||
++sized_delete_called;
|
||||
std::free(p);
|
||||
|
||||
@@ -25,23 +25,25 @@
|
||||
#include <cstdlib>
|
||||
#include <cassert>
|
||||
|
||||
#include "test_macros.h"
|
||||
|
||||
int unsized_delete_called = 0;
|
||||
int unsized_delete_nothrow_called = 0;
|
||||
int sized_delete_called = 0;
|
||||
|
||||
void operator delete[](void* p) throw()
|
||||
void operator delete[](void* p) TEST_NOEXCEPT
|
||||
{
|
||||
++unsized_delete_called;
|
||||
std::free(p);
|
||||
}
|
||||
|
||||
void operator delete[](void* p, const std::nothrow_t&) throw()
|
||||
void operator delete[](void* p, const std::nothrow_t&) TEST_NOEXCEPT
|
||||
{
|
||||
++unsized_delete_nothrow_called;
|
||||
std::free(p);
|
||||
}
|
||||
|
||||
void operator delete[](void* p, std::size_t) throw()
|
||||
void operator delete[](void* p, std::size_t) TEST_NOEXCEPT
|
||||
{
|
||||
++sized_delete_called;
|
||||
std::free(p);
|
||||
|
||||
@@ -18,16 +18,18 @@
|
||||
#include <cstdlib>
|
||||
#include <cassert>
|
||||
|
||||
#include "test_macros.h"
|
||||
|
||||
int delete_called = 0;
|
||||
int delete_nothrow_called = 0;
|
||||
|
||||
void operator delete[](void* p) throw()
|
||||
void operator delete[](void* p) TEST_NOEXCEPT
|
||||
{
|
||||
++delete_called;
|
||||
std::free(p);
|
||||
}
|
||||
|
||||
void operator delete[](void* p, const std::nothrow_t&) throw()
|
||||
void operator delete[](void* p, const std::nothrow_t&) TEST_NOEXCEPT
|
||||
{
|
||||
++delete_nothrow_called;
|
||||
std::free(p);
|
||||
|
||||
@@ -33,23 +33,25 @@
|
||||
#include <cstdlib>
|
||||
#include <cassert>
|
||||
|
||||
#include "test_macros.h"
|
||||
|
||||
int unsized_delete_called = 0;
|
||||
int unsized_delete_nothrow_called = 0;
|
||||
int sized_delete_called = 0;
|
||||
|
||||
void operator delete[](void* p) throw()
|
||||
void operator delete[](void* p) TEST_NOEXCEPT
|
||||
{
|
||||
++unsized_delete_called;
|
||||
std::free(p);
|
||||
}
|
||||
|
||||
void operator delete[](void* p, const std::nothrow_t&) throw()
|
||||
void operator delete[](void* p, const std::nothrow_t&) TEST_NOEXCEPT
|
||||
{
|
||||
++unsized_delete_nothrow_called;
|
||||
std::free(p);
|
||||
}
|
||||
|
||||
void operator delete[](void* p, std::size_t) throw()
|
||||
void operator delete[](void* p, std::size_t) TEST_NOEXCEPT
|
||||
{
|
||||
++sized_delete_called;
|
||||
std::free(p);
|
||||
|
||||
@@ -23,6 +23,8 @@
|
||||
#include <cstdlib>
|
||||
#include <cassert>
|
||||
|
||||
#include "test_macros.h"
|
||||
|
||||
constexpr auto OverAligned = alignof(std::max_align_t) * 2;
|
||||
|
||||
int unsized_delete_called = 0;
|
||||
@@ -35,19 +37,19 @@ void reset() {
|
||||
aligned_delete_called = 0;
|
||||
}
|
||||
|
||||
void operator delete(void* p) throw()
|
||||
void operator delete(void* p) TEST_NOEXCEPT
|
||||
{
|
||||
++unsized_delete_called;
|
||||
std::free(p);
|
||||
}
|
||||
|
||||
void operator delete(void* p, const std::nothrow_t&) throw()
|
||||
void operator delete(void* p, const std::nothrow_t&) TEST_NOEXCEPT
|
||||
{
|
||||
++unsized_delete_nothrow_called;
|
||||
std::free(p);
|
||||
}
|
||||
|
||||
void operator delete(void* p, std::align_val_t a) throw()
|
||||
void operator delete(void* p, std::align_val_t a) TEST_NOEXCEPT
|
||||
{
|
||||
++aligned_delete_called;
|
||||
std::free(p);
|
||||
|
||||
@@ -20,6 +20,7 @@
|
||||
#include <cassert>
|
||||
#include <limits>
|
||||
|
||||
#include "test_macros.h"
|
||||
|
||||
constexpr auto OverAligned = alignof(std::max_align_t) * 2;
|
||||
|
||||
@@ -42,7 +43,7 @@ struct B {
|
||||
int new_called = 0;
|
||||
alignas(OverAligned) char Buff[OverAligned * 2];
|
||||
|
||||
void* operator new(std::size_t s, std::align_val_t a) throw(std::bad_alloc)
|
||||
void* operator new(std::size_t s, std::align_val_t a) TEST_THROW_SPEC(std::bad_alloc)
|
||||
{
|
||||
assert(!new_called);
|
||||
assert(s <= sizeof(Buff));
|
||||
@@ -51,7 +52,7 @@ void* operator new(std::size_t s, std::align_val_t a) throw(std::bad_alloc)
|
||||
return Buff;
|
||||
}
|
||||
|
||||
void operator delete(void* p, std::align_val_t a) throw()
|
||||
void operator delete(void* p, std::align_val_t a) TEST_NOEXCEPT
|
||||
{
|
||||
assert(p == Buff);
|
||||
assert(static_cast<std::size_t>(a) == OverAligned);
|
||||
|
||||
@@ -21,6 +21,8 @@
|
||||
#include <cassert>
|
||||
#include <limits>
|
||||
|
||||
#include "test_macros.h"
|
||||
|
||||
constexpr auto OverAligned = alignof(std::max_align_t) * 2;
|
||||
|
||||
bool A_constructed = false;
|
||||
@@ -44,7 +46,7 @@ int new_called = 0;
|
||||
|
||||
alignas(OverAligned) char DummyData[OverAligned];
|
||||
|
||||
void* operator new(std::size_t s, std::align_val_t a) throw(std::bad_alloc)
|
||||
void* operator new(std::size_t s, std::align_val_t a) TEST_THROW_SPEC(std::bad_alloc)
|
||||
{
|
||||
assert(new_called == 0); // We already allocated
|
||||
assert(s <= sizeof(DummyData));
|
||||
@@ -53,7 +55,7 @@ void* operator new(std::size_t s, std::align_val_t a) throw(std::bad_alloc)
|
||||
return DummyData;
|
||||
}
|
||||
|
||||
void operator delete(void* p, std::align_val_t a) throw()
|
||||
void operator delete(void* p, std::align_val_t a) TEST_NOEXCEPT
|
||||
{
|
||||
assert(new_called == 1);
|
||||
--new_called;
|
||||
|
||||
@@ -17,9 +17,11 @@
|
||||
#include <cassert>
|
||||
#include <limits>
|
||||
|
||||
#include "test_macros.h"
|
||||
|
||||
int new_called = 0;
|
||||
|
||||
void* operator new(std::size_t s) throw(std::bad_alloc)
|
||||
void* operator new(std::size_t s) TEST_THROW_SPEC(std::bad_alloc)
|
||||
{
|
||||
++new_called;
|
||||
void* ret = std::malloc(s);
|
||||
@@ -27,7 +29,7 @@ void* operator new(std::size_t s) throw(std::bad_alloc)
|
||||
return ret;
|
||||
}
|
||||
|
||||
void operator delete(void* p) throw()
|
||||
void operator delete(void* p) TEST_NOEXCEPT
|
||||
{
|
||||
--new_called;
|
||||
std::free(p);
|
||||
|
||||
@@ -17,9 +17,11 @@
|
||||
#include <cassert>
|
||||
#include <limits>
|
||||
|
||||
#include "test_macros.h"
|
||||
|
||||
int new_called = 0;
|
||||
|
||||
void* operator new(std::size_t s) throw(std::bad_alloc)
|
||||
void* operator new(std::size_t s) TEST_THROW_SPEC(std::bad_alloc)
|
||||
{
|
||||
++new_called;
|
||||
void* ret = std::malloc(s);
|
||||
@@ -27,7 +29,7 @@ void* operator new(std::size_t s) throw(std::bad_alloc)
|
||||
return ret;
|
||||
}
|
||||
|
||||
void operator delete(void* p) throw()
|
||||
void operator delete(void* p) TEST_NOEXCEPT
|
||||
{
|
||||
--new_called;
|
||||
std::free(p);
|
||||
|
||||
@@ -20,23 +20,25 @@
|
||||
#include <cstdlib>
|
||||
#include <cassert>
|
||||
|
||||
#include "test_macros.h"
|
||||
|
||||
int unsized_delete_called = 0;
|
||||
int unsized_delete_nothrow_called = 0;
|
||||
int sized_delete_called = 0;
|
||||
|
||||
void operator delete(void* p) throw()
|
||||
void operator delete(void* p) TEST_NOEXCEPT
|
||||
{
|
||||
++unsized_delete_called;
|
||||
std::free(p);
|
||||
}
|
||||
|
||||
void operator delete(void* p, const std::nothrow_t&) throw()
|
||||
void operator delete(void* p, const std::nothrow_t&) TEST_NOEXCEPT
|
||||
{
|
||||
++unsized_delete_nothrow_called;
|
||||
std::free(p);
|
||||
}
|
||||
|
||||
void operator delete(void* p, std::size_t) throw()
|
||||
void operator delete(void* p, std::size_t) TEST_NOEXCEPT
|
||||
{
|
||||
++sized_delete_called;
|
||||
std::free(p);
|
||||
|
||||
@@ -25,23 +25,25 @@
|
||||
#include <cstdlib>
|
||||
#include <cassert>
|
||||
|
||||
#include "test_macros.h"
|
||||
|
||||
int unsized_delete_called = 0;
|
||||
int unsized_delete_nothrow_called = 0;
|
||||
int sized_delete_called = 0;
|
||||
|
||||
void operator delete(void* p) throw()
|
||||
void operator delete(void* p) TEST_NOEXCEPT
|
||||
{
|
||||
++unsized_delete_called;
|
||||
std::free(p);
|
||||
}
|
||||
|
||||
void operator delete(void* p, const std::nothrow_t&) throw()
|
||||
void operator delete(void* p, const std::nothrow_t&) TEST_NOEXCEPT
|
||||
{
|
||||
++unsized_delete_nothrow_called;
|
||||
std::free(p);
|
||||
}
|
||||
|
||||
void operator delete(void* p, std::size_t) throw()
|
||||
void operator delete(void* p, std::size_t) TEST_NOEXCEPT
|
||||
{
|
||||
++sized_delete_called;
|
||||
std::free(p);
|
||||
|
||||
@@ -18,16 +18,18 @@
|
||||
#include <cstdlib>
|
||||
#include <cassert>
|
||||
|
||||
#include "test_macros.h"
|
||||
|
||||
int delete_called = 0;
|
||||
int delete_nothrow_called = 0;
|
||||
|
||||
void operator delete(void* p) throw()
|
||||
void operator delete(void* p) TEST_NOEXCEPT
|
||||
{
|
||||
++delete_called;
|
||||
std::free(p);
|
||||
}
|
||||
|
||||
void operator delete(void* p, const std::nothrow_t&) throw()
|
||||
void operator delete(void* p, const std::nothrow_t&) TEST_NOEXCEPT
|
||||
{
|
||||
++delete_nothrow_called;
|
||||
std::free(p);
|
||||
|
||||
@@ -33,23 +33,25 @@
|
||||
#include <cstdlib>
|
||||
#include <cassert>
|
||||
|
||||
#include "test_macros.h"
|
||||
|
||||
int unsized_delete_called = 0;
|
||||
int unsized_delete_nothrow_called = 0;
|
||||
int sized_delete_called = 0;
|
||||
|
||||
void operator delete(void* p) throw()
|
||||
void operator delete(void* p) TEST_NOEXCEPT
|
||||
{
|
||||
++unsized_delete_called;
|
||||
std::free(p);
|
||||
}
|
||||
|
||||
void operator delete(void* p, const std::nothrow_t&) throw()
|
||||
void operator delete(void* p, const std::nothrow_t&) TEST_NOEXCEPT
|
||||
{
|
||||
++unsized_delete_nothrow_called;
|
||||
std::free(p);
|
||||
}
|
||||
|
||||
void operator delete(void* p, std::size_t) throw()
|
||||
void operator delete(void* p, std::size_t) TEST_NOEXCEPT
|
||||
{
|
||||
++sized_delete_called;
|
||||
std::free(p);
|
||||
|
||||
Reference in New Issue
Block a user