[committed] libstdc++: Fix some tests that fail with -fno-exceptions
Checks
Commit Message
Tested x86_64-linux (-m32/-m64) and powerpc64le-linux. Pushed to trunk.
-- >8 --
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.
---
.../18_support/nested_exception/rethrow_if_nested-term.cc | 2 +-
.../testsuite/23_containers/vector/capacity/constexpr.cc | 8 ++++++++
.../23_containers/vector/capacity/shrink_to_fit.cc | 4 ++++
.../ext/bitmap_allocator/check_allocate_max_size.cc | 2 ++
.../ext/malloc_allocator/check_allocate_max_size.cc | 2 ++
.../testsuite/ext/mt_allocator/check_allocate_max_size.cc | 2 ++
.../ext/new_allocator/check_allocate_max_size.cc | 2 ++
.../ext/pool_allocator/check_allocate_max_size.cc | 2 ++
.../ext/throw_allocator/check_allocate_max_size.cc | 1 +
9 files changed, 24 insertions(+), 1 deletion(-)
@@ -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>
@@ -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;
}
@@ -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()
@@ -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>
@@ -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>
@@ -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>
@@ -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>
@@ -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>
@@ -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>