Skip to content

Commit

Permalink
Revert "[libc++][streams] P1759R6: Native handles and file streams (#…
Browse files Browse the repository at this point in the history
…76632)"

This reverts commit 255f95a, which
contains a breaking libcxx test on Windows when using C++26
  • Loading branch information
zeroomega committed Jan 6, 2024
1 parent 09e0d71 commit 40c07b5
Show file tree
Hide file tree
Showing 24 changed files with 30 additions and 508 deletions.
2 changes: 1 addition & 1 deletion libcxx/docs/FeatureTestMacroTable.rst
Original file line number Diff line number Diff line change
Expand Up @@ -418,7 +418,7 @@ Status
--------------------------------------------------- -----------------
``__cpp_lib_freestanding_variant`` *unimplemented*
--------------------------------------------------- -----------------
``__cpp_lib_fstream_native_handle`` ``202306L``
``__cpp_lib_fstream_native_handle`` *unimplemented*
--------------------------------------------------- -----------------
``__cpp_lib_function_ref`` *unimplemented*
--------------------------------------------------- -----------------
Expand Down
1 change: 0 additions & 1 deletion libcxx/docs/ReleaseNotes/18.rst
Original file line number Diff line number Diff line change
Expand Up @@ -59,7 +59,6 @@ Implemented Papers
- P2909R4 - Fix formatting of code units as integers (Dude, where’s my ``char``?)
- P2821R5 - span.at()
- P0521R0 - Proposed Resolution for CA 14 (shared_ptr use_count/unique)
- P1759R6 - Native handles and file streams


Improvements and New Features
Expand Down
2 changes: 1 addition & 1 deletion libcxx/docs/Status/Cxx2cPapers.csv
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@
"`P2757R3 <https://wg21.link/P2757R3>`__","LWG","Type-checking format args","Varna June 2023","","","|format|"
"`P2637R3 <https://wg21.link/P2637R3>`__","LWG","Member ``visit``","Varna June 2023","","","|format|"
"`P2641R4 <https://wg21.link/P2641R4>`__","CWG, LWG","Checking if a ``union`` alternative is active","Varna June 2023","","",""
"`P1759R6 <https://wg21.link/P1759R6>`__","LWG","Native handles and file streams","Varna June 2023","|Complete|","18.0",""
"`P1759R6 <https://wg21.link/P1759R6>`__","LWG","Native handles and file streams","Varna June 2023","","",""
"`P2697R1 <https://wg21.link/P2697R1>`__","LWG","Interfacing ``bitset`` with ``string_view``","Varna June 2023","|Complete|","18.0",""
"`P1383R2 <https://wg21.link/P1383R2>`__","LWG","More ``constexpr`` for ``<cmath>`` and ``<complex>``","Varna June 2023","","",""
"`P2734R0 <https://wg21.link/P2734R0>`__","LWG","Adding the new SI prefixes","Varna June 2023","|Complete|","17.0",""
Expand Down
50 changes: 0 additions & 50 deletions libcxx/include/fstream
Original file line number Diff line number Diff line change
Expand Up @@ -73,7 +73,6 @@ public:
typedef typename traits_type::int_type int_type;
typedef typename traits_type::pos_type pos_type;
typedef typename traits_type::off_type off_type;
using native_handle_type = typename basic_filebuf<charT, traits>::native_handle_type; // Since C++26
basic_ifstream();
explicit basic_ifstream(const char* s, ios_base::openmode mode = ios_base::in);
Expand All @@ -86,7 +85,6 @@ public:
void swap(basic_ifstream& rhs);
basic_filebuf<char_type, traits_type>* rdbuf() const;
native_handle_type native_handle() const noexcept; // Since C++26
bool is_open() const;
void open(const char* s, ios_base::openmode mode = ios_base::in);
void open(const string& s, ios_base::openmode mode = ios_base::in);
Expand All @@ -112,7 +110,6 @@ public:
typedef typename traits_type::int_type int_type;
typedef typename traits_type::pos_type pos_type;
typedef typename traits_type::off_type off_type;
using native_handle_type = typename basic_filebuf<charT, traits>::native_handle_type; // Since C++26
basic_ofstream();
explicit basic_ofstream(const char* s, ios_base::openmode mode = ios_base::out);
Expand All @@ -125,8 +122,6 @@ public:
void swap(basic_ofstream& rhs);
basic_filebuf<char_type, traits_type>* rdbuf() const;
native_handle_type native_handle() const noexcept; // Since C++26
bool is_open() const;
void open(const char* s, ios_base::openmode mode = ios_base::out);
void open(const string& s, ios_base::openmode mode = ios_base::out);
Expand All @@ -153,7 +148,6 @@ public:
typedef typename traits_type::int_type int_type;
typedef typename traits_type::pos_type pos_type;
typedef typename traits_type::off_type off_type;
using native_handle_type = typename basic_filebuf<charT, traits>::native_handle_type; // Since C++26
basic_fstream();
explicit basic_fstream(const char* s, ios_base::openmode mode = ios_base::in|ios_base::out);
Expand All @@ -166,7 +160,6 @@ public:
void swap(basic_fstream& rhs);
basic_filebuf<char_type, traits_type>* rdbuf() const;
native_handle_type native_handle() const noexcept; // Since C++26
bool is_open() const;
void open(const char* s, ios_base::openmode mode = ios_base::in|ios_base::out);
void open(const string& s, ios_base::openmode mode = ios_base::in|ios_base::out);
Expand Down Expand Up @@ -217,10 +210,6 @@ _LIBCPP_PUSH_MACROS

