Skip to content

Commit 40c07b5

Browse files
committed
Revert "[libc++][streams] P1759R6: Native handles and file streams (#76632)"
This reverts commit 255f95a, which contains a breaking libcxx test on Windows when using C++26
1 parent 09e0d71 commit 40c07b5

File tree

24 files changed

+30
-508
lines changed

24 files changed

+30
-508
lines changed

libcxx/docs/FeatureTestMacroTable.rst

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -418,7 +418,7 @@ Status
418418
--------------------------------------------------- -----------------
419419
``__cpp_lib_freestanding_variant`` *unimplemented*
420420
--------------------------------------------------- -----------------
421-
``__cpp_lib_fstream_native_handle`` ``202306L``
421+
``__cpp_lib_fstream_native_handle`` *unimplemented*
422422
--------------------------------------------------- -----------------
423423
``__cpp_lib_function_ref`` *unimplemented*
424424
--------------------------------------------------- -----------------

libcxx/docs/ReleaseNotes/18.rst

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -59,7 +59,6 @@ Implemented Papers
5959
- P2909R4 - Fix formatting of code units as integers (Dude, where’s my ``char``?)
6060
- P2821R5 - span.at()
6161
- P0521R0 - Proposed Resolution for CA 14 (shared_ptr use_count/unique)
62-
- P1759R6 - Native handles and file streams
6362

6463

6564
Improvements and New Features

libcxx/docs/Status/Cxx2cPapers.csv

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,7 @@
1919
"`P2757R3 <https://wg21.link/P2757R3>`__","LWG","Type-checking format args","Varna June 2023","","","|format|"
2020
"`P2637R3 <https://wg21.link/P2637R3>`__","LWG","Member ``visit``","Varna June 2023","","","|format|"
2121
"`P2641R4 <https://wg21.link/P2641R4>`__","CWG, LWG","Checking if a ``union`` alternative is active","Varna June 2023","","",""
22-
"`P1759R6 <https://wg21.link/P1759R6>`__","LWG","Native handles and file streams","Varna June 2023","|Complete|","18.0",""
22+
"`P1759R6 <https://wg21.link/P1759R6>`__","LWG","Native handles and file streams","Varna June 2023","","",""
2323
"`P2697R1 <https://wg21.link/P2697R1>`__","LWG","Interfacing ``bitset`` with ``string_view``","Varna June 2023","|Complete|","18.0",""
2424
"`P1383R2 <https://wg21.link/P1383R2>`__","LWG","More ``constexpr`` for ``<cmath>`` and ``<complex>``","Varna June 2023","","",""
2525
"`P2734R0 <https://wg21.link/P2734R0>`__","LWG","Adding the new SI prefixes","Varna June 2023","|Complete|","17.0",""

libcxx/include/fstream

Lines changed: 0 additions & 50 deletions
Original file line numberDiff line numberDiff line change
@@ -73,7 +73,6 @@ public:
7373
typedef typename traits_type::int_type int_type;
7474
typedef typename traits_type::pos_type pos_type;
7575
typedef typename traits_type::off_type off_type;
76-
using native_handle_type = typename basic_filebuf<charT, traits>::native_handle_type; // Since C++26
7776
7877
basic_ifstream();
7978
explicit basic_ifstream(const char* s, ios_base::openmode mode = ios_base::in);
@@ -86,7 +85,6 @@ public:
8685
void swap(basic_ifstream& rhs);
8786
8887
basic_filebuf<char_type, traits_type>* rdbuf() const;
89-
native_handle_type native_handle() const noexcept; // Since C++26
9088
bool is_open() const;
9189
void open(const char* s, ios_base::openmode mode = ios_base::in);
9290
void open(const string& s, ios_base::openmode mode = ios_base::in);
@@ -112,7 +110,6 @@ public:
112110
typedef typename traits_type::int_type int_type;
113111
typedef typename traits_type::pos_type pos_type;
114112
typedef typename traits_type::off_type off_type;
115-
using native_handle_type = typename basic_filebuf<charT, traits>::native_handle_type; // Since C++26
116113
117114
basic_ofstream();
118115
explicit basic_ofstream(const char* s, ios_base::openmode mode = ios_base::out);
@@ -125,8 +122,6 @@ public:
125122
void swap(basic_ofstream& rhs);
126123
127124
basic_filebuf<char_type, traits_type>* rdbuf() const;
128-
native_handle_type native_handle() const noexcept; // Since C++26
129-
130125
bool is_open() const;
131126
void open(const char* s, ios_base::openmode mode = ios_base::out);
132127
void open(const string& s, ios_base::openmode mode = ios_base::out);
@@ -153,7 +148,6 @@ public:
153148
typedef typename traits_type::int_type int_type;
154149
typedef typename traits_type::pos_type pos_type;
155150
typedef typename traits_type::off_type off_type;
156-
using native_handle_type = typename basic_filebuf<charT, traits>::native_handle_type; // Since C++26
157151
158152
basic_fstream();
159153
explicit basic_fstream(const char* s, ios_base::openmode mode = ios_base::in|ios_base::out);
@@ -166,7 +160,6 @@ public:
166160
void swap(basic_fstream& rhs);
167161
168162
basic_filebuf<char_type, traits_type>* rdbuf() const;
169-
native_handle_type native_handle() const noexcept; // Since C++26
170163
bool is_open() const;
171164
void open(const char* s, ios_base::openmode mode = ios_base::in|ios_base::out);
172165
void open(const string& s, ios_base::openmode mode = ios_base::in|ios_base::out);
@@ -217,10 +210,6 @@ _LIBCPP_PUSH_MACROS
217210

