public inbox for gcc-cvs@sourceware.org
help / color / mirror / Atom feed
From: Jonathan Wakely <redi@gcc.gnu.org>
To: gcc-cvs@gcc.gnu.org, libstdc++-cvs@gcc.gnu.org
Subject: [gcc r14-1612] libstdc++: Fix some tests that fail with -fno-exceptions
Date: Wed,  7 Jun 2023 15:52:34 +0000 (GMT)	[thread overview]
Message-ID: <20230607155234.8433A3857729@sourceware.org> (raw)

https://gcc.gnu.org/g:fa8b4468e0d124bec0fdbfc0a168bd8c377b08ec

commit r14-1612-gfa8b4468e0d124bec0fdbfc0a168bd8c377b08ec
Author: Jonathan Wakely <jwakely@redhat.com>
Date:   Wed Jun 7 13:01:36 2023 +0100

    libstdc++: Fix some tests that fail with -fno-exceptions
    
    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.

Diff:
---
 .../18_support/nested_exception/rethrow_if_nested-term.cc         | 2 +-
 libstdc++-v3/testsuite/23_containers/vector/capacity/constexpr.cc | 8 ++++++++
 .../testsuite/23_containers/vector/capacity/shrink_to_fit.cc      | 4 ++++
 .../testsuite/ext/bitmap_allocator/check_allocate_max_size.cc     | 2 ++
 .../testsuite/ext/malloc_allocator/check_allocate_max_size.cc     | 2 ++
 .../testsuite/ext/mt_allocator/check_allocate_max_size.cc         | 2 ++
 .../testsuite/ext/new_allocator/check_allocate_max_size.cc        | 2 ++
 .../testsuite/ext/pool_allocator/check_allocate_max_size.cc       | 2 ++
 .../testsuite/ext/throw_allocator/check_allocate_max_size.cc      | 1 +
 9 files changed, 24 insertions(+), 1 deletion(-)

diff --git a/libstdc++-v3/testsuite/18_support/nested_exception/rethrow_if_nested-term.cc b/libstdc++-v3/testsuite/18_support/nested_exception/rethrow_if_nested-term.cc
index 5913392bd46..3bfc7ab9943 100644
--- a/libstdc++-v3/testsuite/18_support/nested_exception/rethrow_if_nested-term.cc
+++ b/libstdc++-v3/testsuite/18_support/nested_exception/rethrow_if_nested-term.cc
@@ -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>
diff --git a/libstdc++-v3/testsuite/23_containers/vector/capacity/constexpr.cc b/libstdc++-v3/testsuite/23_containers/vector/capacity/constexpr.cc
index 92c23035e4f..f102e78425b 100644
--- a/libstdc++-v3/testsuite/23_containers/vector/capacity/constexpr.cc
+++ b/libstdc++-v3/testsuite/23_containers/vector/capacity/constexpr.cc
@@ -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;
 }
diff --git a/libstdc++-v3/testsuite/23_containers/vector/capacity/shrink_to_fit.cc b/libstdc++-v3/testsuite/23_containers/vector/capacity/shrink_to_fit.cc
index a8cede2278d..6542b5fd39f 100644
--- a/libstdc++-v3/testsuite/23_containers/vector/capacity/shrink_to_fit.cc
+++ b/libstdc++-v3/testsuite/23_containers/vector/capacity/shrink_to_fit.cc
@@ -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()
diff --git a/libstdc++-v3/testsuite/ext/bitmap_allocator/check_allocate_max_size.cc b/libstdc++-v3/testsuite/ext/bitmap_allocator/check_allocate_max_size.cc
index 712489f26a9..e523bb8f6c2 100644
--- a/libstdc++-v3/testsuite/ext/bitmap_allocator/check_allocate_max_size.cc
+++ b/libstdc++-v3/testsuite/ext/bitmap_allocator/check_allocate_max_size.cc
@@ -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>
diff --git a/libstdc++-v3/testsuite/ext/malloc_allocator/check_allocate_max_size.cc b/libstdc++-v3/testsuite/ext/malloc_allocator/check_allocate_max_size.cc
index 53fb8d4ab31..e59f6ad99b9 100644
--- a/libstdc++-v3/testsuite/ext/malloc_allocator/check_allocate_max_size.cc
+++ b/libstdc++-v3/testsuite/ext/malloc_allocator/check_allocate_max_size.cc
@@ -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>
diff --git a/libstdc++-v3/testsuite/ext/mt_allocator/check_allocate_max_size.cc b/libstdc++-v3/testsuite/ext/mt_allocator/check_allocate_max_size.cc
index cc6f94bb2d0..b636098b5c9 100644
--- a/libstdc++-v3/testsuite/ext/mt_allocator/check_allocate_max_size.cc
+++ b/libstdc++-v3/testsuite/ext/mt_allocator/check_allocate_max_size.cc
@@ -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>
diff --git a/libstdc++-v3/testsuite/ext/new_allocator/check_allocate_max_size.cc b/libstdc++-v3/testsuite/ext/new_allocator/check_allocate_max_size.cc
index 80eece038dc..dbe7307636c 100644
--- a/libstdc++-v3/testsuite/ext/new_allocator/check_allocate_max_size.cc
+++ b/libstdc++-v3/testsuite/ext/new_allocator/check_allocate_max_size.cc
@@ -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>
diff --git a/libstdc++-v3/testsuite/ext/pool_allocator/check_allocate_max_size.cc b/libstdc++-v3/testsuite/ext/pool_allocator/check_allocate_max_size.cc
index 7ad5f701521..6eecb74bcdf 100644
--- a/libstdc++-v3/testsuite/ext/pool_allocator/check_allocate_max_size.cc
+++ b/libstdc++-v3/testsuite/ext/pool_allocator/check_allocate_max_size.cc
@@ -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>
diff --git a/libstdc++-v3/testsuite/ext/throw_allocator/check_allocate_max_size.cc b/libstdc++-v3/testsuite/ext/throw_allocator/check_allocate_max_size.cc
index 424d87b9df6..73fec6ff071 100644
--- a/libstdc++-v3/testsuite/ext/throw_allocator/check_allocate_max_size.cc
+++ b/libstdc++-v3/testsuite/ext/throw_allocator/check_allocate_max_size.cc
@@ -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>

                 reply	other threads:[~2023-06-07 15:52 UTC|newest]

Thread overview: [no followups] expand[flat|nested]  mbox.gz  Atom feed

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20230607155234.8433A3857729@sourceware.org \
    --to=redi@gcc.gnu.org \
    --cc=gcc-cvs@gcc.gnu.org \
    --cc=libstdc++-cvs@gcc.gnu.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).