[llvm-branch-commits] [libcxx] 933518f - [libc++] Make LIBCXX_ENABLE_FILESYSTEM fully consistent

Louis Dionne via llvm-branch-commits llvm-branch-commits at lists.llvm.org
Tue Jan 19 11:20:15 PST 2021


Author: Louis Dionne
Date: 2021-01-19T14:15:48-05:00
New Revision: 933518fff82c8f39626bbcca81adc516483a9651

URL: https://github.com/llvm/llvm-project/commit/933518fff82c8f39626bbcca81adc516483a9651
DIFF: https://github.com/llvm/llvm-project/commit/933518fff82c8f39626bbcca81adc516483a9651.diff

LOG: [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

Added: 
    libcxx/cmake/caches/Generic-no-filesystem.cmake

Modified: 
    libcxx/CMakeLists.txt
    libcxx/include/__config_site.in
    libcxx/include/filesystem
    libcxx/include/fstream
    libcxx/test/configs/legacy.cfg.in
    libcxx/test/libcxx/double_include.sh.cpp
    libcxx/test/libcxx/experimental/filesystem/deprecated.verify.cpp
    libcxx/test/libcxx/experimental/filesystem/version.pass.cpp
    libcxx/test/libcxx/min_max_macros.compile.pass.cpp
    libcxx/test/libcxx/modules/cinttypes_exports.compile.pass.cpp
    libcxx/test/libcxx/modules/clocale_exports.compile.pass.cpp
    libcxx/test/libcxx/modules/cstdint_exports.compile.pass.cpp
    libcxx/test/libcxx/modules/inttypes_h_exports.compile.pass.cpp
    libcxx/test/libcxx/modules/stdint_h_exports.compile.pass.cpp
    libcxx/test/libcxx/modules/stds_include.sh.cpp
    libcxx/test/libcxx/no_assert_include.compile.pass.cpp
    libcxx/test/std/experimental/filesystem/fs.req.macros/feature_macro.pass.cpp
    libcxx/test/std/experimental/filesystem/fs.req.namespace/namespace.pass.cpp
    libcxx/test/std/input.output/file.streams/fstreams/filebuf.members/open_path.pass.cpp
    libcxx/test/std/input.output/file.streams/fstreams/fstream.cons/path.pass.cpp
    libcxx/test/std/input.output/file.streams/fstreams/fstream.members/open_path.pass.cpp
    libcxx/test/std/input.output/file.streams/fstreams/ifstream.cons/path.pass.cpp
    libcxx/test/std/input.output/file.streams/fstreams/ifstream.members/open_path.pass.cpp
    libcxx/test/std/input.output/file.streams/fstreams/ofstream.cons/path.pass.cpp
    libcxx/test/std/input.output/file.streams/fstreams/ofstream.members/open_path.pass.cpp
    libcxx/test/std/input.output/filesystems/lit.local.cfg
    libcxx/test/std/language.support/support.limits/support.limits.general/filesystem.version.pass.cpp
    libcxx/test/std/utilities/time/time.clock/time.clock.file/now.pass.cpp
    libcxx/utils/ci/buildkite-pipeline.yml
    libcxx/utils/ci/macos-backdeployment.sh
    libcxx/utils/ci/run-buildbot
    libcxx/utils/generate_feature_test_macro_components.py
    libcxx/utils/generate_header_tests.py
    libcxx/utils/libcxx/test/features.py
    libcxx/utils/libcxx/test/params.py

Removed: 
    


################################################################################
diff  --git a/libcxx/CMakeLists.txt b/libcxx/CMakeLists.txt
index 46a669500548..6a55245ab87a 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 000000000000..4000f3a3e8ef
--- /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 6089fb7d0133..ec4d410bb971 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 c60020a3e893..92e37e183def 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 701f65b44452..d7d6b46c32d9 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 c8c6855140c0..8090517f08a6 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 f382ee7ab9f6..5e6fa2b14e23 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 47fed610998a..d9064e182e82 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 08d49be0ddca..70c3ba742222 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 953dbbea5e66..6bf58c71fbc1 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 ec5c8de3f01b..aa3ae7f97a21 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 a460c6e884ff..92c50e24a0cb 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 c106bf68e86c..b83e4da37471 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 59b0d6256d7e..ffc6a6296b18 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 830a2515be03..2b1997a24e6d 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 5235c7b05432..9ea13bbc3407 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 e2aba50d0960..287039b57d2c 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 76efcce9aceb..58cadb53e49a 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 97d175103986..7a82fe6cd474 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 baa00aaf4104..b51f9598f948 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 a910f8bf6d8e..8384f503eba9 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 62cbc61ccfdf..bd5b1f81e0c9 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 51543f0fa736..483cfbacd642 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 10eec8f9580c..3e440c9fdb21 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 64885abd764a..2406295be402 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 c0885736c43a..c656ada41d95 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 682a2ab1c63b..792a902ceb2a 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 44850780d315..6e47bdf3b5fe 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 02c48ba2c6c7..9bc047771d6d 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 7ad2556f60e0..f133a04245f4 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 f91d7197e9e5..9ce7f3cefe05 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 ec4080a61d98..1fb09f3a91aa 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 2ce79606981f..11bbb2fd65ed 100755
--- a/libcxx/utils/generate_feature_test_macro_components.py
+++ b/libcxx/utils/generate_feature_test_macro_components.py
@@ -646,6 +646,7 @@ def add_version_header(tc):
 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 b00f0d53be47..b4ed43ba030c 100755
--- a/libcxx/utils/generate_header_tests.py
+++ b/libcxx/utils/generate_header_tests.py
@@ -30,6 +30,9 @@ def get_libcxx_paths():
     "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 a435a938fdcd..248e4bfbee3c 100644
--- 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
index 6b508ad26df8..fef2543f0b6f 100644
--- 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++ <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 [


        


More information about the llvm-branch-commits mailing list