From patchwork Wed Jun 7 15:53:20 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Jonathan Wakely X-Patchwork-Id: 104597 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a59:994d:0:b0:3d9:f83d:47d9 with SMTP id k13csp300126vqr; Wed, 7 Jun 2023 08:55:57 -0700 (PDT) X-Google-Smtp-Source: ACHHUZ61jFj+Uci+WOE5uB3G0pjHYsFtBBFIZWnzUi3WI0LbeQ4tjCoNCxw7kX6HipRCfYATbjf2 X-Received: by 2002:a17:907:160b:b0:96f:74d0:ad0e with SMTP id hb11-20020a170907160b00b0096f74d0ad0emr6359079ejc.58.1686153356909; Wed, 07 Jun 2023 08:55:56 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1686153356; cv=none; d=google.com; s=arc-20160816; b=WdwrpGrca+kNQF54w70fxNIafGeshPlWjuWdg85fiTP8I3QKMsNFD1P42X7Vy7hqzJ TQnW14s7otP1dtibuLB1320v3nTpJ0lO4NWJACuDyh2xTpx8CGZ7Nkatuce06saalXxn NumJHE4e513SMVtmkoc2a+6pl8VY43wBvm0c9109dctRzDmGJnp7Ox0nddSGwx5VyiIA Owv3FF8cZPFcLWMK6BzEOjpC9+Fq6z1nYqTlWk/LnJ5fZDYUEqP7sWlODIAv5szetYoU sugYZGa7oWOqfD+rBiNuUtnp41O1eET383JhxMkd1+OhkJzUo9I94j05xV+D08NbigyZ Ty4A== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=sender:errors-to:reply-to:from:list-subscribe:list-help:list-post :list-archive:list-unsubscribe:list-id:precedence :content-transfer-encoding:mime-version:message-id:date:subject:to :dmarc-filter:delivered-to:dkim-signature:dkim-filter; bh=WZVlmVMNor5AKSrV9ak2fnv4NMRIWylf4jrRWV3kqdY=; b=krysN4F0dvx4buHUAfrKjm/HYxO8eFbphhwONnkhwNssdZTPlih4cANjBbKW2KO7++ a88AssY7nnQ60E2WmOnu2p+mkSRgwuOSeQRtP9jsCBbHgZvl4+jBevebnULNU986IR7Q 01ixJog9c+U76h5DP+Oz9UXRnhcJslP+XmIOBo4sh8pPPEqCijGFiRRA9ycIPZJdTi6h 765mMijbsyyL5v0o3a4mnhpAPQN6RyaXeMEX22E/MGiDumaJNNCnBiqQHjfrx1+AnMha gT+tlNq8yy/AQlkAeL6+ahAZ7KH8mKDbb3Y98VOGv0E/i1V9HfECLX1IMhAQOysuXDY6 x5og== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@gcc.gnu.org header.s=default header.b=kF+7yoYT; spf=pass (google.com: domain of gcc-patches-bounces+ouuuleilei=gmail.com@gcc.gnu.org designates 2620:52:3:1:0:246e:9693:128c as permitted sender) smtp.mailfrom="gcc-patches-bounces+ouuuleilei=gmail.com@gcc.gnu.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=gnu.org Received: from sourceware.org (server2.sourceware.org. [2620:52:3:1:0:246e:9693:128c]) by mx.google.com with ESMTPS id ga18-20020a1709070c1200b0096f8abba1aesi10514572ejc.292.2023.06.07.08.55.56 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 07 Jun 2023 08:55:56 -0700 (PDT) Received-SPF: pass (google.com: domain of gcc-patches-bounces+ouuuleilei=gmail.com@gcc.gnu.org designates 2620:52:3:1:0:246e:9693:128c as permitted sender) client-ip=2620:52:3:1:0:246e:9693:128c; Authentication-Results: mx.google.com; dkim=pass header.i=@gcc.gnu.org header.s=default header.b=kF+7yoYT; spf=pass (google.com: domain of gcc-patches-bounces+ouuuleilei=gmail.com@gcc.gnu.org designates 2620:52:3:1:0:246e:9693:128c as permitted sender) smtp.mailfrom="gcc-patches-bounces+ouuuleilei=gmail.com@gcc.gnu.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=gnu.org Received: from server2.sourceware.org (localhost [IPv6:::1]) by sourceware.org (Postfix) with ESMTP id 305C9385663D for ; Wed, 7 Jun 2023 15:54:47 +0000 (GMT) DKIM-Filter: OpenDKIM Filter v2.11.0 sourceware.org 305C9385663D DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gcc.gnu.org; s=default; t=1686153287; bh=WZVlmVMNor5AKSrV9ak2fnv4NMRIWylf4jrRWV3kqdY=; h=To:Subject:Date:List-Id:List-Unsubscribe:List-Archive:List-Post: List-Help:List-Subscribe:From:Reply-To:From; b=kF+7yoYTYTl3twNZSQnt87XCOkDXznl79LT5XdT9IHkUxR5nj6xXHLRmLW5x1ssit hKXLXrjUbijqEAkUQDG8gdWwFiUuOAJb1ynJIBuizuZsyFT+PYlL+cKLRRqb1zOnSH Y2/eHbPJqAT8ZBojT7/qc2zTzoT6Q4YdWIF6DjMY= X-Original-To: gcc-patches@gcc.gnu.org Delivered-To: gcc-patches@gcc.gnu.org Received: from us-smtp-delivery-124.mimecast.com (us-smtp-delivery-124.mimecast.com [170.10.133.124]) by sourceware.org (Postfix) with ESMTPS id 3489E3857739 for ; Wed, 7 Jun 2023 15:53:25 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.4.2 sourceware.org 3489E3857739 Received: from mimecast-mx02.redhat.com (mimecast-mx02.redhat.com [66.187.233.88]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id us-mta-462--xRvrR2rNAOEjL1_FAY0sA-1; Wed, 07 Jun 2023 11:53:22 -0400 X-MC-Unique: -xRvrR2rNAOEjL1_FAY0sA-1 Received: from smtp.corp.redhat.com (int-mx09.intmail.prod.int.rdu2.redhat.com [10.11.54.9]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mimecast-mx02.redhat.com (Postfix) with ESMTPS id A7737811E85; Wed, 7 Jun 2023 15:53:21 +0000 (UTC) Received: from localhost (unknown [10.42.28.30]) by smtp.corp.redhat.com (Postfix) with ESMTP id 6FB3E492B00; Wed, 7 Jun 2023 15:53:21 +0000 (UTC) To: libstdc++@gcc.gnu.org, gcc-patches@gcc.gnu.org Subject: [committed] libstdc++: Fix some tests that fail with -fno-exceptions Date: Wed, 7 Jun 2023 16:53:20 +0100 Message-Id: <20230607155320.1369738-1-jwakely@redhat.com> MIME-Version: 1.0 X-Scanned-By: MIMEDefang 3.1 on 10.11.54.9 X-Mimecast-Spam-Score: 0 X-Mimecast-Originator: redhat.com X-Spam-Status: No, score=-11.8 required=5.0 tests=BAYES_00, DKIMWL_WL_HIGH, DKIM_SIGNED, DKIM_VALID, DKIM_VALID_AU, DKIM_VALID_EF, GIT_PATCH_0, KAM_SHORT, RCVD_IN_DNSWL_NONE, SPF_HELO_NONE, SPF_NONE, TXREP, T_SCC_BODY_TEXT_LINE autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on server2.sourceware.org X-BeenThere: gcc-patches@gcc.gnu.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: Gcc-patches mailing list List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-Patchwork-Original-From: Jonathan Wakely via Gcc-patches From: Jonathan Wakely Reply-To: Jonathan Wakely Errors-To: gcc-patches-bounces+ouuuleilei=gmail.com@gcc.gnu.org Sender: "Gcc-patches" X-getmail-retrieved-from-mailbox: =?utf-8?q?INBOX?= X-GMAIL-THRID: =?utf-8?q?1768059942522583522?= X-GMAIL-MSGID: =?utf-8?q?1768059942522583522?= 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(-) 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 #include 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 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 // . +// { dg-require-effective-target exceptions_enabled } + // 20.4.1.1 allocator members #include 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 // . +// { dg-require-effective-target exceptions_enabled } + // 20.4.1.1 allocator members #include 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 // . +// { dg-require-effective-target exceptions_enabled } + // 20.4.1.1 allocator members #include 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 // . +// { dg-require-effective-target exceptions_enabled } + // 20.4.1.1 allocator members #include 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 // . +// { dg-require-effective-target exceptions_enabled } + // 20.4.1.1 allocator members #include 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 #include