From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from us-smtp-delivery-124.mimecast.com (us-smtp-delivery-124.mimecast.com [170.10.133.124]) by sourceware.org (Postfix) with ESMTP id 8F121385843F for ; Wed, 25 Aug 2021 21:29:11 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.4.1 sourceware.org 8F121385843F Received: from mimecast-mx01.redhat.com (mimecast-mx01.redhat.com [209.132.183.4]) (Using TLS) by relay.mimecast.com with ESMTP id us-mta-42-gT97i-h3M9iOxrj90jKtRg-1; Wed, 25 Aug 2021 17:29:09 -0400 X-MC-Unique: gT97i-h3M9iOxrj90jKtRg-1 Received: from smtp.corp.redhat.com (int-mx01.intmail.prod.int.phx2.redhat.com [10.5.11.11]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mimecast-mx01.redhat.com (Postfix) with ESMTPS id 74F908799EB; Wed, 25 Aug 2021 21:29:08 +0000 (UTC) Received: from localhost (unknown [10.33.36.8]) by smtp.corp.redhat.com (Postfix) with ESMTP id 20CB960657; Wed, 25 Aug 2021 21:29:07 +0000 (UTC) Date: Wed, 25 Aug 2021 22:29:07 +0100 From: Jonathan Wakely To: libstdc++@gcc.gnu.org, gcc-patches@gcc.gnu.org Subject: [committed] libstdc++: Remove __gnu_cxx::rope::erase(size_type) [PR102048] Message-ID: MIME-Version: 1.0 X-Clacks-Overhead: GNU Terry Pratchett X-Scanned-By: MIMEDefang 2.79 on 10.5.11.11 X-Mimecast-Spam-Score: 0 X-Mimecast-Originator: redhat.com Content-Type: multipart/mixed; boundary="FBcG+UJWjMWzH5BD" Content-Disposition: inline X-Spam-Status: No, score=-14.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_LOW, RCVD_IN_MSPIKE_H2, SPF_HELO_NONE, SPF_NONE, TXREP autolearn=ham autolearn_force=no version=3.4.4 X-Spam-Checker-Version: SpamAssassin 3.4.4 (2020-01-24) on server2.sourceware.org X-BeenThere: libstdc++@gcc.gnu.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: Libstdc++ mailing list List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 25 Aug 2021 21:29:13 -0000 --FBcG+UJWjMWzH5BD Content-Type: text/plain; charset=us-ascii Content-Disposition: inline This function claims to remove a single character at index p, but it actually removes p+1 characters beginning at p. So r.erase(0) removes the first character, but r.erase(1) removes the second and third, and r.erase(2) removes the second, third and fourth. This is not a useful API. The overload is present in the SGI STL header that we imported, but it isn't documented in the API reference. The erase overloads that are documented are: erase(const iterator& p) erase(const iterator& f, const iterator& l) erase(size_type i, size_type n); Having an erase(size_type p) overload that erases a single character (as the comment says it does) might be useful, but would be inconsistent with std::basic_string::erase(size_type p = 0, size_type n = npos), which erases from p to the end of the string when called with a single argument. Since the function isn't part of the documented API, doesn't do what it claims to do (or anything useful) and "fixing" it would leave it inconsistent with basic_string, I'm just removing that overload. libstdc++-v3/ChangeLog: PR libstdc++/102048 * include/ext/rope (rope::erase(size_type)): Remove broken function. Tested powerpc64le-linux. Committed to trunk. --FBcG+UJWjMWzH5BD Content-Type: text/plain; charset=us-ascii Content-Disposition: attachment; filename="patch.txt" commit 2cd229dec8d6716938de5052479d059d306969da Author: Jonathan Wakely Date: Wed Aug 25 16:42:49 2021 libstdc++: Remove __gnu_cxx::rope::erase(size_type) [PR102048] This function claims to remove a single character at index p, but it actually removes p+1 characters beginning at p. So r.erase(0) removes the first character, but r.erase(1) removes the second and third, and r.erase(2) removes the second, third and fourth. This is not a useful API. The overload is present in the SGI STL header that we imported, but it isn't documented in the API reference. The erase overloads that are documented are: erase(const iterator& p) erase(const iterator& f, const iterator& l) erase(size_type i, size_type n); Having an erase(size_type p) overload that erases a single character (as the comment says it does) might be useful, but would be inconsistent with std::basic_string::erase(size_type p = 0, size_type n = npos), which erases from p to the end of the string when called with a single argument. Since the function isn't part of the documented API, doesn't do what it claims to do (or anything useful) and "fixing" it would leave it inconsistent with basic_string, I'm just removing that overload. libstdc++-v3/ChangeLog: PR libstdc++/102048 * include/ext/rope (rope::erase(size_type)): Remove broken function. diff --git a/libstdc++-v3/include/ext/rope b/libstdc++-v3/include/ext/rope index 9681dbc6225..d4406a942b6 100644 --- a/libstdc++-v3/include/ext/rope +++ b/libstdc++-v3/include/ext/rope @@ -2401,11 +2401,6 @@ _GLIBCXX_BEGIN_NAMESPACE_VERSION this->_M_tree_ptr = __result; } - // Erase, single character - void - erase(size_type __p) - { erase(__p, __p + 1); } - // Insert, iterator variants. iterator insert(const iterator& __p, const rope& __r) --FBcG+UJWjMWzH5BD--