Replace dynamic exception specifications in testsuite
authorJonathan Wakely <jwakely@redhat.com>
Wed, 7 Dec 2016 15:22:51 +0000 (15:22 +0000)
committerJonathan Wakely <redi@gcc.gnu.org>
Wed, 7 Dec 2016 15:22:51 +0000 (15:22 +0000)
* 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

libstdc++-v3/ChangeLog
libstdc++-v3/testsuite/20_util/allocator/1.cc
libstdc++-v3/testsuite/22_locale/locale/cons/12352.cc
libstdc++-v3/testsuite/23_containers/vector/zero_sized_allocations.cc
libstdc++-v3/testsuite/30_threads/lock_guard/cons/1.cc
libstdc++-v3/testsuite/ext/pool_allocator/allocate_chunk.cc
libstdc++-v3/testsuite/ext/profile/replace_new.cc
libstdc++-v3/testsuite/util/replacement_memory_operators.h
libstdc++-v3/testsuite/util/testsuite_hooks.h
libstdc++-v3/testsuite/util/testsuite_tr1.h

index 53b4511cd35856aaac59b553567817cdb8e70bb7..c102e607804e154a6f449dc839cb95aa71276d78 100644 (file)
@@ -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.
index 6905c86bd2d1d837ad6c6c2fcfe5ddbbad126bf9..0c068394c9a53565b2327c2bc019301f8fc2d1af 100644 (file)
@@ -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);
index 8faf71490fa46670ea322d1ae1822967acca08de..d514b2affcb9fc9ee682507b28ffdc3876d6e544 100644 (file)
@@ -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)
index 272caf3c793f799eb5eebd59f72cd75be518d69d..524241b3fdda6b22c6cde99dcdf377bf0f4ba4fe 100644 (file)
@@ -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)
index 1296760aae529dd241b42b246e8052c2021f4977..414b678c6c9d238d0dad98cf191e8dd5ee1cb400 100644 (file)
@@ -26,7 +26,7 @@ struct Mutex
 {
   Mutex() : locked(false) { }
 
-  ~Mutex() throw(int)
+  ~Mutex() noexcept(false)
   {
     if (locked)
       throw 0;
index c751739d18575686c416afa71f5d99df5b782803..78380398421eead13e94e133646955566387ad58 100644 (file)
@@ -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)
index be5ec096894aca86adff38da4e57134a200db20d..9c9459488e476cfcbc8cfbfbf33ba916c12fa5a8 100644 (file)
 // { 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)
index d063edf945b9349aa92b189c5f1ff10dd2e62ee7..5ea6753e445789e00df0a9fbd4a6546179adbc24 100644 (file)
@@ -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);
index e4c4866eba403e7056a9858a8d79437c98150515..9974faa40cb9681cb91a081dd4e56f1b598b5568 100644 (file)
          #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
index 9f2c632da8c865d1afdc129ab9e52e092edf112b..c6a4986b983dc3b2855fd2142e232bf506dbf1e0 100644 (file)
@@ -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