From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: by sourceware.org (Postfix, from userid 2181) id 08DAE3858422; Wed, 18 Jan 2023 21:49:12 +0000 (GMT) DKIM-Filter: OpenDKIM Filter v2.11.0 sourceware.org 08DAE3858422 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gcc.gnu.org; s=default; t=1674078552; bh=sgn9fLMMyUXs9AZ1f0EYRm2xZn8ropExmMfL0INlA/o=; h=From:To:Subject:Date:From; b=IiKg1hgw8s1o6cJTbPIo2hGCMv9gRj2W8OAFvvHHHcbB1kfD/cTgC+2YqoPIXPkaI ghq2dE4jrAUfCcD/Kz97DnyqvFVc0p81aoLFHuW5LmgLBaMPmy326g35/UN1ESYjhg fM+5/U2nj1ZXHSS5mq6Yi1h03RNDDRVYA/1wtQvQ= MIME-Version: 1.0 Content-Transfer-Encoding: 7bit Content-Type: text/plain; charset="utf-8" From: Jonathan Wakely To: gcc-cvs@gcc.gnu.org, libstdc++-cvs@gcc.gnu.org Subject: [gcc r13-5248] libstdc++: Deprecate std::filesystem::u8path for C++20 X-Act-Checkin: gcc X-Git-Author: Jonathan Wakely X-Git-Refname: refs/heads/master X-Git-Oldrev: 26c68b8c31f637cc01f4bf511f9a0ca714231161 X-Git-Newrev: 33237e93d59ee7bb215cd5b726880bcbd679bb36 Message-Id: <20230118214912.08DAE3858422@sourceware.org> Date: Wed, 18 Jan 2023 21:49:12 +0000 (GMT) List-Id: https://gcc.gnu.org/g:33237e93d59ee7bb215cd5b726880bcbd679bb36 commit r13-5248-g33237e93d59ee7bb215cd5b726880bcbd679bb36 Author: Jonathan Wakely Date: Wed Jan 18 14:27:55 2023 +0000 libstdc++: Deprecate std::filesystem::u8path for C++20 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. Diff: --- libstdc++-v3/include/bits/fs_path.h | 2 ++ .../testsuite/27_io/filesystem/path/construct/90281.cc | 1 + .../27_io/filesystem/path/factory/u8path-char8_t.cc | 1 + .../27_io/filesystem/path/factory/u8path-depr.cc | 16 ++++++++++++++++ .../testsuite/27_io/filesystem/path/factory/u8path.cc | 1 + .../testsuite/27_io/filesystem/path/native/string.cc | 1 + 6 files changed, 22 insertions(+) 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