diff --git a/libcxx/CMakeLists.txt b/libcxx/CMakeLists.txt --- a/libcxx/CMakeLists.txt +++ b/libcxx/CMakeLists.txt @@ -84,6 +84,8 @@ the C locale API (e.g. embedded). When localization is not supported, several parts of the library will be disabled: , , will be completely unusable, and other parts may be only partly available." ON) +option(LIBCXX_ENABLE_FSTREAM + "Whether to include support for ." ON) # TODO: Consider rolling that into LIBCXX_ENABLE_FILESYSTEM option(LIBCXX_ENABLE_UNICODE "Whether to include support for Unicode in the library. Disabling Unicode can be useful when porting to platforms that don't support UTF-8 encoding (e.g. @@ -860,6 +862,7 @@ config_define_if_not(LIBCXX_ENABLE_FILESYSTEM _LIBCPP_HAS_NO_FILESYSTEM_LIBRARY) config_define_if_not(LIBCXX_ENABLE_RANDOM_DEVICE _LIBCPP_HAS_NO_RANDOM_DEVICE) config_define_if_not(LIBCXX_ENABLE_LOCALIZATION _LIBCPP_HAS_NO_LOCALIZATION) +config_define_if_not(LIBCXX_ENABLE_FSTREAM _LIBCPP_HAS_NO_FSTREAM) config_define_if_not(LIBCXX_ENABLE_UNICODE _LIBCPP_HAS_NO_UNICODE) config_define_if_not(LIBCXX_ENABLE_WIDE_CHARACTERS _LIBCPP_HAS_NO_WIDE_CHARACTERS) config_define_if_not(LIBCXX_ENABLE_VENDOR_AVAILABILITY_ANNOTATIONS _LIBCPP_HAS_NO_VENDOR_AVAILABILITY_ANNOTATIONS) diff --git a/libcxx/cmake/caches/Generic-no-fstream.cmake b/libcxx/cmake/caches/Generic-no-fstream.cmake new file mode 100644 --- /dev/null +++ b/libcxx/cmake/caches/Generic-no-fstream.cmake @@ -0,0 +1 @@ +set(LIBCXX_ENABLE_FSTREAM OFF CACHE BOOL "") diff --git a/libcxx/include/CMakeLists.txt b/libcxx/include/CMakeLists.txt --- a/libcxx/include/CMakeLists.txt +++ b/libcxx/include/CMakeLists.txt @@ -838,7 +838,7 @@ wctype.h ) -foreach(feature LIBCXX_ENABLE_FILESYSTEM LIBCXX_ENABLE_LOCALIZATION LIBCXX_ENABLE_THREADS LIBCXX_ENABLE_WIDE_CHARACTERS) +foreach(feature LIBCXX_ENABLE_FILESYSTEM LIBCXX_ENABLE_LOCALIZATION LIBCXX_ENABLE_FSTREAM LIBCXX_ENABLE_THREADS LIBCXX_ENABLE_WIDE_CHARACTERS) if (NOT ${${feature}}) set(requires_${feature} "requires LIBCXX_CONFIGURED_WITHOUT_SUPPORT_FOR_THIS_HEADER") endif() diff --git a/libcxx/include/__config_site.in b/libcxx/include/__config_site.in --- a/libcxx/include/__config_site.in +++ b/libcxx/include/__config_site.in @@ -28,6 +28,7 @@ #cmakedefine _LIBCPP_HAS_PARALLEL_ALGORITHMS #cmakedefine _LIBCPP_HAS_NO_RANDOM_DEVICE #cmakedefine _LIBCPP_HAS_NO_LOCALIZATION +#cmakedefine _LIBCPP_HAS_NO_FSTREAM #cmakedefine _LIBCPP_HAS_NO_WIDE_CHARACTERS #cmakedefine01 _LIBCPP_ENABLE_ASSERTIONS_DEFAULT #cmakedefine _LIBCPP_ENABLE_DEBUG_MODE diff --git a/libcxx/include/fstream b/libcxx/include/fstream --- a/libcxx/include/fstream +++ b/libcxx/include/fstream @@ -210,6 +210,8 @@ # define _LIBCPP_HAS_NO_OFF_T_FUNCTIONS #endif +#if !defined(_LIBCPP_HAS_NO_FSTREAM) + _LIBCPP_BEGIN_NAMESPACE_STD template @@ -1742,6 +1744,8 @@ _LIBCPP_END_NAMESPACE_STD +#endif // _LIBCPP_HAS_NO_FSTREAM + _LIBCPP_POP_MACROS #if !defined(_LIBCPP_REMOVE_TRANSITIVE_INCLUDES) && _LIBCPP_STD_VER <= 20 diff --git a/libcxx/include/module.modulemap.in b/libcxx/include/module.modulemap.in --- a/libcxx/include/module.modulemap.in +++ b/libcxx/include/module.modulemap.in @@ -855,6 +855,7 @@ } module fstream { @requires_LIBCXX_ENABLE_LOCALIZATION@ + @requires_LIBCXX_ENABLE_FSTREAM@ header "fstream" export * } diff --git a/libcxx/src/ios.instantiations.cpp b/libcxx/src/ios.instantiations.cpp --- a/libcxx/src/ios.instantiations.cpp +++ b/libcxx/src/ios.instantiations.cpp @@ -36,9 +36,12 @@ 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; + +#ifndef _LIBCPP_HAS_NO_FSTREAM 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; +#endif // Add more here if needed... diff --git a/libcxx/test/libcxx/assertions/headers_declare_verbose_abort.sh.cpp b/libcxx/test/libcxx/assertions/headers_declare_verbose_abort.sh.cpp --- a/libcxx/test/libcxx/assertions/headers_declare_verbose_abort.sh.cpp +++ b/libcxx/test/libcxx/assertions/headers_declare_verbose_abort.sh.cpp @@ -325,7 +325,7 @@ #endif // RUN: %{build} -DTEST_51 -#if defined(TEST_51) && !defined(_LIBCPP_HAS_NO_LOCALIZATION) +#if defined(TEST_51) && !defined(_LIBCPP_HAS_NO_LOCALIZATION) && !defined(_LIBCPP_HAS_NO_FSTREAM) # include using HandlerType = decltype(std::__libcpp_verbose_abort); #endif diff --git a/libcxx/test/libcxx/clang_tidy.sh.cpp b/libcxx/test/libcxx/clang_tidy.sh.cpp --- a/libcxx/test/libcxx/clang_tidy.sh.cpp +++ b/libcxx/test/libcxx/clang_tidy.sh.cpp @@ -98,7 +98,7 @@ #include #include #include -#if !defined(_LIBCPP_HAS_NO_LOCALIZATION) +#if !defined(_LIBCPP_HAS_NO_LOCALIZATION) && !defined(_LIBCPP_HAS_NO_FSTREAM) # include #endif #include diff --git a/libcxx/test/libcxx/double_include.sh.cpp b/libcxx/test/libcxx/double_include.sh.cpp --- a/libcxx/test/libcxx/double_include.sh.cpp +++ b/libcxx/test/libcxx/double_include.sh.cpp @@ -100,7 +100,7 @@ #include #include #include -#if !defined(_LIBCPP_HAS_NO_LOCALIZATION) +#if !defined(_LIBCPP_HAS_NO_LOCALIZATION) && !defined(_LIBCPP_HAS_NO_FSTREAM) # include #endif #include diff --git a/libcxx/test/libcxx/min_max_macros.compile.pass.cpp b/libcxx/test/libcxx/min_max_macros.compile.pass.cpp --- a/libcxx/test/libcxx/min_max_macros.compile.pass.cpp +++ b/libcxx/test/libcxx/min_max_macros.compile.pass.cpp @@ -151,7 +151,7 @@ TEST_MACROS(); #include TEST_MACROS(); -#if !defined(_LIBCPP_HAS_NO_LOCALIZATION) +#if !defined(_LIBCPP_HAS_NO_LOCALIZATION) && !defined(_LIBCPP_HAS_NO_FSTREAM) # include TEST_MACROS(); #endif diff --git a/libcxx/test/libcxx/modules_include.sh.cpp b/libcxx/test/libcxx/modules_include.sh.cpp --- a/libcxx/test/libcxx/modules_include.sh.cpp +++ b/libcxx/test/libcxx/modules_include.sh.cpp @@ -251,7 +251,7 @@ #include #endif // RUN: %{cxx} %s %{flags} %{compile_flags} -fmodules -fcxx-modules -fmodules-cache-path=%t -fsyntax-only -DTEST_51 -#if defined(TEST_51) && !defined(_LIBCPP_HAS_NO_LOCALIZATION) +#if defined(TEST_51) && !defined(_LIBCPP_HAS_NO_LOCALIZATION) && !defined(_LIBCPP_HAS_NO_FSTREAM) #include #endif // RUN: %{cxx} %s %{flags} %{compile_flags} -fmodules -fcxx-modules -fmodules-cache-path=%t -fsyntax-only -DTEST_52 diff --git a/libcxx/test/libcxx/nasty_macros.compile.pass.cpp b/libcxx/test/libcxx/nasty_macros.compile.pass.cpp --- a/libcxx/test/libcxx/nasty_macros.compile.pass.cpp +++ b/libcxx/test/libcxx/nasty_macros.compile.pass.cpp @@ -219,7 +219,7 @@ #include #include #include -#if !defined(_LIBCPP_HAS_NO_LOCALIZATION) +#if !defined(_LIBCPP_HAS_NO_LOCALIZATION) && !defined(_LIBCPP_HAS_NO_FSTREAM) # include #endif #include diff --git a/libcxx/test/libcxx/no_assert_include.compile.pass.cpp b/libcxx/test/libcxx/no_assert_include.compile.pass.cpp --- a/libcxx/test/libcxx/no_assert_include.compile.pass.cpp +++ b/libcxx/test/libcxx/no_assert_include.compile.pass.cpp @@ -97,7 +97,7 @@ #include #include #include -#if !defined(_LIBCPP_HAS_NO_LOCALIZATION) +#if !defined(_LIBCPP_HAS_NO_LOCALIZATION) && !defined(_LIBCPP_HAS_NO_FSTREAM) # include #endif #include diff --git a/libcxx/test/std/input.output/file.streams/fstreams/filebuf.virtuals/seekoff.pass.cpp b/libcxx/test/std/input.output/file.streams/fstreams/filebuf.virtuals/seekoff.pass.cpp --- a/libcxx/test/std/input.output/file.streams/fstreams/filebuf.virtuals/seekoff.pass.cpp +++ b/libcxx/test/std/input.output/file.streams/fstreams/filebuf.virtuals/seekoff.pass.cpp @@ -13,8 +13,6 @@ // pos_type seekpos(pos_type sp, // ios_base::openmode which = ios_base::in | ios_base::out); -// FILE_DEPENDENCIES: underflow.dat - #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 --- a/libcxx/test/std/input.output/file.streams/lit.local.cfg +++ b/libcxx/test/std/input.output/file.streams/lit.local.cfg @@ -1,3 +1,6 @@ # All non-trivial uses of iostreams require localization support if 'no-localization' in config.available_features: config.unsupported = True + +if 'no-fstream' in config.available_features: + config.unsupported = True diff --git a/libcxx/test/std/input.output/stream.buffers/streambuf/streambuf.virtuals/streambuf.virt.put/xsputn.PR14074.pass.cpp b/libcxx/test/std/input.output/stream.buffers/streambuf/streambuf.virtuals/streambuf.virt.put/xsputn.PR14074.pass.cpp --- a/libcxx/test/std/input.output/stream.buffers/streambuf/streambuf.virtuals/streambuf.virt.put/xsputn.PR14074.pass.cpp +++ b/libcxx/test/std/input.output/stream.buffers/streambuf/streambuf.virtuals/streambuf.virt.put/xsputn.PR14074.pass.cpp @@ -17,6 +17,8 @@ // basic_streambuf, but I can't seem to reproduce without going through one // of its derived classes. +// UNSUPPORTED: no-fstream + #include #include #include diff --git a/libcxx/test/std/localization/locales/locale.convenience/conversions/conversions.buffer/overflow.pass.cpp b/libcxx/test/std/localization/locales/locale.convenience/conversions/conversions.buffer/overflow.pass.cpp --- a/libcxx/test/std/localization/locales/locale.convenience/conversions/conversions.buffer/overflow.pass.cpp +++ b/libcxx/test/std/localization/locales/locale.convenience/conversions/conversions.buffer/overflow.pass.cpp @@ -19,9 +19,10 @@ // XFAIL: no-wide-characters #include +#include #include #include -#include +#include #include "test_macros.h" @@ -46,62 +47,73 @@ int main(int, char**) { { - std::ofstream bs("overflow.dat"); - test_buf f(bs.rdbuf()); - assert(f.pbase() == 0); - assert(f.pptr() == 0); - assert(f.epptr() == 0); - assert(f.overflow(L'a') == L'a'); - assert(f.pbase() != 0); - assert(f.pptr() == f.pbase()); - assert(f.epptr() - f.pbase() == 4095); - } - { - std::ifstream bs("overflow.dat"); - test_buf f(bs.rdbuf()); - assert(f.sgetc() == L'a'); - } - std::remove("overflow.dat"); - { - std::ofstream bs("overflow.dat"); - test_buf f(bs.rdbuf()); - f.pubsetbuf(0, 0); - assert(f.pbase() == 0); - assert(f.pptr() == 0); - assert(f.epptr() == 0); - assert(f.overflow('a') == 'a'); - assert(f.pbase() == 0); - assert(f.pptr() == 0); - assert(f.epptr() == 0); - } - { - std::ifstream bs("overflow.dat"); - test_buf f(bs.rdbuf()); - assert(f.sgetc() == L'a'); + std::string s; + { + std::ostringstream out; + test_buf f(out.rdbuf()); + assert(f.pbase() == 0); + assert(f.pptr() == 0); + assert(f.epptr() == 0); + assert(f.overflow(L'a') == L'a'); + assert(f.pbase() != 0); + assert(f.pptr() == f.pbase()); + assert(f.epptr() - f.pbase() == 4095); + s = out.str(); + } + { + std::istringstream in(s); + test_buf f(in.rdbuf()); + assert(f.sgetc() == L'a'); + } } - std::remove("overflow.dat"); { - std::ofstream bs("overflow.dat"); - test_buf f(bs.rdbuf()); - assert(f.sputc(0x4E51) == 0x4E51); - assert(f.sputc(0x4E52) == 0x4E52); - assert(f.sputc(0x4E53) == 0x4E53); + std::string s; + { + std::ostringstream out; + test_buf f(out.rdbuf()); + f.pubsetbuf(0, 0); + assert(f.pbase() == 0); + assert(f.pptr() == 0); + assert(f.epptr() == 0); + assert(f.overflow('a') == 'a'); + assert(f.pbase() == 0); + assert(f.pptr() == 0); + assert(f.epptr() == 0); + s = out.str(); + } + { + std::istringstream in(s); + test_buf f(in.rdbuf()); + assert(f.sgetc() == L'a'); + } } + // TODO: Move this to std::stringstream once https://llvm.org/PR59083 has been resolved +#ifndef TEST_HAS_NO_FSTREAM { - std::ifstream f("overflow.dat"); - assert(f.is_open()); - assert(f.get() == 0xE4); - assert(f.get() == 0xB9); - assert(f.get() == 0x91); - assert(f.get() == 0xE4); - assert(f.get() == 0xB9); - assert(f.get() == 0x92); - assert(f.get() == 0xE4); - assert(f.get() == 0xB9); - assert(f.get() == 0x93); - assert(f.get() == -1); + { + std::ofstream bs("overflow.dat"); + test_buf f(bs.rdbuf()); + assert(f.sputc(0x4E51) == 0x4E51); + assert(f.sputc(0x4E52) == 0x4E52); + assert(f.sputc(0x4E53) == 0x4E53); + } + { + std::ifstream f("overflow.dat"); + assert(f.is_open()); + assert(f.get() == 0xE4); + assert(f.get() == 0xB9); + assert(f.get() == 0x91); + assert(f.get() == 0xE4); + assert(f.get() == 0xB9); + assert(f.get() == 0x92); + assert(f.get() == 0xE4); + assert(f.get() == 0xB9); + assert(f.get() == 0x93); + assert(f.get() == -1); + } + std::remove("overflow.dat"); } - std::remove("overflow.dat"); +#endif // TEST_HAS_NO_FSTREAM - return 0; + return 0; } diff --git a/libcxx/test/std/localization/locales/locale.convenience/conversions/conversions.buffer/pbackfail.pass.cpp b/libcxx/test/std/localization/locales/locale.convenience/conversions/conversions.buffer/pbackfail.pass.cpp --- a/libcxx/test/std/localization/locales/locale.convenience/conversions/conversions.buffer/pbackfail.pass.cpp +++ b/libcxx/test/std/localization/locales/locale.convenience/conversions/conversions.buffer/pbackfail.pass.cpp @@ -6,8 +6,6 @@ // //===----------------------------------------------------------------------===// -// FILE_DEPENDENCIES: underflow.dat - // // ADDITIONAL_COMPILE_FLAGS: -D_LIBCPP_DISABLE_DEPRECATION_WARNINGS @@ -21,11 +19,9 @@ // XFAIL: no-wide-characters #include -#include -#include #include - -#include "test_macros.h" +#include +#include struct test_buf : public std::wbuffer_convert > @@ -47,16 +43,17 @@ int main(int, char**) { + std::string const s = "123456789"; { - std::ifstream bs("underflow.dat"); - test_buf f(bs.rdbuf()); + std::istringstream in(s); + test_buf f(in.rdbuf()); assert(f.sbumpc() == L'1'); assert(f.sgetc() == L'2'); assert(f.pbackfail(L'a') == test_buf::traits_type::eof()); } { - std::fstream bs("underflow.dat"); - test_buf f(bs.rdbuf()); + std::istringstream in(s); + test_buf f(in.rdbuf()); assert(f.sbumpc() == L'1'); assert(f.sgetc() == L'2'); assert(f.pbackfail(L'a') == test_buf::traits_type::eof()); diff --git a/libcxx/test/std/localization/locales/locale.convenience/conversions/conversions.buffer/seekoff.pass.cpp b/libcxx/test/std/localization/locales/locale.convenience/conversions/conversions.buffer/seekoff.pass.cpp --- a/libcxx/test/std/localization/locales/locale.convenience/conversions/conversions.buffer/seekoff.pass.cpp +++ b/libcxx/test/std/localization/locales/locale.convenience/conversions/conversions.buffer/seekoff.pass.cpp @@ -21,13 +21,14 @@ // XFAIL: no-wide-characters +// TODO: Avoid using in this test. +// XFAIL: no-fstream + #include #include #include #include -#include "test_macros.h" - class test_codecvt : public std::codecvt { diff --git a/libcxx/test/std/localization/locales/locale.convenience/conversions/conversions.buffer/test.pass.cpp b/libcxx/test/std/localization/locales/locale.convenience/conversions/conversions.buffer/test.pass.cpp --- a/libcxx/test/std/localization/locales/locale.convenience/conversions/conversions.buffer/test.pass.cpp +++ b/libcxx/test/std/localization/locales/locale.convenience/conversions/conversions.buffer/test.pass.cpp @@ -14,30 +14,28 @@ // XFAIL: no-wide-characters -#include -#include -#include #include +#include +#include +#include -#include "test_macros.h" - -int main(int, char**) -{ +int main(int, char**) { + std::string storage; { - std::ofstream bytestream("myfile.txt"); + std::ostringstream bytestream; std::wbuffer_convert > mybuf(bytestream.rdbuf()); std::wostream mystr(&mybuf); mystr << L"Hello" << std::endl; + storage = bytestream.str(); } { - std::ifstream bytestream("myfile.txt"); + std::istringstream bytestream(storage); std::wbuffer_convert > mybuf(bytestream.rdbuf()); std::wistream mystr(&mybuf); std::wstring ws; mystr >> ws; assert(ws == L"Hello"); } - std::remove("myfile.txt"); - return 0; + return 0; } diff --git a/libcxx/test/std/localization/locales/locale.convenience/conversions/conversions.buffer/underflow.dat b/libcxx/test/std/localization/locales/locale.convenience/conversions/conversions.buffer/underflow.dat deleted file mode 100644 --- a/libcxx/test/std/localization/locales/locale.convenience/conversions/conversions.buffer/underflow.dat +++ /dev/null @@ -1 +0,0 @@ -123456789 \ No newline at end of file diff --git a/libcxx/test/std/localization/locales/locale.convenience/conversions/conversions.buffer/underflow.pass.cpp b/libcxx/test/std/localization/locales/locale.convenience/conversions/conversions.buffer/underflow.pass.cpp --- a/libcxx/test/std/localization/locales/locale.convenience/conversions/conversions.buffer/underflow.pass.cpp +++ b/libcxx/test/std/localization/locales/locale.convenience/conversions/conversions.buffer/underflow.pass.cpp @@ -6,8 +6,6 @@ // //===----------------------------------------------------------------------===// -// FILE_DEPENDENCIES: underflow.dat, underflow_utf8.dat - // // ADDITIONAL_COMPILE_FLAGS: -D_LIBCPP_DISABLE_DEPRECATION_WARNINGS @@ -21,9 +19,9 @@ // XFAIL: no-wide-characters #include -#include -#include #include +#include +#include #include "test_macros.h" @@ -48,7 +46,8 @@ int main(int, char**) { { - std::ifstream bs("underflow.dat"); + std::string s = "123456789"; + std::istringstream bs(s); test_buf f(bs.rdbuf()); assert(f.eback() == 0); assert(f.gptr() == 0); @@ -60,7 +59,8 @@ assert(f.egptr() - f.eback() == 9); } { - std::ifstream bs("underflow.dat"); + std::string s = "123456789"; + std::istringstream bs(s); test_buf f(bs.rdbuf()); assert(f.eback() == 0); assert(f.gptr() == 0); @@ -81,7 +81,8 @@ assert(f.egptr() - f.gptr() == 1); } { - std::ifstream bs("underflow_utf8.dat"); + std::string s = "乑乒乓"; + std::istringstream bs(s); test_buf f(bs.rdbuf()); assert(f.sbumpc() == 0x4E51); assert(f.sbumpc() == 0x4E52); @@ -89,5 +90,5 @@ assert(f.sbumpc() == test_buf::traits_type::eof()); } - return 0; + return 0; } diff --git a/libcxx/test/std/localization/locales/locale.convenience/conversions/conversions.buffer/underflow_utf8.dat b/libcxx/test/std/localization/locales/locale.convenience/conversions/conversions.buffer/underflow_utf8.dat deleted file mode 100644 --- a/libcxx/test/std/localization/locales/locale.convenience/conversions/conversions.buffer/underflow_utf8.dat +++ /dev/null @@ -1 +0,0 @@ -乑乒乓 \ No newline at end of file diff --git a/libcxx/test/std/utilities/charconv/charconv.msvc/test.cpp b/libcxx/test/std/utilities/charconv/charconv.msvc/test.cpp --- a/libcxx/test/std/utilities/charconv/charconv.msvc/test.cpp +++ b/libcxx/test/std/utilities/charconv/charconv.msvc/test.cpp @@ -9,7 +9,6 @@ #include #include #include -#include #include #include #include @@ -49,7 +48,7 @@ using namespace std; -void initialize_randomness(mt19937_64& mt64, const int argc, char** const argv) { +void initialize_randomness(mt19937_64& mt64, const int argc, char** const /*argv*/) { constexpr size_t n = mt19937_64::state_size; constexpr size_t w = mt19937_64::word_size; static_assert(w % 32 == 0); @@ -59,32 +58,11 @@ puts("USAGE:"); puts("test.exe : generates seed data from random_device."); - puts("test.exe filename.txt : loads seed data from a given text file."); if (argc == 1) { random_device rd; generate(vec.begin(), vec.end(), ref(rd)); puts("Generated seed data."); - } else if (argc == 2) { - const char* const filename = argv[1]; - - ifstream file(filename); - - if (!file) { - printf("ERROR: Can't open %s.\n", filename); - abort(); - } - - for (auto& elem : vec) { - file >> elem; - - if (!file) { - printf("ERROR: Can't read seed data from %s.\n", filename); - abort(); - } - } - - printf("Loaded seed data from %s.\n", filename); } else { puts("ERROR: Too many command-line arguments."); abort(); diff --git a/libcxx/test/support/test_macros.h b/libcxx/test/support/test_macros.h --- a/libcxx/test/support/test_macros.h +++ b/libcxx/test/support/test_macros.h @@ -387,6 +387,10 @@ # define TEST_HAS_NO_FILESYSTEM_LIBRARY #endif +#if defined(_LIBCPP_HAS_NO_FSTREAM) +# define TEST_HAS_NO_FSTREAM +#endif + #if defined(_LIBCPP_HAS_NO_FGETPOS_FSETPOS) # define TEST_HAS_NO_FGETPOS_FSETPOS #endif diff --git a/libcxx/utils/ci/buildkite-pipeline.yml b/libcxx/utils/ci/buildkite-pipeline.yml --- a/libcxx/utils/ci/buildkite-pipeline.yml +++ b/libcxx/utils/ci/buildkite-pipeline.yml @@ -520,6 +520,23 @@ limit: 2 timeout_in_minutes: 120 + - label: "No fstream" + command: "libcxx/utils/ci/run-buildbot generic-no-fstream" + artifact_paths: + - "**/test-results.xml" + - "**/*.abilist" + env: + CC: "clang-${LLVM_HEAD_VERSION}" + CXX: "clang++-${LLVM_HEAD_VERSION}" + agents: + queue: "libcxx-builders" + os: "linux" + retry: + automatic: + - exit_status: -1 # Agent was lost + limit: 2 + timeout_in_minutes: 120 + - label: "No locale" command: "libcxx/utils/ci/run-buildbot generic-no-localization" artifact_paths: diff --git a/libcxx/utils/ci/run-buildbot b/libcxx/utils/ci/run-buildbot --- a/libcxx/utils/ci/run-buildbot +++ b/libcxx/utils/ci/run-buildbot @@ -196,6 +196,7 @@ --exclude 'locale-specific_form.pass.cpp' \ --exclude 'ostream.pass.cpp' \ --exclude 'std_format_spec_string_unicode.bench.cpp' \ + --exclude 'underflow.pass.cpp' \ || false # Reject code with trailing whitespace @@ -334,6 +335,11 @@ generate-cmake -C "${MONOREPO_ROOT}/libcxx/cmake/caches/Generic-no-random_device.cmake" check-runtimes ;; +generic-no-fstream) + clean + generate-cmake -C "${MONOREPO_ROOT}/libcxx/cmake/caches/Generic-no-fstream.cmake" + check-runtimes +;; generic-no-localization) clean generate-cmake -C "${MONOREPO_ROOT}/libcxx/cmake/caches/Generic-no-localization.cmake" diff --git a/libcxx/utils/generate_header_tests.py b/libcxx/utils/generate_header_tests.py --- a/libcxx/utils/generate_header_tests.py +++ b/libcxx/utils/generate_header_tests.py @@ -21,7 +21,7 @@ "clocale": "!defined(_LIBCPP_HAS_NO_LOCALIZATION)", "codecvt": "!defined(_LIBCPP_HAS_NO_LOCALIZATION)", - "fstream": "!defined(_LIBCPP_HAS_NO_LOCALIZATION)", + "fstream": "!defined(_LIBCPP_HAS_NO_LOCALIZATION) && !defined(_LIBCPP_HAS_NO_FSTREAM)", "iomanip": "!defined(_LIBCPP_HAS_NO_LOCALIZATION)", "ios": "!defined(_LIBCPP_HAS_NO_LOCALIZATION)", "iostream": "!defined(_LIBCPP_HAS_NO_LOCALIZATION)", diff --git a/libcxx/utils/libcxx/test/features.py b/libcxx/utils/libcxx/test/features.py --- a/libcxx/utils/libcxx/test/features.py +++ b/libcxx/utils/libcxx/test/features.py @@ -206,6 +206,7 @@ '_LIBCPP_HAS_NO_FILESYSTEM_LIBRARY': 'no-filesystem', '_LIBCPP_HAS_NO_RANDOM_DEVICE': 'no-random-device', '_LIBCPP_HAS_NO_LOCALIZATION': 'no-localization', + '_LIBCPP_HAS_NO_FSTREAM': 'no-fstream', '_LIBCPP_HAS_NO_WIDE_CHARACTERS': 'no-wide-characters', '_LIBCPP_HAS_NO_UNICODE': 'libcpp-has-no-unicode', '_LIBCPP_ENABLE_DEBUG_MODE': 'libcpp-has-debug-mode',