Index: libcxx/include/__config =================================================================== --- libcxx/include/__config +++ libcxx/include/__config @@ -1368,6 +1368,21 @@ # define _LIBCPP_AVAILABILITY_ATOMIC_SHARED_PTR \ __attribute__((availability(macosx,strict,introduced=10.9))) \ __attribute__((availability(ios,strict,introduced=7.0))) +# define _LIBCPP_AVAILABILITY_FILESYSTEM \ + __attribute__((availability(macosx,strict,unavailable))) \ + __attribute__((availability(ios,strict,unavailable))) \ + __attribute__((availability(tvos,strict,unavailable))) \ + __attribute__((availability(watchos,strict,unavailable))) +# define _LIBCPP_AVAILABILITY_FILESYSTEM_PUSH \ + _Pragma("clang attribute push(__attribute__((availability(macosx,strict,unavailable))), apply_to=any(function,record))") \ + _Pragma("clang attribute push(__attribute__((availability(ios,strict,unavailable))), apply_to=any(function,record))") \ + _Pragma("clang attribute push(__attribute__((availability(tvos,strict,unavailable))), apply_to=any(function,record))") \ + _Pragma("clang attribute push(__attribute__((availability(watchos,strict,unavailable))), apply_to=any(function,record))") +# define _LIBCPP_AVAILABILITY_FILESYSTEM_POP \ + _Pragma("clang attribute pop") \ + _Pragma("clang attribute pop") \ + _Pragma("clang attribute pop") \ + _Pragma("clang attribute pop") #else # define _LIBCPP_AVAILABILITY_SHARED_MUTEX # define _LIBCPP_AVAILABILITY_BAD_VARIANT_ACCESS @@ -1379,6 +1394,9 @@ # define _LIBCPP_AVAILABILITY_TYPEINFO_VTABLE # define _LIBCPP_AVAILABILITY_LOCALE_CATEGORY # define _LIBCPP_AVAILABILITY_ATOMIC_SHARED_PTR +# define _LIBCPP_AVAILABILITY_FILESYSTEM +# define _LIBCPP_AVAILABILITY_FILESYSTEM_PUSH +# define _LIBCPP_AVAILABILITY_FILESYSTEM_POP #endif // Define availability that depends on _LIBCPP_NO_EXCEPTIONS. Index: libcxx/include/chrono =================================================================== --- libcxx/include/chrono +++ libcxx/include/chrono @@ -2841,7 +2841,7 @@ static _LIBCPP_CONSTEXPR_AFTER_CXX11 const bool is_steady = false; - _LIBCPP_FUNC_VIS static time_point now() noexcept; + _LIBCPP_AVAILABILITY_FILESYSTEM _LIBCPP_FUNC_VIS static time_point now() noexcept; _LIBCPP_INLINE_VISIBILITY static time_t to_time_t(const time_point& __t) noexcept { Index: libcxx/include/filesystem =================================================================== --- libcxx/include/filesystem +++ libcxx/include/filesystem @@ -258,6 +258,8 @@ _LIBCPP_BEGIN_NAMESPACE_FILESYSTEM +_LIBCPP_AVAILABILITY_FILESYSTEM_PUSH + typedef chrono::time_point<_FilesystemClock> file_time_type; struct _LIBCPP_TYPE_VIS space_info { @@ -1310,7 +1312,11 @@ return !(__lhs == __rhs); } -class _LIBCPP_EXCEPTION_ABI filesystem_error : public system_error { +// TODO(ldionne): We need to pop the pragma and push it again after +// filesystem_error to work around PR41078. +_LIBCPP_AVAILABILITY_FILESYSTEM_POP + +class _LIBCPP_AVAILABILITY_FILESYSTEM _LIBCPP_EXCEPTION_ABI filesystem_error : public system_error { public: _LIBCPP_INLINE_VISIBILITY filesystem_error(const string& __what, error_code __ec) @@ -1361,6 +1367,8 @@ shared_ptr<_Storage> __storage_; }; +_LIBCPP_AVAILABILITY_FILESYSTEM_PUSH + template _LIBCPP_NORETURN inline _LIBCPP_INLINE_VISIBILITY #ifndef _LIBCPP_NO_EXCEPTIONS @@ -2624,6 +2632,8 @@ return recursive_directory_iterator(); } +_LIBCPP_AVAILABILITY_FILESYSTEM_POP + _LIBCPP_END_NAMESPACE_FILESYSTEM #endif // !_LIBCPP_CXX03_LANG Index: libcxx/include/fstream =================================================================== --- libcxx/include/fstream +++ libcxx/include/fstream @@ -235,7 +235,7 @@ basic_filebuf* open(const string& __s, ios_base::openmode __mode); #if _LIBCPP_STD_VER >= 17 - _LIBCPP_INLINE_VISIBILITY + _LIBCPP_AVAILABILITY_FILESYSTEM _LIBCPP_INLINE_VISIBILITY basic_filebuf* open(const _VSTD_FS::path& __p, ios_base::openmode __mode) { return open(__p.c_str(), __mode); } @@ -757,7 +757,7 @@ this->eback() + __ibs_, __inext); if (__r == codecvt_base::noconv) { - this->setg((char_type*)__extbuf_, (char_type*)__extbuf_, + this->setg((char_type*)__extbuf_, (char_type*)__extbuf_, (char_type*)const_cast(__extbufend_)); __c = traits_type::to_int_type(*this->gptr()); } @@ -1151,7 +1151,7 @@ _LIBCPP_INLINE_VISIBILITY explicit basic_ifstream(const string& __s, ios_base::openmode __mode = ios_base::in); #if _LIBCPP_STD_VER >= 17 - _LIBCPP_INLINE_VISIBILITY + _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) {} #endif // _LIBCPP_STD_VER >= 17 @@ -1177,7 +1177,7 @@ #endif void open(const string& __s, ios_base::openmode __mode = ios_base::in); #if _LIBCPP_STD_VER >= 17 - _LIBCPP_INLINE_VISIBILITY + _LIBCPP_AVAILABILITY_FILESYSTEM _LIBCPP_INLINE_VISIBILITY void open(const filesystem::path& __p, ios_base::openmode __mode = ios_base::in) { return open(__p.c_str(), __mode); @@ -1365,7 +1365,7 @@ explicit basic_ofstream(const string& __s, ios_base::openmode __mode = ios_base::out); #if _LIBCPP_STD_VER >= 17 - _LIBCPP_INLINE_VISIBILITY + _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) {} #endif // _LIBCPP_STD_VER >= 17 @@ -1392,7 +1392,7 @@ void open(const string& __s, ios_base::openmode __mode = ios_base::out); #if _LIBCPP_STD_VER >= 17 - _LIBCPP_INLINE_VISIBILITY + _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); } #endif // _LIBCPP_STD_VER >= 17 @@ -1579,7 +1579,7 @@ explicit basic_fstream(const string& __s, ios_base::openmode __mode = ios_base::in | ios_base::out); #if _LIBCPP_STD_VER >= 17 - _LIBCPP_INLINE_VISIBILITY + _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) {} #endif // _LIBCPP_STD_VER >= 17 @@ -1607,7 +1607,7 @@ void open(const string& __s, ios_base::openmode __mode = ios_base::in | ios_base::out); #if _LIBCPP_STD_VER >= 17 - _LIBCPP_INLINE_VISIBILITY + _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); } #endif // _LIBCPP_STD_VER >= 17 Index: libcxx/test/libcxx/input.output/filesystems/lit.local.cfg =================================================================== --- libcxx/test/libcxx/input.output/filesystems/lit.local.cfg +++ libcxx/test/libcxx/input.output/filesystems/lit.local.cfg @@ -1,3 +1,7 @@ # Disable all of the filesystem tests if the correct feature is not available. if 'c++filesystem' not in config.available_features: config.unsupported = True + +# Disable all of the filesystem tests if the dylib under test doesn't support them. +if 'dylib-has-no-filesystem' in config.available_features: + config.unsupported = True Index: libcxx/test/std/input.output/file.streams/fstreams/filebuf.members/open_path.pass.cpp =================================================================== --- libcxx/test/std/input.output/file.streams/fstreams/filebuf.members/open_path.pass.cpp +++ libcxx/test/std/input.output/file.streams/fstreams/filebuf.members/open_path.pass.cpp @@ -7,6 +7,7 @@ //===----------------------------------------------------------------------===// // UNSUPPORTED: c++98, c++03, c++11, c++14 +// XFAIL: dylib-has-no-filesystem // Index: libcxx/test/std/input.output/file.streams/fstreams/fstream.cons/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.cons/path.pass.cpp @@ -7,6 +7,7 @@ //===----------------------------------------------------------------------===// // UNSUPPORTED: c++98, c++03, c++11, c++14 +// XFAIL: dylib-has-no-filesystem // Index: libcxx/test/std/input.output/file.streams/fstreams/fstream.members/open_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/fstream.members/open_path.pass.cpp @@ -7,6 +7,7 @@ //===----------------------------------------------------------------------===// // UNSUPPORTED: c++98, c++03, c++11, c++14 +// XFAIL: dylib-has-no-filesystem // Index: libcxx/test/std/input.output/file.streams/fstreams/ifstream.cons/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.cons/path.pass.cpp @@ -7,6 +7,7 @@ //===----------------------------------------------------------------------===// // UNSUPPORTED: c++98, c++03, c++11, c++14 +// XFAIL: dylib-has-no-filesystem // Index: libcxx/test/std/input.output/file.streams/fstreams/ifstream.members/open_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/ifstream.members/open_path.pass.cpp @@ -7,6 +7,7 @@ //===----------------------------------------------------------------------===// // UNSUPPORTED: c++98, c++03, c++11, c++14 +// XFAIL: dylib-has-no-filesystem // Index: libcxx/test/std/input.output/file.streams/fstreams/ofstream.cons/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.cons/path.pass.cpp @@ -7,6 +7,7 @@ //===----------------------------------------------------------------------===// // UNSUPPORTED: c++98, c++03, c++11, c++14 +// XFAIL: dylib-has-no-filesystem // Index: libcxx/test/std/input.output/file.streams/fstreams/ofstream.members/open_path.pass.cpp =================================================================== --- libcxx/test/std/input.output/file.streams/fstreams/ofstream.members/open_path.pass.cpp +++ libcxx/test/std/input.output/file.streams/fstreams/ofstream.members/open_path.pass.cpp @@ -7,6 +7,7 @@ //===----------------------------------------------------------------------===// // UNSUPPORTED: c++98, c++03, c++11, c++14 +// XFAIL: dylib-has-no-filesystem // Index: libcxx/test/std/input.output/filesystems/lit.local.cfg =================================================================== --- libcxx/test/std/input.output/filesystems/lit.local.cfg +++ libcxx/test/std/input.output/filesystems/lit.local.cfg @@ -1,3 +1,7 @@ # Disable all of the filesystem tests if the correct feature is not available. if 'c++filesystem' not in config.available_features: config.unsupported = True + +# Disable all of the filesystem tests if the dylib under test doesn't support them. +if 'dylib-has-no-filesystem' in config.available_features: + config.unsupported = True Index: libcxx/test/std/utilities/time/time.clock/time.clock.file/consistency.pass.cpp =================================================================== --- libcxx/test/std/utilities/time/time.clock/time.clock.file/consistency.pass.cpp +++ libcxx/test/std/utilities/time/time.clock/time.clock.file/consistency.pass.cpp @@ -7,6 +7,7 @@ //===----------------------------------------------------------------------===// // // UNSUPPORTED: c++98, c++03, c++11, c++14, c++17 +// XFAIL: dylib-has-no-filesystem // // TODO: Remove this when filesystem gets integrated into the dylib // REQUIRES: c++filesystem Index: libcxx/test/std/utilities/time/time.clock/time.clock.file/file_time.pass.cpp =================================================================== --- libcxx/test/std/utilities/time/time.clock/time.clock.file/file_time.pass.cpp +++ libcxx/test/std/utilities/time/time.clock/time.clock.file/file_time.pass.cpp @@ -7,6 +7,7 @@ //===----------------------------------------------------------------------===// // UNSUPPORTED: c++98, c++03, c++11, c++14, c++17 +// XFAIL: dylib-has-no-filesystem // Index: libcxx/test/std/utilities/time/time.clock/time.clock.file/now.pass.cpp =================================================================== --- libcxx/test/std/utilities/time/time.clock/time.clock.file/now.pass.cpp +++ libcxx/test/std/utilities/time/time.clock/time.clock.file/now.pass.cpp @@ -7,6 +7,7 @@ //===----------------------------------------------------------------------===// // UNSUPPORTED: c++98, c++03, c++11, c++14, c++17 +// XFAIL: dylib-has-no-filesystem // TODO: Remove this when filesystem gets integrated into the dylib // REQUIRES: c++filesystem Index: libcxx/test/std/utilities/time/time.clock/time.clock.file/rep_signed.pass.cpp =================================================================== --- libcxx/test/std/utilities/time/time.clock/time.clock.file/rep_signed.pass.cpp +++ libcxx/test/std/utilities/time/time.clock/time.clock.file/rep_signed.pass.cpp @@ -7,6 +7,7 @@ //===----------------------------------------------------------------------===// // UNSUPPORTED: c++98, c++03, c++11, c++14, c++17 +// XFAIL: dylib-has-no-filesystem // TODO: Remove this when filesystem gets integrated into the dylib // REQUIRES: c++filesystem Index: libcxx/utils/libcxx/test/config.py =================================================================== --- libcxx/utils/libcxx/test/config.py +++ libcxx/utils/libcxx/test/config.py @@ -1165,6 +1165,10 @@ self.config.available_features.add('dylib-has-no-bad_any_cast') self.lit_config.note("throwing bad_any_cast is not supported by the deployment target") + # Filesystem is not supported on Apple platforms yet + if name == 'macosx': + self.config.available_features.add('dylib-has-no-filesystem') + self.lit_config.note("the deployment target does not support the dylib parts of ") else: self.cxx.flags += ['-D_LIBCPP_DISABLE_AVAILABILITY']