From patchwork Fri May 12 16:48:38 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Jonathan Wakely X-Patchwork-Id: 93282 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a59:b0ea:0:b0:3b6:4342:cba0 with SMTP id b10csp5251433vqo; Fri, 12 May 2023 09:51:18 -0700 (PDT) X-Google-Smtp-Source: ACHHUZ7xM08PQWJQYctU91Xih0mFv3XTutsSwUH5ef0ktpTipksrzWJ7+5cCrSB2KHJLQcbok+1v X-Received: by 2002:a17:907:6e07:b0:966:4033:d1dd with SMTP id sd7-20020a1709076e0700b009664033d1ddmr19050885ejc.34.1683910278308; Fri, 12 May 2023 09:51:18 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1683910278; cv=none; d=google.com; s=arc-20160816; b=aXX+YV25MOYyBlzRifdDOiWPOxmdiKu2BwOllHTIRVzanR3+VH6CR6dg+QdZu2e6ew o3TqXQ87+S7pvEWW5sZGZxxDT7jK7dZYTtDY6GAKOWds+nQTZOpUtUC90VmD/dtbe+Zl bMPBfxf2WTMG6DfkfB5dQDWEbZuHeJXg/NfGxe1CrjhQylfeWAmeBOszKh3fYRngD3LF 7c5c92YAz7I05HjJsdjl6VYM1zykNDebnypp5tP6BzBzCm4Pcs9/QuQxIDPRmZvB1fHj fFVfOOhW19mOMAUeDVSP1W1DXpqeecm3ZREX9QVz+f29xmEG6gcflZ+x3wmBPEPv0jn9 hz6Q== 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=b/Z0uut5rRso+AVToMVMNgTnjOBHbtEbF1lYn/dHiLo=; b=ZX8QMNmOeStcSPJIbeH/K1+NuGHMyvdQStLHL6jcEFUTGns1yZq/MgXagKqx1lkCL4 uxEs5YxlgNfPd312/R7On4A0OzOaKUM5V6v2NB1N525B9/yUmcLconCLtUIrCFPyIsSK BZfCd+Ppdf5B27KzfxPRJ+odpf0vlehRyP2pBcw2tBH2nTCc3k1Vtm28+G0XFT33Whgs CuAJ9JO6bGDrLWZQz/olIfvZj97ql/4GlqrVt8gfLgGRKSBJSBxixFzSlN0nnar1+DJb NJwF1bLwtEt+ZWBIjzHsTyS2raEdVm7egUGga6QFdevLpHqpIr3cAHXxGqXKXbenbcQ/ 21ZA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@gcc.gnu.org header.s=default header.b=X6oRGknV; 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 t12-20020a05640203cc00b0050bc94fe05csi7487505edw.117.2023.05.12.09.51.18 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 12 May 2023 09:51:18 -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=X6oRGknV; 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 549233873E54 for ; Fri, 12 May 2023 16:50:03 +0000 (GMT) DKIM-Filter: OpenDKIM Filter v2.11.0 sourceware.org 549233873E54 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gcc.gnu.org; s=default; t=1683910203; bh=b/Z0uut5rRso+AVToMVMNgTnjOBHbtEbF1lYn/dHiLo=; h=To:Subject:Date:List-Id:List-Unsubscribe:List-Archive:List-Post: List-Help:List-Subscribe:From:Reply-To:From; b=X6oRGknViO3XHKTgREH4NR+GqM31zGsUr8VIyOoYtjN41J4Vh0IlOPLGMl3LDKZ1W mDIWluns6KXFdY17rLVOfurTOWVVrgjTOgSbeEIhaBPl2HzePFRpbkqDbrz2l16LaH tl/u5fwIxbFarKyYPBvGQLyYetk3CGM/MKibJ4eA= 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 162E73858C2D for ; Fri, 12 May 2023 16:48:43 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.4.2 sourceware.org 162E73858C2D 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-19-h4NF2yMHO12jkF9oMGJ9Dw-1; Fri, 12 May 2023 12:48:39 -0400 X-MC-Unique: h4NF2yMHO12jkF9oMGJ9Dw-1 Received: from smtp.corp.redhat.com (int-mx10.intmail.prod.int.rdu2.redhat.com [10.11.54.10]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mimecast-mx02.redhat.com (Postfix) with ESMTPS id 2A15686BF46; Fri, 12 May 2023 16:48:39 +0000 (UTC) Received: from localhost (unknown [10.42.28.178]) by smtp.corp.redhat.com (Postfix) with ESMTP id E77F6492C13; Fri, 12 May 2023 16:48:38 +0000 (UTC) To: libstdc++@gcc.gnu.org, gcc-patches@gcc.gnu.org Subject: [committed] libstdc++: Remove dependency on _GLIBCXX_USE_C99_STDINT_TR1 Date: Fri, 12 May 2023 17:48:38 +0100 Message-Id: <20230512164838.1303266-1-jwakely@redhat.com> MIME-Version: 1.0 X-Scanned-By: MIMEDefang 3.1 on 10.11.54.10 X-Mimecast-Spam-Score: 0 X-Mimecast-Originator: redhat.com X-Spam-Status: No, score=-11.5 required=5.0 tests=BAYES_00, DKIMWL_WL_HIGH, DKIM_SIGNED, DKIM_VALID, DKIM_VALID_AU, DKIM_VALID_EF, GIT_PATCH_0, KAM_NUMSUBJECT, RCVD_IN_DNSWL_NONE, SPF_HELO_NONE, SPF_NONE, TXREP, T_SCC_BODY_TEXT_LINE autolearn=unavailable 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?1765707904186496634?= X-GMAIL-MSGID: =?utf-8?q?1765707904186496634?= Tested powerpc64le-linux. Pushed to trunk. -- >8 -- Since r9-2028-g8ba7f29e3dd064 we've defined most of unconditionally, including uint_least32_t. This means that all of can be defined unconditionally, which means that std::shuffle and std::ranges::shuffle can be too. libstdc++-v3/ChangeLog: * include/bits/algorithmfwd.h (shuffle): Do not depend on _GLIBCXX_USE_C99_STDINT_TR1. * include/bits/ranges_algo.h (shuffle): Likewise. * include/bits/stl_algo.h (shuffle): Likewise. * include/ext/random: Likewise. * include/ext/throw_allocator.h (random_condition): Likewise. * include/std/random: Likewise. * src/c++11/cow-string-inst.cc: Likewise. * src/c++11/random.cc: Likewise. --- libstdc++-v3/include/bits/algorithmfwd.h | 2 +- libstdc++-v3/include/bits/ranges_algo.h | 2 -- libstdc++-v3/include/bits/stl_algo.h | 3 --- libstdc++-v3/include/ext/random | 4 ++-- libstdc++-v3/include/ext/throw_allocator.h | 8 -------- libstdc++-v3/include/std/random | 7 +------ libstdc++-v3/src/c++11/cow-string-inst.cc | 2 -- libstdc++-v3/src/c++11/random.cc | 3 --- 8 files changed, 4 insertions(+), 27 deletions(-) diff --git a/libstdc++-v3/include/bits/algorithmfwd.h b/libstdc++-v3/include/bits/algorithmfwd.h index 03e627866ad..0d623901cd2 100644 --- a/libstdc++-v3/include/bits/algorithmfwd.h +++ b/libstdc++-v3/include/bits/algorithmfwd.h @@ -622,7 +622,7 @@ _GLIBCXX_END_INLINE_ABI_NAMESPACE(_V2) // set_symmetric_difference // set_union -#if (__cplusplus >= 201103L) && defined(_GLIBCXX_USE_C99_STDINT_TR1) +#if __cplusplus >= 201103L template void shuffle(_RAIter, _RAIter, _UGenerator&&); diff --git a/libstdc++-v3/include/bits/ranges_algo.h b/libstdc++-v3/include/bits/ranges_algo.h index 410d3ae1dd8..da66ff8045d 100644 --- a/libstdc++-v3/include/bits/ranges_algo.h +++ b/libstdc++-v3/include/bits/ranges_algo.h @@ -1564,7 +1564,6 @@ namespace ranges inline constexpr __sample_fn sample{}; -#ifdef _GLIBCXX_USE_C99_STDINT_TR1 struct __shuffle_fn { template _Sent, @@ -1591,7 +1590,6 @@ namespace ranges }; inline constexpr __shuffle_fn shuffle{}; -#endif struct __push_heap_fn { diff --git a/libstdc++-v3/include/bits/stl_algo.h b/libstdc++-v3/include/bits/stl_algo.h index 3d37091a9b4..54695490166 100644 --- a/libstdc++-v3/include/bits/stl_algo.h +++ b/libstdc++-v3/include/bits/stl_algo.h @@ -3692,7 +3692,6 @@ _GLIBCXX_END_INLINE_ABI_NAMESPACE(_V2) #endif // C++17 #endif // C++14 -#ifdef _GLIBCXX_USE_C99_STDINT_TR1 /** * @brief Generate two uniformly distributed integers using a * single distribution invocation. @@ -3803,8 +3802,6 @@ _GLIBCXX_END_INLINE_ABI_NAMESPACE(_V2) for (_RandomAccessIterator __i = __first + 1; __i != __last; ++__i) std::iter_swap(__i, __first + __d(__g, __p_type(0, __i - __first))); } -#endif // USE C99_STDINT - #endif // C++11 _GLIBCXX_BEGIN_NAMESPACE_ALGO diff --git a/libstdc++-v3/include/ext/random b/libstdc++-v3/include/ext/random index 795c3c5389a..62acb67e05b 100644 --- a/libstdc++-v3/include/ext/random +++ b/libstdc++-v3/include/ext/random @@ -45,7 +45,7 @@ # include #endif -#if defined(_GLIBCXX_USE_C99_STDINT_TR1) && defined(UINT32_C) +#ifdef UINT32_C namespace __gnu_cxx _GLIBCXX_VISIBILITY(default) { @@ -3923,7 +3923,7 @@ _GLIBCXX_END_NAMESPACE_VERSION #include #include -#endif // _GLIBCXX_USE_C99_STDINT_TR1 && UINT32_C +#endif // UINT32_C #endif // C++11 diff --git a/libstdc++-v3/include/ext/throw_allocator.h b/libstdc++-v3/include/ext/throw_allocator.h index 0dbf00176dc..71b7198fa1e 100644 --- a/libstdc++-v3/include/ext/throw_allocator.h +++ b/libstdc++-v3/include/ext/throw_allocator.h @@ -495,7 +495,6 @@ _GLIBCXX_BEGIN_NAMESPACE_VERSION } }; -#ifdef _GLIBCXX_USE_C99_STDINT_TR1 /** * @brief Base class for random probability control and throw. */ @@ -613,7 +612,6 @@ _GLIBCXX_BEGIN_NAMESPACE_VERSION return _S_e; } }; -#endif // _GLIBCXX_USE_C99_STDINT_TR1 /** * @brief Class with exception generation control. Intended to be @@ -769,7 +767,6 @@ _GLIBCXX_BEGIN_NAMESPACE_VERSION #endif }; -#ifdef _GLIBCXX_USE_C99_STDINT_TR1 /// Type throwing via random condition. struct throw_value_random : public throw_value_base { @@ -800,7 +797,6 @@ _GLIBCXX_BEGIN_NAMESPACE_VERSION operator=(throw_value_random&&) = default; #endif }; -#endif // _GLIBCXX_USE_C99_STDINT_TR1 /** * @brief Allocator class with logging and exception generation control. @@ -947,7 +943,6 @@ _GLIBCXX_BEGIN_NAMESPACE_VERSION #endif }; -#ifdef _GLIBCXX_USE_C99_STDINT_TR1 /// Allocator throwing via random condition. template struct throw_allocator_random @@ -973,7 +968,6 @@ _GLIBCXX_BEGIN_NAMESPACE_VERSION operator=(const throw_allocator_random&) = default; #endif }; -#endif // _GLIBCXX_USE_C99_STDINT_TR1 _GLIBCXX_END_NAMESPACE_VERSION } // namespace @@ -1002,7 +996,6 @@ namespace std _GLIBCXX_VISIBILITY(default) } }; -#ifdef _GLIBCXX_USE_C99_STDINT_TR1 /// Explicit specialization of std::hash for __gnu_cxx::throw_value_random. template<> struct hash<__gnu_cxx::throw_value_random> @@ -1017,7 +1010,6 @@ namespace std _GLIBCXX_VISIBILITY(default) return __result; } }; -#endif #pragma GCC diagnostic pop } // end namespace std diff --git a/libstdc++-v3/include/std/random b/libstdc++-v3/include/std/random index e6591bc48a7..a0785a46019 100644 --- a/libstdc++-v3/include/std/random +++ b/libstdc++-v3/include/std/random @@ -38,22 +38,17 @@ #else #include +#include // For uint_fast32_t, uint_fast64_t, uint_least32_t #include #include #include #include #include #include - -#ifdef _GLIBCXX_USE_C99_STDINT_TR1 - -#include // For uint_fast32_t, uint_fast64_t, uint_least32_t #include #include #include -#endif // _GLIBCXX_USE_C99_STDINT_TR1 - #endif // C++11 #endif // _GLIBCXX_RANDOM diff --git a/libstdc++-v3/src/c++11/cow-string-inst.cc b/libstdc++-v3/src/c++11/cow-string-inst.cc index c6b3a2cce1e..5a2b8ffa568 100644 --- a/libstdc++-v3/src/c++11/cow-string-inst.cc +++ b/libstdc++-v3/src/c++11/cow-string-inst.cc @@ -33,7 +33,6 @@ # error This file should not be compiled for this configuration. #endif -#ifdef _GLIBCXX_USE_C99_STDINT_TR1 #include namespace std _GLIBCXX_VISIBILITY(default) @@ -46,4 +45,3 @@ namespace std _GLIBCXX_VISIBILITY(default) random_device::_M_init_pretr1(const std::string& token) { _M_init(token.c_str(), token.length()); } } // namespace -#endif diff --git a/libstdc++-v3/src/c++11/random.cc b/libstdc++-v3/src/c++11/random.cc index daf934808cc..6ecdc7169ab 100644 --- a/libstdc++-v3/src/c++11/random.cc +++ b/libstdc++-v3/src/c++11/random.cc @@ -28,8 +28,6 @@ #include #include -#ifdef _GLIBCXX_USE_C99_STDINT_TR1 - #if defined __i386__ || defined __x86_64__ # include # ifdef _GLIBCXX_X86_RDRAND @@ -674,4 +672,3 @@ namespace std _GLIBCXX_VISIBILITY(default) template struct __detail::_Mod; #endif } -#endif // _GLIBCXX_USE_C99_STDINT_TR1