From 3fb48184fa4017328c531edac99fa0cb3941afe4 Mon Sep 17 00:00:00 2001 From: Simi Pallipurath Date: Mon, 1 Dec 2025 12:34:48 +0000 Subject: [PATCH 1/3] [ATFE] Remove Downstream Change which enables fstream independently of filesystem. With the merging of llvm/llvm-project#147956 upstream, the downstream patch is not required anymore. --- libcxx/include/fstream | 3 +-- libcxx/src/ios.instantiations.cpp | 3 +-- libcxx/src/ostream.cpp | 3 +-- .../fstreams/filebuf.members/native_handle.pass.cpp | 2 -- .../fstreams/filebuf.members/open_pointer.pass.cpp | 2 -- .../fstreams/fstream.cons/pointer.pass.cpp | 3 --- .../fstreams/fstream.members/native_handle.pass.cpp | 2 -- .../fstreams/fstream.members/open_pointer.pass.cpp | 2 -- .../ifstream.members/native_handle.pass.cpp | 2 -- .../fstreams/ifstream.members/offset_range.pass.cpp | 3 --- .../fstreams/ofstream.cons/pointer.pass.cpp | 3 --- .../ofstream.members/native_handle.pass.cpp | 2 -- .../fstreams/ofstream.members/open_pointer.pass.cpp | 2 -- .../std/input.output/file.streams/lit.local.cfg | 4 ---- libcxx/test/support/platform_support.h | 13 ------------- 15 files changed, 3 insertions(+), 46 deletions(-) diff --git a/libcxx/include/fstream b/libcxx/include/fstream index 339a434ea78c..1f88d134fe06 100644 --- a/libcxx/include/fstream +++ b/libcxx/include/fstream @@ -191,8 +191,7 @@ typedef basic_fstream wfstream; #else # include <__config> -// Downstream issue: #375 (Enable fstream independently of filesystem) -# if _LIBCPP_HAS_FILESYSTEM && _LIBCPP_HAS_LOCALIZATION || defined(_NEWLIB_VERSION) +# if _LIBCPP_HAS_FILESYSTEM && _LIBCPP_HAS_LOCALIZATION # include <__algorithm/max.h> # include <__assert> diff --git a/libcxx/src/ios.instantiations.cpp b/libcxx/src/ios.instantiations.cpp index 24106d0a225e..a8d267f7cfd4 100644 --- a/libcxx/src/ios.instantiations.cpp +++ b/libcxx/src/ios.instantiations.cpp @@ -37,8 +37,7 @@ template class _LIBCPP_CLASS_TEMPLATE_INSTANTIATION_VIS basic_stringstream template class _LIBCPP_CLASS_TEMPLATE_INSTANTIATION_VIS basic_ostringstream; template class _LIBCPP_CLASS_TEMPLATE_INSTANTIATION_VIS basic_istringstream; -// Downstream issue: #375 (Enable fstream independently of filesystem) -#if _LIBCPP_HAS_FILESYSTEM || defined(_NEWLIB_VERSION) +#if _LIBCPP_HAS_FILESYSTEM template class _LIBCPP_CLASS_TEMPLATE_INSTANTIATION_VIS basic_ifstream; template class _LIBCPP_CLASS_TEMPLATE_INSTANTIATION_VIS basic_ofstream; template class _LIBCPP_CLASS_TEMPLATE_INSTANTIATION_VIS basic_filebuf; diff --git a/libcxx/src/ostream.cpp b/libcxx/src/ostream.cpp index 1cec2db0c45e..bcc213cc6602 100644 --- a/libcxx/src/ostream.cpp +++ b/libcxx/src/ostream.cpp @@ -8,8 +8,7 @@ #include <__config> -// Downstream issue: #375 (Enable fstream independently of filesystem) -#if _LIBCPP_HAS_FILESYSTEM || defined(_NEWLIB_VERSION) +#if _LIBCPP_HAS_FILESYSTEM # include #endif #include diff --git a/libcxx/test/std/input.output/file.streams/fstreams/filebuf.members/native_handle.pass.cpp b/libcxx/test/std/input.output/file.streams/fstreams/filebuf.members/native_handle.pass.cpp index 7c59d94d445e..22cc63e909c5 100644 --- a/libcxx/test/std/input.output/file.streams/fstreams/filebuf.members/native_handle.pass.cpp +++ b/libcxx/test/std/input.output/file.streams/fstreams/filebuf.members/native_handle.pass.cpp @@ -13,8 +13,6 @@ // class basic_filebuf; // native_handle_type native_handle() const noexcept; -// Downstream issue: #375 (Enable fstream independently of filesystem) -// UNSUPPORTED: baremetal #include #include diff --git a/libcxx/test/std/input.output/file.streams/fstreams/filebuf.members/open_pointer.pass.cpp b/libcxx/test/std/input.output/file.streams/fstreams/filebuf.members/open_pointer.pass.cpp index 85b79077bd4c..9f617dc1e5a8 100644 --- a/libcxx/test/std/input.output/file.streams/fstreams/filebuf.members/open_pointer.pass.cpp +++ b/libcxx/test/std/input.output/file.streams/fstreams/filebuf.members/open_pointer.pass.cpp @@ -14,8 +14,6 @@ // XFAIL: (!c++03 && !c++11 && !c++14 && !c++17 && !c++20) && using-built-library-before-llvm-18 // XFAIL: LIBCXX-AIX-FIXME -// Downstream issue: #375 (Enable fstream independently of filesystem) -// UNSUPPORTED: baremetal #include #include diff --git a/libcxx/test/std/input.output/file.streams/fstreams/fstream.cons/pointer.pass.cpp b/libcxx/test/std/input.output/file.streams/fstreams/fstream.cons/pointer.pass.cpp index ae7553c84741..2e0ebcd684d7 100644 --- a/libcxx/test/std/input.output/file.streams/fstreams/fstream.cons/pointer.pass.cpp +++ b/libcxx/test/std/input.output/file.streams/fstreams/fstream.cons/pointer.pass.cpp @@ -18,9 +18,6 @@ // XFAIL: LIBCXX-AIX-FIXME -// Downstream issue: #375 (Enable fstream independently of filesystem) -// UNSUPPORTED: baremetal - #include #include diff --git a/libcxx/test/std/input.output/file.streams/fstreams/fstream.members/native_handle.pass.cpp b/libcxx/test/std/input.output/file.streams/fstreams/fstream.members/native_handle.pass.cpp index 68c114daa41d..a7229512385a 100644 --- a/libcxx/test/std/input.output/file.streams/fstreams/fstream.members/native_handle.pass.cpp +++ b/libcxx/test/std/input.output/file.streams/fstreams/fstream.members/native_handle.pass.cpp @@ -13,8 +13,6 @@ // class basic_fstream; // native_handle_type native_handle() const noexcept; -// Downstream issue: #375 (Enable fstream independently of filesystem) -// UNSUPPORTED: baremetal #include "test_macros.h" #include "../native_handle_test_helpers.h" diff --git a/libcxx/test/std/input.output/file.streams/fstreams/fstream.members/open_pointer.pass.cpp b/libcxx/test/std/input.output/file.streams/fstreams/fstream.members/open_pointer.pass.cpp index c4af1a3f3c10..0d83d681b1df 100644 --- a/libcxx/test/std/input.output/file.streams/fstreams/fstream.members/open_pointer.pass.cpp +++ b/libcxx/test/std/input.output/file.streams/fstreams/fstream.members/open_pointer.pass.cpp @@ -17,8 +17,6 @@ // XFAIL: (!c++03 && !c++11 && !c++14 && !c++17 && !c++20) && using-built-library-before-llvm-18 // XFAIL: LIBCXX-AIX-FIXME -// Downstream issue: #375 (Enable fstream independently of filesystem) -// UNSUPPORTED: baremetal #include #include diff --git a/libcxx/test/std/input.output/file.streams/fstreams/ifstream.members/native_handle.pass.cpp b/libcxx/test/std/input.output/file.streams/fstreams/ifstream.members/native_handle.pass.cpp index e71f7d966972..c2aff949c8fa 100644 --- a/libcxx/test/std/input.output/file.streams/fstreams/ifstream.members/native_handle.pass.cpp +++ b/libcxx/test/std/input.output/file.streams/fstreams/ifstream.members/native_handle.pass.cpp @@ -13,8 +13,6 @@ // class basic_ifstream; // native_handle_type native_handle() const noexcept; -// Downstream issue: #375 (Enable fstream independently of filesystem) -// UNSUPPORTED: baremetal #include "test_macros.h" #include "../native_handle_test_helpers.h" diff --git a/libcxx/test/std/input.output/file.streams/fstreams/ifstream.members/offset_range.pass.cpp b/libcxx/test/std/input.output/file.streams/fstreams/ifstream.members/offset_range.pass.cpp index f3c9f2e31caa..9fc3cb4a9447 100644 --- a/libcxx/test/std/input.output/file.streams/fstreams/ifstream.members/offset_range.pass.cpp +++ b/libcxx/test/std/input.output/file.streams/fstreams/ifstream.members/offset_range.pass.cpp @@ -26,9 +26,6 @@ // meaning it can represent file sizes up to 2GB (2^31 bytes) only. // // UNSUPPORTED: target=armv7-unknown-linux-gnueabihf -// Downstream issue: #375 (Enable fstream independently of filesystem) -// UNSUPPORTED: baremetal - #include #include diff --git a/libcxx/test/std/input.output/file.streams/fstreams/ofstream.cons/pointer.pass.cpp b/libcxx/test/std/input.output/file.streams/fstreams/ofstream.cons/pointer.pass.cpp index f898e87a7aa6..fbb03f1e8584 100644 --- a/libcxx/test/std/input.output/file.streams/fstreams/ofstream.cons/pointer.pass.cpp +++ b/libcxx/test/std/input.output/file.streams/fstreams/ofstream.cons/pointer.pass.cpp @@ -18,9 +18,6 @@ // XFAIL: LIBCXX-AIX-FIXME -// Downstream issue: #375 (Enable fstream independently of filesystem) -// UNSUPPORTED: baremetal - #include #include #include diff --git a/libcxx/test/std/input.output/file.streams/fstreams/ofstream.members/native_handle.pass.cpp b/libcxx/test/std/input.output/file.streams/fstreams/ofstream.members/native_handle.pass.cpp index 11ac86d862dd..88b3a00934cc 100644 --- a/libcxx/test/std/input.output/file.streams/fstreams/ofstream.members/native_handle.pass.cpp +++ b/libcxx/test/std/input.output/file.streams/fstreams/ofstream.members/native_handle.pass.cpp @@ -13,8 +13,6 @@ // class basic_ofstream; // native_handle_type native_handle() const noexcept; -// Downstream issue: #375 (Enable fstream independently of filesystem) -// UNSUPPORTED: baremetal #include "test_macros.h" #include "../native_handle_test_helpers.h" diff --git a/libcxx/test/std/input.output/file.streams/fstreams/ofstream.members/open_pointer.pass.cpp b/libcxx/test/std/input.output/file.streams/fstreams/ofstream.members/open_pointer.pass.cpp index 909569ff0d12..73a474277a93 100644 --- a/libcxx/test/std/input.output/file.streams/fstreams/ofstream.members/open_pointer.pass.cpp +++ b/libcxx/test/std/input.output/file.streams/fstreams/ofstream.members/open_pointer.pass.cpp @@ -17,8 +17,6 @@ // XFAIL: (!c++03 && !c++11 && !c++14 && !c++17 && !c++20) && using-built-library-before-llvm-18 // XFAIL: LIBCXX-AIX-FIXME -// Downstream issue: #375 (Enable fstream independently of filesystem) -// UNSUPPORTED: baremetal #include #include diff --git a/libcxx/test/std/input.output/file.streams/lit.local.cfg b/libcxx/test/std/input.output/file.streams/lit.local.cfg index bc846c477c51..fb65433eef81 100644 --- a/libcxx/test/std/input.output/file.streams/lit.local.cfg +++ b/libcxx/test/std/input.output/file.streams/lit.local.cfg @@ -2,10 +2,6 @@ if "no-localization" in config.available_features: config.unsupported = True -# Downstream issue: #375 (Enable fstream independently of filesystem) #if "no-filesystem" in config.available_features: # config.unsupported = True -# Downstream issue: #375 (Enable fstream independently of filesystem) -if 'none' in config.target_triple: - config.available_features.add('baremetal') diff --git a/libcxx/test/support/platform_support.h b/libcxx/test/support/platform_support.h index 031c434053b8..99e60f60c599 100644 --- a/libcxx/test/support/platform_support.h +++ b/libcxx/test/support/platform_support.h @@ -40,10 +40,6 @@ # include // _mktemp_s # include // _O_EXCL, ... # include // _S_IREAD, ... -// Downstream issue: #375 (Enable fstream independently of filesystem) -#elif defined(_NEWLIB_VERSION) -// No need to include extra headers for the get_temp_file_name() implementation -// below: tmpnam() is defined in #elif __has_include() # include // close #endif @@ -74,15 +70,6 @@ inline std::string get_temp_file_name() { continue; abort(); } -// Downstream issue: #375 (Enable fstream independently of filesystem) -#elif defined(_NEWLIB_VERSION) - char tmp_name[L_tmpnam]; - char *ret = tmpnam(tmp_name); - if (ret == NULL) { - perror("tmpnam"); - abort(); - } - return std::string(ret); #elif !__has_include() // Without `unistd.h` we cannot guarantee that the file is unused, however we // can simply generate a good guess in the temporary folder and create it. From a4003ba027bdeefb5cf9d9eb04581f7b94c93003 Mon Sep 17 00:00:00 2001 From: Simi Pallipurath Date: Mon, 1 Dec 2025 12:34:48 +0000 Subject: [PATCH 2/3] [ATFE] Remove Downstream Change #378 With the merging of llvm/llvm-project#147956 upstream, the downstream patch is not required anymore. --- libcxx/include/__configuration/platform.h | 5 ----- 1 file changed, 5 deletions(-) diff --git a/libcxx/include/__configuration/platform.h b/libcxx/include/__configuration/platform.h index 148eba740c8c..88bba5473c60 100644 --- a/libcxx/include/__configuration/platform.h +++ b/libcxx/include/__configuration/platform.h @@ -49,11 +49,6 @@ # include #endif -// Downstream issue: 378 (Include newlib.h to define _NEWLIB_VERSION) -#if __has_include() -# include -#endif - #ifndef __BYTE_ORDER__ # error \ "Your compiler doesn't seem to define __BYTE_ORDER__, which is required by libc++ to know the endianness of your target platform" From 0db328be8f585de4c74cae0e5b831daaa3733ab3 Mon Sep 17 00:00:00 2001 From: Simi Pallipurath Date: Mon, 1 Dec 2025 14:16:24 +0000 Subject: [PATCH 3/3] fixup! [ATFE] Remove Downstream Change #378 --- libcxx/include/fstream | 3 ++- libcxx/src/ios.instantiations.cpp | 3 ++- libcxx/src/ostream.cpp | 3 ++- .../fstreams/filebuf.members/native_handle.pass.cpp | 2 ++ .../fstreams/filebuf.members/open_pointer.pass.cpp | 2 ++ .../fstreams/fstream.cons/pointer.pass.cpp | 3 +++ .../fstreams/fstream.members/native_handle.pass.cpp | 2 ++ .../fstreams/fstream.members/open_pointer.pass.cpp | 2 ++ .../ifstream.members/native_handle.pass.cpp | 2 ++ .../fstreams/ifstream.members/offset_range.pass.cpp | 3 +++ .../fstreams/ofstream.cons/pointer.pass.cpp | 3 +++ .../ofstream.members/native_handle.pass.cpp | 2 ++ .../fstreams/ofstream.members/open_pointer.pass.cpp | 2 ++ .../std/input.output/file.streams/lit.local.cfg | 4 ++++ libcxx/test/support/platform_support.h | 13 +++++++++++++ 15 files changed, 46 insertions(+), 3 deletions(-) diff --git a/libcxx/include/fstream b/libcxx/include/fstream index 1f88d134fe06..339a434ea78c 100644 --- a/libcxx/include/fstream +++ b/libcxx/include/fstream @@ -191,7 +191,8 @@ typedef basic_fstream wfstream; #else # include <__config> -# if _LIBCPP_HAS_FILESYSTEM && _LIBCPP_HAS_LOCALIZATION +// Downstream issue: #375 (Enable fstream independently of filesystem) +# if _LIBCPP_HAS_FILESYSTEM && _LIBCPP_HAS_LOCALIZATION || defined(_NEWLIB_VERSION) # include <__algorithm/max.h> # include <__assert> diff --git a/libcxx/src/ios.instantiations.cpp b/libcxx/src/ios.instantiations.cpp index a8d267f7cfd4..24106d0a225e 100644 --- a/libcxx/src/ios.instantiations.cpp +++ b/libcxx/src/ios.instantiations.cpp @@ -37,7 +37,8 @@ template class _LIBCPP_CLASS_TEMPLATE_INSTANTIATION_VIS basic_stringstream template class _LIBCPP_CLASS_TEMPLATE_INSTANTIATION_VIS basic_ostringstream; template class _LIBCPP_CLASS_TEMPLATE_INSTANTIATION_VIS basic_istringstream; -#if _LIBCPP_HAS_FILESYSTEM +// Downstream issue: #375 (Enable fstream independently of filesystem) +#if _LIBCPP_HAS_FILESYSTEM || defined(_NEWLIB_VERSION) template class _LIBCPP_CLASS_TEMPLATE_INSTANTIATION_VIS basic_ifstream; template class _LIBCPP_CLASS_TEMPLATE_INSTANTIATION_VIS basic_ofstream; template class _LIBCPP_CLASS_TEMPLATE_INSTANTIATION_VIS basic_filebuf; diff --git a/libcxx/src/ostream.cpp b/libcxx/src/ostream.cpp index bcc213cc6602..1cec2db0c45e 100644 --- a/libcxx/src/ostream.cpp +++ b/libcxx/src/ostream.cpp @@ -8,7 +8,8 @@ #include <__config> -#if _LIBCPP_HAS_FILESYSTEM +// Downstream issue: #375 (Enable fstream independently of filesystem) +#if _LIBCPP_HAS_FILESYSTEM || defined(_NEWLIB_VERSION) # include #endif #include diff --git a/libcxx/test/std/input.output/file.streams/fstreams/filebuf.members/native_handle.pass.cpp b/libcxx/test/std/input.output/file.streams/fstreams/filebuf.members/native_handle.pass.cpp index 22cc63e909c5..7c59d94d445e 100644 --- a/libcxx/test/std/input.output/file.streams/fstreams/filebuf.members/native_handle.pass.cpp +++ b/libcxx/test/std/input.output/file.streams/fstreams/filebuf.members/native_handle.pass.cpp @@ -13,6 +13,8 @@ // class basic_filebuf; // native_handle_type native_handle() const noexcept; +// Downstream issue: #375 (Enable fstream independently of filesystem) +// UNSUPPORTED: baremetal #include #include diff --git a/libcxx/test/std/input.output/file.streams/fstreams/filebuf.members/open_pointer.pass.cpp b/libcxx/test/std/input.output/file.streams/fstreams/filebuf.members/open_pointer.pass.cpp index 9f617dc1e5a8..85b79077bd4c 100644 --- a/libcxx/test/std/input.output/file.streams/fstreams/filebuf.members/open_pointer.pass.cpp +++ b/libcxx/test/std/input.output/file.streams/fstreams/filebuf.members/open_pointer.pass.cpp @@ -14,6 +14,8 @@ // XFAIL: (!c++03 && !c++11 && !c++14 && !c++17 && !c++20) && using-built-library-before-llvm-18 // XFAIL: LIBCXX-AIX-FIXME +// Downstream issue: #375 (Enable fstream independently of filesystem) +// UNSUPPORTED: baremetal #include #include diff --git a/libcxx/test/std/input.output/file.streams/fstreams/fstream.cons/pointer.pass.cpp b/libcxx/test/std/input.output/file.streams/fstreams/fstream.cons/pointer.pass.cpp index 2e0ebcd684d7..ae7553c84741 100644 --- a/libcxx/test/std/input.output/file.streams/fstreams/fstream.cons/pointer.pass.cpp +++ b/libcxx/test/std/input.output/file.streams/fstreams/fstream.cons/pointer.pass.cpp @@ -18,6 +18,9 @@ // XFAIL: LIBCXX-AIX-FIXME +// Downstream issue: #375 (Enable fstream independently of filesystem) +// UNSUPPORTED: baremetal + #include #include diff --git a/libcxx/test/std/input.output/file.streams/fstreams/fstream.members/native_handle.pass.cpp b/libcxx/test/std/input.output/file.streams/fstreams/fstream.members/native_handle.pass.cpp index a7229512385a..68c114daa41d 100644 --- a/libcxx/test/std/input.output/file.streams/fstreams/fstream.members/native_handle.pass.cpp +++ b/libcxx/test/std/input.output/file.streams/fstreams/fstream.members/native_handle.pass.cpp @@ -13,6 +13,8 @@ // class basic_fstream; // native_handle_type native_handle() const noexcept; +// Downstream issue: #375 (Enable fstream independently of filesystem) +// UNSUPPORTED: baremetal #include "test_macros.h" #include "../native_handle_test_helpers.h" diff --git a/libcxx/test/std/input.output/file.streams/fstreams/fstream.members/open_pointer.pass.cpp b/libcxx/test/std/input.output/file.streams/fstreams/fstream.members/open_pointer.pass.cpp index 0d83d681b1df..c4af1a3f3c10 100644 --- a/libcxx/test/std/input.output/file.streams/fstreams/fstream.members/open_pointer.pass.cpp +++ b/libcxx/test/std/input.output/file.streams/fstreams/fstream.members/open_pointer.pass.cpp @@ -17,6 +17,8 @@ // XFAIL: (!c++03 && !c++11 && !c++14 && !c++17 && !c++20) && using-built-library-before-llvm-18 // XFAIL: LIBCXX-AIX-FIXME +// Downstream issue: #375 (Enable fstream independently of filesystem) +// UNSUPPORTED: baremetal #include #include diff --git a/libcxx/test/std/input.output/file.streams/fstreams/ifstream.members/native_handle.pass.cpp b/libcxx/test/std/input.output/file.streams/fstreams/ifstream.members/native_handle.pass.cpp index c2aff949c8fa..e71f7d966972 100644 --- a/libcxx/test/std/input.output/file.streams/fstreams/ifstream.members/native_handle.pass.cpp +++ b/libcxx/test/std/input.output/file.streams/fstreams/ifstream.members/native_handle.pass.cpp @@ -13,6 +13,8 @@ // class basic_ifstream; // native_handle_type native_handle() const noexcept; +// Downstream issue: #375 (Enable fstream independently of filesystem) +// UNSUPPORTED: baremetal #include "test_macros.h" #include "../native_handle_test_helpers.h" diff --git a/libcxx/test/std/input.output/file.streams/fstreams/ifstream.members/offset_range.pass.cpp b/libcxx/test/std/input.output/file.streams/fstreams/ifstream.members/offset_range.pass.cpp index 9fc3cb4a9447..f3c9f2e31caa 100644 --- a/libcxx/test/std/input.output/file.streams/fstreams/ifstream.members/offset_range.pass.cpp +++ b/libcxx/test/std/input.output/file.streams/fstreams/ifstream.members/offset_range.pass.cpp @@ -26,6 +26,9 @@ // meaning it can represent file sizes up to 2GB (2^31 bytes) only. // // UNSUPPORTED: target=armv7-unknown-linux-gnueabihf +// Downstream issue: #375 (Enable fstream independently of filesystem) +// UNSUPPORTED: baremetal + #include #include diff --git a/libcxx/test/std/input.output/file.streams/fstreams/ofstream.cons/pointer.pass.cpp b/libcxx/test/std/input.output/file.streams/fstreams/ofstream.cons/pointer.pass.cpp index fbb03f1e8584..f898e87a7aa6 100644 --- a/libcxx/test/std/input.output/file.streams/fstreams/ofstream.cons/pointer.pass.cpp +++ b/libcxx/test/std/input.output/file.streams/fstreams/ofstream.cons/pointer.pass.cpp @@ -18,6 +18,9 @@ // XFAIL: LIBCXX-AIX-FIXME +// Downstream issue: #375 (Enable fstream independently of filesystem) +// UNSUPPORTED: baremetal + #include #include #include diff --git a/libcxx/test/std/input.output/file.streams/fstreams/ofstream.members/native_handle.pass.cpp b/libcxx/test/std/input.output/file.streams/fstreams/ofstream.members/native_handle.pass.cpp index 88b3a00934cc..11ac86d862dd 100644 --- a/libcxx/test/std/input.output/file.streams/fstreams/ofstream.members/native_handle.pass.cpp +++ b/libcxx/test/std/input.output/file.streams/fstreams/ofstream.members/native_handle.pass.cpp @@ -13,6 +13,8 @@ // class basic_ofstream; // native_handle_type native_handle() const noexcept; +// Downstream issue: #375 (Enable fstream independently of filesystem) +// UNSUPPORTED: baremetal #include "test_macros.h" #include "../native_handle_test_helpers.h" diff --git a/libcxx/test/std/input.output/file.streams/fstreams/ofstream.members/open_pointer.pass.cpp b/libcxx/test/std/input.output/file.streams/fstreams/ofstream.members/open_pointer.pass.cpp index 73a474277a93..909569ff0d12 100644 --- a/libcxx/test/std/input.output/file.streams/fstreams/ofstream.members/open_pointer.pass.cpp +++ b/libcxx/test/std/input.output/file.streams/fstreams/ofstream.members/open_pointer.pass.cpp @@ -17,6 +17,8 @@ // XFAIL: (!c++03 && !c++11 && !c++14 && !c++17 && !c++20) && using-built-library-before-llvm-18 // XFAIL: LIBCXX-AIX-FIXME +// Downstream issue: #375 (Enable fstream independently of filesystem) +// UNSUPPORTED: baremetal #include #include diff --git a/libcxx/test/std/input.output/file.streams/lit.local.cfg b/libcxx/test/std/input.output/file.streams/lit.local.cfg index fb65433eef81..bc846c477c51 100644 --- a/libcxx/test/std/input.output/file.streams/lit.local.cfg +++ b/libcxx/test/std/input.output/file.streams/lit.local.cfg @@ -2,6 +2,10 @@ if "no-localization" in config.available_features: config.unsupported = True +# Downstream issue: #375 (Enable fstream independently of filesystem) #if "no-filesystem" in config.available_features: # config.unsupported = True +# Downstream issue: #375 (Enable fstream independently of filesystem) +if 'none' in config.target_triple: + config.available_features.add('baremetal') diff --git a/libcxx/test/support/platform_support.h b/libcxx/test/support/platform_support.h index 99e60f60c599..031c434053b8 100644 --- a/libcxx/test/support/platform_support.h +++ b/libcxx/test/support/platform_support.h @@ -40,6 +40,10 @@ # include // _mktemp_s # include // _O_EXCL, ... # include // _S_IREAD, ... +// Downstream issue: #375 (Enable fstream independently of filesystem) +#elif defined(_NEWLIB_VERSION) +// No need to include extra headers for the get_temp_file_name() implementation +// below: tmpnam() is defined in #elif __has_include() # include // close #endif @@ -70,6 +74,15 @@ inline std::string get_temp_file_name() { continue; abort(); } +// Downstream issue: #375 (Enable fstream independently of filesystem) +#elif defined(_NEWLIB_VERSION) + char tmp_name[L_tmpnam]; + char *ret = tmpnam(tmp_name); + if (ret == NULL) { + perror("tmpnam"); + abort(); + } + return std::string(ret); #elif !__has_include() // Without `unistd.h` we cannot guarantee that the file is unused, however we // can simply generate a good guess in the temporary folder and create it.