From patchwork Tue Jan 10 11:46:55 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Jonathan Wakely X-Patchwork-Id: 41418 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a5d:4e01:0:0:0:0:0 with SMTP id p1csp2698430wrt; Tue, 10 Jan 2023 03:50:06 -0800 (PST) X-Google-Smtp-Source: AMrXdXvboy3xYiCrMexlvTTgOgLRgdRqK7z8/sEYatwiQD3/Moy9+gsJW9jL4aZj0VGr7dVdGSsU X-Received: by 2002:a17:906:8e91:b0:7c1:5248:4f3a with SMTP id ru17-20020a1709068e9100b007c152484f3amr54094879ejc.56.1673351406341; Tue, 10 Jan 2023 03:50:06 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1673351406; cv=none; d=google.com; s=arc-20160816; b=mIO+0ePiXVNlZ5semWwl/SOj5t32wu6+V5lYdAGuYMIt2uBrVZmy9gtf1A+nkE5gDA DsPnkhn/HVqOu2XCr0+A5GuV7HoDzRrgwp2Kf4lJ/QYnz4hefKW1j99uTfhwFqy/gDxJ mle4psJ+97YSMMDVLDf7+9yFgds3rpUongmHKzR5MKI7j5h5ZWnJiD7EtZ1DUslpx7eP p+ebnGEHyAF7e3HQKKKG1CFoVBZW+itYZzh1OJF5T8D1nYbl/0OsLDvfPdfD4HCPRcDW w6Ay52feLrdbDmITrXsFjTMYJnA9Eaw+71GB41YnPINfjHLz/8oMpdqlKLgVGMKA1sa7 MmEQ== 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=ljGqe42JxiPvjAYxxyM3xzdk1M9v2YSPTpKA2IvtjPk=; b=Kj9hB/6e7rKkP77MHhu87wrBwwWpBzoafgPVVVq08Z3w9rXwDLTwDtJemUyg8OQ7AP Ops31k1JkZEwkKJsNXHviM24h7/9z+XUI4/WKlQuH+rdi7i/JXFmjeVOpRrzkab/cA94 OSyhlX4IxcoGH2gONADaZUjLSFyAEZXdggnLl2bu+LdzSGVFiMo77VQY+jazuStzJ807 Iw5lFqfrtiLoMxBvoJ6Q/fCyWc0XmmhGd/7/yM9QKVKcg9+bw9HF7ZySQkjOiqy3aZ8q MWHYynHpJ7Sf3uosVOPe9RACGHNmr+EaW4GAWztMthR4h23lmXY2oeTLmPvM9q5WZvaQ cAqg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@gcc.gnu.org header.s=default header.b=MngeKtPg; 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 xa14-20020a170906fd8e00b00787b9cd2fe3si11020558ejb.844.2023.01.10.03.50.06 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 10 Jan 2023 03:50:06 -0800 (PST) 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=MngeKtPg; 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 21B29385B50B for ; Tue, 10 Jan 2023 11:49:27 +0000 (GMT) DKIM-Filter: OpenDKIM Filter v2.11.0 sourceware.org 21B29385B50B DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gcc.gnu.org; s=default; t=1673351367; bh=ljGqe42JxiPvjAYxxyM3xzdk1M9v2YSPTpKA2IvtjPk=; h=To:Subject:Date:List-Id:List-Unsubscribe:List-Archive:List-Post: List-Help:List-Subscribe:From:Reply-To:From; b=MngeKtPgbwdhHxa4MKocyZ/LV538xnoWItVGRk+KWLJdwB6wlPrOW/E5XFlZVBgy1 cRg/vJy3B+OKOO3aZEhbVeAJ+/F0IaP/RkTbXy0S+GYaj0AOgWDmEwwULUfUH7VyqI TsG9J1Qa9hmzPzZt+05jdSzyHgEx3PTO/6eKNufI= 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.129.124]) by sourceware.org (Postfix) with ESMTPS id AAA833858281 for ; Tue, 10 Jan 2023 11:47:07 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.4.2 sourceware.org AAA833858281 Received: from mimecast-mx02.redhat.com (mx3-rdu2.redhat.com [66.187.233.73]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id us-mta-149-_IIYwdI4MumDYQiPD9yMew-1; Tue, 10 Jan 2023 06:46:58 -0500 X-MC-Unique: _IIYwdI4MumDYQiPD9yMew-1 Received: from smtp.corp.redhat.com (int-mx06.intmail.prod.int.rdu2.redhat.com [10.11.54.6]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mimecast-mx02.redhat.com (Postfix) with ESMTPS id 129E829DD989; Tue, 10 Jan 2023 11:46:58 +0000 (UTC) Received: from localhost (unknown [10.33.36.192]) by smtp.corp.redhat.com (Postfix) with ESMTP id CB5322166B26; Tue, 10 Jan 2023 11:46:57 +0000 (UTC) To: libstdc++@gcc.gnu.org, gcc-patches@gcc.gnu.org Subject: [committed 1/3] libstdc++: Fix std::span constraint for sizeof(size_t) < sizeof(int) [PR108221] Date: Tue, 10 Jan 2023 11:46:55 +0000 Message-Id: <20230110114657.636853-1-jwakely@redhat.com> MIME-Version: 1.0 X-Scanned-By: MIMEDefang 3.1 on 10.11.54.6 X-Mimecast-Spam-Score: 0 X-Mimecast-Originator: redhat.com X-Spam-Status: No, score=-12.2 required=5.0 tests=BAYES_00, DKIMWL_WL_HIGH, DKIM_SIGNED, DKIM_VALID, DKIM_VALID_AU, DKIM_VALID_EF, GIT_PATCH_0, RCVD_IN_DNSWL_NONE, RCVD_IN_MSPIKE_H2, SPF_HELO_NONE, SPF_NONE, TXREP 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?1754636124221833726?= X-GMAIL-MSGID: =?utf-8?q?1754636124221833726?= Tested x86_64-linux. Pushed to trunk. -- >8 -- The default constructor has a constraint that is always false if arithmetic on size_t values promotes to int. Rewrite the constraint exactly as written in the standard, which works correctly. libstdc++-v3/ChangeLog: PR libstdc++/108221 * include/std/span (span::span()): Un-simplify constraint to work for size_t of lesser rank than int. --- libstdc++-v3/include/std/span | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/libstdc++-v3/include/std/span b/libstdc++-v3/include/std/span index 251fed91abf..b336332b190 100644 --- a/libstdc++-v3/include/std/span +++ b/libstdc++-v3/include/std/span @@ -145,7 +145,7 @@ _GLIBCXX_BEGIN_NAMESPACE_VERSION constexpr span() noexcept - requires ((_Extent + 1u) <= 1u) + requires (_Extent == dynamic_extent || _Extent == 0) : _M_ptr(nullptr), _M_extent(0) { } From patchwork Tue Jan 10 11:46:56 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Jonathan Wakely X-Patchwork-Id: 41417 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a5d:4e01:0:0:0:0:0 with SMTP id p1csp2697826wrt; Tue, 10 Jan 2023 03:48:29 -0800 (PST) X-Google-Smtp-Source: AMrXdXu3/cEryBzbPdtSEy9uMrvalcWewKMrTdCuNhhbpohvdWl2BTCTYES9Ho9xIDfp8U/ysDit X-Received: by 2002:a05:6402:25c3:b0:48e:a55a:9c4b with SMTP id x3-20020a05640225c300b0048ea55a9c4bmr25120062edb.19.1673351309714; Tue, 10 Jan 2023 03:48:29 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1673351309; cv=none; d=google.com; s=arc-20160816; b=l7+trpoVgvz1KahZNiMjxPaDGCW6+Ki2fI5kObA9WqQ4HqD967r6n7Bl2EW9d5avaD RNfDgkZbeHX8h/cwkfKJSmYoaiEOG61jJ7qiAS3e91uTOy1R915DCVoUgQAgnUVHpuzj XyZzTJZMm/qxr12t6c0l72efts6acLmy+HoeNN12DCVcIWzdrlf9Rd6n44p7+gdXX5uD IDO9FW2S6ILXeEoRmX5h7o1AU8u4bK3ffLQUoQM7UcS/Rgnj9TC2urGN+bqHpYDtsqui 29acTxrv9rR6TYm0SHJNhnfe/N8hCiWUEqvobks6hlC5oU5KNzEMFTk70GCjTjrr3qnl ikVw== 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=RJeY2hhvViNgEkweno/de3KiWKd76d5ziFYHWYAG97I=; b=n5JCBYRhMKkJIaYHATgpJlnRIqloMPEH+GH3RNmuqWpYSzYqKhrvJhTjSEg2IJy/hW CyDB0Bi7ma3kXs4jZrlFojpxLtmZLsH7KGybpRZSetEThnm2o3Rq4clS+7IqYbPHIuR4 pYtzLs703i00r6WGbkwIL5l4+2DFcEKNEnoWTCMfCa/Rd1ZnRGQiNIgYAFnhYcOOTC/L PDE/dqwVvVTM7ePzG070kOlP7eGnEIpTdZ7vjDy4WxKnYFQ7dWpSpMR6IQvyz2ALOZKe YwcVgabatjVLvBVuguSgfapjSh9O0wD6swRHDgERKdo/24pJZwNIw068Z4GDnfuZfxsC juPw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@gcc.gnu.org header.s=default header.b=QsH1emx+; spf=pass (google.com: domain of gcc-patches-bounces+ouuuleilei=gmail.com@gcc.gnu.org designates 8.43.85.97 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. [8.43.85.97]) by mx.google.com with ESMTPS id l16-20020a056402029000b00499c59c0ac1si1574596edv.148.2023.01.10.03.48.29 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 10 Jan 2023 03:48:29 -0800 (PST) Received-SPF: pass (google.com: domain of gcc-patches-bounces+ouuuleilei=gmail.com@gcc.gnu.org designates 8.43.85.97 as permitted sender) client-ip=8.43.85.97; Authentication-Results: mx.google.com; dkim=pass header.i=@gcc.gnu.org header.s=default header.b=QsH1emx+; spf=pass (google.com: domain of gcc-patches-bounces+ouuuleilei=gmail.com@gcc.gnu.org designates 8.43.85.97 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 2693338493EB for ; Tue, 10 Jan 2023 11:47:49 +0000 (GMT) DKIM-Filter: OpenDKIM Filter v2.11.0 sourceware.org 2693338493EB DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gcc.gnu.org; s=default; t=1673351269; bh=RJeY2hhvViNgEkweno/de3KiWKd76d5ziFYHWYAG97I=; h=To:Subject:Date:List-Id:List-Unsubscribe:List-Archive:List-Post: List-Help:List-Subscribe:From:Reply-To:From; b=QsH1emx+AKKjWyN5LJTCyEYJ4PpR6SsgzwV7nqlzmmU8bNcpV7Fa6MLaSR4574YS+ OHL4cqgmybDJRyw3JrI7hvdmos+gwEFzVQGxvUPgLIV82CDfLQztrVC+9TEq6MCjpx 3o1eUBfSzmALSDlBgr4J3iGOV5F3s9bSt7j4/IN8= 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.129.124]) by sourceware.org (Postfix) with ESMTPS id 44A8A385842E for ; Tue, 10 Jan 2023 11:47:01 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.4.2 sourceware.org 44A8A385842E Received: from mimecast-mx02.redhat.com (mx3-rdu2.redhat.com [66.187.233.73]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id us-mta-231-36WM0rfTNg-sEHMugzmXdQ-1; Tue, 10 Jan 2023 06:46:59 -0500 X-MC-Unique: 36WM0rfTNg-sEHMugzmXdQ-1 Received: from smtp.corp.redhat.com (int-mx04.intmail.prod.int.rdu2.redhat.com [10.11.54.4]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mimecast-mx02.redhat.com (Postfix) with ESMTPS id EFE261C07588; Tue, 10 Jan 2023 11:46:58 +0000 (UTC) Received: from localhost (unknown [10.33.36.192]) by smtp.corp.redhat.com (Postfix) with ESMTP id B87AD2026D68; Tue, 10 Jan 2023 11:46:58 +0000 (UTC) To: libstdc++@gcc.gnu.org, gcc-patches@gcc.gnu.org Subject: [committed 2/3] libstdc++: Fix some algos for 16-bit size_t [PR108221] Date: Tue, 10 Jan 2023 11:46:56 +0000 Message-Id: <20230110114657.636853-2-jwakely@redhat.com> MIME-Version: 1.0 X-Scanned-By: MIMEDefang 3.1 on 10.11.54.4 X-Mimecast-Spam-Score: 0 X-Mimecast-Originator: redhat.com X-Spam-Status: No, score=-12.2 required=5.0 tests=BAYES_00, DKIMWL_WL_HIGH, DKIM_SIGNED, DKIM_VALID, DKIM_VALID_AU, DKIM_VALID_EF, GIT_PATCH_0, RCVD_IN_DNSWL_NONE, RCVD_IN_MSPIKE_H2, SPF_HELO_NONE, SPF_NONE, TXREP 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?1754636022609056789?= X-GMAIL-MSGID: =?utf-8?q?1754636022609056789?= Tested x86_64-linux. Pushed to trunk. -- >8 -- Some standard algorithms fail to compile when size_t or ptrdiff_t is narrower than int. The __lg helper function is ambiguous if ptrdiff_t is short or __int20, so replace it with a function template that works for those types as well as signed/unsigned int/long/long long. The helpers for stable_sort perform arithmetic on size values and assume the types won't change, which isn't true if the type promotes to int. libstdc++-v3/ChangeLog: PR libstdc++/108221 * include/bits/stl_algobase.h (__lg): Replace six overloads with a single function template for all integer types. * include/bits/stl_algo.h (__merge_adaptive_resize): Cast arithmetic results back to _Distance. --- libstdc++-v3/include/bits/stl_algo.h | 5 ++- libstdc++-v3/include/bits/stl_algobase.h | 47 ++++++++++++------------ 2 files changed, 26 insertions(+), 26 deletions(-) diff --git a/libstdc++-v3/include/bits/stl_algo.h b/libstdc++-v3/include/bits/stl_algo.h index 6386918fc8b..eed04b3c1b8 100644 --- a/libstdc++-v3/include/bits/stl_algo.h +++ b/libstdc++-v3/include/bits/stl_algo.h @@ -2458,13 +2458,14 @@ _GLIBCXX_END_INLINE_ABI_NAMESPACE(_V2) _BidirectionalIterator __new_middle = std::__rotate_adaptive(__first_cut, __middle, __second_cut, - __len1 - __len11, __len22, + _Distance(__len1 - __len11), __len22, __buffer, __buffer_size); std::__merge_adaptive_resize(__first, __first_cut, __new_middle, __len11, __len22, __buffer, __buffer_size, __comp); std::__merge_adaptive_resize(__new_middle, __second_cut, __last, - __len1 - __len11, __len2 - __len22, + _Distance(__len1 - __len11), + _Distance(__len2 - __len22), __buffer, __buffer_size, __comp); } } diff --git a/libstdc++-v3/include/bits/stl_algobase.h b/libstdc++-v3/include/bits/stl_algobase.h index ae898ed3706..566b6d9c4bc 100644 --- a/libstdc++-v3/include/bits/stl_algobase.h +++ b/libstdc++-v3/include/bits/stl_algobase.h @@ -72,7 +72,10 @@ #if __cplusplus >= 201103L # include #endif -#if __cplusplus > 201703L +#if __cplusplus >= 201402L +# include // std::__bit_width +#endif +#if __cplusplus >= 202002L # include #endif @@ -1505,29 +1508,25 @@ _GLIBCXX_END_NAMESPACE_CONTAINER /// This is a helper function for the sort routines and for random.tcc. // Precondition: __n > 0. - inline _GLIBCXX_CONSTEXPR int - __lg(int __n) - { return (int)sizeof(int) * __CHAR_BIT__ - 1 - __builtin_clz(__n); } - - inline _GLIBCXX_CONSTEXPR unsigned - __lg(unsigned __n) - { return (int)sizeof(int) * __CHAR_BIT__ - 1 - __builtin_clz(__n); } - - inline _GLIBCXX_CONSTEXPR long - __lg(long __n) - { return (int)sizeof(long) * __CHAR_BIT__ - 1 - __builtin_clzl(__n); } - - inline _GLIBCXX_CONSTEXPR unsigned long - __lg(unsigned long __n) - { return (int)sizeof(long) * __CHAR_BIT__ - 1 - __builtin_clzl(__n); } - - inline _GLIBCXX_CONSTEXPR long long - __lg(long long __n) - { return (int)sizeof(long long) * __CHAR_BIT__ - 1 - __builtin_clzll(__n); } - - inline _GLIBCXX_CONSTEXPR unsigned long long - __lg(unsigned long long __n) - { return (int)sizeof(long long) * __CHAR_BIT__ - 1 - __builtin_clzll(__n); } + template + inline _GLIBCXX_CONSTEXPR _Tp + __lg(_Tp __n) + { +#if __cplusplus >= 201402L + return std::__bit_width(make_unsigned_t<_Tp>(__n)) - 1; +#else + // Use +__n so it promotes to at least int. + const int __sz = sizeof(+__n); + int __w = __sz * __CHAR_BIT__ - 1; + if (__sz == sizeof(long long)) + __w -= __builtin_clzll(+__n); + else if (__sz == sizeof(long)) + __w -= __builtin_clzl(+__n); + else if (__sz == sizeof(int)) + __w -= __builtin_clz(+__n); + return __w; +#endif + } _GLIBCXX_BEGIN_NAMESPACE_ALGO From patchwork Tue Jan 10 11:46:57 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Jonathan Wakely X-Patchwork-Id: 41416 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a5d:4e01:0:0:0:0:0 with SMTP id p1csp2697805wrt; Tue, 10 Jan 2023 03:48:25 -0800 (PST) X-Google-Smtp-Source: AMrXdXsdHs/GjhIKjF8fCGrJPXVAIwZMdklAT8iW/C4xeKAYpH2od5vCgexWQrNBkvwbnoxN4Q5D X-Received: by 2002:a17:906:9f07:b0:7ec:27d7:1838 with SMTP id fy7-20020a1709069f0700b007ec27d71838mr73477677ejc.22.1673351304899; Tue, 10 Jan 2023 03:48:24 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1673351304; cv=none; d=google.com; s=arc-20160816; b=0Rvt1VY5LVf+uwEBPYgVoVU7nFdCZBwkZWfTLJqIxiyTT4evJvYn57jQqTMI8xchqg PrY3uY9DMk+OtYDET6YSSGkktw3Z/ZIkEOINfx4nZJuJ2ujUeeLapS5RqHob2yjiYo6B 9NTewzIEhLQBDp8mCXZcddu4EJojMi/9k81/M4SV4KOwVH48fxwarTJTxOqNl4mWhyWX y/5rd7EqRrYpcu/Hw3QH6KplASV6SEl1rwSMdVePxoj6yxREM9TuMConCRfWaeIkHC0Q nBF0hWE0qarxK/8ghALM94FgT5Jg0B+zCyhgpH10sMbTrt5BB6mSE1hgeg9HOxeyTOtS pavQ== 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=N2KQ2cyv/zltu0X2YRCcNEoGXj2SFX+hvED5DU9vHk4=; b=oDa3zvE9xZdx6bRr3uWHaFlb305eEKq27k1MVTcYIMO2LRsIx36wRW4JhdFl0H1i1V dq//oCgaFkDEtSFBGDU3U3NKTSHeZnpRDSEY5AC6I4lHwLRkSm3/mMSrV2sO6pWFbIwP Q/tev18jDgMo9itMUSLQhc0GJaommANuxHVNNBWVis7NZF2JBPZp87SFUXqUsINyIsMR hp7c2ikl15JZnzlwZhpaQbOOeSbjV/UkiQ9uL1toX5kEQVFMItF9tJh33jjPgfbykh4Z /s2qPSfjCAef02A6j4GUtw5UqPe6LOiK//21nvgYQjbV4+QilTGlHWoEowVbyiQAR/x4 l8sQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@gcc.gnu.org header.s=default header.b=Kzca6po3; 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 nc26-20020a1709071c1a00b007b9eeb4879asi11771747ejc.419.2023.01.10.03.48.24 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 10 Jan 2023 03:48:24 -0800 (PST) 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=Kzca6po3; 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 2DC2838582AB for ; Tue, 10 Jan 2023 11:47:46 +0000 (GMT) DKIM-Filter: OpenDKIM Filter v2.11.0 sourceware.org 2DC2838582AB DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gcc.gnu.org; s=default; t=1673351266; bh=N2KQ2cyv/zltu0X2YRCcNEoGXj2SFX+hvED5DU9vHk4=; h=To:Subject:Date:List-Id:List-Unsubscribe:List-Archive:List-Post: List-Help:List-Subscribe:From:Reply-To:From; b=Kzca6po3+7tpyc3MWugfzil4hzMxSAOzUL6lYz3oUfEvPuKReF43sww7PFtiTmEdg l/oyPYLPYDCKVFo77Xt4OTwFxPvcrIPV7aDVP7E6aqxz1NL9Ts4jIS8c+ERcSEmF8U MHwOKM4+AbtWIxKhbrmJakTYthfNH1q2LTYwc1F4= 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 C67043858438 for ; Tue, 10 Jan 2023 11:47:01 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.4.2 sourceware.org C67043858438 Received: from mimecast-mx02.redhat.com (mx3-rdu2.redhat.com [66.187.233.73]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id us-mta-60-6_gd1SzeOT2Xr1XK4n4-5Q-1; Tue, 10 Jan 2023 06:47:00 -0500 X-MC-Unique: 6_gd1SzeOT2Xr1XK4n4-5Q-1 Received: from smtp.corp.redhat.com (int-mx02.intmail.prod.int.rdu2.redhat.com [10.11.54.2]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mimecast-mx02.redhat.com (Postfix) with ESMTPS id C655029DD989; Tue, 10 Jan 2023 11:46:59 +0000 (UTC) Received: from localhost (unknown [10.33.36.192]) by smtp.corp.redhat.com (Postfix) with ESMTP id 8EB094085720; Tue, 10 Jan 2023 11:46:59 +0000 (UTC) To: libstdc++@gcc.gnu.org, gcc-patches@gcc.gnu.org Subject: [committed 3/3] libstdc++: Fix tzdb.cc to compile with -fno-exceptions Date: Tue, 10 Jan 2023 11:46:57 +0000 Message-Id: <20230110114657.636853-3-jwakely@redhat.com> MIME-Version: 1.0 X-Scanned-By: MIMEDefang 3.1 on 10.11.54.2 X-Mimecast-Spam-Score: 0 X-Mimecast-Originator: redhat.com X-Spam-Status: No, score=-12.2 required=5.0 tests=BAYES_00, DKIMWL_WL_HIGH, DKIM_SIGNED, DKIM_VALID, DKIM_VALID_AU, DKIM_VALID_EF, GIT_PATCH_0, RCVD_IN_DNSWL_NONE, RCVD_IN_MSPIKE_H2, SPF_HELO_NONE, SPF_NONE, TXREP 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?1754636017717533569?= X-GMAIL-MSGID: =?utf-8?q?1754636017717533569?= Tested x86_64-linux. Pushed to trunk. -- >8 -- libstdc++-v3/ChangeLog: * src/c++20/tzdb.cc (tzdb_list::_S_init_tzdb): Use __try and __catch macros for exception handling. --- libstdc++-v3/src/c++20/tzdb.cc | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/libstdc++-v3/src/c++20/tzdb.cc b/libstdc++-v3/src/c++20/tzdb.cc index 7227fe7cfe6..e335ea61c4d 100644 --- a/libstdc++-v3/src/c++20/tzdb.cc +++ b/libstdc++-v3/src/c++20/tzdb.cc @@ -1197,11 +1197,11 @@ namespace std::chrono const tzdb& tzdb_list::_Node::_S_init_tzdb() { - try + __try { return reload_tzdb(); } - catch (const std::exception&) + __catch (const std::exception&) { auto [leaps, ok] = _S_read_leap_seconds();