218211
_LIBCPP_BEGIN_NAMESPACE_STD
219212

220-
# if _LIBCPP_STD_VER >= 26 && defined(_LIBCPP_WIN32API)
221-
_LIBCPP_EXPORTED_FROM_ABI void* __filebuf_windows_native_handle(FILE* __file);
222-
# endif
223-
224213
template <class _CharT, class _Traits>
225214
class _LIBCPP_TEMPLATE_VIS basic_filebuf : public basic_streambuf<_CharT, _Traits> {
226215
public:
@@ -230,15 +219,6 @@ public:
230219
typedef typename traits_type::pos_type pos_type;
231220
typedef typename traits_type::off_type off_type;
232221
typedef typename traits_type::state_type state_type;
233-
# if _LIBCPP_STD_VER >= 26
234-
# if defined(_LIBCPP_WIN32API)
235-
using native_handle_type = void*; // HANDLE
236-
# elif __has_include(<unistd.h>)
237-
using native_handle_type = int; // POSIX file descriptor
238-
# else
239-
# error "Provide a native file handle!"
240-
# endif
241-
# endif
242222

243223
// 27.9.1.2 Constructors/destructor:
244224
basic_filebuf();
@@ -265,18 +245,6 @@ public:
265245
# endif
266246
_LIBCPP_HIDE_FROM_ABI basic_filebuf* __open(int __fd, ios_base::openmode __mode);
267247
basic_filebuf* close();
268-
# if _LIBCPP_STD_VER >= 26
269-
_LIBCPP_HIDE_FROM_ABI native_handle_type native_handle() const noexcept {
270-
_LIBCPP_ASSERT_UNCATEGORIZED(this->is_open(), "File must be opened");
271-
# if defined(_LIBCPP_WIN32API)
272-
return std::__filebuf_windows_native_handle(__file_);
273-
# elif __has_include(<unistd.h>)
274-
return fileno(__file_);
275-
# else
276-
# error "Provide a way to determine the file native handle!"
277-
# endif
278-
}
279-
# endif // _LIBCPP_STD_VER >= 26
280248

281249
_LIBCPP_HIDE_FROM_ABI inline static const char* __make_mdstring(ios_base::openmode __mode) _NOEXCEPT;
282250

@@ -1056,9 +1024,6 @@ public:
10561024
typedef typename traits_type::int_type int_type;
10571025
typedef typename traits_type::pos_type pos_type;
10581026
typedef typename traits_type::off_type off_type;
1059-
# if _LIBCPP_STD_VER >= 26
1060-
using native_handle_type = typename basic_filebuf<_CharT, _Traits>::native_handle_type;
1061-
# endif
10621027

10631028
_LIBCPP_HIDE_FROM_ABI basic_ifstream();
10641029
_LIBCPP_HIDE_FROM_ABI explicit basic_ifstream(const char* __s, ios_base::openmode __mode = ios_base::in);
@@ -1076,9 +1041,6 @@ public:
10761041
_LIBCPP_HIDE_FROM_ABI void swap(basic_ifstream& __rhs);
10771042

10781043
_LIBCPP_HIDE_FROM_ABI basic_filebuf<char_type, traits_type>* rdbuf() const;
1079-
# if _LIBCPP_STD_VER >= 26
1080-
_LIBCPP_HIDE_FROM_ABI native_handle_type native_handle() const noexcept { return rdbuf()->native_handle(); }
1081-
# endif
10821044
_LIBCPP_HIDE_FROM_ABI bool is_open() const;
10831045
void open(const char* __s, ios_base::openmode __mode = ios_base::in);
10841046
# ifdef _LIBCPP_HAS_OPEN_WITH_WCHAR
@@ -1209,9 +1171,6 @@ public:
12091171
typedef typename traits_type::int_type int_type;
12101172
typedef typename traits_type::pos_type pos_type;
12111173
typedef typename traits_type::off_type off_type;
1212-
# if _LIBCPP_STD_VER >= 26
1213-
using native_handle_type = typename basic_filebuf<_CharT, _Traits>::native_handle_type;
1214-
# endif
12151174

12161175
_LIBCPP_HIDE_FROM_ABI basic_ofstream();
12171176
_LIBCPP_HIDE_FROM_ABI explicit basic_ofstream(const char* __s, ios_base::openmode __mode = ios_base::out);
@@ -1231,9 +1190,6 @@ public:
12311190
_LIBCPP_HIDE_FROM_ABI void swap(basic_ofstream& __rhs);
12321191

12331192
_LIBCPP_HIDE_FROM_ABI basic_filebuf<char_type, traits_type>* rdbuf() const;
1234-
# if _LIBCPP_STD_VER >= 26
1235-
_LIBCPP_HIDE_FROM_ABI native_handle_type native_handle() const noexcept { return rdbuf()->native_handle(); }
1236-
# endif
12371193
_LIBCPP_HIDE_FROM_ABI bool is_open() const;
12381194
void open(const char* __s, ios_base::openmode __mode = ios_base::out);
12391195
# ifdef _LIBCPP_HAS_OPEN_WITH_WCHAR
@@ -1365,9 +1321,6 @@ public:
13651321
typedef typename traits_type::int_type int_type;
13661322
typedef typename traits_type::pos_type pos_type;
13671323
typedef typename traits_type::off_type off_type;
1368-
# if _LIBCPP_STD_VER >= 26
1369-
using native_handle_type = typename basic_filebuf<_CharT, _Traits>::native_handle_type;
1370-
# endif
13711324

13721325
_LIBCPP_HIDE_FROM_ABI basic_fstream();
13731326
_LIBCPP_HIDE_FROM_ABI explicit basic_fstream(const char* __s,
@@ -1392,9 +1345,6 @@ public:
13921345
_LIBCPP_HIDE_FROM_ABI void swap(basic_fstream& __rhs);
13931346

13941347
_LIBCPP_HIDE_FROM_ABI basic_filebuf<char_type, traits_type>* rdbuf() const;
1395-
# if _LIBCPP_STD_VER >= 26
1396-
_LIBCPP_HIDE_FROM_ABI native_handle_type native_handle() const noexcept { return rdbuf()->native_handle(); }
1397-
# endif
13981348
_LIBCPP_HIDE_FROM_ABI bool is_open() const;
13991349
_LIBCPP_HIDE_FROM_ABI void open(const char* __s, ios_base::openmode __mode = ios_base::in | ios_base::out);
14001350
# ifdef _LIBCPP_HAS_OPEN_WITH_WCHAR

libcxx/include/version

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -496,7 +496,7 @@ __cpp_lib_within_lifetime 202306L <type_traits>
496496
// # define __cpp_lib_freestanding_optional 202311L
497497
// # define __cpp_lib_freestanding_string_view 202311L
498498
// # define __cpp_lib_freestanding_variant 202311L
499-
# define __cpp_lib_fstream_native_handle 202306L
499+
// # define __cpp_lib_fstream_native_handle 202306L
500500
// # define __cpp_lib_function_ref 202306L
501501
// # define __cpp_lib_hazard_pointer 202306L
502502
// # define __cpp_lib_linalg 202311L

libcxx/src/CMakeLists.txt

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -84,7 +84,6 @@ endif()
8484

8585
if (LIBCXX_ENABLE_LOCALIZATION)
8686
list(APPEND LIBCXX_SOURCES
87-
fstream.cpp
8887
include/sso_allocator.h
8988
ios.cpp
9089
ios.instantiations.cpp

libcxx/src/fstream.cpp

Lines changed: 0 additions & 37 deletions
This file was deleted.

libcxx/test/std/input.output/file.streams/fstreams/filebuf.members/native_handle.assert.pass.cpp

Lines changed: 0 additions & 32 deletions
This file was deleted.

libcxx/test/std/input.output/file.streams/fstreams/filebuf.members/native_handle.pass.cpp

Lines changed: 0 additions & 58 deletions
This file was deleted.

libcxx/test/std/input.output/file.streams/fstreams/filebuf/types.pass.cpp

Lines changed: 1 addition & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -23,7 +23,6 @@
2323
#include <type_traits>
2424

2525
#include "test_macros.h"
26-
#include "../native_handle_test_helpers.h"
2726

2827
int main(int, char**)
2928
{
@@ -33,12 +32,6 @@ int main(int, char**)
3332
static_assert((std::is_same<std::basic_filebuf<char>::int_type, std::char_traits<char>::int_type>::value), "");
3433
static_assert((std::is_same<std::basic_filebuf<char>::pos_type, std::char_traits<char>::pos_type>::value), "");
3534
static_assert((std::is_same<std::basic_filebuf<char>::off_type, std::char_traits<char>::off_type>::value), "");
36-
#if TEST_STD_VER >= 26
37-
test_native_handle_type< std::basic_filebuf<char>>();
38-
# ifndef TEST_HAS_NO_WIDE_CHARACTERS
39-
test_native_handle_type< std::basic_filebuf<wchar_t>>();
40-
# endif
41-
#endif
4235

43-
return 0;
36+
return 0;
4437
}

libcxx/test/std/input.output/file.streams/fstreams/fstream.members/native_handle.assert.pass.cpp

Lines changed: 0 additions & 32 deletions
This file was deleted.

0 commit comments

Comments
 (0)