From patchwork Wed Jan 18 21:49:29 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Jonathan Wakely X-Patchwork-Id: 1728473 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@legolas.ozlabs.org Authentication-Results: legolas.ozlabs.org; spf=pass (sender SPF authorized) smtp.mailfrom=gcc.gnu.org (client-ip=8.43.85.97; helo=sourceware.org; envelope-from=gcc-patches-bounces+incoming=patchwork.ozlabs.org@gcc.gnu.org; receiver=) Authentication-Results: legolas.ozlabs.org; dkim=pass (1024-bit key; unprotected) header.d=gcc.gnu.org header.i=@gcc.gnu.org header.a=rsa-sha256 header.s=default header.b=YCXwUoD5; dkim-atps=neutral Received: from sourceware.org (ip-8-43-85-97.sourceware.org [8.43.85.97]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature ECDSA (P-384) server-digest SHA384) (No client certificate requested) by legolas.ozlabs.org (Postfix) with ESMTPS id 4Nxzv903Gjz23g6 for ; Thu, 19 Jan 2023 08:49:56 +1100 (AEDT) Received: from server2.sourceware.org (localhost [IPv6:::1]) by sourceware.org (Postfix) with ESMTP id 419D03857C45 for ; Wed, 18 Jan 2023 21:49:54 +0000 (GMT) DKIM-Filter: OpenDKIM Filter v2.11.0 sourceware.org 419D03857C45 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gcc.gnu.org; s=default; t=1674078594; bh=8kbr61q9IiO+CeSmkpwQPhSdaAan4Ykpw3iQNllj8dQ=; h=To:Subject:Date:List-Id:List-Unsubscribe:List-Archive:List-Post: List-Help:List-Subscribe:From:Reply-To:From; b=YCXwUoD5omjNqX4O2AueA85s2KIoWJQhtmYAZhPHsxRRjaEpZPQzSI8pwXvLwFvW8 O97dDuqZcWTd/dQGT2KaWOs3ONP7OsL4ZJihWOa1T3EoxAa3STyhbF4E6ohQ+zhwuI sV+s6+vdGEmvEuZZv97FfIHETxytNLCkmRv4qcFU= 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 DC5DA3858C27 for ; Wed, 18 Jan 2023 21:49:32 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.4.2 sourceware.org DC5DA3858C27 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) 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 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=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+incoming=patchwork.ozlabs.org@gcc.gnu.org Sender: "Gcc-patches" 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