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.129.124]) by sourceware.org (Postfix) with ESMTPS id 990073858421 for ; Wed, 18 Jan 2023 21:49:34 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.4.2 sourceware.org 990073858421 Authentication-Results: sourceware.org; dmarc=pass (p=none dis=none) header.from=redhat.com Authentication-Results: sourceware.org; spf=pass smtp.mailfrom=redhat.com DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1674078574; 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=8kbr61q9IiO+CeSmkpwQPhSdaAan4Ykpw3iQNllj8dQ=; b=c0B3HZTCZ1lNzwUqBRiGCUZ+AP4nPKW1AGqgidvj4ZRYzsIvxQ6zOrTzWagY4jHLrkjNXx Fn6RgS75ZTl5eIAxrQk5s7Gc/scsLUKlpRAIMeshhKr+h9DujYvb9IsdvLEidHpLFYa9Hh GWhZ6Xez7Io/F83AWnp23ALDmj/hceo= Received: from mimecast-mx02.redhat.com (mx3-rdu2.redhat.com [66.187.233.73]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id us-mta-353-lKsYOyoVP9-wGMSxHIpo0g-1; Wed, 18 Jan 2023 16:49:31 -0500 X-MC-Unique: lKsYOyoVP9-wGMSxHIpo0g-1 Received: from smtp.corp.redhat.com (int-mx06.intmail.prod.int.rdu2.redhat.com [10.11.54.6]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mimecast-mx02.redhat.com (Postfix) with ESMTPS id C94501C0513C; Wed, 18 Jan 2023 21:49:30 +0000 (UTC) Received: from localhost (unknown [10.33.36.201]) by smtp.corp.redhat.com (Postfix) with ESMTP id 9005E2166B26; Wed, 18 Jan 2023 21:49:30 +0000 (UTC) From: Jonathan Wakely To: libstdc++@gcc.gnu.org, gcc-patches@gcc.gnu.org Subject: [committed] libstdc++: Deprecate std::filesystem::u8path for C++20 Date: Wed, 18 Jan 2023 21:49:29 +0000 Message-Id: <20230118214929.440253-1-jwakely@redhat.com> MIME-Version: 1.0 X-Scanned-By: MIMEDefang 3.1 on 10.11.54.6 X-Mimecast-Spam-Score: 0 X-Mimecast-Originator: redhat.com Content-Type: text/plain Content-Transfer-Encoding: 8bit X-Spam-Status: No, score=-11.9 required=5.0 tests=BAYES_00,DKIMWL_WL_HIGH,DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,GIT_PATCH_0,KAM_NUMSUBJECT,KAM_SHORT,RCVD_IN_DNSWL_NONE,RCVD_IN_MSPIKE_H2,SPF_HELO_NONE,SPF_NONE,TXREP autolearn=unavailable autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on server2.sourceware.org List-Id: Tested x86_64-linux. Pushed to trunk. -- >8 -- P0482R6 deprecated these functions for C++20. There was a ballot comment on the C++23 CD saying to un-deprecate it, but LEWG just rejected that, so let's add attributes to deprecate them. libstdc++-v3/ChangeLog: * include/bits/fs_path.h (u8path): Add deprecated attribute. * testsuite/27_io/filesystem/path/construct/90281.cc: Add -Wno-deprecated-declarations for C++20 and later. * testsuite/27_io/filesystem/path/factory/u8path-char8_t.cc: Likewise. * testsuite/27_io/filesystem/path/factory/u8path.cc: Likewise. * testsuite/27_io/filesystem/path/native/string.cc: Likewise. * testsuite/27_io/filesystem/path/factory/u8path-depr.cc: New test. --- libstdc++-v3/include/bits/fs_path.h | 2 ++ .../27_io/filesystem/path/construct/90281.cc | 1 + .../filesystem/path/factory/u8path-char8_t.cc | 1 + .../27_io/filesystem/path/factory/u8path-depr.cc | 16 ++++++++++++++++ .../27_io/filesystem/path/factory/u8path.cc | 1 + .../27_io/filesystem/path/native/string.cc | 1 + 6 files changed, 22 insertions(+) create mode 100644 libstdc++-v3/testsuite/27_io/filesystem/path/factory/u8path-depr.cc diff --git a/libstdc++-v3/include/bits/fs_path.h b/libstdc++-v3/include/bits/fs_path.h index 5f18f2314d1..1cbfaaa5427 100644 --- a/libstdc++-v3/include/bits/fs_path.h +++ b/libstdc++-v3/include/bits/fs_path.h @@ -808,6 +808,7 @@ namespace __detail typename _Require = __detail::_Path2<_InputIterator>, typename _CharT = __detail::__value_type_is_char_or_char8_t<_InputIterator>> + _GLIBCXX20_DEPRECATED_SUGGEST("path(u8string(first, last))") inline path u8path(_InputIterator __first, _InputIterator __last) { @@ -830,6 +831,7 @@ namespace __detail template, typename _CharT = __detail::__value_type_is_char_or_char8_t<_Source>> + _GLIBCXX20_DEPRECATED_SUGGEST("path((const char8_t*)&*source)") inline path u8path(const _Source& __source) { diff --git a/libstdc++-v3/testsuite/27_io/filesystem/path/construct/90281.cc b/libstdc++-v3/testsuite/27_io/filesystem/path/construct/90281.cc index 4b38646c0e0..d26b5e15b29 100644 --- a/libstdc++-v3/testsuite/27_io/filesystem/path/construct/90281.cc +++ b/libstdc++-v3/testsuite/27_io/filesystem/path/construct/90281.cc @@ -16,6 +16,7 @@ // . // { dg-do run { target c++17 } } +// { dg-additional-options "-Wno-deprecated-declarations" { target c++20 } } #include #include diff --git a/libstdc++-v3/testsuite/27_io/filesystem/path/factory/u8path-char8_t.cc b/libstdc++-v3/testsuite/27_io/filesystem/path/factory/u8path-char8_t.cc index ceedd5fbdc2..eff95c18bdf 100644 --- a/libstdc++-v3/testsuite/27_io/filesystem/path/factory/u8path-char8_t.cc +++ b/libstdc++-v3/testsuite/27_io/filesystem/path/factory/u8path-char8_t.cc @@ -17,6 +17,7 @@ // { dg-options "-fchar8_t -Wno-stringop-overread" } // { dg-do run { target c++17 } } +// { dg-additional-options "-Wno-deprecated-declarations" { target c++20 } } #include #include diff --git a/libstdc++-v3/testsuite/27_io/filesystem/path/factory/u8path-depr.cc b/libstdc++-v3/testsuite/27_io/filesystem/path/factory/u8path-depr.cc new file mode 100644 index 00000000000..de54668c055 --- /dev/null +++ b/libstdc++-v3/testsuite/27_io/filesystem/path/factory/u8path-depr.cc @@ -0,0 +1,16 @@ +// { dg-options "-std=gnu++20" } +// { dg-do compile { target c++20 } } + +#include + +namespace fs = std::filesystem; + +const char* s = ""; +auto p1 = fs::u8path(s); // { dg-warning "deprecated" } +auto p2 = fs::u8path(s, s); // { dg-warning "deprecated" } + +#if __cpp_lib_char8_t +const char8_t* u = u8""; +auto p3 = fs::u8path(u); // { dg-warning "deprecated" } +auto p4 = fs::u8path(u, u); // { dg-warning "deprecated" } +#endif diff --git a/libstdc++-v3/testsuite/27_io/filesystem/path/factory/u8path.cc b/libstdc++-v3/testsuite/27_io/filesystem/path/factory/u8path.cc index 726b3eaadd8..4c41fc28da9 100644 --- a/libstdc++-v3/testsuite/27_io/filesystem/path/factory/u8path.cc +++ b/libstdc++-v3/testsuite/27_io/filesystem/path/factory/u8path.cc @@ -16,6 +16,7 @@ // . // { dg-do run { target c++17 } } +// { dg-additional-options "-Wno-deprecated-declarations" { target c++20 } } #include #include diff --git a/libstdc++-v3/testsuite/27_io/filesystem/path/native/string.cc b/libstdc++-v3/testsuite/27_io/filesystem/path/native/string.cc index 8620c15fa88..d5942c9beaa 100644 --- a/libstdc++-v3/testsuite/27_io/filesystem/path/native/string.cc +++ b/libstdc++-v3/testsuite/27_io/filesystem/path/native/string.cc @@ -16,6 +16,7 @@ // . // { dg-do run { target c++17 } } +// { dg-additional-options "-Wno-deprecated-declarations" { target c++20 } } #include #include -- 2.39.0