]> git.ipfire.org Git - thirdparty/gcc.git/commitdiff
libstdc++: Fix some tests that fail with -fno-exceptions
authorJonathan Wakely <jwakely@redhat.com>
Wed, 7 Jun 2023 12:01:36 +0000 (13:01 +0100)
committerJonathan Wakely <jwakely@redhat.com>
Wed, 7 Jun 2023 15:51:59 +0000 (16:51 +0100)
libstdc++-v3/ChangeLog:

* testsuite/18_support/nested_exception/rethrow_if_nested-term.cc:
Require effective target exceptions_enabled instead of using
dg-skip-if.
* testsuite/23_containers/vector/capacity/constexpr.cc: Expect
shrink_to_fit() to be a no-op without exceptions enabled.
* testsuite/23_containers/vector/capacity/shrink_to_fit.cc:
Likewise.
* testsuite/ext/bitmap_allocator/check_allocate_max_size.cc:
Require effective target exceptions_enabled.
* testsuite/ext/malloc_allocator/check_allocate_max_size.cc:
Likewise.
* testsuite/ext/mt_allocator/check_allocate_max_size.cc:
Likewise.
* testsuite/ext/new_allocator/check_allocate_max_size.cc:
Likewise.
* testsuite/ext/pool_allocator/check_allocate_max_size.cc:
Likewise.
* testsuite/ext/throw_allocator/check_allocate_max_size.cc:
Likewise.

libstdc++-v3/testsuite/18_support/nested_exception/rethrow_if_nested-term.cc
libstdc++-v3/testsuite/23_containers/vector/capacity/constexpr.cc
libstdc++-v3/testsuite/23_containers/vector/capacity/shrink_to_fit.cc
libstdc++-v3/testsuite/ext/bitmap_allocator/check_allocate_max_size.cc
libstdc++-v3/testsuite/ext/malloc_allocator/check_allocate_max_size.cc
libstdc++-v3/testsuite/ext/mt_allocator/check_allocate_max_size.cc
libstdc++-v3/testsuite/ext/new_allocator/check_allocate_max_size.cc
libstdc++-v3/testsuite/ext/pool_allocator/check_allocate_max_size.cc
libstdc++-v3/testsuite/ext/throw_allocator/check_allocate_max_size.cc

index 5913392bd461a9e4c9b30f4d2b01aa543faa3dfb..3bfc7ab994362fe235f617688594c6b7b34f2758 100644 (file)
@@ -1,5 +1,5 @@
 // { dg-do run { target c++11 } }
-// { dg-skip-if "" { *-*-* } { "-fno-exceptions" } }
+// { dg-require-effective-target exceptions_enabled }
 
 #include <exception>
 #include <cstdlib>
index 92c23035e4f36370d349b0b1d7f4d4c83a812afe..f102e78425b97373298a9f74e89dc0603a692efc 100644 (file)
@@ -89,11 +89,19 @@ test_shrink_to_fit()
   std::vector<int> v;
   v.reserve(9);
   v.shrink_to_fit();
+#if __cpp_exceptions
   VERIFY( v.capacity() == 0 );
+#else
+  VERIFY( v.capacity() == 9 );
+#endif
   v.reserve(9);
   v.resize(5);
   v.shrink_to_fit();
+#if __cpp_exceptions
   VERIFY( v.capacity() == v.size() );
+#else
+  VERIFY( v.capacity() == 9 );
+#endif
 
   return true;
 }
index a8cede2278d83edbcbbc329387e32b54dfc340f7..6542b5fd39f694a05c68c5aa8a8c19c1aea6efae 100644 (file)
@@ -30,7 +30,11 @@ void test01()
   v.push_back(1);
   VERIFY( v.size() < v.capacity() );
   v.shrink_to_fit();
+#if __cpp_exceptions
   VERIFY( v.size() == v.capacity() );
+#else
+  VERIFY( v.size() < v.capacity() );
+#endif
 }
 
 int main()
index 712489f26a92c3e21430133c69b3d09087b417b7..e523bb8f6c2cb9db5d6f24196e0a674430082632 100644 (file)
@@ -16,6 +16,8 @@
 // with this library; see the file COPYING3.  If not see
 // <http://www.gnu.org/licenses/>.
 
+// { dg-require-effective-target exceptions_enabled }
+
 // 20.4.1.1 allocator members
 
 #include <ext/bitmap_allocator.h>
index 53fb8d4ab31dcfa6642acb5319db58911db85519..e59f6ad99b96a352795d48c7cc95947c134e3ae0 100644 (file)
@@ -16,6 +16,8 @@
 // with this library; see the file COPYING3.  If not see
 // <http://www.gnu.org/licenses/>.
 
+// { dg-require-effective-target exceptions_enabled }
+
 // 20.4.1.1 allocator members
 
 #include <ext/malloc_allocator.h>
index cc6f94bb2d0db49986c3da7fbe14ed77e95eb189..b636098b5c9aa06f2f315c7e8e71809ddb931b6a 100644 (file)
@@ -16,6 +16,8 @@
 // with this library; see the file COPYING3.  If not see
 // <http://www.gnu.org/licenses/>.
 
+// { dg-require-effective-target exceptions_enabled }
+
 // 20.4.1.1 allocator members
 
 #include <ext/mt_allocator.h>
index 80eece038dcd595723f2da44ee890550609c0554..dbe7307636c5eaf4499f6a549680050e36fc70c0 100644 (file)
@@ -16,6 +16,8 @@
 // with this library; see the file COPYING3.  If not see
 // <http://www.gnu.org/licenses/>.
 
+// { dg-require-effective-target exceptions_enabled }
+
 // 20.4.1.1 allocator members
 
 #include <ext/new_allocator.h>
index 7ad5f7015216ba25a6ede9868353fc87173eccd6..6eecb74bcdf36a84605bb26d4c179be4a5c8643d 100644 (file)
@@ -16,6 +16,8 @@
 // with this library; see the file COPYING3.  If not see
 // <http://www.gnu.org/licenses/>.
 
+// { dg-require-effective-target exceptions_enabled }
+
 // 20.4.1.1 allocator members
 
 #include <ext/pool_allocator.h>
index 424d87b9df6ac0e1256c85efc623614935dd3f33..73fec6ff0715a47f9481f6c18dd7495a6ad0bbc0 100644 (file)
@@ -18,6 +18,7 @@
 
 // { dg-require-time "" }
 // { dg-require-cstdint "" }
+// { dg-require-effective-target exceptions_enabled }
 
 #include <ext/throw_allocator.h>
 #include <testsuite_allocator.h>