_LIBCPP_BEGIN_NAMESPACE_STD

# if _LIBCPP_STD_VER >= 26 && defined(_LIBCPP_WIN32API)
_LIBCPP_EXPORTED_FROM_ABI void* __filebuf_windows_native_handle(FILE* __file);
# endif

template <class _CharT, class _Traits>
class _LIBCPP_TEMPLATE_VIS basic_filebuf : public basic_streambuf<_CharT, _Traits> {
public:
Expand All @@ -230,15 +219,6 @@ public:
typedef typename traits_type::pos_type pos_type;
typedef typename traits_type::off_type off_type;
typedef typename traits_type::state_type state_type;
# if _LIBCPP_STD_VER >= 26
# if defined(_LIBCPP_WIN32API)
using native_handle_type = void*; // HANDLE
# elif __has_include(<unistd.h>)
using native_handle_type = int; // POSIX file descriptor
# else
# error "Provide a native file handle!"
# endif
# endif

// 27.9.1.2 Constructors/destructor:
basic_filebuf();
Expand All @@ -265,18 +245,6 @@ public:
# endif
_LIBCPP_HIDE_FROM_ABI basic_filebuf* __open(int __fd, ios_base::openmode __mode);
basic_filebuf* close();
# if _LIBCPP_STD_VER >= 26
_LIBCPP_HIDE_FROM_ABI native_handle_type native_handle() const noexcept {
_LIBCPP_ASSERT_UNCATEGORIZED(this->is_open(), "File must be opened");
# if defined(_LIBCPP_WIN32API)
return std::__filebuf_windows_native_handle(__file_);
# elif __has_include(<unistd.h>)
return fileno(__file_);
# else
# error "Provide a way to determine the file native handle!"
# endif
}
# endif // _LIBCPP_STD_VER >= 26

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

Expand Down Expand Up @@ -1056,9 +1024,6 @@ public:
typedef typename traits_type::int_type int_type;
typedef typename traits_type::pos_type pos_type;
typedef typename traits_type::off_type off_type;
# if _LIBCPP_STD_VER >= 26
using native_handle_type = typename basic_filebuf<_CharT, _Traits>::native_handle_type;
# endif

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

_LIBCPP_HIDE_FROM_ABI basic_filebuf<char_type, traits_type>* rdbuf() const;
# if _LIBCPP_STD_VER >= 26
_LIBCPP_HIDE_FROM_ABI native_handle_type native_handle() const noexcept { return rdbuf()->native_handle(); }
# endif
_LIBCPP_HIDE_FROM_ABI bool is_open() const;
void open(const char* __s, ios_base::openmode __mode = ios_base::in);
# ifdef _LIBCPP_HAS_OPEN_WITH_WCHAR
Expand Down Expand Up @@ -1209,9 +1171,6 @@ public:
typedef typename traits_type::int_type int_type;
typedef typename traits_type::pos_type pos_type;
typedef typename traits_type::off_type off_type;
# if _LIBCPP_STD_VER >= 26
using native_handle_type = typename basic_filebuf<_CharT, _Traits>::native_handle_type;
# endif

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

_LIBCPP_HIDE_FROM_ABI basic_filebuf<char_type, traits_type>* rdbuf() const;
# if _LIBCPP_STD_VER >= 26
_LIBCPP_HIDE_FROM_ABI native_handle_type native_handle() const noexcept { return rdbuf()->native_handle(); }
# endif
_LIBCPP_HIDE_FROM_ABI bool is_open() const;
void open(const char* __s, ios_base::openmode __mode = ios_base::out);
# ifdef _LIBCPP_HAS_OPEN_WITH_WCHAR
Expand Down Expand Up @@ -1365,9 +1321,6 @@ public:
typedef typename traits_type::int_type int_type;
typedef typename traits_type::pos_type pos_type;
typedef typename traits_type::off_type off_type;
# if _LIBCPP_STD_VER >= 26
using native_handle_type = typename basic_filebuf<_CharT, _Traits>::native_handle_type;
# endif

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

_LIBCPP_HIDE_FROM_ABI basic_filebuf<char_type, traits_type>* rdbuf() const;
# if _LIBCPP_STD_VER >= 26
_LIBCPP_HIDE_FROM_ABI native_handle_type native_handle() const noexcept { return rdbuf()->native_handle(); }
# endif
_LIBCPP_HIDE_FROM_ABI bool is_open() const;
_LIBCPP_HIDE_FROM_ABI void open(const char* __s, ios_base::openmode __mode = ios_base::in | ios_base::out);
# ifdef _LIBCPP_HAS_OPEN_WITH_WCHAR
Expand Down
2 changes: 1 addition & 1 deletion libcxx/include/version
Original file line number Diff line number Diff line change
Expand Up @@ -496,7 +496,7 @@ __cpp_lib_within_lifetime 202306L <type_traits>
// # define __cpp_lib_freestanding_optional 202311L
// # define __cpp_lib_freestanding_string_view 202311L
// # define __cpp_lib_freestanding_variant 202311L
# define __cpp_lib_fstream_native_handle 202306L
// # define __cpp_lib_fstream_native_handle 202306L
// # define __cpp_lib_function_ref 202306L
// # define __cpp_lib_hazard_pointer 202306L
// # define __cpp_lib_linalg 202311L
Expand Down
1 change: 0 additions & 1 deletion libcxx/src/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -84,7 +84,6 @@ endif()

if (LIBCXX_ENABLE_LOCALIZATION)
list(APPEND LIBCXX_SOURCES
fstream.cpp
include/sso_allocator.h
ios.cpp
ios.instantiations.cpp
Expand Down
37 changes: 0 additions & 37 deletions libcxx/src/fstream.cpp

This file was deleted.

This file was deleted.

This file was deleted.

Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,6 @@
#include <type_traits>

#include "test_macros.h"
#include "../native_handle_test_helpers.h"

int main(int, char**)
{
Expand All @@ -33,12 +32,6 @@ int main(int, char**)
static_assert((std::is_same<std::basic_filebuf<char>::int_type, std::char_traits<char>::int_type>::value), "");
static_assert((std::is_same<std::basic_filebuf<char>::pos_type, std::char_traits<char>::pos_type>::value), "");
static_assert((std::is_same<std::basic_filebuf<char>::off_type, std::char_traits<char>::off_type>::value), "");
#if TEST_STD_VER >= 26
test_native_handle_type< std::basic_filebuf<char>>();
# ifndef TEST_HAS_NO_WIDE_CHARACTERS
test_native_handle_type< std::basic_filebuf<wchar_t>>();
# endif
#endif

return 0;
return 0;
}

This file was deleted.

0 comments on commit 40c07b5

Please sign in to comment.