aboutsummaryrefslogtreecommitdiff
path: root/libstdc++-v3
diff options
context:
space:
mode:
authorJonathan Wakely <jwakely@redhat.com>2016-12-07 15:22:51 +0000
committerJonathan Wakely <redi@gcc.gnu.org>2016-12-07 15:22:51 +0000
commit1f153a1d2a97feaca914787f3d08b7d952b4bfe0 (patch)
tree3ba08e59fdfc71363ecc1ae48190ef94110c34ac /libstdc++-v3
parentba454dfbbec81fafed8f14b2fe59d895bd0255ac (diff)
downloadgcc-1f153a1d2a97feaca914787f3d08b7d952b4bfe0.zip
gcc-1f153a1d2a97feaca914787f3d08b7d952b4bfe0.tar.gz
gcc-1f153a1d2a97feaca914787f3d08b7d952b4bfe0.tar.bz2
Replace dynamic exception specifications in testsuite
* testsuite/util/testsuite_hooks.h (THROW): Define. * testsuite/util/replacement_memory_operators.h: Include testsuite_hooks.h and use THROW macro. * testsuite/util/testsuite_tr1.h: Likewise. * testsuite/20_util/allocator/1.cc: Use THROW macro. * testsuite/22_locale/locale/cons/12352.cc: Likewise. * testsuite/23_containers/vector/zero_sized_allocations.cc: Likewise. * testsuite/30_threads/lock_guard/cons/1.cc: Replace dynamic exception specification with noexcept-specifier. * testsuite/ext/pool_allocator/allocate_chunk.cc: Include testsuite_hooks.h and use THROW macro. * testsuite/ext/profile/replace_new.cc: Likewise. From-SVN: r243353
Diffstat (limited to 'libstdc++-v3')
-rw-r--r--libstdc++-v3/ChangeLog13
-rw-r--r--libstdc++-v3/testsuite/20_util/allocator/1.cc2
-rw-r--r--libstdc++-v3/testsuite/22_locale/locale/cons/12352.cc4
-rw-r--r--libstdc++-v3/testsuite/23_containers/vector/zero_sized_allocations.cc2
-rw-r--r--libstdc++-v3/testsuite/30_threads/lock_guard/cons/1.cc2
-rw-r--r--libstdc++-v3/testsuite/ext/pool_allocator/allocate_chunk.cc3
-rw-r--r--libstdc++-v3/testsuite/ext/profile/replace_new.cc3
-rw-r--r--libstdc++-v3/testsuite/util/replacement_memory_operators.h5
-rw-r--r--libstdc++-v3/testsuite/util/testsuite_hooks.h6
-rw-r--r--libstdc++-v3/testsuite/util/testsuite_tr1.h15
10 files changed, 39 insertions, 16 deletions
diff --git a/libstdc++-v3/ChangeLog b/libstdc++-v3/ChangeLog
index 53b4511..c102e60 100644
--- a/libstdc++-v3/ChangeLog
+++ b/libstdc++-v3/ChangeLog
@@ -1,5 +1,18 @@
2016-12-07 Jonathan Wakely <jwakely@redhat.com>
+ * testsuite/util/testsuite_hooks.h (THROW): Define.
+ * testsuite/util/replacement_memory_operators.h: Include
+ testsuite_hooks.h and use THROW macro.
+ * testsuite/util/testsuite_tr1.h: Likewise.
+ * testsuite/20_util/allocator/1.cc: Use THROW macro.
+ * testsuite/22_locale/locale/cons/12352.cc: Likewise.
+ * testsuite/23_containers/vector/zero_sized_allocations.cc: Likewise.
+ * testsuite/30_threads/lock_guard/cons/1.cc: Replace dynamic exception
+ specification with noexcept-specifier.
+ * testsuite/ext/pool_allocator/allocate_chunk.cc: Include
+ testsuite_hooks.h and use THROW macro.
+ * testsuite/ext/profile/replace_new.cc: Likewise.
+
* include/ext/bitmap_allocator.h (bitmap_allocator::_S_refill_pool)
(bitmap_allocator::_M_allocate_single_object)
(bitmap_allocator::_M_get): Use _GLIBCXX_THROW macro.
diff --git a/libstdc++-v3/testsuite/20_util/allocator/1.cc b/libstdc++-v3/testsuite/20_util/allocator/1.cc
index 6905c86..0c06839 100644
--- a/libstdc++-v3/testsuite/20_util/allocator/1.cc
+++ b/libstdc++-v3/testsuite/20_util/allocator/1.cc
@@ -30,7 +30,7 @@ bool check_new = false;
bool check_delete = false;
void*
-operator new(std::size_t n) throw(std::bad_alloc)
+operator new(std::size_t n) THROW(std::bad_alloc)
{
check_new = true;
return std::malloc(n);
diff --git a/libstdc++-v3/testsuite/22_locale/locale/cons/12352.cc b/libstdc++-v3/testsuite/22_locale/locale/cons/12352.cc
index 8faf714..d514b2a 100644
--- a/libstdc++-v3/testsuite/22_locale/locale/cons/12352.cc
+++ b/libstdc++-v3/testsuite/22_locale/locale/cons/12352.cc
@@ -45,7 +45,7 @@ void deallocate(void* p)
std::free(p);
}
-void* operator new(std::size_t n) throw (std::bad_alloc)
+void* operator new(std::size_t n) THROW (std::bad_alloc)
{
void* ret = allocate(n);
if (!ret)
@@ -53,7 +53,7 @@ void* operator new(std::size_t n) throw (std::bad_alloc)
return ret;
}
-void* operator new[](std::size_t n) throw (std::bad_alloc)
+void* operator new[](std::size_t n) THROW (std::bad_alloc)
{
void* ret = allocate(n);
if (!ret)
diff --git a/libstdc++-v3/testsuite/23_containers/vector/zero_sized_allocations.cc b/libstdc++-v3/testsuite/23_containers/vector/zero_sized_allocations.cc
index 272caf3..524241b 100644
--- a/libstdc++-v3/testsuite/23_containers/vector/zero_sized_allocations.cc
+++ b/libstdc++-v3/testsuite/23_containers/vector/zero_sized_allocations.cc
@@ -22,7 +22,7 @@
unsigned int zero_sized_news = 0;
-void *operator new(std::size_t size) throw (std::bad_alloc)
+void *operator new(std::size_t size) THROW (std::bad_alloc)
{
/* malloc(0) is unpredictable; avoid it. */
if (size == 0)
diff --git a/libstdc++-v3/testsuite/30_threads/lock_guard/cons/1.cc b/libstdc++-v3/testsuite/30_threads/lock_guard/cons/1.cc
index 1296760..414b678 100644
--- a/libstdc++-v3/testsuite/30_threads/lock_guard/cons/1.cc
+++ b/libstdc++-v3/testsuite/30_threads/lock_guard/cons/1.cc
@@ -26,7 +26,7 @@ struct Mutex
{
Mutex() : locked(false) { }
- ~Mutex() throw(int)
+ ~Mutex() noexcept(false)
{
if (locked)
throw 0;
diff --git a/libstdc++-v3/testsuite/ext/pool_allocator/allocate_chunk.cc b/libstdc++-v3/testsuite/ext/pool_allocator/allocate_chunk.cc
index c751739..7838039 100644
--- a/libstdc++-v3/testsuite/ext/pool_allocator/allocate_chunk.cc
+++ b/libstdc++-v3/testsuite/ext/pool_allocator/allocate_chunk.cc
@@ -20,6 +20,7 @@
// 20.4.1.1 allocator members
#include <ext/pool_allocator.h>
+#include <testsuite_hooks.h>
struct small
{
@@ -32,7 +33,7 @@ struct big
};
void*
-operator new(size_t n) throw(std::bad_alloc)
+operator new(size_t n) THROW(std::bad_alloc)
{
static bool first = true;
if (!first)
diff --git a/libstdc++-v3/testsuite/ext/profile/replace_new.cc b/libstdc++-v3/testsuite/ext/profile/replace_new.cc
index be5ec09..9c94594 100644
--- a/libstdc++-v3/testsuite/ext/profile/replace_new.cc
+++ b/libstdc++-v3/testsuite/ext/profile/replace_new.cc
@@ -20,10 +20,11 @@
// { dg-require-profile-mode "" }
#include <vector>
+#include <testsuite_hooks.h>
using std::vector;
-void* operator new(std::size_t size) throw(std::bad_alloc)
+void* operator new(std::size_t size) THROW(std::bad_alloc)
{
void* p = std::malloc(size);
if (!p)
diff --git a/libstdc++-v3/testsuite/util/replacement_memory_operators.h b/libstdc++-v3/testsuite/util/replacement_memory_operators.h
index d063edf..5ea6753 100644
--- a/libstdc++-v3/testsuite/util/replacement_memory_operators.h
+++ b/libstdc++-v3/testsuite/util/replacement_memory_operators.h
@@ -20,6 +20,7 @@
#include <stdexcept>
#include <cstdlib>
#include <cstdio>
+#include <testsuite_hooks.h>
namespace __gnu_test
{
@@ -32,7 +33,7 @@ namespace __gnu_test
counter() : _M_count(0), _M_throw(true) { }
- ~counter() throw (counter_error)
+ ~counter() THROW (counter_error)
{
if (_M_throw && _M_count != 0)
throw counter_error();
@@ -86,7 +87,7 @@ namespace __gnu_test
}
} // namespace __gnu_test
-void* operator new(std::size_t size) throw(std::bad_alloc)
+void* operator new(std::size_t size) THROW(std::bad_alloc)
{
std::printf("operator new is called \n");
void* p = std::malloc(size);
diff --git a/libstdc++-v3/testsuite/util/testsuite_hooks.h b/libstdc++-v3/testsuite/util/testsuite_hooks.h
index e4c4866..9974faa 100644
--- a/libstdc++-v3/testsuite/util/testsuite_hooks.h
+++ b/libstdc++-v3/testsuite/util/testsuite_hooks.h
@@ -75,6 +75,12 @@
#langTERR ".ISO8859-" #part "@euro" : #langTERR ".ISO8859-" #part)
#endif
+#if __cplusplus < 201103L
+# define THROW(X) throw(X)
+#else
+# define THROW(X) noexcept(false)
+#endif
+
namespace __gnu_test
{
// All macros are defined in GLIBCXX_CONFIGURE_TESTSUITE and imported
diff --git a/libstdc++-v3/testsuite/util/testsuite_tr1.h b/libstdc++-v3/testsuite/util/testsuite_tr1.h
index 9f2c632..c6a4986 100644
--- a/libstdc++-v3/testsuite/util/testsuite_tr1.h
+++ b/libstdc++-v3/testsuite/util/testsuite_tr1.h
@@ -23,6 +23,7 @@
#define _GLIBCXX_TESTSUITE_TR1_H
#include <ext/type_traits.h>
+#include <testsuite_hooks.h>
namespace __gnu_test
{
@@ -146,25 +147,25 @@ namespace __gnu_test
struct ThrowExplicitClass
{
- ThrowExplicitClass(double&) throw(int);
- explicit ThrowExplicitClass(int&) throw(int);
- ThrowExplicitClass(double&, int&, double&) throw(int);
+ ThrowExplicitClass(double&) THROW(int);
+ explicit ThrowExplicitClass(int&) THROW(int);
+ ThrowExplicitClass(double&, int&, double&) THROW(int);
};
struct ThrowDefaultClass
{
- ThrowDefaultClass() throw(int);
+ ThrowDefaultClass() THROW(int);
};
struct ThrowCopyConsClass
{
- ThrowCopyConsClass(const ThrowCopyConsClass&) throw(int);
+ ThrowCopyConsClass(const ThrowCopyConsClass&) THROW(int);
};
#if __cplusplus >= 201103L
struct ThrowMoveConsClass
{
- ThrowMoveConsClass(ThrowMoveConsClass&&) throw(int);
+ ThrowMoveConsClass(ThrowMoveConsClass&&) THROW(int);
};
struct NoexceptExplicitClass
@@ -558,7 +559,7 @@ namespace __gnu_test
struct TD2
{
- ~TD2() throw(int);
+ ~TD2() THROW(int);
};
struct Aggr