From patchwork Fri Sep 30 20:57:08 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Jonathan Wakely X-Patchwork-Id: 1613 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a5d:4ac7:0:0:0:0:0 with SMTP id y7csp668225wrs; Fri, 30 Sep 2022 14:00:23 -0700 (PDT) X-Google-Smtp-Source: AMsMyM6O4dV1XABKsMzrdDzJ95m/p0DdbD+ptZ1b0o3RcNddq9MLD7ZjwchZZQnwF7eFTbLzpo9t X-Received: by 2002:a05:6402:2b85:b0:457:6216:d251 with SMTP id fj5-20020a0564022b8500b004576216d251mr9390039edb.56.1664571623127; Fri, 30 Sep 2022 14:00:23 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1664571623; cv=none; d=google.com; s=arc-20160816; b=XX1LXobbuoSaAtDLm6OKKFPuyTS0kLJGesCaqr/YAWW4h2f+nZWRxY98HHiTmhHL/g RDNrYUMqroCMcE/c2ZVwsOJanAaWkcIHj+XA/5S9vWPHSc0aGvDAG/DZRTSFC2/vIGle C4dTQqTUPSBmWvWLUQa9LaZzxALvlrdnQAvFszxthZI76GTmm0At1H4n+f2F31mBRUHW pz1reK3bxLws+mFRchNB+d0qxVBUqzTExWH7w6lb14vMfkug1zlinGYysWGernVvJ02x Rb7Y0/4zB3bjNCJkJhz34EUIScHt/3kItnF+2AyYqB4d/K28F1wdV245SmiRy813VH/h 9YPw== 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=DPot6V78Ve+FXbFaTKBkld6G1aRVxQEiCIr3WcU9Vzk=; b=OSHHrK8IBqRYth86AE5Q5YrX9y/xfO4TF1C3tKOM6y9sQZgjOgMwu5klbKOvcDLTjT 60OSZS0nymVOKn8O1Nd35b1rMz4md5mcc4RKdBmrCi2LUUWAUfJBWRwQI6PRbmMdC6sv gFrnBXDcKHHcDK6z75G9rl2jocuCbN7k6GXLonTKVQkGEItWiZY5LkUzalxzqQPONhYn J1uISQ3z0Y9gcPKbW2Ocyy4jNYqbx1+/vCDKfzzW9rgGpOU1/YfBq1lVL26aEKlTDvQQ 0xRlkv0jPOpcNgRg+ZU3Z2yNGXfUibrh/glmV7IhhgZB14bXUDhLEKtVC6GT8eIkQQny jD8Q== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@gcc.gnu.org header.s=default header.b=gWY5lNfz; 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 a13-20020a1709063e8d00b00782e9b7305dsi1921467ejj.266.2022.09.30.14.00.22 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 30 Sep 2022 14:00:23 -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=gWY5lNfz; 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 A304E385275F for ; Fri, 30 Sep 2022 20:59:20 +0000 (GMT) DKIM-Filter: OpenDKIM Filter v2.11.0 sourceware.org A304E385275F DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gcc.gnu.org; s=default; t=1664571560; bh=DPot6V78Ve+FXbFaTKBkld6G1aRVxQEiCIr3WcU9Vzk=; h=To:Subject:Date:List-Id:List-Unsubscribe:List-Archive:List-Post: List-Help:List-Subscribe:From:Reply-To:From; b=gWY5lNfzl6aLoveCyBXGqckh/aHhnlAA239bFn3ighqaub+JUFNO9PAdXJjoJBExU Zko7hrT13h+8EVBV68gCQ/XeFfAiiywWxYDQAtOUY4e7UlFxzv9cQt33lx74iZVFrW Gz6m7il4PtPfakrS2fWlF24kzPrb88dvahuIAPVw= 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 593E23858D1E for ; Fri, 30 Sep 2022 20:57:19 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.4.1 sourceware.org 593E23858D1E 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-373-2D4D3IoOMsi1vwXPFT4j6A-1; Fri, 30 Sep 2022 16:57:09 -0400 X-MC-Unique: 2D4D3IoOMsi1vwXPFT4j6A-1 Received: from smtp.corp.redhat.com (int-mx08.intmail.prod.int.rdu2.redhat.com [10.11.54.8]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mimecast-mx02.redhat.com (Postfix) with ESMTPS id 38708800B30; Fri, 30 Sep 2022 20:57:09 +0000 (UTC) Received: from localhost (unknown [10.33.36.64]) by smtp.corp.redhat.com (Postfix) with ESMTP id 01937C15BA4; Fri, 30 Sep 2022 20:57:08 +0000 (UTC) To: libstdc++@gcc.gnu.org, gcc-patches@gcc.gnu.org Subject: [committed] libstdc++: Remove non-standard public members in std::bitset Date: Fri, 30 Sep 2022 21:57:08 +0100 Message-Id: <20220930205708.170313-1-jwakely@redhat.com> MIME-Version: 1.0 X-Scanned-By: MIMEDefang 3.1 on 10.11.54.8 X-Mimecast-Spam-Score: 0 X-Mimecast-Originator: redhat.com X-Spam-Status: No, score=-12.4 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_LOW, 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?1745429854491705181?= X-GMAIL-MSGID: =?utf-8?q?1745429854491705181?= Tested x86_64-linux. Pushed to trunk. -- >8 -- This makes _M_copy_from_ptr, _M_copy_from_string and _M_copy_to_string private, and declares operator<< and operator>> as friends. Also remove the historical _M_copy_from_string and _M_copy_to_string overloads. Those were used before DR 396 was implemented but are not needed now. There are no tests or docs describing them, so I don't think we intend to support them as extensions. libstdc++-v3/ChangeLog: * include/std/bitset (_M_copy_from_ptr, _M_copy_from_string) (_M_copy_to_string): Change access to private. (_M_copy_from_string(const basic_string&, size_t, size_t)): Remove. (_M_copy_to_string(const basic_string&)): Remove. --- libstdc++-v3/include/std/bitset | 69 ++++++++++++++++----------------- 1 file changed, 33 insertions(+), 36 deletions(-) diff --git a/libstdc++-v3/include/std/bitset b/libstdc++-v3/include/std/bitset index 3fe8b18735c..757da020ffe 100644 --- a/libstdc++-v3/include/std/bitset +++ b/libstdc++-v3/include/std/bitset @@ -1321,42 +1321,6 @@ _GLIBCXX_BEGIN_NAMESPACE_CONTAINER return to_string, std::allocator >(__zero, __one); } - - // Helper functions for string operations. - template - _GLIBCXX23_CONSTEXPR - void - _M_copy_from_ptr(const _CharT*, size_t, size_t, size_t, - _CharT, _CharT); - - template - _GLIBCXX23_CONSTEXPR - void - _M_copy_from_string(const std::basic_string<_CharT, - _Traits, _Alloc>& __s, size_t __pos, size_t __n, - _CharT __zero, _CharT __one) - { _M_copy_from_ptr<_CharT, _Traits>(__s.data(), __s.size(), __pos, __n, - __zero, __one); } - - template - _GLIBCXX23_CONSTEXPR - void - _M_copy_to_string(std::basic_string<_CharT, _Traits, _Alloc>&, - _CharT, _CharT) const; - - // NB: Backward compat. - template - _GLIBCXX23_CONSTEXPR - void - _M_copy_from_string(const std::basic_string<_CharT, - _Traits, _Alloc>& __s, size_t __pos, size_t __n) - { _M_copy_from_string(__s, __pos, __n, _CharT('0'), _CharT('1')); } - - template - _GLIBCXX23_CONSTEXPR - void - _M_copy_to_string(std::basic_string<_CharT, _Traits,_Alloc>& __s) const - { _M_copy_to_string(__s, _CharT('0'), _CharT('1')); } #endif // HOSTED /// Returns the number of bits which are set. @@ -1463,6 +1427,39 @@ _GLIBCXX_BEGIN_NAMESPACE_CONTAINER size_t _Find_next(size_t __prev) const _GLIBCXX_NOEXCEPT { return this->_M_do_find_next(__prev, _Nb); } + + private: + // Helper functions for string operations. + template + _GLIBCXX23_CONSTEXPR + void + _M_copy_from_ptr(const _CharT*, size_t, size_t, size_t, + _CharT, _CharT); + +#if _GLIBCXX_HOSTED + template + _GLIBCXX23_CONSTEXPR + void + _M_copy_from_string(const std::basic_string<_CharT, + _Traits, _Alloc>& __s, size_t __pos, size_t __n, + _CharT __zero, _CharT __one) + { _M_copy_from_ptr<_CharT, _Traits>(__s.data(), __s.size(), __pos, __n, + __zero, __one); } + + template + _GLIBCXX23_CONSTEXPR + void + _M_copy_to_string(std::basic_string<_CharT, _Traits, _Alloc>&, + _CharT, _CharT) const; + + template + friend std::basic_istream<_CharT, _Traits>& + operator>>(std::basic_istream<_CharT, _Traits>&, bitset<_Nb2>&); + + template + friend std::basic_ostream<_CharT, _Traits>& + operator<<(std::basic_ostream<_CharT, _Traits>&, const bitset<_Nb2>&); +#endif }; #if _GLIBCXX_HOSTED