Index: libcxx/include/__config =================================================================== --- libcxx/include/__config +++ libcxx/include/__config @@ -1368,6 +1368,11 @@ # 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,introduced=99.99))) \ + __attribute__((availability(ios,strict,introduced=99.99))) \ + __attribute__((availability(tvos,strict,introduced=99.99))) \ + __attribute__((availability(watchos,strict,introduced=99.99))) #else # define _LIBCPP_AVAILABILITY_SHARED_MUTEX # define _LIBCPP_AVAILABILITY_BAD_VARIANT_ACCESS @@ -1379,6 +1384,7 @@ # define _LIBCPP_AVAILABILITY_TYPEINFO_VTABLE # define _LIBCPP_AVAILABILITY_LOCALE_CATEGORY # define _LIBCPP_AVAILABILITY_ATOMIC_SHARED_PTR +# define _LIBCPP_AVAILABILITY_FILESYSTEM #endif // Define availability that depends on _LIBCPP_NO_EXCEPTIONS. Index: libcxx/include/chrono =================================================================== --- libcxx/include/chrono +++ libcxx/include/chrono @@ -2827,7 +2827,7 @@ #ifndef _LIBCPP_CXX03_LANG _LIBCPP_BEGIN_NAMESPACE_FILESYSTEM -struct _FilesystemClock { +struct _LIBCPP_AVAILABILITY_FILESYSTEM _FilesystemClock { #if !defined(_LIBCPP_HAS_NO_INT128) typedef __int128_t rep; typedef nano period; Index: libcxx/include/filesystem =================================================================== --- libcxx/include/filesystem +++ libcxx/include/filesystem @@ -258,7 +258,7 @@ _LIBCPP_BEGIN_NAMESPACE_FILESYSTEM -typedef chrono::time_point<_FilesystemClock> file_time_type; +typedef _LIBCPP_AVAILABILITY_FILESYSTEM chrono::time_point<_FilesystemClock> file_time_type; struct _LIBCPP_TYPE_VIS space_info { uintmax_t capacity; @@ -733,7 +733,7 @@ } }; -class _LIBCPP_TYPE_VIS path { +class _LIBCPP_AVAILABILITY_FILESYSTEM _LIBCPP_TYPE_VIS path { template using _EnableIfPathable = typename enable_if<__is_pathable<_SourceOrIter>::value, _Tp>::type; @@ -1184,14 +1184,16 @@ string_type __pn_; }; +_LIBCPP_AVAILABILITY_FILESYSTEM inline _LIBCPP_INLINE_VISIBILITY void swap(path& __lhs, path& __rhs) noexcept { __lhs.swap(__rhs); } -_LIBCPP_FUNC_VIS +_LIBCPP_AVAILABILITY_FILESYSTEM _LIBCPP_FUNC_VIS size_t hash_value(const path& __p) noexcept; template +_LIBCPP_AVAILABILITY_FILESYSTEM _LIBCPP_INLINE_VISIBILITY typename enable_if<__is_pathable<_Source>::value, path>::type u8path(const _Source& __s) { @@ -1203,6 +1205,7 @@ } template +_LIBCPP_AVAILABILITY_FILESYSTEM _LIBCPP_INLINE_VISIBILITY typename enable_if<__is_pathable<_InputIt>::value, path>::type u8path(_InputIt __f, _InputIt __l) { @@ -1299,18 +1302,20 @@ _ParserState __state_; }; +_LIBCPP_AVAILABILITY_FILESYSTEM inline _LIBCPP_INLINE_VISIBILITY bool operator==(const path::iterator& __lhs, const path::iterator& __rhs) { return __lhs.__path_ptr_ == __rhs.__path_ptr_ && __lhs.__entry_.data() == __rhs.__entry_.data(); } +_LIBCPP_AVAILABILITY_FILESYSTEM inline _LIBCPP_INLINE_VISIBILITY bool operator!=(const path::iterator& __lhs, const path::iterator& __rhs) { return !(__lhs == __rhs); } -class _LIBCPP_EXCEPTION_ABI filesystem_error : public system_error { +class _LIBCPP_AVAILABILITY_FILESYSTEM _LIBCPP_EXCEPTION_ABI filesystem_error : public system_error { public: _LIBCPP_INLINE_VISIBILITY filesystem_error(const string& __what, error_code __ec) @@ -1362,7 +1367,7 @@ }; template -_LIBCPP_NORETURN inline _LIBCPP_INLINE_VISIBILITY +_LIBCPP_NORETURN inline _LIBCPP_AVAILABILITY_FILESYSTEM _LIBCPP_INLINE_VISIBILITY #ifndef _LIBCPP_NO_EXCEPTIONS void __throw_filesystem_error(_Args&&... __args) { throw filesystem_error(std::forward<_Args>(__args)...); @@ -1375,148 +1380,164 @@ // operational functions -_LIBCPP_FUNC_VIS +_LIBCPP_AVAILABILITY_FILESYSTEM _LIBCPP_FUNC_VIS path __absolute(const path&, error_code* __ec = nullptr); -_LIBCPP_FUNC_VIS +_LIBCPP_AVAILABILITY_FILESYSTEM _LIBCPP_FUNC_VIS path __canonical(const path&, error_code* __ec = nullptr); -_LIBCPP_FUNC_VIS +_LIBCPP_AVAILABILITY_FILESYSTEM _LIBCPP_FUNC_VIS void __copy(const path& __from, const path& __to, copy_options __opt, error_code* __ec = nullptr); -_LIBCPP_FUNC_VIS +_LIBCPP_AVAILABILITY_FILESYSTEM _LIBCPP_FUNC_VIS bool __copy_file(const path& __from, const path& __to, copy_options __opt, error_code* __ec = nullptr); -_LIBCPP_FUNC_VIS +_LIBCPP_AVAILABILITY_FILESYSTEM _LIBCPP_FUNC_VIS void __copy_symlink(const path& __existing_symlink, const path& __new_symlink, error_code* __ec = nullptr); -_LIBCPP_FUNC_VIS +_LIBCPP_AVAILABILITY_FILESYSTEM _LIBCPP_FUNC_VIS bool __create_directories(const path& p, error_code* ec = nullptr); -_LIBCPP_FUNC_VIS +_LIBCPP_AVAILABILITY_FILESYSTEM _LIBCPP_FUNC_VIS bool __create_directory(const path& p, error_code* ec = nullptr); -_LIBCPP_FUNC_VIS +_LIBCPP_AVAILABILITY_FILESYSTEM _LIBCPP_FUNC_VIS bool __create_directory(const path& p, const path& attributes, error_code* ec = nullptr); -_LIBCPP_FUNC_VIS +_LIBCPP_AVAILABILITY_FILESYSTEM _LIBCPP_FUNC_VIS void __create_directory_symlink(const path& __to, const path& __new_symlink, error_code* __ec = nullptr); -_LIBCPP_FUNC_VIS +_LIBCPP_AVAILABILITY_FILESYSTEM _LIBCPP_FUNC_VIS void __create_hard_link(const path& __to, const path& __new_hard_link, error_code* __ec = nullptr); -_LIBCPP_FUNC_VIS +_LIBCPP_AVAILABILITY_FILESYSTEM _LIBCPP_FUNC_VIS void __create_symlink(const path& __to, const path& __new_symlink, error_code* __ec = nullptr); -_LIBCPP_FUNC_VIS +_LIBCPP_AVAILABILITY_FILESYSTEM _LIBCPP_FUNC_VIS path __current_path(error_code* __ec = nullptr); -_LIBCPP_FUNC_VIS +_LIBCPP_AVAILABILITY_FILESYSTEM _LIBCPP_FUNC_VIS void __current_path(const path&, error_code* __ec = nullptr); -_LIBCPP_FUNC_VIS +_LIBCPP_AVAILABILITY_FILESYSTEM _LIBCPP_FUNC_VIS bool __equivalent(const path&, const path&, error_code* __ec = nullptr); -_LIBCPP_FUNC_VIS +_LIBCPP_AVAILABILITY_FILESYSTEM _LIBCPP_FUNC_VIS uintmax_t __file_size(const path&, error_code* __ec = nullptr); -_LIBCPP_FUNC_VIS +_LIBCPP_AVAILABILITY_FILESYSTEM _LIBCPP_FUNC_VIS uintmax_t __hard_link_count(const path&, error_code* __ec = nullptr); -_LIBCPP_FUNC_VIS +_LIBCPP_AVAILABILITY_FILESYSTEM _LIBCPP_FUNC_VIS bool __fs_is_empty(const path& p, error_code* ec = nullptr); -_LIBCPP_FUNC_VIS +_LIBCPP_AVAILABILITY_FILESYSTEM _LIBCPP_FUNC_VIS file_time_type __last_write_time(const path& p, error_code* ec = nullptr); -_LIBCPP_FUNC_VIS +_LIBCPP_AVAILABILITY_FILESYSTEM _LIBCPP_FUNC_VIS void __last_write_time(const path& p, file_time_type new_time, error_code* ec = nullptr); -_LIBCPP_FUNC_VIS +_LIBCPP_AVAILABILITY_FILESYSTEM _LIBCPP_FUNC_VIS void __permissions(const path&, perms, perm_options, error_code* = nullptr); -_LIBCPP_FUNC_VIS +_LIBCPP_AVAILABILITY_FILESYSTEM _LIBCPP_FUNC_VIS path __read_symlink(const path& p, error_code* ec = nullptr); -_LIBCPP_FUNC_VIS +_LIBCPP_AVAILABILITY_FILESYSTEM _LIBCPP_FUNC_VIS bool __remove(const path& p, error_code* ec = nullptr); -_LIBCPP_FUNC_VIS +_LIBCPP_AVAILABILITY_FILESYSTEM _LIBCPP_FUNC_VIS uintmax_t __remove_all(const path& p, error_code* ec = nullptr); -_LIBCPP_FUNC_VIS +_LIBCPP_AVAILABILITY_FILESYSTEM _LIBCPP_FUNC_VIS void __rename(const path& from, const path& to, error_code* ec = nullptr); -_LIBCPP_FUNC_VIS +_LIBCPP_AVAILABILITY_FILESYSTEM _LIBCPP_FUNC_VIS void __resize_file(const path& p, uintmax_t size, error_code* ec = nullptr); -_LIBCPP_FUNC_VIS +_LIBCPP_AVAILABILITY_FILESYSTEM _LIBCPP_FUNC_VIS space_info __space(const path&, error_code* __ec = nullptr); -_LIBCPP_FUNC_VIS +_LIBCPP_AVAILABILITY_FILESYSTEM _LIBCPP_FUNC_VIS file_status __status(const path&, error_code* __ec = nullptr); -_LIBCPP_FUNC_VIS +_LIBCPP_AVAILABILITY_FILESYSTEM _LIBCPP_FUNC_VIS file_status __symlink_status(const path&, error_code* __ec = nullptr); -_LIBCPP_FUNC_VIS +_LIBCPP_AVAILABILITY_FILESYSTEM _LIBCPP_FUNC_VIS path __system_complete(const path&, error_code* __ec = nullptr); -_LIBCPP_FUNC_VIS +_LIBCPP_AVAILABILITY_FILESYSTEM _LIBCPP_FUNC_VIS path __temp_directory_path(error_code* __ec = nullptr); -_LIBCPP_FUNC_VIS +_LIBCPP_AVAILABILITY_FILESYSTEM _LIBCPP_FUNC_VIS path __weakly_canonical(path const& __p, error_code* __ec = nullptr); +_LIBCPP_AVAILABILITY_FILESYSTEM inline _LIBCPP_INLINE_VISIBILITY path current_path() { return __current_path(); } +_LIBCPP_AVAILABILITY_FILESYSTEM inline _LIBCPP_INLINE_VISIBILITY path current_path(error_code& __ec) { return __current_path(&__ec); } +_LIBCPP_AVAILABILITY_FILESYSTEM inline _LIBCPP_INLINE_VISIBILITY void current_path(const path& __p) { __current_path(__p); } +_LIBCPP_AVAILABILITY_FILESYSTEM inline _LIBCPP_INLINE_VISIBILITY void current_path(const path& __p, error_code& __ec) noexcept { __current_path(__p, &__ec); } +_LIBCPP_AVAILABILITY_FILESYSTEM inline _LIBCPP_INLINE_VISIBILITY path absolute(const path& __p) { return __absolute(__p); } +_LIBCPP_AVAILABILITY_FILESYSTEM inline _LIBCPP_INLINE_VISIBILITY path absolute(const path& __p, error_code& __ec) { return __absolute(__p, &__ec); } +_LIBCPP_AVAILABILITY_FILESYSTEM inline _LIBCPP_INLINE_VISIBILITY path canonical(const path& __p) { return __canonical(__p); } +_LIBCPP_AVAILABILITY_FILESYSTEM inline _LIBCPP_INLINE_VISIBILITY path canonical(const path& __p, error_code& __ec) { return __canonical(__p, &__ec); } +_LIBCPP_AVAILABILITY_FILESYSTEM inline _LIBCPP_INLINE_VISIBILITY void copy(const path& __from, const path& __to) { __copy(__from, __to, copy_options::none); } +_LIBCPP_AVAILABILITY_FILESYSTEM inline _LIBCPP_INLINE_VISIBILITY void copy(const path& __from, const path& __to, error_code& __ec) { __copy(__from, __to, copy_options::none, &__ec); } +_LIBCPP_AVAILABILITY_FILESYSTEM inline _LIBCPP_INLINE_VISIBILITY void copy(const path& __from, const path& __to, copy_options __opt) { __copy(__from, __to, __opt); } +_LIBCPP_AVAILABILITY_FILESYSTEM inline _LIBCPP_INLINE_VISIBILITY void copy(const path& __from, const path& __to, copy_options __opt, error_code& __ec) { __copy(__from, __to, __opt, &__ec); } +_LIBCPP_AVAILABILITY_FILESYSTEM inline _LIBCPP_INLINE_VISIBILITY bool copy_file(const path& __from, const path& __to) { return __copy_file(__from, __to, copy_options::none); } +_LIBCPP_AVAILABILITY_FILESYSTEM inline _LIBCPP_INLINE_VISIBILITY bool copy_file(const path& __from, const path& __to, error_code& __ec) { return __copy_file(__from, __to, copy_options::none, &__ec); } +_LIBCPP_AVAILABILITY_FILESYSTEM inline _LIBCPP_INLINE_VISIBILITY bool copy_file(const path& __from, const path& __to, copy_options __opt) { return __copy_file(__from, __to, __opt); } +_LIBCPP_AVAILABILITY_FILESYSTEM inline _LIBCPP_INLINE_VISIBILITY bool copy_file(const path& __from, const path& __to, copy_options __opt, @@ -1524,72 +1545,86 @@ return __copy_file(__from, __to, __opt, &__ec); } +_LIBCPP_AVAILABILITY_FILESYSTEM inline _LIBCPP_INLINE_VISIBILITY void copy_symlink(const path& __existing, const path& __new) { __copy_symlink(__existing, __new); } +_LIBCPP_AVAILABILITY_FILESYSTEM inline _LIBCPP_INLINE_VISIBILITY void copy_symlink(const path& __ext, const path& __new, error_code& __ec) noexcept { __copy_symlink(__ext, __new, &__ec); } +_LIBCPP_AVAILABILITY_FILESYSTEM inline _LIBCPP_INLINE_VISIBILITY bool create_directories(const path& __p) { return __create_directories(__p); } +_LIBCPP_AVAILABILITY_FILESYSTEM inline _LIBCPP_INLINE_VISIBILITY bool create_directories(const path& __p, error_code& __ec) { return __create_directories(__p, &__ec); } +_LIBCPP_AVAILABILITY_FILESYSTEM inline _LIBCPP_INLINE_VISIBILITY bool create_directory(const path& __p) { return __create_directory(__p); } +_LIBCPP_AVAILABILITY_FILESYSTEM inline _LIBCPP_INLINE_VISIBILITY bool create_directory(const path& __p, error_code& __ec) noexcept { return __create_directory(__p, &__ec); } +_LIBCPP_AVAILABILITY_FILESYSTEM inline _LIBCPP_INLINE_VISIBILITY bool create_directory(const path& __p, const path& __attrs) { return __create_directory(__p, __attrs); } +_LIBCPP_AVAILABILITY_FILESYSTEM inline _LIBCPP_INLINE_VISIBILITY bool create_directory(const path& __p, const path& __attrs, error_code& __ec) noexcept { return __create_directory(__p, __attrs, &__ec); } +_LIBCPP_AVAILABILITY_FILESYSTEM inline _LIBCPP_INLINE_VISIBILITY void create_directory_symlink(const path& __to, const path& __new) { __create_directory_symlink(__to, __new); } +_LIBCPP_AVAILABILITY_FILESYSTEM inline _LIBCPP_INLINE_VISIBILITY void create_directory_symlink(const path& __to, const path& __new, error_code& __ec) noexcept { __create_directory_symlink(__to, __new, &__ec); } +_LIBCPP_AVAILABILITY_FILESYSTEM inline _LIBCPP_INLINE_VISIBILITY void create_hard_link(const path& __to, const path& __new) { __create_hard_link(__to, __new); } +_LIBCPP_AVAILABILITY_FILESYSTEM inline _LIBCPP_INLINE_VISIBILITY void create_hard_link(const path& __to, const path& __new, error_code& __ec) noexcept { __create_hard_link(__to, __new, &__ec); } +_LIBCPP_AVAILABILITY_FILESYSTEM inline _LIBCPP_INLINE_VISIBILITY void create_symlink(const path& __to, const path& __new) { __create_symlink(__to, __new); } +_LIBCPP_AVAILABILITY_FILESYSTEM inline _LIBCPP_INLINE_VISIBILITY void create_symlink(const path& __to, const path& __new, error_code& __ec) noexcept { return __create_symlink(__to, __new, &__ec); @@ -1603,10 +1638,12 @@ return status_known(__s) && __s.type() != file_type::not_found; } +_LIBCPP_AVAILABILITY_FILESYSTEM inline _LIBCPP_INLINE_VISIBILITY bool exists(const path& __p) { return exists(__status(__p)); } +_LIBCPP_AVAILABILITY_FILESYSTEM inline _LIBCPP_INLINE_VISIBILITY bool exists(const path& __p, error_code& __ec) noexcept { auto __s = __status(__p, &__ec); @@ -1615,29 +1652,35 @@ return exists(__s); } +_LIBCPP_AVAILABILITY_FILESYSTEM inline _LIBCPP_INLINE_VISIBILITY bool equivalent(const path& __p1, const path& __p2) { return __equivalent(__p1, __p2); } +_LIBCPP_AVAILABILITY_FILESYSTEM inline _LIBCPP_INLINE_VISIBILITY bool equivalent(const path& __p1, const path& __p2, error_code& __ec) noexcept { return __equivalent(__p1, __p2, &__ec); } +_LIBCPP_AVAILABILITY_FILESYSTEM inline _LIBCPP_INLINE_VISIBILITY uintmax_t file_size(const path& __p) { return __file_size(__p); } +_LIBCPP_AVAILABILITY_FILESYSTEM inline _LIBCPP_INLINE_VISIBILITY uintmax_t file_size(const path& __p, error_code& __ec) noexcept { return __file_size(__p, &__ec); } +_LIBCPP_AVAILABILITY_FILESYSTEM inline _LIBCPP_INLINE_VISIBILITY uintmax_t hard_link_count(const path& __p) { return __hard_link_count(__p); } +_LIBCPP_AVAILABILITY_FILESYSTEM inline _LIBCPP_INLINE_VISIBILITY uintmax_t hard_link_count(const path& __p, error_code& __ec) noexcept { return __hard_link_count(__p, &__ec); @@ -1647,10 +1690,12 @@ return __s.type() == file_type::block; } +_LIBCPP_AVAILABILITY_FILESYSTEM inline _LIBCPP_INLINE_VISIBILITY bool is_block_file(const path& __p) { return is_block_file(__status(__p)); } +_LIBCPP_AVAILABILITY_FILESYSTEM inline _LIBCPP_INLINE_VISIBILITY bool is_block_file(const path& __p, error_code& __ec) noexcept { return is_block_file(__status(__p, &__ec)); @@ -1661,10 +1706,12 @@ return __s.type() == file_type::character; } +_LIBCPP_AVAILABILITY_FILESYSTEM inline _LIBCPP_INLINE_VISIBILITY bool is_character_file(const path& __p) { return is_character_file(__status(__p)); } +_LIBCPP_AVAILABILITY_FILESYSTEM inline _LIBCPP_INLINE_VISIBILITY bool is_character_file(const path& __p, error_code& __ec) noexcept { return is_character_file(__status(__p, &__ec)); @@ -1674,19 +1721,23 @@ return __s.type() == file_type::directory; } +_LIBCPP_AVAILABILITY_FILESYSTEM inline _LIBCPP_INLINE_VISIBILITY bool is_directory(const path& __p) { return is_directory(__status(__p)); } +_LIBCPP_AVAILABILITY_FILESYSTEM inline _LIBCPP_INLINE_VISIBILITY bool is_directory(const path& __p, error_code& __ec) noexcept { return is_directory(__status(__p, &__ec)); } +_LIBCPP_AVAILABILITY_FILESYSTEM inline _LIBCPP_INLINE_VISIBILITY bool is_empty(const path& __p) { return __fs_is_empty(__p); } +_LIBCPP_AVAILABILITY_FILESYSTEM inline _LIBCPP_INLINE_VISIBILITY bool is_empty(const path& __p, error_code& __ec) { return __fs_is_empty(__p, &__ec); @@ -1695,10 +1746,12 @@ inline _LIBCPP_INLINE_VISIBILITY bool is_fifo(file_status __s) noexcept { return __s.type() == file_type::fifo; } +_LIBCPP_AVAILABILITY_FILESYSTEM inline _LIBCPP_INLINE_VISIBILITY bool is_fifo(const path& __p) { return is_fifo(__status(__p)); } +_LIBCPP_AVAILABILITY_FILESYSTEM inline _LIBCPP_INLINE_VISIBILITY bool is_fifo(const path& __p, error_code& __ec) noexcept { return is_fifo(__status(__p, &__ec)); @@ -1709,10 +1762,12 @@ return __s.type() == file_type::regular; } +_LIBCPP_AVAILABILITY_FILESYSTEM inline _LIBCPP_INLINE_VISIBILITY bool is_regular_file(const path& __p) { return is_regular_file(__status(__p)); } +_LIBCPP_AVAILABILITY_FILESYSTEM inline _LIBCPP_INLINE_VISIBILITY bool is_regular_file(const path& __p, error_code& __ec) noexcept { return is_regular_file(__status(__p, &__ec)); @@ -1722,10 +1777,12 @@ return __s.type() == file_type::socket; } +_LIBCPP_AVAILABILITY_FILESYSTEM inline _LIBCPP_INLINE_VISIBILITY bool is_socket(const path& __p) { return is_socket(__status(__p)); } +_LIBCPP_AVAILABILITY_FILESYSTEM inline _LIBCPP_INLINE_VISIBILITY bool is_socket(const path& __p, error_code& __ec) noexcept { return is_socket(__status(__p, &__ec)); @@ -1735,10 +1792,12 @@ return __s.type() == file_type::symlink; } +_LIBCPP_AVAILABILITY_FILESYSTEM inline _LIBCPP_INLINE_VISIBILITY bool is_symlink(const path& __p) { return is_symlink(__symlink_status(__p)); } +_LIBCPP_AVAILABILITY_FILESYSTEM inline _LIBCPP_INLINE_VISIBILITY bool is_symlink(const path& __p, error_code& __ec) noexcept { return is_symlink(__symlink_status(__p, &__ec)); @@ -1749,53 +1808,63 @@ !is_symlink(__s); } +_LIBCPP_AVAILABILITY_FILESYSTEM inline _LIBCPP_INLINE_VISIBILITY bool is_other(const path& __p) { return is_other(__status(__p)); } +_LIBCPP_AVAILABILITY_FILESYSTEM inline _LIBCPP_INLINE_VISIBILITY bool is_other(const path& __p, error_code& __ec) noexcept { return is_other(__status(__p, &__ec)); } +_LIBCPP_AVAILABILITY_FILESYSTEM inline _LIBCPP_INLINE_VISIBILITY file_time_type last_write_time(const path& __p) { return __last_write_time(__p); } +_LIBCPP_AVAILABILITY_FILESYSTEM inline _LIBCPP_INLINE_VISIBILITY file_time_type last_write_time(const path& __p, error_code& __ec) noexcept { return __last_write_time(__p, &__ec); } +_LIBCPP_AVAILABILITY_FILESYSTEM inline _LIBCPP_INLINE_VISIBILITY void last_write_time(const path& __p, file_time_type __t) { __last_write_time(__p, __t); } +_LIBCPP_AVAILABILITY_FILESYSTEM inline _LIBCPP_INLINE_VISIBILITY void last_write_time(const path& __p, file_time_type __t, error_code& __ec) noexcept { __last_write_time(__p, __t, &__ec); } +_LIBCPP_AVAILABILITY_FILESYSTEM inline _LIBCPP_INLINE_VISIBILITY void permissions(const path& __p, perms __prms, perm_options __opts = perm_options::replace) { __permissions(__p, __prms, __opts); } +_LIBCPP_AVAILABILITY_FILESYSTEM inline _LIBCPP_INLINE_VISIBILITY void permissions(const path& __p, perms __prms, error_code& __ec) noexcept { __permissions(__p, __prms, perm_options::replace, &__ec); } +_LIBCPP_AVAILABILITY_FILESYSTEM inline _LIBCPP_INLINE_VISIBILITY void permissions(const path& __p, perms __prms, perm_options __opts, error_code& __ec) { __permissions(__p, __prms, __opts, &__ec); } +_LIBCPP_AVAILABILITY_FILESYSTEM inline _LIBCPP_INLINE_VISIBILITY path proximate(const path& __p, const path& __base, error_code& __ec) { @@ -1808,26 +1877,31 @@ return __tmp.lexically_proximate(__tmp_base); } +_LIBCPP_AVAILABILITY_FILESYSTEM inline _LIBCPP_INLINE_VISIBILITY path proximate(const path& __p, error_code& __ec) { return proximate(__p, current_path(), __ec); } +_LIBCPP_AVAILABILITY_FILESYSTEM inline _LIBCPP_INLINE_VISIBILITY path proximate(const path& __p, const path& __base = current_path()) { return __weakly_canonical(__p).lexically_proximate( __weakly_canonical(__base)); } +_LIBCPP_AVAILABILITY_FILESYSTEM inline _LIBCPP_INLINE_VISIBILITY path read_symlink(const path& __p) { return __read_symlink(__p); } +_LIBCPP_AVAILABILITY_FILESYSTEM inline _LIBCPP_INLINE_VISIBILITY path read_symlink(const path& __p, error_code& __ec) { return __read_symlink(__p, &__ec); } +_LIBCPP_AVAILABILITY_FILESYSTEM inline _LIBCPP_INLINE_VISIBILITY path relative(const path& __p, const path& __base, error_code& __ec) { @@ -1840,93 +1914,113 @@ return __tmp.lexically_relative(__tmpbase); } +_LIBCPP_AVAILABILITY_FILESYSTEM inline _LIBCPP_INLINE_VISIBILITY path relative(const path& __p, error_code& __ec) { return relative(__p, current_path(), __ec); } +_LIBCPP_AVAILABILITY_FILESYSTEM inline _LIBCPP_INLINE_VISIBILITY path relative(const path& __p, const path& __base = current_path()) { return __weakly_canonical(__p).lexically_relative(__weakly_canonical(__base)); } +_LIBCPP_AVAILABILITY_FILESYSTEM inline _LIBCPP_INLINE_VISIBILITY bool remove(const path& __p) { return __remove(__p); } +_LIBCPP_AVAILABILITY_FILESYSTEM inline _LIBCPP_INLINE_VISIBILITY bool remove(const path& __p, error_code& __ec) noexcept { return __remove(__p, &__ec); } +_LIBCPP_AVAILABILITY_FILESYSTEM inline _LIBCPP_INLINE_VISIBILITY uintmax_t remove_all(const path& __p) { return __remove_all(__p); } +_LIBCPP_AVAILABILITY_FILESYSTEM inline _LIBCPP_INLINE_VISIBILITY uintmax_t remove_all(const path& __p, error_code& __ec) { return __remove_all(__p, &__ec); } +_LIBCPP_AVAILABILITY_FILESYSTEM inline _LIBCPP_INLINE_VISIBILITY void rename(const path& __from, const path& __to) { return __rename(__from, __to); } +_LIBCPP_AVAILABILITY_FILESYSTEM inline _LIBCPP_INLINE_VISIBILITY void rename(const path& __from, const path& __to, error_code& __ec) noexcept { return __rename(__from, __to, &__ec); } +_LIBCPP_AVAILABILITY_FILESYSTEM inline _LIBCPP_INLINE_VISIBILITY void resize_file(const path& __p, uintmax_t __ns) { return __resize_file(__p, __ns); } +_LIBCPP_AVAILABILITY_FILESYSTEM inline _LIBCPP_INLINE_VISIBILITY void resize_file(const path& __p, uintmax_t __ns, error_code& __ec) noexcept { return __resize_file(__p, __ns, &__ec); } +_LIBCPP_AVAILABILITY_FILESYSTEM inline _LIBCPP_INLINE_VISIBILITY space_info space(const path& __p) { return __space(__p); } +_LIBCPP_AVAILABILITY_FILESYSTEM inline _LIBCPP_INLINE_VISIBILITY space_info space(const path& __p, error_code& __ec) noexcept { return __space(__p, &__ec); } +_LIBCPP_AVAILABILITY_FILESYSTEM inline _LIBCPP_INLINE_VISIBILITY file_status status(const path& __p) { return __status(__p); } +_LIBCPP_AVAILABILITY_FILESYSTEM inline _LIBCPP_INLINE_VISIBILITY file_status status(const path& __p, error_code& __ec) noexcept { return __status(__p, &__ec); } +_LIBCPP_AVAILABILITY_FILESYSTEM inline _LIBCPP_INLINE_VISIBILITY file_status symlink_status(const path& __p) { return __symlink_status(__p); } +_LIBCPP_AVAILABILITY_FILESYSTEM inline _LIBCPP_INLINE_VISIBILITY file_status symlink_status(const path& __p, error_code& __ec) noexcept { return __symlink_status(__p, &__ec); } +_LIBCPP_AVAILABILITY_FILESYSTEM inline _LIBCPP_INLINE_VISIBILITY path temp_directory_path() { return __temp_directory_path(); } +_LIBCPP_AVAILABILITY_FILESYSTEM inline _LIBCPP_INLINE_VISIBILITY path temp_directory_path(error_code& __ec) { return __temp_directory_path(&__ec); } +_LIBCPP_AVAILABILITY_FILESYSTEM inline _LIBCPP_INLINE_VISIBILITY path weakly_canonical(path const& __p) { return __weakly_canonical(__p); } +_LIBCPP_AVAILABILITY_FILESYSTEM inline _LIBCPP_INLINE_VISIBILITY path weakly_canonical(path const& __p, error_code& __ec) { return __weakly_canonical(__p, &__ec); @@ -1936,7 +2030,7 @@ class recursive_directory_iterator; class __dir_stream; -class directory_entry { +class _LIBCPP_AVAILABILITY_FILESYSTEM directory_entry { typedef _VSTD_FS::path _Path; public: @@ -2379,7 +2473,7 @@ __cached_data __data_; }; -class __dir_element_proxy { +class _LIBCPP_AVAILABILITY_FILESYSTEM __dir_element_proxy { public: inline _LIBCPP_INLINE_VISIBILITY directory_entry operator*() { return _VSTD::move(__elem_); @@ -2394,7 +2488,7 @@ directory_entry __elem_; }; -class directory_iterator { +class _LIBCPP_AVAILABILITY_FILESYSTEM directory_iterator { public: typedef directory_entry value_type; typedef ptrdiff_t difference_type; @@ -2470,12 +2564,14 @@ shared_ptr<__dir_stream> __imp_; }; +_LIBCPP_AVAILABILITY_FILESYSTEM inline _LIBCPP_INLINE_VISIBILITY bool operator==(const directory_iterator& __lhs, const directory_iterator& __rhs) noexcept { return __lhs.__imp_ == __rhs.__imp_; } +_LIBCPP_AVAILABILITY_FILESYSTEM inline _LIBCPP_INLINE_VISIBILITY bool operator!=(const directory_iterator& __lhs, const directory_iterator& __rhs) noexcept { @@ -2483,17 +2579,19 @@ } // enable directory_iterator range-based for statements +_LIBCPP_AVAILABILITY_FILESYSTEM inline _LIBCPP_INLINE_VISIBILITY directory_iterator begin(directory_iterator __iter) noexcept { return __iter; } +_LIBCPP_AVAILABILITY_FILESYSTEM inline _LIBCPP_INLINE_VISIBILITY directory_iterator end(const directory_iterator&) noexcept { return directory_iterator(); } -class recursive_directory_iterator { +class _LIBCPP_AVAILABILITY_FILESYSTEM recursive_directory_iterator { public: using value_type = directory_entry; using difference_type = std::ptrdiff_t; @@ -2602,23 +2700,27 @@ bool __rec_; }; // class recursive_directory_iterator +_LIBCPP_AVAILABILITY_FILESYSTEM inline _LIBCPP_INLINE_VISIBILITY bool operator==(const recursive_directory_iterator& __lhs, const recursive_directory_iterator& __rhs) noexcept { return __lhs.__imp_ == __rhs.__imp_; } -_LIBCPP_INLINE_VISIBILITY -inline bool operator!=(const recursive_directory_iterator& __lhs, - const recursive_directory_iterator& __rhs) noexcept { +_LIBCPP_AVAILABILITY_FILESYSTEM +inline _LIBCPP_INLINE_VISIBILITY bool +operator!=(const recursive_directory_iterator& __lhs, + const recursive_directory_iterator& __rhs) noexcept { return !(__lhs == __rhs); } // enable recursive_directory_iterator range-based for statements +_LIBCPP_AVAILABILITY_FILESYSTEM inline _LIBCPP_INLINE_VISIBILITY recursive_directory_iterator begin(recursive_directory_iterator __iter) noexcept { return __iter; } +_LIBCPP_AVAILABILITY_FILESYSTEM inline _LIBCPP_INLINE_VISIBILITY recursive_directory_iterator end(const recursive_directory_iterator&) noexcept { return recursive_directory_iterator(); 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']