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: 101410 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a59:994d:0:b0:3d9:f83d:47d9 with SMTP id k13csp2840738vqr; Wed, 31 May 2023 05:30:01 -0700 (PDT) X-Google-Smtp-Source: ACHHUZ7pjkUskND4AOe3zlbNJS7+PAdKxuGhr0UhPJ/JoKSx2fiS0GYPp0Ijt/mNE3K4vJqHaffj X-Received: by 2002:a05:6402:5107:b0:514:9311:e83a with SMTP id m7-20020a056402510700b005149311e83amr5999337edd.8.1685536201836; Wed, 31 May 2023 05:30:01 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1685536201; cv=none; d=google.com; s=arc-20160816; b=ZdLaXC6NkZGr7JroQMiN585L7LYX7Pz8+kChiziqIqz3CiukLYC+oHRFIuW9FReZZm xB7Sy256GIi38lTmzX05f51FBX7xm9pXN0eJfJp2ZK9CHfOAFaHmLxOIFfGLhJM4gPag /Y07kuU1/rUSvmcusZnPRBDwjn/3Ccxt9m4iybvh7EDnntNu30k8xqYD0jj2LoTVOTTk 1zHTQhVYSsBDphaVJyf079gz+eUOjROUU/JEtBIQiPeqSRj4T0yp6h2Uulznzlu7MDMi pu0Q7IjJFNgr4V32/aKBRq/zSv9QTB9UnMgwo3ZQeI9N6QMe+zdTktkJ44Kzo6GoH6Lh 5Kcw== 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=bDQuKpSsNCfiXc5YXQ7B5ThprsJjYlbby3SZQfNtZb0=; b=01f5A79TJTkg088Yh32oXjRicxwz1GiW4I1Vu6cVARQSGorRO4VsbSbAEhwo1l7q4G tOZwvWpsU73MNTGT/baKu4HzJmoo14mzrmfpuhl1OCs0KazHF5dlGidBMqgj9BHTxdrM BWNg+cvIuxpt/v7qdkdN4hvhKKtJooX1VGfhAv7bLRSW3MrNafmS6qrhnio84aeqJusm wzNML3GAvbyZBjE6HLv8TbwpUwiLJ9w0ZTGe/huWWoswO7D9q3z9ExbWLI6fLc3WVZ4G +0edO88zG1Ulqv4hdiZ1/gX6PWnmDGHRC29EnKgsjBDTQPV06Bhmezz6mSlYtcAN41+n wfHQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@gcc.gnu.org header.s=default header.b=c15pWvsw; 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 b13-20020aa7df8d000000b00514a23e7f17si2420205edy.380.2023.05.31.05.30.01 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 31 May 2023 05:30:01 -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=c15pWvsw; 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 B6CBF383532E for ; Wed, 31 May 2023 12:25:29 +0000 (GMT) DKIM-Filter: OpenDKIM Filter v2.11.0 sourceware.org B6CBF383532E DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gcc.gnu.org; s=default; t=1685535929; bh=bDQuKpSsNCfiXc5YXQ7B5ThprsJjYlbby3SZQfNtZb0=; h=To:Subject:Date:List-Id:List-Unsubscribe:List-Archive:List-Post: List-Help:List-Subscribe:From:Reply-To:From; b=c15pWvswqBQ9TfpfwZO0HKSCH2qzrjAiHDI2mVJxXCt/Hsz+TmJNHhRPUpkqiwUqC 11/cUGWPPodLLjJXXd4HIMrbIL/KF0OMvujaqhmblVHV291IQk0c8V/TWF6b7a3W3Y s+1VorqUpnzSHgC15Mhnxv9q0PM0z9i+BH75icb0= 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+ouuuleilei=gmail.com@gcc.gnu.org Sender: "Gcc-patches" X-getmail-retrieved-from-mailbox: =?utf-8?q?INBOX?= X-GMAIL-THRID: =?utf-8?q?1767412808717241329?= X-GMAIL-MSGID: =?utf-8?q?1767412808717241329?= 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;