From 3ca45664523ceef88a98df07ba0db922313f9ee8 Mon Sep 17 00:00:00 2001 From: Eric Fiselier Date: Sun, 11 Dec 2016 02:47:36 +0000 Subject: [PATCH] Fix more uses of dynamic exception specifications in C++17 llvm-svn: 289356 --- .../delete_align_val_t_replace.pass.cpp | 8 +++-- .../new_align_val_t_nothrow_replace.pass.cpp | 6 ++-- .../new_align_val_t_replace.pass.cpp | 6 ++-- .../new_array_nothrow_replace.pass.cpp | 6 ++-- .../new.delete.array/new_array_replace.pass.cpp | 6 ++-- .../new.delete.array/sized_delete_array11.pass.cpp | 8 +++-- .../new.delete.array/sized_delete_array14.pass.cpp | 8 +++-- ...elete_array_calls_unsized_delete_array.pass.cpp | 6 ++-- .../sized_delete_array_fsizeddeallocation.sh.cpp | 8 +++-- .../delete_align_val_t_replace.pass.cpp | 8 +++-- .../new_align_val_t_nothrow_replace.pass.cpp | 5 ++-- .../new_align_val_t_replace.pass.cpp | 6 ++-- .../new.delete.single/new_nothrow_replace.pass.cpp | 6 ++-- .../new.delete.single/new_replace.pass.cpp | 6 ++-- .../new.delete.single/sized_delete11.pass.cpp | 8 +++-- .../new.delete.single/sized_delete14.pass.cpp | 8 +++-- .../sized_delete_calls_unsized_delete.pass.cpp | 6 ++-- .../sized_delete_fsizeddeallocation.sh.cpp | 8 +++-- libcxx/test/support/count_new.hpp | 24 +++------------ libcxx/test/support/test_allocator.h | 34 +++++++++++----------- libcxx/test/support/test_macros.h | 14 ++++++--- 21 files changed, 110 insertions(+), 85 deletions(-) diff --git a/libcxx/test/std/language.support/support.dynamic/new.delete/new.delete.array/delete_align_val_t_replace.pass.cpp b/libcxx/test/std/language.support/support.dynamic/new.delete/new.delete.array/delete_align_val_t_replace.pass.cpp index decf26e..71130a8 100644 --- a/libcxx/test/std/language.support/support.dynamic/new.delete/new.delete.array/delete_align_val_t_replace.pass.cpp +++ b/libcxx/test/std/language.support/support.dynamic/new.delete/new.delete.array/delete_align_val_t_replace.pass.cpp @@ -22,6 +22,8 @@ #include #include +#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); diff --git a/libcxx/test/std/language.support/support.dynamic/new.delete/new.delete.array/new_align_val_t_nothrow_replace.pass.cpp b/libcxx/test/std/language.support/support.dynamic/new.delete/new.delete.array/new_align_val_t_nothrow_replace.pass.cpp index 800318d..03e490e 100644 --- a/libcxx/test/std/language.support/support.dynamic/new.delete/new.delete.array/new_align_val_t_nothrow_replace.pass.cpp +++ b/libcxx/test/std/language.support/support.dynamic/new.delete/new.delete.array/new_align_val_t_nothrow_replace.pass.cpp @@ -20,6 +20,8 @@ #include #include +#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(a) == OverAligned); diff --git a/libcxx/test/std/language.support/support.dynamic/new.delete/new.delete.array/new_align_val_t_replace.pass.cpp b/libcxx/test/std/language.support/support.dynamic/new.delete/new.delete.array/new_align_val_t_replace.pass.cpp index 898d4aa..8f8dfe3 100644 --- a/libcxx/test/std/language.support/support.dynamic/new.delete/new.delete.array/new_align_val_t_replace.pass.cpp +++ b/libcxx/test/std/language.support/support.dynamic/new.delete/new.delete.array/new_align_val_t_replace.pass.cpp @@ -21,6 +21,8 @@ #include #include +#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; diff --git a/libcxx/test/std/language.support/support.dynamic/new.delete/new.delete.array/new_array_nothrow_replace.pass.cpp b/libcxx/test/std/language.support/support.dynamic/new.delete/new.delete.array/new_array_nothrow_replace.pass.cpp index 3b0cb27..53e26c9 100644 --- a/libcxx/test/std/language.support/support.dynamic/new.delete/new.delete.array/new_array_nothrow_replace.pass.cpp +++ b/libcxx/test/std/language.support/support.dynamic/new.delete/new.delete.array/new_array_nothrow_replace.pass.cpp @@ -17,9 +17,11 @@ #include #include +#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); diff --git a/libcxx/test/std/language.support/support.dynamic/new.delete/new.delete.array/new_array_replace.pass.cpp b/libcxx/test/std/language.support/support.dynamic/new.delete/new.delete.array/new_array_replace.pass.cpp index 2815f5b..b0820b1 100644 --- a/libcxx/test/std/language.support/support.dynamic/new.delete/new.delete.array/new_array_replace.pass.cpp +++ b/libcxx/test/std/language.support/support.dynamic/new.delete/new.delete.array/new_array_replace.pass.cpp @@ -18,9 +18,11 @@ #include #include +#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); diff --git a/libcxx/test/std/language.support/support.dynamic/new.delete/new.delete.array/sized_delete_array11.pass.cpp b/libcxx/test/std/language.support/support.dynamic/new.delete/new.delete.array/sized_delete_array11.pass.cpp index 0f7840c..3e41b24 100644 --- a/libcxx/test/std/language.support/support.dynamic/new.delete/new.delete.array/sized_delete_array11.pass.cpp +++ b/libcxx/test/std/language.support/support.dynamic/new.delete/new.delete.array/sized_delete_array11.pass.cpp @@ -20,23 +20,25 @@ #include #include +#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); diff --git a/libcxx/test/std/language.support/support.dynamic/new.delete/new.delete.array/sized_delete_array14.pass.cpp b/libcxx/test/std/language.support/support.dynamic/new.delete/new.delete.array/sized_delete_array14.pass.cpp index 0e2cc6d..fb71580 100644 --- a/libcxx/test/std/language.support/support.dynamic/new.delete/new.delete.array/sized_delete_array14.pass.cpp +++ b/libcxx/test/std/language.support/support.dynamic/new.delete/new.delete.array/sized_delete_array14.pass.cpp @@ -25,23 +25,25 @@ #include #include +#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); diff --git a/libcxx/test/std/language.support/support.dynamic/new.delete/new.delete.array/sized_delete_array_calls_unsized_delete_array.pass.cpp b/libcxx/test/std/language.support/support.dynamic/new.delete/new.delete.array/sized_delete_array_calls_unsized_delete_array.pass.cpp index 6d24aec..ff55ec7 100644 --- a/libcxx/test/std/language.support/support.dynamic/new.delete/new.delete.array/sized_delete_array_calls_unsized_delete_array.pass.cpp +++ b/libcxx/test/std/language.support/support.dynamic/new.delete/new.delete.array/sized_delete_array_calls_unsized_delete_array.pass.cpp @@ -18,16 +18,18 @@ #include #include +#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); diff --git a/libcxx/test/std/language.support/support.dynamic/new.delete/new.delete.array/sized_delete_array_fsizeddeallocation.sh.cpp b/libcxx/test/std/language.support/support.dynamic/new.delete/new.delete.array/sized_delete_array_fsizeddeallocation.sh.cpp index 7dd510b..5b93540e 100644 --- a/libcxx/test/std/language.support/support.dynamic/new.delete/new.delete.array/sized_delete_array_fsizeddeallocation.sh.cpp +++ b/libcxx/test/std/language.support/support.dynamic/new.delete/new.delete.array/sized_delete_array_fsizeddeallocation.sh.cpp @@ -33,23 +33,25 @@ #include #include +#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); diff --git a/libcxx/test/std/language.support/support.dynamic/new.delete/new.delete.single/delete_align_val_t_replace.pass.cpp b/libcxx/test/std/language.support/support.dynamic/new.delete/new.delete.single/delete_align_val_t_replace.pass.cpp index 30ce114..6bfdd05 100644 --- a/libcxx/test/std/language.support/support.dynamic/new.delete/new.delete.single/delete_align_val_t_replace.pass.cpp +++ b/libcxx/test/std/language.support/support.dynamic/new.delete/new.delete.single/delete_align_val_t_replace.pass.cpp @@ -23,6 +23,8 @@ #include #include +#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); diff --git a/libcxx/test/std/language.support/support.dynamic/new.delete/new.delete.single/new_align_val_t_nothrow_replace.pass.cpp b/libcxx/test/std/language.support/support.dynamic/new.delete/new.delete.single/new_align_val_t_nothrow_replace.pass.cpp index 8348240..9f64c97 100644 --- a/libcxx/test/std/language.support/support.dynamic/new.delete/new.delete.single/new_align_val_t_nothrow_replace.pass.cpp +++ b/libcxx/test/std/language.support/support.dynamic/new.delete/new.delete.single/new_align_val_t_nothrow_replace.pass.cpp @@ -20,6 +20,7 @@ #include #include +#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(a) == OverAligned); diff --git a/libcxx/test/std/language.support/support.dynamic/new.delete/new.delete.single/new_align_val_t_replace.pass.cpp b/libcxx/test/std/language.support/support.dynamic/new.delete/new.delete.single/new_align_val_t_replace.pass.cpp index 8aecc2d..0366cf8 100644 --- a/libcxx/test/std/language.support/support.dynamic/new.delete/new.delete.single/new_align_val_t_replace.pass.cpp +++ b/libcxx/test/std/language.support/support.dynamic/new.delete/new.delete.single/new_align_val_t_replace.pass.cpp @@ -21,6 +21,8 @@ #include #include +#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; diff --git a/libcxx/test/std/language.support/support.dynamic/new.delete/new.delete.single/new_nothrow_replace.pass.cpp b/libcxx/test/std/language.support/support.dynamic/new.delete/new.delete.single/new_nothrow_replace.pass.cpp index 9df4ace..dbc64ba 100644 --- a/libcxx/test/std/language.support/support.dynamic/new.delete/new.delete.single/new_nothrow_replace.pass.cpp +++ b/libcxx/test/std/language.support/support.dynamic/new.delete/new.delete.single/new_nothrow_replace.pass.cpp @@ -17,9 +17,11 @@ #include #include +#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); diff --git a/libcxx/test/std/language.support/support.dynamic/new.delete/new.delete.single/new_replace.pass.cpp b/libcxx/test/std/language.support/support.dynamic/new.delete/new.delete.single/new_replace.pass.cpp index 6056ed7..ad15b49 100644 --- a/libcxx/test/std/language.support/support.dynamic/new.delete/new.delete.single/new_replace.pass.cpp +++ b/libcxx/test/std/language.support/support.dynamic/new.delete/new.delete.single/new_replace.pass.cpp @@ -17,9 +17,11 @@ #include #include +#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); diff --git a/libcxx/test/std/language.support/support.dynamic/new.delete/new.delete.single/sized_delete11.pass.cpp b/libcxx/test/std/language.support/support.dynamic/new.delete/new.delete.single/sized_delete11.pass.cpp index e4064e2..7369c36 100644 --- a/libcxx/test/std/language.support/support.dynamic/new.delete/new.delete.single/sized_delete11.pass.cpp +++ b/libcxx/test/std/language.support/support.dynamic/new.delete/new.delete.single/sized_delete11.pass.cpp @@ -20,23 +20,25 @@ #include #include +#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); diff --git a/libcxx/test/std/language.support/support.dynamic/new.delete/new.delete.single/sized_delete14.pass.cpp b/libcxx/test/std/language.support/support.dynamic/new.delete/new.delete.single/sized_delete14.pass.cpp index 5d9ddd4..6c91f5c 100644 --- a/libcxx/test/std/language.support/support.dynamic/new.delete/new.delete.single/sized_delete14.pass.cpp +++ b/libcxx/test/std/language.support/support.dynamic/new.delete/new.delete.single/sized_delete14.pass.cpp @@ -25,23 +25,25 @@ #include #include +#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); diff --git a/libcxx/test/std/language.support/support.dynamic/new.delete/new.delete.single/sized_delete_calls_unsized_delete.pass.cpp b/libcxx/test/std/language.support/support.dynamic/new.delete/new.delete.single/sized_delete_calls_unsized_delete.pass.cpp index 06be2ea..cb093f3 100644 --- a/libcxx/test/std/language.support/support.dynamic/new.delete/new.delete.single/sized_delete_calls_unsized_delete.pass.cpp +++ b/libcxx/test/std/language.support/support.dynamic/new.delete/new.delete.single/sized_delete_calls_unsized_delete.pass.cpp @@ -18,16 +18,18 @@ #include #include +#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); diff --git a/libcxx/test/std/language.support/support.dynamic/new.delete/new.delete.single/sized_delete_fsizeddeallocation.sh.cpp b/libcxx/test/std/language.support/support.dynamic/new.delete/new.delete.single/sized_delete_fsizeddeallocation.sh.cpp index 8f70427..1b6de23 100644 --- a/libcxx/test/std/language.support/support.dynamic/new.delete/new.delete.single/sized_delete_fsizeddeallocation.sh.cpp +++ b/libcxx/test/std/language.support/support.dynamic/new.delete/new.delete.single/sized_delete_fsizeddeallocation.sh.cpp @@ -33,23 +33,25 @@ #include #include +#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); diff --git a/libcxx/test/support/count_new.hpp b/libcxx/test/support/count_new.hpp index 14645a4..1b05fe3 100644 --- a/libcxx/test/support/count_new.hpp +++ b/libcxx/test/support/count_new.hpp @@ -234,10 +234,7 @@ public: MemCounter globalMemCounter((MemCounter::MemCounterCtorArg_())); #ifndef DISABLE_NEW_COUNT -void* operator new(std::size_t s) -#if TEST_STD_VER < 11 - throw(std::bad_alloc) -#endif +void* operator new(std::size_t s) TEST_THROW_SPEC(std::bad_alloc) { globalMemCounter.newCalled(s); void* ret = std::malloc(s); @@ -246,34 +243,21 @@ void* operator new(std::size_t s) return ret; } -void operator delete(void* p) -#if TEST_STD_VER < 11 - throw() -#else - noexcept -#endif +void operator delete(void* p) TEST_NOEXCEPT { globalMemCounter.deleteCalled(p); std::free(p); } -void* operator new[](std::size_t s) -#if TEST_STD_VER < 11 - throw(std::bad_alloc) -#endif +void* operator new[](std::size_t s) TEST_THROW_SPEC(std::bad_alloc) { globalMemCounter.newArrayCalled(s); return operator new(s); } -void operator delete[](void* p) -#if TEST_STD_VER < 11 - throw() -#else - noexcept -#endif +void operator delete[](void* p) TEST_NOEXCEPT { globalMemCounter.deleteArrayCalled(p); operator delete(p); diff --git a/libcxx/test/support/test_allocator.h b/libcxx/test/support/test_allocator.h index 578b69d..04f15ab 100644 --- a/libcxx/test/support/test_allocator.h +++ b/libcxx/test/support/test_allocator.h @@ -61,13 +61,13 @@ public: template struct rebind {typedef test_allocator other;}; - test_allocator() throw() : data_(0) {++count;} - explicit test_allocator(int i) throw() : data_(i) {++count;} - test_allocator(const test_allocator& a) throw() + test_allocator() TEST_NOEXCEPT : data_(0) {++count;} + explicit test_allocator(int i) TEST_NOEXCEPT : data_(i) {++count;} + test_allocator(const test_allocator& a) TEST_NOEXCEPT : data_(a.data_) {++count;} - template test_allocator(const test_allocator& a) throw() + template test_allocator(const test_allocator& a) TEST_NOEXCEPT : data_(a.data_) {++count;} - ~test_allocator() throw() {assert(data_ >= 0); --count; data_ = -1;} + ~test_allocator() TEST_NOEXCEPT {assert(data_ >= 0); --count; data_ = -1;} pointer address(reference x) const {return &x;} const_pointer address(const_reference x) const {return &x;} pointer allocate(size_type n, const void* = 0) @@ -86,7 +86,7 @@ public: } void deallocate(pointer p, size_type) {assert(data_ >= 0); --alloc_count; ::operator delete((void*)p);} - size_type max_size() const throw() + size_type max_size() const TEST_NOEXCEPT {return UINT_MAX / sizeof(T);} #if TEST_STD_VER < 11 void construct(pointer p, const T& val) @@ -122,13 +122,13 @@ public: template struct rebind {typedef non_default_test_allocator other;}; -// non_default_test_allocator() throw() : data_(0) {++count;} - explicit non_default_test_allocator(int i) throw() : data_(i) {++count;} - non_default_test_allocator(const non_default_test_allocator& a) throw() +// non_default_test_allocator() TEST_NOEXCEPT : data_(0) {++count;} + explicit non_default_test_allocator(int i) TEST_NOEXCEPT : data_(i) {++count;} + non_default_test_allocator(const non_default_test_allocator& a) TEST_NOEXCEPT : data_(a.data_) {++count;} - template non_default_test_allocator(const non_default_test_allocator& a) throw() + template non_default_test_allocator(const non_default_test_allocator& a) TEST_NOEXCEPT : data_(a.data_) {++count;} - ~non_default_test_allocator() throw() {assert(data_ >= 0); --count; data_ = -1;} + ~non_default_test_allocator() TEST_NOEXCEPT {assert(data_ >= 0); --count; data_ = -1;} pointer address(reference x) const {return &x;} const_pointer address(const_reference x) const {return &x;} pointer allocate(size_type n, const void* = 0) @@ -147,7 +147,7 @@ public: } void deallocate(pointer p, size_type) {assert(data_ >= 0); --alloc_count; ::operator delete((void*)p); } - size_type max_size() const throw() + size_type max_size() const TEST_NOEXCEPT {return UINT_MAX / sizeof(T);} #if TEST_STD_VER < 11 void construct(pointer p, const T& val) @@ -181,13 +181,13 @@ public: template struct rebind {typedef test_allocator other;}; - test_allocator() throw() : data_(0) {} - explicit test_allocator(int i) throw() : data_(i) {} - test_allocator(const test_allocator& a) throw() + test_allocator() TEST_NOEXCEPT : data_(0) {} + explicit test_allocator(int i) TEST_NOEXCEPT : data_(i) {} + test_allocator(const test_allocator& a) TEST_NOEXCEPT : data_(a.data_) {} - template test_allocator(const test_allocator& a) throw() + template test_allocator(const test_allocator& a) TEST_NOEXCEPT : data_(a.data_) {} - ~test_allocator() throw() {data_ = -1;} + ~test_allocator() TEST_NOEXCEPT {data_ = -1;} friend bool operator==(const test_allocator& x, const test_allocator& y) {return x.data_ == y.data_;} diff --git a/libcxx/test/support/test_macros.h b/libcxx/test/support/test_macros.h index 32d49be..40d366a 100644 --- a/libcxx/test/support/test_macros.h +++ b/libcxx/test/support/test_macros.h @@ -86,6 +86,8 @@ #endif #if TEST_STD_VER >= 11 +#define TEST_ALIGNOF(...) alignof(__VA_ARGS__) +#define TEST_ALIGNAS(...) alignas(__VA_ARGS__) #define TEST_CONSTEXPR constexpr #define TEST_NOEXCEPT noexcept #define TEST_NOEXCEPT_COND(...) noexcept(__VA_ARGS__) @@ -94,15 +96,19 @@ # else # define TEST_CONSTEXPR_CXX14 # endif -#define TEST_ALIGNOF(...) alignof(__VA_ARGS__) -#define TEST_ALIGNAS(...) alignas(__VA_ARGS__) +# if TEST_STD_VER > 14 +# define TEST_THROW_SPEC(...) +# else +# define TEST_THROW_SPEC(...) throw(__VA_ARGS__) +# endif #else +#define TEST_ALIGNOF(...) __alignof(__VA_ARGS__) +#define TEST_ALIGNAS(...) __attribute__((__aligned__(__VA_ARGS__))) #define TEST_CONSTEXPR #define TEST_CONSTEXPR_CXX14 #define TEST_NOEXCEPT throw() #define TEST_NOEXCEPT_COND(...) -#define TEST_ALIGNOF(...) __alignof(__VA_ARGS__) -#define TEST_ALIGNAS(...) __attribute__((__aligned__(__VA_ARGS__))) +#define TEST_THROW_SPEC(...) throw(__VA_ARGS__) #endif #define TEST_ALIGNAS_TYPE(...) TEST_ALIGNAS(TEST_ALIGNOF(__VA_ARGS__)) -- 2.7.4