diff --git a/libcxx/CMakeLists.txt b/libcxx/CMakeLists.txt --- a/libcxx/CMakeLists.txt +++ b/libcxx/CMakeLists.txt @@ -845,6 +845,7 @@ config_define_if(LIBCXX_HAS_MUSL_LIBC _LIBCPP_HAS_MUSL_LIBC) config_define_if(LIBCXX_NO_VCRUNTIME _LIBCPP_NO_VCRUNTIME) config_define_if(LIBCXX_ENABLE_PARALLEL_ALGORITHMS _LIBCPP_HAS_PARALLEL_ALGORITHMS) +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_VENDOR_AVAILABILITY_ANNOTATIONS _LIBCPP_HAS_NO_VENDOR_AVAILABILITY_ANNOTATIONS) diff --git a/libcxx/cmake/caches/Generic-no-filesystem.cmake b/libcxx/cmake/caches/Generic-no-filesystem.cmake new file mode 100644 --- /dev/null +++ b/libcxx/cmake/caches/Generic-no-filesystem.cmake @@ -0,0 +1 @@ +set(LIBCXX_ENABLE_FILESYSTEM OFF CACHE BOOL "") 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 @@ -30,6 +30,7 @@ #cmakedefine _LIBCPP_NO_VCRUNTIME #cmakedefine _LIBCPP_TYPEINFO_COMPARISON_IMPLEMENTATION @_LIBCPP_TYPEINFO_COMPARISON_IMPLEMENTATION@ #cmakedefine _LIBCPP_ABI_NAMESPACE @_LIBCPP_ABI_NAMESPACE@ +#cmakedefine _LIBCPP_HAS_NO_FILESYSTEM_LIBRARY #cmakedefine _LIBCPP_HAS_PARALLEL_ALGORITHMS #cmakedefine _LIBCPP_HAS_NO_RANDOM_DEVICE #cmakedefine _LIBCPP_HAS_NO_LOCALIZATION diff --git a/libcxx/include/filesystem b/libcxx/include/filesystem --- a/libcxx/include/filesystem +++ b/libcxx/include/filesystem @@ -251,6 +251,10 @@ #include <__debug> +#if defined(_LIBCPP_HAS_NO_FILESYSTEM_LIBRARY) +# error "The Filesystem library is not supported by this configuration of libc++" +#endif + #if !defined(_LIBCPP_HAS_NO_PRAGMA_SYSTEM_HEADER) #pragma GCC system_header #endif diff --git a/libcxx/include/fstream b/libcxx/include/fstream --- a/libcxx/include/fstream +++ b/libcxx/include/fstream @@ -186,7 +186,10 @@ #include <__locale> #include #include -#include + +#if !defined(_LIBCPP_HAS_NO_FILESYSTEM_LIBRARY) +# include +#endif #if !defined(_LIBCPP_HAS_NO_PRAGMA_SYSTEM_HEADER) #pragma GCC system_header @@ -235,7 +238,7 @@ _LIBCPP_INLINE_VISIBILITY basic_filebuf* open(const string& __s, ios_base::openmode __mode); -#if _LIBCPP_STD_VER >= 17 +#if _LIBCPP_STD_VER >= 17 && !defined(_LIBCPP_HAS_NO_FILESYSTEM_LIBRARY) _LIBCPP_AVAILABILITY_FILESYSTEM _LIBCPP_INLINE_VISIBILITY basic_filebuf* open(const _VSTD_FS::path& __p, ios_base::openmode __mode) { return open(__p.c_str(), __mode); @@ -1151,7 +1154,7 @@ #endif _LIBCPP_INLINE_VISIBILITY explicit basic_ifstream(const string& __s, ios_base::openmode __mode = ios_base::in); -#if _LIBCPP_STD_VER >= 17 +#if _LIBCPP_STD_VER >= 17 && !defined(_LIBCPP_HAS_NO_FILESYSTEM_LIBRARY) _LIBCPP_AVAILABILITY_FILESYSTEM _LIBCPP_INLINE_VISIBILITY explicit basic_ifstream(const filesystem::path& __p, ios_base::openmode __mode = ios_base::in) : basic_ifstream(__p.c_str(), __mode) {} @@ -1177,7 +1180,7 @@ void open(const wchar_t* __s, ios_base::openmode __mode = ios_base::in); #endif void open(const string& __s, ios_base::openmode __mode = ios_base::in); -#if _LIBCPP_STD_VER >= 17 +#if _LIBCPP_STD_VER >= 17 && !defined(_LIBCPP_HAS_NO_FILESYSTEM_LIBRARY) _LIBCPP_AVAILABILITY_FILESYSTEM _LIBCPP_INLINE_VISIBILITY void open(const filesystem::path& __p, ios_base::openmode __mode = ios_base::in) { @@ -1365,7 +1368,7 @@ _LIBCPP_INLINE_VISIBILITY explicit basic_ofstream(const string& __s, ios_base::openmode __mode = ios_base::out); -#if _LIBCPP_STD_VER >= 17 +#if _LIBCPP_STD_VER >= 17 && !defined(_LIBCPP_HAS_NO_FILESYSTEM_LIBRARY) _LIBCPP_AVAILABILITY_FILESYSTEM _LIBCPP_INLINE_VISIBILITY explicit basic_ofstream(const filesystem::path& __p, ios_base::openmode __mode = ios_base::out) : basic_ofstream(__p.c_str(), __mode) {} @@ -1392,7 +1395,7 @@ #endif void open(const string& __s, ios_base::openmode __mode = ios_base::out); -#if _LIBCPP_STD_VER >= 17 +#if _LIBCPP_STD_VER >= 17 && !defined(_LIBCPP_HAS_NO_FILESYSTEM_LIBRARY) _LIBCPP_AVAILABILITY_FILESYSTEM _LIBCPP_INLINE_VISIBILITY void open(const filesystem::path& __p, ios_base::openmode __mode = ios_base::out) { return open(__p.c_str(), __mode); } @@ -1579,7 +1582,7 @@ _LIBCPP_INLINE_VISIBILITY explicit basic_fstream(const string& __s, ios_base::openmode __mode = ios_base::in | ios_base::out); -#if _LIBCPP_STD_VER >= 17 +#if _LIBCPP_STD_VER >= 17 && !defined(_LIBCPP_HAS_NO_FILESYSTEM_LIBRARY) _LIBCPP_AVAILABILITY_FILESYSTEM _LIBCPP_INLINE_VISIBILITY explicit basic_fstream(const filesystem::path& __p, ios_base::openmode __mode = ios_base::in | ios_base::out) : basic_fstream(__p.c_str(), __mode) {} @@ -1607,7 +1610,7 @@ #endif void open(const string& __s, ios_base::openmode __mode = ios_base::in | ios_base::out); -#if _LIBCPP_STD_VER >= 17 +#if _LIBCPP_STD_VER >= 17 && !defined(_LIBCPP_HAS_NO_FILESYSTEM_LIBRARY) _LIBCPP_AVAILABILITY_FILESYSTEM _LIBCPP_INLINE_VISIBILITY void open(const filesystem::path& __p, ios_base::openmode __mode = ios_base::in|ios_base::out) { return open(__p.c_str(), __mode); } diff --git a/libcxx/test/configs/legacy.cfg.in b/libcxx/test/configs/legacy.cfg.in --- a/libcxx/test/configs/legacy.cfg.in +++ b/libcxx/test/configs/legacy.cfg.in @@ -11,7 +11,6 @@ config.enable_exceptions = @LIBCXX_ENABLE_EXCEPTIONS@ config.enable_debug_tests = @LIBCXX_ENABLE_DEBUG_MODE_SUPPORT@ config.enable_experimental = @LIBCXX_ENABLE_EXPERIMENTAL_LIBRARY@ -config.enable_filesystem = @LIBCXX_ENABLE_FILESYSTEM@ config.enable_rtti = @LIBCXX_ENABLE_RTTI@ config.enable_shared = @LIBCXX_LINK_TESTS_WITH_SHARED_LIBCXX@ config.enable_32bit = @LIBCXX_BUILD_32_BITS@ 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 @@ -87,7 +87,9 @@ #include #include #include -#include +#ifndef _LIBCPP_HAS_NO_FILESYSTEM_LIBRARY +# include +#endif #include #include #ifndef _LIBCPP_HAS_NO_LOCALIZATION @@ -199,7 +201,9 @@ # include # endif # include -# include +# ifndef _LIBCPP_HAS_NO_FILESYSTEM_LIBRARY +# include +# endif # include # include # include diff --git a/libcxx/test/libcxx/experimental/filesystem/deprecated.verify.cpp b/libcxx/test/libcxx/experimental/filesystem/deprecated.verify.cpp --- a/libcxx/test/libcxx/experimental/filesystem/deprecated.verify.cpp +++ b/libcxx/test/libcxx/experimental/filesystem/deprecated.verify.cpp @@ -7,6 +7,7 @@ //===----------------------------------------------------------------------===// // UNSUPPORTED: c++03 +// UNSUPPORTED: libcpp-has-no-filesystem-library // diff --git a/libcxx/test/libcxx/experimental/filesystem/version.pass.cpp b/libcxx/test/libcxx/experimental/filesystem/version.pass.cpp --- a/libcxx/test/libcxx/experimental/filesystem/version.pass.cpp +++ b/libcxx/test/libcxx/experimental/filesystem/version.pass.cpp @@ -6,6 +6,8 @@ // //===----------------------------------------------------------------------===// +// UNSUPPORTED: libcpp-has-no-filesystem-library + // #define _LIBCPP_NO_EXPERIMENTAL_DEPRECATION_WARNING_FILESYSTEM 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 @@ -130,8 +130,10 @@ TEST_MACROS(); #include TEST_MACROS(); -#include +#ifndef _LIBCPP_HAS_NO_FILESYSTEM_LIBRARY +# include TEST_MACROS(); +#endif #include TEST_MACROS(); #include @@ -313,8 +315,10 @@ # endif # include TEST_MACROS(); -# include +# ifndef _LIBCPP_HAS_NO_FILESYSTEM_LIBRARY +# include TEST_MACROS(); +# endif # include TEST_MACROS(); # include diff --git a/libcxx/test/libcxx/modules/cinttypes_exports.compile.pass.cpp b/libcxx/test/libcxx/modules/cinttypes_exports.compile.pass.cpp --- a/libcxx/test/libcxx/modules/cinttypes_exports.compile.pass.cpp +++ b/libcxx/test/libcxx/modules/cinttypes_exports.compile.pass.cpp @@ -14,6 +14,7 @@ // still get built as part of the 'std' module, which breaks the build. // UNSUPPORTED: libcpp-has-no-threads // UNSUPPORTED: libcpp-has-no-localization +// UNSUPPORTED: libcpp-has-no-filesystem-library // REQUIRES: modules-support // ADDITIONAL_COMPILE_FLAGS: -fmodules diff --git a/libcxx/test/libcxx/modules/clocale_exports.compile.pass.cpp b/libcxx/test/libcxx/modules/clocale_exports.compile.pass.cpp --- a/libcxx/test/libcxx/modules/clocale_exports.compile.pass.cpp +++ b/libcxx/test/libcxx/modules/clocale_exports.compile.pass.cpp @@ -14,6 +14,7 @@ // still get built as part of the 'std' module, which breaks the build. // UNSUPPORTED: libcpp-has-no-threads // UNSUPPORTED: libcpp-has-no-localization +// UNSUPPORTED: libcpp-has-no-filesystem-library // UNSUPPORTED: c++03 diff --git a/libcxx/test/libcxx/modules/cstdint_exports.compile.pass.cpp b/libcxx/test/libcxx/modules/cstdint_exports.compile.pass.cpp --- a/libcxx/test/libcxx/modules/cstdint_exports.compile.pass.cpp +++ b/libcxx/test/libcxx/modules/cstdint_exports.compile.pass.cpp @@ -14,6 +14,7 @@ // still get built as part of the 'std' module, which breaks the build. // UNSUPPORTED: libcpp-has-no-threads // UNSUPPORTED: libcpp-has-no-localization +// UNSUPPORTED: libcpp-has-no-filesystem-library // Test that re-exports diff --git a/libcxx/test/libcxx/modules/inttypes_h_exports.compile.pass.cpp b/libcxx/test/libcxx/modules/inttypes_h_exports.compile.pass.cpp --- a/libcxx/test/libcxx/modules/inttypes_h_exports.compile.pass.cpp +++ b/libcxx/test/libcxx/modules/inttypes_h_exports.compile.pass.cpp @@ -14,6 +14,7 @@ // still get built as part of the 'std' module, which breaks the build. // UNSUPPORTED: libcpp-has-no-threads // UNSUPPORTED: libcpp-has-no-localization +// UNSUPPORTED: libcpp-has-no-filesystem-library // Test that intypes.h re-exports stdint.h diff --git a/libcxx/test/libcxx/modules/stdint_h_exports.compile.pass.cpp b/libcxx/test/libcxx/modules/stdint_h_exports.compile.pass.cpp --- a/libcxx/test/libcxx/modules/stdint_h_exports.compile.pass.cpp +++ b/libcxx/test/libcxx/modules/stdint_h_exports.compile.pass.cpp @@ -10,6 +10,7 @@ // still get built as part of the 'std' module, which breaks the build. // UNSUPPORTED: libcpp-has-no-threads // UNSUPPORTED: libcpp-has-no-localization +// UNSUPPORTED: libcpp-has-no-filesystem-library // Test that int8_t and the like are exported from stdint.h, not inttypes.h diff --git a/libcxx/test/libcxx/modules/stds_include.sh.cpp b/libcxx/test/libcxx/modules/stds_include.sh.cpp --- a/libcxx/test/libcxx/modules/stds_include.sh.cpp +++ b/libcxx/test/libcxx/modules/stds_include.sh.cpp @@ -19,6 +19,7 @@ // still get built as part of the 'std' module, which breaks the build. // UNSUPPORTED: libcpp-has-no-threads // UNSUPPORTED: libcpp-has-no-localization +// UNSUPPORTED: libcpp-has-no-filesystem-library // REQUIRES: modules-support 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 @@ -80,7 +80,9 @@ #include #include #include -#include +#ifndef _LIBCPP_HAS_NO_FILESYSTEM_LIBRARY +# include +#endif #include #include #ifndef _LIBCPP_HAS_NO_LOCALIZATION @@ -192,7 +194,9 @@ # include # endif # include -# include +# ifndef _LIBCPP_HAS_NO_FILESYSTEM_LIBRARY +# include +# endif # include # include # include diff --git a/libcxx/test/std/experimental/filesystem/fs.req.macros/feature_macro.pass.cpp b/libcxx/test/std/experimental/filesystem/fs.req.macros/feature_macro.pass.cpp --- a/libcxx/test/std/experimental/filesystem/fs.req.macros/feature_macro.pass.cpp +++ b/libcxx/test/std/experimental/filesystem/fs.req.macros/feature_macro.pass.cpp @@ -6,6 +6,8 @@ // //===----------------------------------------------------------------------===// +// UNSUPPORTED: libcpp-has-no-filesystem-library + // // #define __cpp_lib_experimental_filesystem 201406L diff --git a/libcxx/test/std/experimental/filesystem/fs.req.namespace/namespace.pass.cpp b/libcxx/test/std/experimental/filesystem/fs.req.namespace/namespace.pass.cpp --- a/libcxx/test/std/experimental/filesystem/fs.req.namespace/namespace.pass.cpp +++ b/libcxx/test/std/experimental/filesystem/fs.req.namespace/namespace.pass.cpp @@ -7,6 +7,7 @@ //===----------------------------------------------------------------------===// // UNSUPPORTED: c++03 +// UNSUPPORTED: libcpp-has-no-filesystem-library // diff --git a/libcxx/test/std/input.output/file.streams/fstreams/filebuf.members/open_path.pass.cpp b/libcxx/test/std/input.output/file.streams/fstreams/filebuf.members/open_path.pass.cpp --- a/libcxx/test/std/input.output/file.streams/fstreams/filebuf.members/open_path.pass.cpp +++ b/libcxx/test/std/input.output/file.streams/fstreams/filebuf.members/open_path.pass.cpp @@ -7,7 +7,15 @@ //===----------------------------------------------------------------------===// // UNSUPPORTED: c++03, c++11, c++14 -// UNSUPPORTED: c++filesystem-disabled +// UNSUPPORTED: libcpp-has-no-filesystem-library + +// Filesystem is supported on Apple platforms starting with macosx10.15. +// UNSUPPORTED: with_system_cxx_lib=macosx10.14 +// UNSUPPORTED: with_system_cxx_lib=macosx10.13 +// UNSUPPORTED: with_system_cxx_lib=macosx10.12 +// UNSUPPORTED: with_system_cxx_lib=macosx10.11 +// UNSUPPORTED: with_system_cxx_lib=macosx10.10 +// UNSUPPORTED: with_system_cxx_lib=macosx10.9 // diff --git a/libcxx/test/std/input.output/file.streams/fstreams/fstream.cons/path.pass.cpp b/libcxx/test/std/input.output/file.streams/fstreams/fstream.cons/path.pass.cpp --- a/libcxx/test/std/input.output/file.streams/fstreams/fstream.cons/path.pass.cpp +++ b/libcxx/test/std/input.output/file.streams/fstreams/fstream.cons/path.pass.cpp @@ -7,7 +7,15 @@ //===----------------------------------------------------------------------===// // UNSUPPORTED: c++03, c++11, c++14 -// UNSUPPORTED: c++filesystem-disabled +// UNSUPPORTED: libcpp-has-no-filesystem-library + +// Filesystem is supported on Apple platforms starting with macosx10.15. +// UNSUPPORTED: with_system_cxx_lib=macosx10.14 +// UNSUPPORTED: with_system_cxx_lib=macosx10.13 +// UNSUPPORTED: with_system_cxx_lib=macosx10.12 +// UNSUPPORTED: with_system_cxx_lib=macosx10.11 +// UNSUPPORTED: with_system_cxx_lib=macosx10.10 +// UNSUPPORTED: with_system_cxx_lib=macosx10.9 // diff --git a/libcxx/test/std/input.output/file.streams/fstreams/fstream.members/open_path.pass.cpp b/libcxx/test/std/input.output/file.streams/fstreams/fstream.members/open_path.pass.cpp --- a/libcxx/test/std/input.output/file.streams/fstreams/fstream.members/open_path.pass.cpp +++ b/libcxx/test/std/input.output/file.streams/fstreams/fstream.members/open_path.pass.cpp @@ -7,7 +7,15 @@ //===----------------------------------------------------------------------===// // UNSUPPORTED: c++03, c++11, c++14 -// UNSUPPORTED: c++filesystem-disabled +// UNSUPPORTED: libcpp-has-no-filesystem-library + +// Filesystem is supported on Apple platforms starting with macosx10.15. +// UNSUPPORTED: with_system_cxx_lib=macosx10.14 +// UNSUPPORTED: with_system_cxx_lib=macosx10.13 +// UNSUPPORTED: with_system_cxx_lib=macosx10.12 +// UNSUPPORTED: with_system_cxx_lib=macosx10.11 +// UNSUPPORTED: with_system_cxx_lib=macosx10.10 +// UNSUPPORTED: with_system_cxx_lib=macosx10.9 // diff --git a/libcxx/test/std/input.output/file.streams/fstreams/ifstream.cons/path.pass.cpp b/libcxx/test/std/input.output/file.streams/fstreams/ifstream.cons/path.pass.cpp --- a/libcxx/test/std/input.output/file.streams/fstreams/ifstream.cons/path.pass.cpp +++ b/libcxx/test/std/input.output/file.streams/fstreams/ifstream.cons/path.pass.cpp @@ -7,7 +7,16 @@ //===----------------------------------------------------------------------===// // UNSUPPORTED: c++03, c++11, c++14 -// UNSUPPORTED: c++filesystem-disabled +// UNSUPPORTED: libcpp-has-no-filesystem-library + +// Filesystem is supported on Apple platforms starting with macosx10.15. +// UNSUPPORTED: with_system_cxx_lib=macosx10.14 +// UNSUPPORTED: with_system_cxx_lib=macosx10.13 +// UNSUPPORTED: with_system_cxx_lib=macosx10.12 +// UNSUPPORTED: with_system_cxx_lib=macosx10.11 +// UNSUPPORTED: with_system_cxx_lib=macosx10.10 +// UNSUPPORTED: with_system_cxx_lib=macosx10.9 + // FILE_DEPENDENCIES: test.dat // diff --git a/libcxx/test/std/input.output/file.streams/fstreams/ifstream.members/open_path.pass.cpp b/libcxx/test/std/input.output/file.streams/fstreams/ifstream.members/open_path.pass.cpp --- a/libcxx/test/std/input.output/file.streams/fstreams/ifstream.members/open_path.pass.cpp +++ b/libcxx/test/std/input.output/file.streams/fstreams/ifstream.members/open_path.pass.cpp @@ -7,7 +7,16 @@ //===----------------------------------------------------------------------===// // UNSUPPORTED: c++03, c++11, c++14 -// UNSUPPORTED: c++filesystem-disabled +// UNSUPPORTED: libcpp-has-no-filesystem-library + +// Filesystem is supported on Apple platforms starting with macosx10.15. +// UNSUPPORTED: with_system_cxx_lib=macosx10.14 +// UNSUPPORTED: with_system_cxx_lib=macosx10.13 +// UNSUPPORTED: with_system_cxx_lib=macosx10.12 +// UNSUPPORTED: with_system_cxx_lib=macosx10.11 +// UNSUPPORTED: with_system_cxx_lib=macosx10.10 +// UNSUPPORTED: with_system_cxx_lib=macosx10.9 + // FILE_DEPENDENCIES: test.dat // diff --git a/libcxx/test/std/input.output/file.streams/fstreams/ofstream.cons/path.pass.cpp b/libcxx/test/std/input.output/file.streams/fstreams/ofstream.cons/path.pass.cpp --- a/libcxx/test/std/input.output/file.streams/fstreams/ofstream.cons/path.pass.cpp +++ b/libcxx/test/std/input.output/file.streams/fstreams/ofstream.cons/path.pass.cpp @@ -7,7 +7,15 @@ //===----------------------------------------------------------------------===// // UNSUPPORTED: c++03, c++11, c++14 -// UNSUPPORTED: c++filesystem-disabled +// UNSUPPORTED: libcpp-has-no-filesystem-library + +// Filesystem is supported on Apple platforms starting with macosx10.15. +// UNSUPPORTED: with_system_cxx_lib=macosx10.14 +// UNSUPPORTED: with_system_cxx_lib=macosx10.13 +// UNSUPPORTED: with_system_cxx_lib=macosx10.12 +// UNSUPPORTED: with_system_cxx_lib=macosx10.11 +// UNSUPPORTED: with_system_cxx_lib=macosx10.10 +// UNSUPPORTED: with_system_cxx_lib=macosx10.9 // diff --git a/libcxx/test/std/input.output/file.streams/fstreams/ofstream.members/open_path.pass.cpp b/libcxx/test/std/input.output/file.streams/fstreams/ofstream.members/open_path.pass.cpp --- a/libcxx/test/std/input.output/file.streams/fstreams/ofstream.members/open_path.pass.cpp +++ b/libcxx/test/std/input.output/file.streams/fstreams/ofstream.members/open_path.pass.cpp @@ -7,7 +7,15 @@ //===----------------------------------------------------------------------===// // UNSUPPORTED: c++03, c++11, c++14 -// UNSUPPORTED: c++filesystem-disabled +// UNSUPPORTED: libcpp-has-no-filesystem-library + +// Filesystem is supported on Apple platforms starting with macosx10.15. +// UNSUPPORTED: with_system_cxx_lib=macosx10.14 +// UNSUPPORTED: with_system_cxx_lib=macosx10.13 +// UNSUPPORTED: with_system_cxx_lib=macosx10.12 +// UNSUPPORTED: with_system_cxx_lib=macosx10.11 +// UNSUPPORTED: with_system_cxx_lib=macosx10.10 +// UNSUPPORTED: with_system_cxx_lib=macosx10.9 // diff --git a/libcxx/test/std/input.output/filesystems/lit.local.cfg b/libcxx/test/std/input.output/filesystems/lit.local.cfg --- a/libcxx/test/std/input.output/filesystems/lit.local.cfg +++ b/libcxx/test/std/input.output/filesystems/lit.local.cfg @@ -1,2 +1,9 @@ -if 'c++filesystem-disabled' in config.available_features: +# Filesystem is supported on Apple platforms starting with macosx10.15. +# Automatically disable the tests when we're running the test +# suite against an older macOS. +too_old = {'10.9', '10.10', '10.11', '10.12', '10.13', '10.14'} +if any('with_system_cxx_lib=macosx{}'.format(v) in config.available_features for v in too_old): config.unsupported = True + +if 'libcpp-has-no-filesystem-library' in config.available_features: + config.unsupported = True diff --git a/libcxx/test/std/language.support/support.limits/support.limits.general/filesystem.version.pass.cpp b/libcxx/test/std/language.support/support.limits/support.limits.general/filesystem.version.pass.cpp --- a/libcxx/test/std/language.support/support.limits/support.limits.general/filesystem.version.pass.cpp +++ b/libcxx/test/std/language.support/support.limits/support.limits.general/filesystem.version.pass.cpp @@ -11,6 +11,8 @@ // // clang-format off +// UNSUPPORTED: libcpp-has-no-filesystem-library + // // Test the feature test macros defined by diff --git a/libcxx/test/std/utilities/time/time.clock/time.clock.file/now.pass.cpp b/libcxx/test/std/utilities/time/time.clock/time.clock.file/now.pass.cpp --- a/libcxx/test/std/utilities/time/time.clock/time.clock.file/now.pass.cpp +++ b/libcxx/test/std/utilities/time/time.clock/time.clock.file/now.pass.cpp @@ -7,7 +7,15 @@ //===----------------------------------------------------------------------===// // UNSUPPORTED: c++03, c++11, c++14, c++17 -// UNSUPPORTED: c++filesystem-disabled +// UNSUPPORTED: libcpp-has-no-filesystem-library + +// Filesystem is supported on Apple platforms starting with macosx10.15. +// UNSUPPORTED: with_system_cxx_lib=macosx10.14 +// UNSUPPORTED: with_system_cxx_lib=macosx10.13 +// UNSUPPORTED: with_system_cxx_lib=macosx10.12 +// UNSUPPORTED: with_system_cxx_lib=macosx10.11 +// UNSUPPORTED: with_system_cxx_lib=macosx10.10 +// UNSUPPORTED: with_system_cxx_lib=macosx10.9 // 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 @@ -175,6 +175,17 @@ - exit_status: -1 # Agent was lost limit: 2 + - label: "No Filesystem" + command: "libcxx/utils/ci/run-buildbot generic-no-filesystem" + artifact_paths: + - "**/test-results.xml" + agents: + queue: "libcxx-builders" + retry: + automatic: + - exit_status: -1 # Agent was lost + limit: 2 + - label: "No random device" command: "libcxx/utils/ci/run-buildbot generic-no-random_device" artifact_paths: diff --git a/libcxx/utils/ci/macos-backdeployment.sh b/libcxx/utils/ci/macos-backdeployment.sh --- a/libcxx/utils/ci/macos-backdeployment.sh +++ b/libcxx/utils/ci/macos-backdeployment.sh @@ -120,13 +120,6 @@ LIBCXX_ROOT_ON_DEPLOYMENT_TARGET="${PREVIOUS_DYLIBS_DIR}/macOS/libc++/${DEPLOYMENT_TARGET}" LIBCXXABI_ROOT_ON_DEPLOYMENT_TARGET="${PREVIOUS_DYLIBS_DIR}/macOS/libc++abi/${DEPLOYMENT_TARGET}" -# Filesystem is supported on Apple platforms starting with macosx10.15. -if [[ ${DEPLOYMENT_TARGET} =~ ^10.9|10.10|10.11|10.12|10.13|10.14$ ]]; then - ENABLE_FILESYSTEM="--param enable_filesystem=false" -else - ENABLE_FILESYSTEM="--param enable_filesystem=true" -fi - # TODO: We need to also run the tests for libc++abi. echo "@@@ Running tests for libc++ @@@" "${LLVM_BUILD_DIR}/bin/llvm-lit" -sv "${MONOREPO_ROOT}/libcxx/test" \ 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 @@ -225,6 +225,13 @@ generate-cmake -C "${MONOREPO_ROOT}/libcxx/cmake/caches/Generic-nodebug.cmake" check-cxx-cxxabi ;; +generic-no-filesystem) + export CC=clang + export CXX=clang++ + clean + generate-cmake -C "${MONOREPO_ROOT}/libcxx/cmake/caches/Generic-no-filesystem.cmake" + check-cxx-cxxabi +;; generic-no-random_device) export CC=clang export CXX=clang++ @@ -271,10 +278,6 @@ PARAMS+=";cxx_runtime_root=${OSX_ROOTS}/macOS/libc++/${DEPLOYMENT_TARGET}" PARAMS+=";abi_library_path=${OSX_ROOTS}/macOS/libc++abi/${DEPLOYMENT_TARGET}" PARAMS+=";use_system_cxx_lib=True" - # Filesystem is supported on Apple platforms starting with macosx10.15. - if [[ ${DEPLOYMENT_TARGET} =~ ^10.9|10.10|10.11|10.12|10.13|10.14$ ]]; then - PARAMS+=";enable_filesystem=False" - fi export CC=clang export CXX=clang++ diff --git a/libcxx/utils/generate_feature_test_macro_components.py b/libcxx/utils/generate_feature_test_macro_components.py --- a/libcxx/utils/generate_feature_test_macro_components.py +++ b/libcxx/utils/generate_feature_test_macro_components.py @@ -646,6 +646,7 @@ lit_markup = { "atomic": ["UNSUPPORTED: libcpp-has-no-threads"], "barrier": ["UNSUPPORTED: libcpp-has-no-threads"], + "filesystem": ["UNSUPPORTED: libcpp-has-no-filesystem-library"], "iomanip": ["UNSUPPORTED: libcpp-has-no-localization"], "istream": ["UNSUPPORTED: libcpp-has-no-localization"], "latch": ["UNSUPPORTED: libcpp-has-no-threads"], 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 @@ -30,6 +30,9 @@ "semaphore": ["ifndef _LIBCPP_HAS_NO_THREADS"], "thread": ["ifndef _LIBCPP_HAS_NO_THREADS"], + "filesystem": ["ifndef _LIBCPP_HAS_NO_FILESYSTEM_LIBRARY"], + "experimental/filesystem": ["ifndef _LIBCPP_HAS_NO_FILESYSTEM_LIBRARY"], + "clocale": ["ifndef _LIBCPP_HAS_NO_LOCALIZATION"], "codecvt": ["ifndef _LIBCPP_HAS_NO_LOCALIZATION"], "fstream": ["ifndef _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 @@ -102,6 +102,7 @@ '_LIBCPP_NO_VCRUNTIME': 'libcpp-no-vcruntime', '_LIBCPP_ABI_VERSION': 'libcpp-abi-version', '_LIBCPP_ABI_UNSTABLE': 'libcpp-abi-unstable', + '_LIBCPP_HAS_NO_FILESYSTEM_LIBRARY': 'libcpp-has-no-filesystem-library', '_LIBCPP_HAS_NO_RANDOM_DEVICE': 'libcpp-has-no-random-device', '_LIBCPP_HAS_NO_LOCALIZATION': 'libcpp-has-no-localization', } diff --git a/libcxx/utils/libcxx/test/params.py b/libcxx/utils/libcxx/test/params.py --- a/libcxx/utils/libcxx/test/params.py +++ b/libcxx/utils/libcxx/test/params.py @@ -86,12 +86,6 @@ ]), # Parameters to enable or disable parts of the test suite - Parameter(name='enable_filesystem', choices=[True, False], type=bool, default=True, - help="Whether to enable tests for the C++ library.", - actions=lambda filesystem: [] if filesystem else [ - AddFeature('c++filesystem-disabled') - ]), - Parameter(name='enable_experimental', choices=[True, False], type=bool, default=False, help="Whether to enable tests for experimental C++ libraries (typically Library Fundamentals TSes).", actions=lambda experimental: [] if not experimental else [