From patchwork Wed May 31 12:22:12 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Jonathan Wakely X-Patchwork-Id: 70376 Return-Path: X-Original-To: patchwork@sourceware.org Delivered-To: patchwork@sourceware.org Received: from server2.sourceware.org (localhost [IPv6:::1]) by sourceware.org (Postfix) with ESMTP id EF3A53836E95 for ; Wed, 31 May 2023 12:25:13 +0000 (GMT) DKIM-Filter: OpenDKIM Filter v2.11.0 sourceware.org EF3A53836E95 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gcc.gnu.org; s=default; t=1685535914; bh=bDQuKpSsNCfiXc5YXQ7B5ThprsJjYlbby3SZQfNtZb0=; h=To:Subject:Date:List-Id:List-Unsubscribe:List-Archive:List-Post: List-Help:List-Subscribe:From:Reply-To:From; b=CuDqp3jbMFZRXCP69cdXOcsvK/cl31I3/0RZ38bILbEVIYX0ofJn4/Rbd84eYiG7Y aDocr6Rjkv5G9jUFGaMXoq99cuNosUzvEiF7c1hadVf748nmVr2hAOBAF4o+Wb4GwJ PvMFDdnX9yVapwb7cJwBWIHeD/NhIXaFe3DzXiUs= 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 5E54838449E9 for ; Wed, 31 May 2023 12:24:15 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.4.2 sourceware.org 5E54838449E9 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-353-YD9RfCeKMlC68JfQp6lDWg-1; Wed, 31 May 2023 08:22:45 -0400 X-MC-Unique: YD9RfCeKMlC68JfQp6lDWg-1 Received: from smtp.corp.redhat.com (int-mx07.intmail.prod.int.rdu2.redhat.com [10.11.54.7]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mimecast-mx02.redhat.com (Postfix) with ESMTPS id 771878032EF; Wed, 31 May 2023 12:22:14 +0000 (UTC) Received: from localhost (unknown [10.42.28.139]) by smtp.corp.redhat.com (Postfix) with ESMTP id 17965140E962; Wed, 31 May 2023 12:22:13 +0000 (UTC) To: libstdc++@gcc.gnu.org, gcc-patches@gcc.gnu.org Subject: [committed] libstdc++: Deprecate std::setfill for std::basic_istream [PR109922] Date: Wed, 31 May 2023 13:22:12 +0100 Message-Id: <20230531122212.4116815-1-jwakely@redhat.com> MIME-Version: 1.0 X-Scanned-By: MIMEDefang 3.1 on 10.11.54.7 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, 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+patchwork=sourceware.org@gcc.gnu.org Sender: "Gcc-patches" Tested powerpc64le-linux. Pushed to trunk. -- >8 -- Prior to N0966 (July 1996) the std::setfill manipulator was specified to work with both input and output streams. In the final C++98 standard it is only specified to work with output streams. We have always supported it for input streams, despite that never being in the standard, and having no meaning for any input streams defined by the standard. This commit adds a deprecated attribute to the overload for input streams, so that we can stop supporting this some day. libstdc++-v3/ChangeLog: PR libstdc++/109922 * include/std/iomanip (operator>>(basic_istream&, _Setfill)): Add deprecated attribute to non-standard overload. * doc/xml/manual/evolution.xml: Document deprecation. * doc/html/*: Regenerate. * testsuite/27_io/manipulators/standard/char/1.cc: Add dg-warning for expected deprecated warning. * testsuite/27_io/manipulators/standard/char/2.cc: Likewise. * testsuite/27_io/manipulators/standard/wchar_t/1.cc: Likewise. * testsuite/27_io/manipulators/standard/wchar_t/2.cc: Likewise. --- libstdc++-v3/doc/html/index.html | 2 +- libstdc++-v3/doc/html/manual/api.html | 3 +++ libstdc++-v3/doc/html/manual/appendix.html | 2 +- libstdc++-v3/doc/html/manual/appendix_porting.html | 2 +- libstdc++-v3/doc/html/manual/index.html | 2 +- libstdc++-v3/doc/xml/manual/evolution.xml | 9 +++++++++ libstdc++-v3/include/std/iomanip | 2 ++ .../testsuite/27_io/manipulators/standard/char/1.cc | 4 ++-- .../testsuite/27_io/manipulators/standard/char/2.cc | 2 +- .../testsuite/27_io/manipulators/standard/wchar_t/1.cc | 4 ++-- .../testsuite/27_io/manipulators/standard/wchar_t/2.cc | 2 +- 11 files changed, 24 insertions(+), 10 deletions(-) diff --git a/libstdc++-v3/doc/xml/manual/evolution.xml b/libstdc++-v3/doc/xml/manual/evolution.xml index a29e4df3822..4037a18d2df 100644 --- a/libstdc++-v3/doc/xml/manual/evolution.xml +++ b/libstdc++-v3/doc/xml/manual/evolution.xml @@ -1089,4 +1089,13 @@ Tunables glibcxx.eh_pool.obj_count and +
<constant>14</constant> + + +Deprecate the non-standard overload that allows std::setfill +to be used with std::basic_istream. + + +
+ diff --git a/libstdc++-v3/include/std/iomanip b/libstdc++-v3/include/std/iomanip index 5c0fb09a60e..eb82fc584b6 100644 --- a/libstdc++-v3/include/std/iomanip +++ b/libstdc++-v3/include/std/iomanip @@ -168,6 +168,8 @@ _GLIBCXX_BEGIN_NAMESPACE_VERSION { return { __c }; } template + __attribute__((__deprecated__("'std::setfill' should only be used with " + "output streams"))) inline basic_istream<_CharT, _Traits>& operator>>(basic_istream<_CharT, _Traits>& __is, _Setfill<_CharT> __f) { diff --git a/libstdc++-v3/testsuite/27_io/manipulators/standard/char/1.cc b/libstdc++-v3/testsuite/27_io/manipulators/standard/char/1.cc index d3eba45aac1..4da43200fe5 100644 --- a/libstdc++-v3/testsuite/27_io/manipulators/standard/char/1.cc +++ b/libstdc++-v3/testsuite/27_io/manipulators/standard/char/1.cc @@ -51,9 +51,9 @@ test01() oss << setbase(8); VERIFY(oss.good()); - // setfil + // setfill setfill('a'); - iss >> setfill('a'); + iss >> setfill('a'); // { dg-warning "deprecated" } VERIFY(iss.good()); oss << setfill('a'); VERIFY(oss.good()); diff --git a/libstdc++-v3/testsuite/27_io/manipulators/standard/char/2.cc b/libstdc++-v3/testsuite/27_io/manipulators/standard/char/2.cc index dc74e1983c7..9acc057ccbb 100644 --- a/libstdc++-v3/testsuite/27_io/manipulators/standard/char/2.cc +++ b/libstdc++-v3/testsuite/27_io/manipulators/standard/char/2.cc @@ -40,7 +40,7 @@ test01() sin >> resetiosflags(ios_base::dec) >> setiosflags(ios_base::dec) >> setbase(ios_base::dec) - >> setfill('c') + >> setfill('c') // { dg-warning "deprecated" } >> setprecision(5) >> setw(20) >> ws; diff --git a/libstdc++-v3/testsuite/27_io/manipulators/standard/wchar_t/1.cc b/libstdc++-v3/testsuite/27_io/manipulators/standard/wchar_t/1.cc index 0c27e8b126a..ebfab0cc732 100644 --- a/libstdc++-v3/testsuite/27_io/manipulators/standard/wchar_t/1.cc +++ b/libstdc++-v3/testsuite/27_io/manipulators/standard/wchar_t/1.cc @@ -51,9 +51,9 @@ test01() oss << setbase(8); VERIFY(oss.good()); - // setfil + // setfill setfill(L'a'); - iss >> setfill(L'a'); + iss >> setfill(L'a'); // { dg-warning "deprecated" } VERIFY(iss.good()); oss << setfill(L'a'); VERIFY(oss.good()); diff --git a/libstdc++-v3/testsuite/27_io/manipulators/standard/wchar_t/2.cc b/libstdc++-v3/testsuite/27_io/manipulators/standard/wchar_t/2.cc index 509c152a6d7..78b812d4288 100644 --- a/libstdc++-v3/testsuite/27_io/manipulators/standard/wchar_t/2.cc +++ b/libstdc++-v3/testsuite/27_io/manipulators/standard/wchar_t/2.cc @@ -40,7 +40,7 @@ test01() sin >> resetiosflags(ios_base::dec) >> setiosflags(ios_base::dec) >> setbase(ios_base::dec) - >> setfill(L'c') + >> setfill(L'c') // { dg-warning "deprecated" } >> setprecision(5) >> setw(20) >> ws;