Index: include/__config =================================================================== --- include/__config +++ include/__config @@ -1311,7 +1311,8 @@ #if !defined(_LIBCPP_BUILDING_LIBRARY) && \ !defined(_LIBCPP_DISABLE_AVAILABILITY) && \ __has_feature(attribute_availability_with_strict) && \ - __has_feature(attribute_availability_in_templates) + __has_feature(attribute_availability_in_templates) && \ + __has_extension(pragma_clang_attribute_external_declaration) # ifdef __APPLE__ # define _LIBCPP_USE_AVAILABILITY_APPLE # endif @@ -1359,6 +1360,16 @@ __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 @@ -1371,6 +1382,8 @@ # 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: include/chrono =================================================================== --- include/chrono +++ 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: include/filesystem =================================================================== --- include/filesystem +++ 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: test/std/utilities/time/time.clock/time.clock.file/consistency.pass.cpp =================================================================== --- test/std/utilities/time/time.clock/time.clock.file/consistency.pass.cpp +++ test/std/utilities/time/time.clock/time.clock.file/consistency.pass.cpp @@ -12,6 +12,8 @@ // violation because Clock::is_steady is defined in both the dylib and this TU. // UNSUPPORTED: asan +// XFAIL: dylib-has-no-filesystem + // // file_clock Index: test/std/utilities/time/time.clock/time.clock.file/file_time.pass.cpp =================================================================== --- test/std/utilities/time/time.clock/time.clock.file/file_time.pass.cpp +++ 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: test/std/utilities/time/time.clock/time.clock.file/rep_signed.pass.cpp =================================================================== --- test/std/utilities/time/time.clock/time.clock.file/rep_signed.pass.cpp +++ 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 //