aboutsummaryrefslogtreecommitdiff
path: root/libcxx
diff options
context:
space:
mode:
authorLouis Dionne <ldionne.2@gmail.com>2021-01-18 12:18:18 -0500
committerLouis Dionne <ldionne.2@gmail.com>2021-01-19 14:15:48 -0500
commit933518fff82c8f39626bbcca81adc516483a9651 (patch)
tree53ee8bbeae82e77f1821be348f06fb8fe33be32f /libcxx
parent68dba7eae1df333738d1c77cbbefd480995c1972 (diff)
downloadllvm-933518fff82c8f39626bbcca81adc516483a9651.zip
llvm-933518fff82c8f39626bbcca81adc516483a9651.tar.gz
llvm-933518fff82c8f39626bbcca81adc516483a9651.tar.bz2
[libc++] Make LIBCXX_ENABLE_FILESYSTEM fully consistent
Previously, LIBCXX_ENABLE_FILESYSTEM controlled only whether the filesystem support was compiled into libc++'s library. This commit promotes the setting to a first-class option like LIBCXX_ENABLE_LOCALIZATION, where the whole library is aware of the setting and features that depend on <filesystem> won't be provided at all. The test suite is also properly annotated such that tests that depend on <filesystem> are disabled when the library doesn't support it. This is an alternative to https://llvm.org/D94824, but also an improvement along the lines of LIBCXX_ENABLE_LOCALIZATION that I had been wanting to make for a while. Differential Revision: https://reviews.llvm.org/D94921
Diffstat (limited to 'libcxx')
-rw-r--r--libcxx/CMakeLists.txt1
-rw-r--r--libcxx/cmake/caches/Generic-no-filesystem.cmake1
-rw-r--r--libcxx/include/__config_site.in1
-rw-r--r--libcxx/include/filesystem4
-rw-r--r--libcxx/include/fstream19
-rw-r--r--libcxx/test/configs/legacy.cfg.in1
-rw-r--r--libcxx/test/libcxx/double_include.sh.cpp8
-rw-r--r--libcxx/test/libcxx/experimental/filesystem/deprecated.verify.cpp1
-rw-r--r--libcxx/test/libcxx/experimental/filesystem/version.pass.cpp2
-rw-r--r--libcxx/test/libcxx/min_max_macros.compile.pass.cpp8
-rw-r--r--libcxx/test/libcxx/modules/cinttypes_exports.compile.pass.cpp1
-rw-r--r--libcxx/test/libcxx/modules/clocale_exports.compile.pass.cpp1
-rw-r--r--libcxx/test/libcxx/modules/cstdint_exports.compile.pass.cpp1
-rw-r--r--libcxx/test/libcxx/modules/inttypes_h_exports.compile.pass.cpp1
-rw-r--r--libcxx/test/libcxx/modules/stdint_h_exports.compile.pass.cpp1
-rw-r--r--libcxx/test/libcxx/modules/stds_include.sh.cpp1
-rw-r--r--libcxx/test/libcxx/no_assert_include.compile.pass.cpp8
-rw-r--r--libcxx/test/std/experimental/filesystem/fs.req.macros/feature_macro.pass.cpp2
-rw-r--r--libcxx/test/std/experimental/filesystem/fs.req.namespace/namespace.pass.cpp1
-rw-r--r--libcxx/test/std/input.output/file.streams/fstreams/filebuf.members/open_path.pass.cpp10
-rw-r--r--libcxx/test/std/input.output/file.streams/fstreams/fstream.cons/path.pass.cpp10
-rw-r--r--libcxx/test/std/input.output/file.streams/fstreams/fstream.members/open_path.pass.cpp10
-rw-r--r--libcxx/test/std/input.output/file.streams/fstreams/ifstream.cons/path.pass.cpp11
-rw-r--r--libcxx/test/std/input.output/file.streams/fstreams/ifstream.members/open_path.pass.cpp11
-rw-r--r--libcxx/test/std/input.output/file.streams/fstreams/ofstream.cons/path.pass.cpp10
-rw-r--r--libcxx/test/std/input.output/file.streams/fstreams/ofstream.members/open_path.pass.cpp10
-rw-r--r--libcxx/test/std/input.output/filesystems/lit.local.cfg9
-rw-r--r--libcxx/test/std/language.support/support.limits/support.limits.general/filesystem.version.pass.cpp2
-rw-r--r--libcxx/test/std/utilities/time/time.clock/time.clock.file/now.pass.cpp10
-rw-r--r--libcxx/utils/ci/buildkite-pipeline.yml11
-rwxr-xr-xlibcxx/utils/ci/macos-backdeployment.sh7
-rwxr-xr-xlibcxx/utils/ci/run-buildbot11
-rwxr-xr-xlibcxx/utils/generate_feature_test_macro_components.py1
-rwxr-xr-xlibcxx/utils/generate_header_tests.py3
-rw-r--r--libcxx/utils/libcxx/test/features.py1
-rw-r--r--libcxx/utils/libcxx/test/params.py6
36 files changed, 155 insertions, 41 deletions
diff --git a/libcxx/CMakeLists.txt b/libcxx/CMakeLists.txt
index 46a6695..6a55245 100644
--- a/libcxx/CMakeLists.txt
+++ b/libcxx/CMakeLists.txt
@@ -845,6 +845,7 @@ config_define_if(LIBCXX_BUILD_EXTERNAL_THREAD_LIBRARY _LIBCPP_HAS_THREAD_LIBRARY
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
index 0000000..4000f3a
--- /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
index 6089fb7..ec4d410 100644
--- 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
index c60020a..92e37e1 100644
--- 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
index 701f65b..d7d6b46 100644
--- a/libcxx/include/fstream
+++ b/libcxx/include/fstream
@@ -186,7 +186,10 @@ typedef basic_fstream<wchar_t> wfstream;
#include <__locale>
#include <cstdio>
#include <cstdlib>
-#include <filesystem>
+
+#if !defined(_LIBCPP_HAS_NO_FILESYSTEM_LIBRARY)
+# include <filesystem>
+#endif
#if !defined(_LIBCPP_HAS_NO_PRAGMA_SYSTEM_HEADER)
#pragma GCC system_header
@@ -235,7 +238,7 @@ public:
_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 @@ public:
#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 @@ public:
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 @@ public:
_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 @@ public:
#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 @@ public:
_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 @@ public:
#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
index c8c6855..8090517 100644
--- a/libcxx/test/configs/legacy.cfg.in
+++ b/libcxx/test/configs/legacy.cfg.in
@@ -11,7 +11,6 @@ config.cxx_library_root = "@LIBCXX_LIBRARY_DIR@"
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
index f382ee7..5e6fa2b 100644
--- a/libcxx/test/libcxx/double_include.sh.cpp
+++ b/libcxx/test/libcxx/double_include.sh.cpp
@@ -87,7 +87,9 @@
#include <exception>
#include <execution>
#include <fenv.h>
-#include <filesystem>
+#ifndef _LIBCPP_HAS_NO_FILESYSTEM_LIBRARY
+# include <filesystem>
+#endif
#include <float.h>
#include <forward_list>
#ifndef _LIBCPP_HAS_NO_LOCALIZATION
@@ -199,7 +201,9 @@
# include <experimental/coroutine>
# endif
# include <experimental/deque>
-# include <experimental/filesystem>
+# ifndef _LIBCPP_HAS_NO_FILESYSTEM_LIBRARY
+# include <experimental/filesystem>
+# endif
# include <experimental/forward_list>
# include <experimental/functional>
# include <experimental/iterator>
diff --git a/libcxx/test/libcxx/experimental/filesystem/deprecated.verify.cpp b/libcxx/test/libcxx/experimental/filesystem/deprecated.verify.cpp
index 47fed610..d9064e1 100644
--- 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
// <experimental/filesystem>
diff --git a/libcxx/test/libcxx/experimental/filesystem/version.pass.cpp b/libcxx/test/libcxx/experimental/filesystem/version.pass.cpp
index 08d49be..70c3ba7 100644
--- 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
+
// <experimental/filesystem>
#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
index 953dbbe..6bf58c71f 100644
--- 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();
TEST_MACROS();
#include <fenv.h>
TEST_MACROS();
-#include <filesystem>
+#ifndef _LIBCPP_HAS_NO_FILESYSTEM_LIBRARY
+# include <filesystem>
TEST_MACROS();
+#endif
#include <float.h>
TEST_MACROS();
#include <forward_list>
@@ -313,8 +315,10 @@ TEST_MACROS();
# endif
# include <experimental/deque>
TEST_MACROS();
-# include <experimental/filesystem>
+# ifndef _LIBCPP_HAS_NO_FILESYSTEM_LIBRARY
+# include <experimental/filesystem>
TEST_MACROS();
+# endif
# include <experimental/forward_list>
TEST_MACROS();
# include <experimental/functional>
diff --git a/libcxx/test/libcxx/modules/cinttypes_exports.compile.pass.cpp b/libcxx/test/libcxx/modules/cinttypes_exports.compile.pass.cpp
index ec5c8de..aa3ae7f 100644
--- 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
index a460c6e..92c50e24 100644
--- 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
index c106bf6..b83e4da 100644
--- 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 <cstdint> re-exports <stdint.h>
diff --git a/libcxx/test/libcxx/modules/inttypes_h_exports.compile.pass.cpp b/libcxx/test/libcxx/modules/inttypes_h_exports.compile.pass.cpp
index 59b0d62..ffc6a62 100644
--- 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
index 830a251..2b1997a 100644
--- 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
index 5235c7b..9ea13bb 100644
--- 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
index e2aba50..287039b 100644
--- 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 <exception>
#include <execution>
#include <fenv.h>
-#include <filesystem>
+#ifndef _LIBCPP_HAS_NO_FILESYSTEM_LIBRARY
+# include <filesystem>
+#endif
#include <float.h>
#include <forward_list>
#ifndef _LIBCPP_HAS_NO_LOCALIZATION
@@ -192,7 +194,9 @@
# include <experimental/coroutine>
# endif
# include <experimental/deque>
-# include <experimental/filesystem>
+# ifndef _LIBCPP_HAS_NO_FILESYSTEM_LIBRARY
+# include <experimental/filesystem>
+# endif
# include <experimental/forward_list>
# include <experimental/functional>
# include <experimental/iterator>
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
index 76efcce..58cadb5 100644
--- 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
+
// <experimental/filesystem>
// #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
index 97d1751..7a82fe6 100644
--- 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
// <experimental/filesystem>
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
index baa00aa..b51f959 100644
--- 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
// <fstream>
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
index a910f8b..8384f50 100644
--- 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
// <fstream>
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
index 62cbc61..bd5b1f8 100644
--- 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
// <fstream>
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
index 51543f0..483cfba 100644
--- 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
// <fstream>
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
index 10eec8f..3e440c9 100644
--- 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
// <fstream>
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
index 64885ab..2406295 100644
--- 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
// <fstream>
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
index c088573..c656ada 100644
--- 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
// <fstream>
diff --git a/libcxx/test/std/input.output/filesystems/lit.local.cfg b/libcxx/test/std/input.output/filesystems/lit.local.cfg
index 682a2ab..792a902 100644
--- 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 <filesystem> 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
index 4485078..6e47bdf 100644
--- 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
+
// <filesystem>
// Test the feature test macros defined by <filesystem>
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
index 02c48ba..9bc0477 100644
--- 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
// <chrono>
diff --git a/libcxx/utils/ci/buildkite-pipeline.yml b/libcxx/utils/ci/buildkite-pipeline.yml
index 7ad2556..f133a042 100644
--- a/libcxx/utils/ci/buildkite-pipeline.yml
+++ b/libcxx/utils/ci/buildkite-pipeline.yml
@@ -175,6 +175,17 @@ steps:
- 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
index f91d719..9ce7f3c 100755
--- a/libcxx/utils/ci/macos-backdeployment.sh
+++ b/libcxx/utils/ci/macos-backdeployment.sh
@@ -120,13 +120,6 @@ fi
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
index ec4080a..1fb09f3 100755
--- a/libcxx/utils/ci/run-buildbot
+++ b/libcxx/utils/ci/run-buildbot
@@ -225,6 +225,13 @@ generic-nodebug)
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 @@ x86_64-apple-system-backdeployment-*)
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
index 2ce7960..11bbb2f 100755
--- a/libcxx/utils/generate_feature_test_macro_components.py
+++ b/libcxx/utils/generate_feature_test_macro_components.py
@@ -646,6 +646,7 @@ assert all(tc["headers"] == sorted(tc["headers"]) for tc in feature_test_macros)
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
index b00f0d5..b4ed43b 100755
--- a/libcxx/utils/generate_header_tests.py
+++ b/libcxx/utils/generate_header_tests.py
@@ -30,6 +30,9 @@ header_markup = {
"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
index a435a93..248e4bf 100644
--- a/libcxx/utils/libcxx/test/features.py
+++ b/libcxx/utils/libcxx/test/features.py
@@ -102,6 +102,7 @@ macros = {
'_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
index 6b508ad..fef2543 100644
--- a/libcxx/utils/libcxx/test/params.py
+++ b/libcxx/utils/libcxx/test/params.py
@@ -86,12 +86,6 @@ DEFAULT_PARAMETERS = [
]),
# 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++ <filesystem> 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 [