From patchwork Thu Jun 20 15:35:52 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Jonathan Wakely X-Patchwork-Id: 1950254 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@legolas.ozlabs.org Authentication-Results: legolas.ozlabs.org; dkim=pass (1024-bit key; unprotected) header.d=redhat.com header.i=@redhat.com header.a=rsa-sha256 header.s=mimecast20190719 header.b=NaucBfa3; dkim-atps=neutral Authentication-Results: legolas.ozlabs.org; spf=pass (sender SPF authorized) smtp.mailfrom=gcc.gnu.org (client-ip=2620:52:3:1:0:246e:9693:128c; helo=server2.sourceware.org; envelope-from=gcc-patches-bounces+incoming=patchwork.ozlabs.org@gcc.gnu.org; receiver=patchwork.ozlabs.org) Received: from server2.sourceware.org (server2.sourceware.org [IPv6:2620:52:3:1:0:246e:9693:128c]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature ECDSA (secp384r1) server-digest SHA384) (No client certificate requested) by legolas.ozlabs.org (Postfix) with ESMTPS id 4W4l4c5LgZz20KL for ; Fri, 21 Jun 2024 01:38:08 +1000 (AEST) Received: from server2.sourceware.org (localhost [IPv6:::1]) by sourceware.org (Postfix) with ESMTP id 0275A3894C36 for ; Thu, 20 Jun 2024 15:38:07 +0000 (GMT) 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 6564B389366C for ; Thu, 20 Jun 2024 15:36:24 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.4.2 sourceware.org 6564B389366C Authentication-Results: sourceware.org; dmarc=pass (p=none dis=none) header.from=redhat.com Authentication-Results: sourceware.org; spf=pass smtp.mailfrom=redhat.com ARC-Filter: OpenARC Filter v1.0.0 sourceware.org 6564B389366C Authentication-Results: server2.sourceware.org; arc=none smtp.remote-ip=170.10.129.124 ARC-Seal: i=1; a=rsa-sha256; d=sourceware.org; s=key; t=1718897800; cv=none; b=LXhBxYosg4V0Z9LhBd1u3sYc13zZyGlkFoAZzWNmXwk6TARE2K2eHKdxR9tAhrR7uL6agySO6CEXAJe6X6CILaDf5im9oXufV/nSYeybSe2eDEkpAHRRjwOY9UlDfliZUwAtZ/NjR6devJ9RPRXYx6xsM+ynVHF45f1GSrMH3ho= ARC-Message-Signature: i=1; a=rsa-sha256; d=sourceware.org; s=key; t=1718897800; c=relaxed/simple; bh=Ksx7obg36kQvdRnI4fLadik0c/FsCVlrdNNq2B/sO+w=; h=DKIM-Signature:From:To:Subject:Date:Message-ID:MIME-Version; b=vljXEpNi/ktoj2dKh5yU4Fc5SYvc1FKvjh3cv9stxO5JZRLuBYsmPH4EE1dX5q64x8xl/HWxQtasfW/Tk1YlLdThii2J2/DhJde5+sI9jAJGvDGQdVawnz+/mdoIaJOX/vOhladgmN42mQee7Hws2AE2O0jPIU0jIJTVhF98bCo= ARC-Authentication-Results: i=1; server2.sourceware.org DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1718897784; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding; bh=I/7ZncQBU6+icOvi2lwkFaRW6vHge7TB9g/R0WtgBaQ=; b=NaucBfa3iQocR0caLj4VGa95O2e8LVh20+bVx5BPxnbz9jeqw12iX/ctEuY+PYzBG0+dgx WjeF/EZEfjOCjj5s1+KvqifCOvLUB/1IJDsROyosuy9GVn+JeedgJFtR+FMws+sPzaLH1/ GyYzdUgMhISJx+tV5S0jWZv+Lf5tNy8= Received: from mx-prod-mc-04.mail-002.prod.us-west-2.aws.redhat.com (ec2-54-186-198-63.us-west-2.compute.amazonaws.com [54.186.198.63]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.3, cipher=TLS_AES_256_GCM_SHA384) id us-mta-593-_LluqjRKMyCrpDrryScw8A-1; Thu, 20 Jun 2024 11:36:21 -0400 X-MC-Unique: _LluqjRKMyCrpDrryScw8A-1 Received: from mx-prod-int-05.mail-002.prod.us-west-2.aws.redhat.com (mx-prod-int-05.mail-002.prod.us-west-2.aws.redhat.com [10.30.177.17]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (2048 bits) server-digest SHA256) (No client certificate requested) by mx-prod-mc-04.mail-002.prod.us-west-2.aws.redhat.com (Postfix) with ESMTPS id 464E51954214; Thu, 20 Jun 2024 15:36:20 +0000 (UTC) Received: from localhost (unknown [10.42.28.182]) by mx-prod-int-05.mail-002.prod.us-west-2.aws.redhat.com (Postfix) with ESMTP id 8DDFD195605B; Thu, 20 Jun 2024 15:36:19 +0000 (UTC) From: Jonathan Wakely To: libstdc++@gcc.gnu.org, gcc-patches@gcc.gnu.org Subject: [PATCH 1/3] libstdc++: Add [[deprecated]] to std::wstring_convert and std::wbuffer_convert Date: Thu, 20 Jun 2024 16:35:52 +0100 Message-ID: <20240620153618.2024734-1-jwakely@redhat.com> MIME-Version: 1.0 X-Scanned-By: MIMEDefang 3.0 on 10.30.177.17 X-Mimecast-Spam-Score: 0 X-Mimecast-Originator: redhat.com X-Spam-Status: No, score=-10.8 required=5.0 tests=BAYES_00, DKIMWL_WL_HIGH, DKIM_SIGNED, DKIM_VALID, DKIM_VALID_AU, DKIM_VALID_EF, GIT_PATCH_0, KAM_SHORT, RCVD_IN_DNSWL_NONE, RCVD_IN_MSPIKE_H4, RCVD_IN_MSPIKE_WL, RCVD_IN_SBL_CSS, 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.30 Precedence: list List-Id: Gcc-patches mailing list List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: gcc-patches-bounces+incoming=patchwork.ozlabs.org@gcc.gnu.org Tested x86_64-linux. -- >8 -- These were deprecated in C++17 and std::wstring_convert is planned for removal in C++26. libstdc++-v3/ChangeLog: * include/bits/locale_conv.h (wstring_convert): Add deprecated attribute for C++17 and later. (wbuffer_convert): Likewise. * testsuite/22_locale/codecvt/codecvt_utf16/79980.cc: Disable deprecated warnings. * testsuite/22_locale/codecvt/codecvt_utf8/79980.cc: Likewise. * testsuite/22_locale/codecvt/codecvt_utf8_utf16/79511.cc: Likewise. * testsuite/22_locale/conversions/buffer/1.cc: Add dg-warning. * testsuite/22_locale/conversions/buffer/2.cc: Likewise. * testsuite/22_locale/conversions/buffer/3.cc: Likewise. * testsuite/22_locale/conversions/buffer/requirements/typedefs.cc: Likewise. * testsuite/22_locale/conversions/string/1.cc: Likewise. * testsuite/22_locale/conversions/string/2.cc: Likewise. * testsuite/22_locale/conversions/string/3.cc: Likewise. * testsuite/22_locale/conversions/string/66441.cc: Likewise. * testsuite/22_locale/conversions/string/requirements/typedefs-2.cc: Likewise. * testsuite/22_locale/conversions/string/requirements/typedefs.cc: Likewise. --- libstdc++-v3/include/bits/locale_conv.h | 5 +++-- .../testsuite/22_locale/codecvt/codecvt_utf16/79980.cc | 1 + .../testsuite/22_locale/codecvt/codecvt_utf8/79980.cc | 1 + .../testsuite/22_locale/codecvt/codecvt_utf8_utf16/79511.cc | 1 + libstdc++-v3/testsuite/22_locale/conversions/buffer/1.cc | 1 + libstdc++-v3/testsuite/22_locale/conversions/buffer/2.cc | 1 + libstdc++-v3/testsuite/22_locale/conversions/buffer/3.cc | 2 ++ .../22_locale/conversions/buffer/requirements/typedefs.cc | 2 +- libstdc++-v3/testsuite/22_locale/conversions/string/1.cc | 1 + libstdc++-v3/testsuite/22_locale/conversions/string/2.cc | 1 + libstdc++-v3/testsuite/22_locale/conversions/string/3.cc | 1 + libstdc++-v3/testsuite/22_locale/conversions/string/66441.cc | 1 + .../22_locale/conversions/string/requirements/typedefs-2.cc | 1 + .../22_locale/conversions/string/requirements/typedefs.cc | 1 + 14 files changed, 17 insertions(+), 3 deletions(-) diff --git a/libstdc++-v3/include/bits/locale_conv.h b/libstdc++-v3/include/bits/locale_conv.h index 754c36b92b8..63dee1ac872 100644 --- a/libstdc++-v3/include/bits/locale_conv.h +++ b/libstdc++-v3/include/bits/locale_conv.h @@ -259,7 +259,7 @@ _GLIBCXX_BEGIN_NAMESPACE_CXX11 template, typename _Byte_alloc = allocator> - class wstring_convert + class _GLIBCXX17_DEPRECATED wstring_convert { public: typedef basic_string, _Byte_alloc> byte_string; @@ -406,7 +406,8 @@ _GLIBCXX_END_NAMESPACE_CXX11 /// Buffer conversions template> - class wbuffer_convert : public basic_streambuf<_Elem, _Tr> + class _GLIBCXX17_DEPRECATED wbuffer_convert + : public basic_streambuf<_Elem, _Tr> { typedef basic_streambuf<_Elem, _Tr> _Wide_streambuf; diff --git a/libstdc++-v3/testsuite/22_locale/codecvt/codecvt_utf16/79980.cc b/libstdc++-v3/testsuite/22_locale/codecvt/codecvt_utf16/79980.cc index 1c6711b56db..90cb844bba3 100644 --- a/libstdc++-v3/testsuite/22_locale/codecvt/codecvt_utf16/79980.cc +++ b/libstdc++-v3/testsuite/22_locale/codecvt/codecvt_utf16/79980.cc @@ -16,6 +16,7 @@ // . // { dg-do run { target c++11 } } +// { dg-additional-options "-Wno-deprecated-declarations" { target c++17 } } #include #include diff --git a/libstdc++-v3/testsuite/22_locale/codecvt/codecvt_utf8/79980.cc b/libstdc++-v3/testsuite/22_locale/codecvt/codecvt_utf8/79980.cc index d6cd89ce420..66aadc1161d 100644 --- a/libstdc++-v3/testsuite/22_locale/codecvt/codecvt_utf8/79980.cc +++ b/libstdc++-v3/testsuite/22_locale/codecvt/codecvt_utf8/79980.cc @@ -16,6 +16,7 @@ // . // { dg-do run { target c++11 } } +// { dg-additional-options "-Wno-deprecated-declarations" { target c++17 } } #include #include diff --git a/libstdc++-v3/testsuite/22_locale/codecvt/codecvt_utf8_utf16/79511.cc b/libstdc++-v3/testsuite/22_locale/codecvt/codecvt_utf8_utf16/79511.cc index d09aa41ee93..e6934818864 100644 --- a/libstdc++-v3/testsuite/22_locale/codecvt/codecvt_utf8_utf16/79511.cc +++ b/libstdc++-v3/testsuite/22_locale/codecvt/codecvt_utf8_utf16/79511.cc @@ -16,6 +16,7 @@ // . // { dg-do run { target c++11 } } +// { dg-additional-options "-Wno-deprecated-declarations" { target c++17 } } #include #include diff --git a/libstdc++-v3/testsuite/22_locale/conversions/buffer/1.cc b/libstdc++-v3/testsuite/22_locale/conversions/buffer/1.cc index 6b1ea950213..63125665d72 100644 --- a/libstdc++-v3/testsuite/22_locale/conversions/buffer/1.cc +++ b/libstdc++-v3/testsuite/22_locale/conversions/buffer/1.cc @@ -29,6 +29,7 @@ struct cvt : std::codecvt { }; template using buf_conv = std::wbuffer_convert, Elem>; +// { dg-warning "deprecated" "" { target c++17 } 31 } using std::string; using std::wstring; diff --git a/libstdc++-v3/testsuite/22_locale/conversions/buffer/2.cc b/libstdc++-v3/testsuite/22_locale/conversions/buffer/2.cc index 42653a9c7b7..5b3da130359 100644 --- a/libstdc++-v3/testsuite/22_locale/conversions/buffer/2.cc +++ b/libstdc++-v3/testsuite/22_locale/conversions/buffer/2.cc @@ -27,6 +27,7 @@ test01() struct Cvt : std::codecvt { }; std::stringstream ss; std::wbuffer_convert cvt(ss.rdbuf()); + // { dg-warning "deprecated" "" { target c++17 } 29 } auto p = ss.std::ios::rdbuf(&cvt); ss << "hello"; VERIFY( ss.flush().good() ); diff --git a/libstdc++-v3/testsuite/22_locale/conversions/buffer/3.cc b/libstdc++-v3/testsuite/22_locale/conversions/buffer/3.cc index de2c1a41322..5dcb9c5ec75 100644 --- a/libstdc++-v3/testsuite/22_locale/conversions/buffer/3.cc +++ b/libstdc++-v3/testsuite/22_locale/conversions/buffer/3.cc @@ -47,6 +47,7 @@ test01() // https://gcc.gnu.org/ml/libstdc++/2017-11/msg00022.html streambuf sb; std::wbuffer_convert conv(&sb); + // { dg-warning "deprecated" "" { target c++17 } 49 } VERIFY( sb.in_avail() == 0 ); wchar_t c = conv.sgetc(); VERIFY( c == L'a' ); @@ -61,6 +62,7 @@ test02() // https://gcc.gnu.org/ml/libstdc++/2017-11/msg00022.html streambuf sb; std::wbuffer_convert conv(&sb); + // { dg-warning "deprecated" "" { target c++17 } 64 } VERIFY( sb.in_avail() == 0 ); char16_t c = conv.sgetc(); VERIFY( c == u'a' ); diff --git a/libstdc++-v3/testsuite/22_locale/conversions/buffer/requirements/typedefs.cc b/libstdc++-v3/testsuite/22_locale/conversions/buffer/requirements/typedefs.cc index 2f4ca01b906..bdd3c578247 100644 --- a/libstdc++-v3/testsuite/22_locale/conversions/buffer/requirements/typedefs.cc +++ b/libstdc++-v3/testsuite/22_locale/conversions/buffer/requirements/typedefs.cc @@ -27,7 +27,7 @@ void test01() // Check for required typedefs struct cvt_type : std::codecvt { }; typedef std::char_traits traits_type; - typedef std::wbuffer_convert test_type; + typedef std::wbuffer_convert test_type; // { dg-warning "deprecated" "" { target c++17 } } typedef test_type::state_type state_type; static_assert( std::is_same::value, diff --git a/libstdc++-v3/testsuite/22_locale/conversions/string/1.cc b/libstdc++-v3/testsuite/22_locale/conversions/string/1.cc index b41bdc5ddfe..33b9bdc6b5e 100644 --- a/libstdc++-v3/testsuite/22_locale/conversions/string/1.cc +++ b/libstdc++-v3/testsuite/22_locale/conversions/string/1.cc @@ -29,6 +29,7 @@ struct cvt : std::codecvt { }; template using str_conv = std::wstring_convert, Elem>; +// { dg-warning "deprecated" "" { target c++17 } 31 } using std::string; using std::wstring; diff --git a/libstdc++-v3/testsuite/22_locale/conversions/string/2.cc b/libstdc++-v3/testsuite/22_locale/conversions/string/2.cc index ac97ff4156a..c2b6496b9ae 100644 --- a/libstdc++-v3/testsuite/22_locale/conversions/string/2.cc +++ b/libstdc++-v3/testsuite/22_locale/conversions/string/2.cc @@ -28,6 +28,7 @@ struct cvt : std::codecvt { }; template using str_conv = std::wstring_convert, Elem>; +// { dg-warning "deprecated" "" { target c++17 } 30 } using std::string; using std::u16string; diff --git a/libstdc++-v3/testsuite/22_locale/conversions/string/3.cc b/libstdc++-v3/testsuite/22_locale/conversions/string/3.cc index 5570ab621aa..5a669e78ce1 100644 --- a/libstdc++-v3/testsuite/22_locale/conversions/string/3.cc +++ b/libstdc++-v3/testsuite/22_locale/conversions/string/3.cc @@ -28,6 +28,7 @@ struct cvt : std::codecvt { }; template using str_conv = std::wstring_convert, Elem>; +// { dg-warning "deprecated" "" { target c++17 } 30 } using std::string; using std::u16string; diff --git a/libstdc++-v3/testsuite/22_locale/conversions/string/66441.cc b/libstdc++-v3/testsuite/22_locale/conversions/string/66441.cc index 104d2f77584..f27204a5630 100644 --- a/libstdc++-v3/testsuite/22_locale/conversions/string/66441.cc +++ b/libstdc++-v3/testsuite/22_locale/conversions/string/66441.cc @@ -29,6 +29,7 @@ test01() // convert from UCS-4 to UTF16BE with BOM. using cvt = std::codecvt_utf16; std::wstring_convert conv; + // { dg-warning "deprecated" "" { target c++17 } 31 } auto to = conv.to_bytes(U"ab\u00e7"); VERIFY( to.length() == 8 ); diff --git a/libstdc++-v3/testsuite/22_locale/conversions/string/requirements/typedefs-2.cc b/libstdc++-v3/testsuite/22_locale/conversions/string/requirements/typedefs-2.cc index 487f890e94e..5026b8c68b1 100644 --- a/libstdc++-v3/testsuite/22_locale/conversions/string/requirements/typedefs-2.cc +++ b/libstdc++-v3/testsuite/22_locale/conversions/string/requirements/typedefs-2.cc @@ -33,6 +33,7 @@ template struct cvt : std::codecvt { }; using wconv = std::wstring_convert, alloc>; +// { dg-warning "deprecated" "" { target c++17 } 35 } static_assert( std::is_same>::value, "byte string is std::string" ); diff --git a/libstdc++-v3/testsuite/22_locale/conversions/string/requirements/typedefs.cc b/libstdc++-v3/testsuite/22_locale/conversions/string/requirements/typedefs.cc index d7f5e441738..9405df4c3ad 100644 --- a/libstdc++-v3/testsuite/22_locale/conversions/string/requirements/typedefs.cc +++ b/libstdc++-v3/testsuite/22_locale/conversions/string/requirements/typedefs.cc @@ -26,6 +26,7 @@ void test01() // Check for required typedefs typedef std::codecvt codecvt_type; typedef std::wstring_convert test_type; + // { dg-warning "deprecated" "" { target c++17 } 28 } typedef test_type::byte_string byte_string; typedef test_type::wide_string wide_string; typedef test_type::state_type state_type;