diff --git a/libcxx/include/__filesystem/copy_options.h b/libcxx/include/__filesystem/copy_options.h --- a/libcxx/include/__filesystem/copy_options.h +++ b/libcxx/include/__filesystem/copy_options.h @@ -21,8 +21,6 @@ _LIBCPP_BEGIN_NAMESPACE_FILESYSTEM -_LIBCPP_AVAILABILITY_FILESYSTEM_LIBRARY_PUSH - enum class _LIBCPP_ENUM_VIS copy_options : unsigned short { none = 0, skip_existing = 1, @@ -75,8 +73,6 @@ return __lhs = __lhs ^ __rhs; } -_LIBCPP_AVAILABILITY_FILESYSTEM_LIBRARY_POP - _LIBCPP_END_NAMESPACE_FILESYSTEM #endif // _LIBCPP_CXX03_LANG diff --git a/libcxx/include/__filesystem/directory_entry.h b/libcxx/include/__filesystem/directory_entry.h --- a/libcxx/include/__filesystem/directory_entry.h +++ b/libcxx/include/__filesystem/directory_entry.h @@ -35,13 +35,12 @@ _LIBCPP_PUSH_MACROS #include <__undef_macros> -#ifndef _LIBCPP_CXX03_LANG +#if !defined(_LIBCPP_CXX03_LANG) && !defined(_LIBCPP_HAS_NO_FILESYSTEM) _LIBCPP_BEGIN_NAMESPACE_FILESYSTEM _LIBCPP_AVAILABILITY_FILESYSTEM_LIBRARY_PUSH - class directory_entry { typedef _VSTD_FS::path _Path; @@ -521,7 +520,7 @@ _LIBCPP_END_NAMESPACE_FILESYSTEM -#endif // _LIBCPP_CXX03_LANG +#endif // !defined(_LIBCPP_CXX03_LANG) && !defined(_LIBCPP_HAS_NO_FILESYSTEM) _LIBCPP_POP_MACROS diff --git a/libcxx/include/__filesystem/directory_iterator.h b/libcxx/include/__filesystem/directory_iterator.h --- a/libcxx/include/__filesystem/directory_iterator.h +++ b/libcxx/include/__filesystem/directory_iterator.h @@ -28,7 +28,7 @@ # pragma GCC system_header #endif -#ifndef _LIBCPP_CXX03_LANG +#if !defined(_LIBCPP_CXX03_LANG) && !defined(_LIBCPP_HAS_NO_FILESYSTEM) _LIBCPP_BEGIN_NAMESPACE_FILESYSTEM @@ -161,6 +161,6 @@ #endif // _LIBCPP_STD_VER >= 20 -#endif // _LIBCPP_CXX03_LANG +#endif // !defined(_LIBCPP_CXX03_LANG) && !defined(_LIBCPP_HAS_NO_FILESYSTEM) #endif // _LIBCPP___FILESYSTEM_DIRECTORY_ITERATOR_H diff --git a/libcxx/include/__filesystem/directory_options.h b/libcxx/include/__filesystem/directory_options.h --- a/libcxx/include/__filesystem/directory_options.h +++ b/libcxx/include/__filesystem/directory_options.h @@ -21,8 +21,6 @@ _LIBCPP_BEGIN_NAMESPACE_FILESYSTEM -_LIBCPP_AVAILABILITY_FILESYSTEM_LIBRARY_PUSH - enum class _LIBCPP_ENUM_VIS directory_options : unsigned char { none = 0, follow_directory_symlink = 1, @@ -73,8 +71,6 @@ return __lhs = __lhs ^ __rhs; } -_LIBCPP_AVAILABILITY_FILESYSTEM_LIBRARY_POP - _LIBCPP_END_NAMESPACE_FILESYSTEM #endif // _LIBCPP_CXX03_LANG diff --git a/libcxx/include/__filesystem/file_status.h b/libcxx/include/__filesystem/file_status.h --- a/libcxx/include/__filesystem/file_status.h +++ b/libcxx/include/__filesystem/file_status.h @@ -23,8 +23,6 @@ _LIBCPP_BEGIN_NAMESPACE_FILESYSTEM -_LIBCPP_AVAILABILITY_FILESYSTEM_LIBRARY_PUSH - class _LIBCPP_TYPE_VIS file_status { public: // constructors @@ -63,8 +61,6 @@ perms __prms_; }; -_LIBCPP_AVAILABILITY_FILESYSTEM_LIBRARY_POP - _LIBCPP_END_NAMESPACE_FILESYSTEM #endif // _LIBCPP_CXX03_LANG diff --git a/libcxx/include/__filesystem/filesystem_error.h b/libcxx/include/__filesystem/filesystem_error.h --- a/libcxx/include/__filesystem/filesystem_error.h +++ b/libcxx/include/__filesystem/filesystem_error.h @@ -82,12 +82,8 @@ shared_ptr<_Storage> __storage_; }; -// TODO(ldionne): We need to pop the pragma and push it again after -// filesystem_error to work around PR41078. -_LIBCPP_AVAILABILITY_FILESYSTEM_LIBRARY_PUSH - template -_LIBCPP_NORETURN inline _LIBCPP_INLINE_VISIBILITY +_LIBCPP_NORETURN inline _LIBCPP_INLINE_VISIBILITY _LIBCPP_AVAILABILITY_FILESYSTEM_LIBRARY #ifndef _LIBCPP_HAS_NO_EXCEPTIONS void __throw_filesystem_error(_Args&&... __args) { throw filesystem_error(_VSTD::forward<_Args>(__args)...); @@ -97,7 +93,6 @@ _LIBCPP_VERBOSE_ABORT("filesystem_error was thrown in -fno-exceptions mode"); } #endif -_LIBCPP_AVAILABILITY_FILESYSTEM_LIBRARY_POP _LIBCPP_END_NAMESPACE_FILESYSTEM diff --git a/libcxx/include/__filesystem/operations.h b/libcxx/include/__filesystem/operations.h --- a/libcxx/include/__filesystem/operations.h +++ b/libcxx/include/__filesystem/operations.h @@ -28,7 +28,7 @@ # pragma GCC system_header #endif -#ifndef _LIBCPP_CXX03_LANG +#if !defined(_LIBCPP_CXX03_LANG) && !defined(_LIBCPP_HAS_NO_FILESYSTEM) _LIBCPP_BEGIN_NAMESPACE_FILESYSTEM @@ -196,6 +196,6 @@ _LIBCPP_END_NAMESPACE_FILESYSTEM -#endif // _LIBCPP_CXX03_LANG +#endif // !defined(_LIBCPP_CXX03_LANG) && !defined(_LIBCPP_HAS_NO_FILESYSTEM) #endif // _LIBCPP___FILESYSTEM_OPERATIONS_H diff --git a/libcxx/include/__filesystem/path_iterator.h b/libcxx/include/__filesystem/path_iterator.h --- a/libcxx/include/__filesystem/path_iterator.h +++ b/libcxx/include/__filesystem/path_iterator.h @@ -27,8 +27,6 @@ _LIBCPP_BEGIN_NAMESPACE_FILESYSTEM -_LIBCPP_AVAILABILITY_FILESYSTEM_LIBRARY_PUSH - class _LIBCPP_TYPE_VIS path::iterator { public: enum _ParserState : unsigned char { @@ -125,8 +123,6 @@ return !(__lhs == __rhs); } -_LIBCPP_AVAILABILITY_FILESYSTEM_LIBRARY_POP - _LIBCPP_END_NAMESPACE_FILESYSTEM #endif // _LIBCPP_CXX03_LANG diff --git a/libcxx/include/__filesystem/perm_options.h b/libcxx/include/__filesystem/perm_options.h --- a/libcxx/include/__filesystem/perm_options.h +++ b/libcxx/include/__filesystem/perm_options.h @@ -21,8 +21,6 @@ _LIBCPP_BEGIN_NAMESPACE_FILESYSTEM -_LIBCPP_AVAILABILITY_FILESYSTEM_LIBRARY_PUSH - enum class _LIBCPP_ENUM_VIS perm_options : unsigned char { replace = 1, add = 2, @@ -68,8 +66,6 @@ return __lhs = __lhs ^ __rhs; } -_LIBCPP_AVAILABILITY_FILESYSTEM_LIBRARY_POP - _LIBCPP_END_NAMESPACE_FILESYSTEM #endif // _LIBCPP_CXX03_LANG diff --git a/libcxx/include/__filesystem/perms.h b/libcxx/include/__filesystem/perms.h --- a/libcxx/include/__filesystem/perms.h +++ b/libcxx/include/__filesystem/perms.h @@ -21,8 +21,6 @@ _LIBCPP_BEGIN_NAMESPACE_FILESYSTEM -_LIBCPP_AVAILABILITY_FILESYSTEM_LIBRARY_PUSH - // On Windows, these permission bits map to one single readonly flag per // file, and the executable bit is always returned as set. When setting // permissions, as long as the write bit is set for either owner, group or @@ -86,8 +84,6 @@ _LIBCPP_INLINE_VISIBILITY inline perms& operator^=(perms& __lhs, perms __rhs) { return __lhs = __lhs ^ __rhs; } -_LIBCPP_AVAILABILITY_FILESYSTEM_LIBRARY_POP - _LIBCPP_END_NAMESPACE_FILESYSTEM #endif // _LIBCPP_CXX03_LANG diff --git a/libcxx/include/__filesystem/recursive_directory_iterator.h b/libcxx/include/__filesystem/recursive_directory_iterator.h --- a/libcxx/include/__filesystem/recursive_directory_iterator.h +++ b/libcxx/include/__filesystem/recursive_directory_iterator.h @@ -27,7 +27,7 @@ # pragma GCC system_header #endif -#ifndef _LIBCPP_CXX03_LANG +#if !defined(_LIBCPP_CXX03_LANG) && !defined(_LIBCPP_HAS_NO_FILESYSTEM) _LIBCPP_BEGIN_NAMESPACE_FILESYSTEM @@ -181,6 +181,6 @@ #endif // _LIBCPP_STD_VER >= 20 -#endif // _LIBCPP_CXX03_LANG +#endif // !defined(_LIBCPP_CXX03_LANG) && !defined(_LIBCPP_HAS_NO_FILESYSTEM) #endif // _LIBCPP___FILESYSTEM_RECURSIVE_DIRECTORY_ITERATOR_H diff --git a/libcxx/include/__filesystem/space_info.h b/libcxx/include/__filesystem/space_info.h --- a/libcxx/include/__filesystem/space_info.h +++ b/libcxx/include/__filesystem/space_info.h @@ -22,8 +22,6 @@ _LIBCPP_BEGIN_NAMESPACE_FILESYSTEM -_LIBCPP_AVAILABILITY_FILESYSTEM_LIBRARY_PUSH - struct _LIBCPP_TYPE_VIS space_info { uintmax_t capacity; uintmax_t free; @@ -34,8 +32,6 @@ # endif }; -_LIBCPP_AVAILABILITY_FILESYSTEM_LIBRARY_POP - _LIBCPP_END_NAMESPACE_FILESYSTEM #endif // _LIBCPP_CXX03_LANG diff --git a/libcxx/include/filesystem b/libcxx/include/filesystem --- a/libcxx/include/filesystem +++ b/libcxx/include/filesystem @@ -457,10 +457,6 @@ // [fs.filesystem.syn] #include -#if defined(_LIBCPP_HAS_NO_FILESYSTEM) -# error "The library is not supported since libc++ has been configured without support for a filesystem." -#endif - #if !defined(_LIBCPP_HAS_NO_PRAGMA_SYSTEM_HEADER) # pragma GCC system_header #endif diff --git a/libcxx/include/fstream b/libcxx/include/fstream --- a/libcxx/include/fstream +++ b/libcxx/include/fstream @@ -189,15 +189,12 @@ #include <__utility/swap.h> #include <__utility/unreachable.h> #include +#include #include #include #include #include -#if !defined(_LIBCPP_HAS_NO_FILESYSTEM) -# include -#endif - #if !defined(_LIBCPP_HAS_NO_PRAGMA_SYSTEM_HEADER) # pragma GCC system_header #endif diff --git a/libcxx/src/CMakeLists.txt b/libcxx/src/CMakeLists.txt --- a/libcxx/src/CMakeLists.txt +++ b/libcxx/src/CMakeLists.txt @@ -12,6 +12,10 @@ condition_variable.cpp condition_variable_destructor.cpp exception.cpp + filesystem/filesystem_clock.cpp + filesystem/filesystem_error.cpp + filesystem/path_parser.h + filesystem/path.cpp functional.cpp future.cpp hash.cpp @@ -112,12 +116,8 @@ list(APPEND LIBCXX_SOURCES filesystem/directory_entry.cpp filesystem/directory_iterator.cpp - filesystem/filesystem_clock.cpp filesystem/filesystem_common.h - filesystem/filesystem_error.cpp filesystem/operations.cpp - filesystem/path_parser.h - filesystem/path.cpp filesystem/posix_compat.h ) # Filesystem uses __int128_t, which requires a definition of __muloi4 when diff --git a/libcxx/test/libcxx/input.output/filesystems/class.directory_entry/directory_entry.mods/last_write_time.pass.cpp b/libcxx/test/libcxx/input.output/filesystems/class.directory_entry/directory_entry.mods/last_write_time.pass.cpp --- a/libcxx/test/libcxx/input.output/filesystems/class.directory_entry/directory_entry.mods/last_write_time.pass.cpp +++ b/libcxx/test/libcxx/input.output/filesystems/class.directory_entry/directory_entry.mods/last_write_time.pass.cpp @@ -7,6 +7,8 @@ //===----------------------------------------------------------------------===// // UNSUPPORTED: c++03 +// UNSUPPORTED: availability-filesystem-missing +// UNSUPPORTED: no-filesystem // ADDITIONAL_COMPILE_FLAGS: -I %S/../../../../../../src/filesystem // This test relies on calling functions from the libcxx internal header diff --git a/libcxx/test/libcxx/input.output/filesystems/class.path/path.member/path.native.obs/string_alloc.pass.cpp b/libcxx/test/libcxx/input.output/filesystems/class.path/path.member/path.native.obs/string_alloc.pass.cpp --- a/libcxx/test/libcxx/input.output/filesystems/class.path/path.member/path.native.obs/string_alloc.pass.cpp +++ b/libcxx/test/libcxx/input.output/filesystems/class.path/path.member/path.native.obs/string_alloc.pass.cpp @@ -24,11 +24,11 @@ #include #include -#include "test_macros.h" -#include "test_iterators.h" #include "count_new.h" +#include "make_string.h" #include "min_allocator.h" -#include "filesystem_test_helper.h" +#include "test_iterators.h" +#include "test_macros.h" // the SSO is always triggered for strings of size 2. diff --git a/libcxx/test/libcxx/input.output/filesystems/convert_file_time.pass.cpp b/libcxx/test/libcxx/input.output/filesystems/convert_file_time.pass.cpp --- a/libcxx/test/libcxx/input.output/filesystems/convert_file_time.pass.cpp +++ b/libcxx/test/libcxx/input.output/filesystems/convert_file_time.pass.cpp @@ -7,6 +7,7 @@ //===----------------------------------------------------------------------===// // UNSUPPORTED: c++03, c++11 +// UNSUPPORTED: availability-filesystem-missing // diff --git a/libcxx/test/libcxx/input.output/filesystems/lit.local.cfg b/libcxx/test/libcxx/input.output/filesystems/lit.local.cfg deleted file mode 100644 --- a/libcxx/test/libcxx/input.output/filesystems/lit.local.cfg +++ /dev/null @@ -1,7 +0,0 @@ -# Load the same local configuration as the filesystem tests in libcxx/test/std -import os - -std_filesystem_tests = os.path.join( - config.test_source_root, "std", "input.output", "filesystems" -) -config.load_from_path(os.path.join(std_filesystem_tests, "lit.local.cfg"), lit_config) diff --git a/libcxx/test/libcxx/transitive_includes.gen.py b/libcxx/test/libcxx/transitive_includes.gen.py --- a/libcxx/test/libcxx/transitive_includes.gen.py +++ b/libcxx/test/libcxx/transitive_includes.gen.py @@ -63,8 +63,8 @@ //--- {header}.sh.cpp {lit_header_restrictions.get(header, '')} -// TODO: Fix this test to make it work with filesystem, localization or wide characters disabled -// UNSUPPORTED{BLOCKLIT}: no-filesystem, no-localization, no-wide-characters +// TODO: Fix this test to make it work with localization or wide characters disabled +// UNSUPPORTED{BLOCKLIT}: no-localization, no-wide-characters // When built with modules, this test doesn't work because --trace-includes doesn't // report the stack of includes correctly. diff --git a/libcxx/test/std/containers/iterator.rel_ops.compile.pass.cpp b/libcxx/test/std/containers/iterator.rel_ops.compile.pass.cpp --- a/libcxx/test/std/containers/iterator.rel_ops.compile.pass.cpp +++ b/libcxx/test/std/containers/iterator.rel_ops.compile.pass.cpp @@ -6,7 +6,6 @@ // //===----------------------------------------------------------------------===// -// UNSUPPORTED: no-filesystem // XFAIL: availability-filesystem-missing // Make sure the various containers' iterators are not broken by the use of `std::rel_ops`. @@ -15,6 +14,7 @@ #include #include +#include #include #include #include @@ -26,10 +26,6 @@ #include "test_macros.h" -#if TEST_STD_VER >= 11 -#include "filesystem_include.h" -#endif - #if TEST_STD_VER >= 17 #include #endif @@ -115,16 +111,18 @@ template void test_forward >(); template void test_random_access >(); -#if TEST_STD_VER >= 11 +#if TEST_STD_VER >= 17 void test_directory_iterators() { - fs::directory_iterator it; +#ifndef TEST_HAS_NO_FILESYSTEM + std::filesystem::directory_iterator it; test_eq(it, it); - fs::recursive_directory_iterator rdit; + std::filesystem::recursive_directory_iterator rdit; test_eq(rdit, rdit); +#endif } -template void test_forward(); +template void test_forward(); #endif #if TEST_STD_VER >= 17 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 --- 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,6 @@ //===----------------------------------------------------------------------===// // UNSUPPORTED: c++03, c++11, c++14 -// UNSUPPORTED: no-filesystem // UNSUPPORTED: availability-filesystem-missing 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 --- 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,6 @@ //===----------------------------------------------------------------------===// // UNSUPPORTED: c++03, c++11, c++14 -// UNSUPPORTED: no-filesystem // UNSUPPORTED: availability-filesystem-missing 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 --- 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,6 @@ //===----------------------------------------------------------------------===// // UNSUPPORTED: c++03, c++11, c++14 -// UNSUPPORTED: no-filesystem // UNSUPPORTED: availability-filesystem-missing 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 --- 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,6 @@ //===----------------------------------------------------------------------===// // UNSUPPORTED: c++03, c++11, c++14 -// UNSUPPORTED: no-filesystem // UNSUPPORTED: availability-filesystem-missing 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 --- 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,6 @@ //===----------------------------------------------------------------------===// // UNSUPPORTED: c++03, c++11, c++14 -// UNSUPPORTED: no-filesystem // UNSUPPORTED: availability-filesystem-missing 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 --- 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,6 @@ //===----------------------------------------------------------------------===// // UNSUPPORTED: c++03, c++11, c++14 -// UNSUPPORTED: no-filesystem // UNSUPPORTED: availability-filesystem-missing 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 --- 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,6 @@ //===----------------------------------------------------------------------===// // UNSUPPORTED: c++03, c++11, c++14 -// UNSUPPORTED: no-filesystem // UNSUPPORTED: availability-filesystem-missing diff --git a/libcxx/test/std/input.output/filesystems/lit.local.cfg b/libcxx/test/std/input.output/filesystems/class.directory_entry/lit.local.cfg rename from libcxx/test/std/input.output/filesystems/lit.local.cfg rename to libcxx/test/std/input.output/filesystems/class.directory_entry/lit.local.cfg diff --git a/libcxx/test/std/input.output/filesystems/lit.local.cfg b/libcxx/test/std/input.output/filesystems/class.directory_iterator/lit.local.cfg copy from libcxx/test/std/input.output/filesystems/lit.local.cfg copy to libcxx/test/std/input.output/filesystems/class.directory_iterator/lit.local.cfg diff --git a/libcxx/test/std/input.output/filesystems/class.filesystem_error/filesystem_error.members.pass.cpp b/libcxx/test/std/input.output/filesystems/class.filesystem_error/filesystem_error.members.pass.cpp --- a/libcxx/test/std/input.output/filesystems/class.filesystem_error/filesystem_error.members.pass.cpp +++ b/libcxx/test/std/input.output/filesystems/class.filesystem_error/filesystem_error.members.pass.cpp @@ -6,6 +6,7 @@ // //===----------------------------------------------------------------------===// +// UNSUPPORTED: availability-filesystem-missing // UNSUPPORTED: c++03 // diff --git a/libcxx/test/std/input.output/filesystems/class.path/path.member/path.append.pass.cpp b/libcxx/test/std/input.output/filesystems/class.path/path.member/path.append.pass.cpp --- a/libcxx/test/std/input.output/filesystems/class.path/path.member/path.append.pass.cpp +++ b/libcxx/test/std/input.output/filesystems/class.path/path.member/path.append.pass.cpp @@ -33,11 +33,10 @@ // to an intermediate path object, causing allocations in cases where no // allocations are done on other platforms. -#include "test_macros.h" -#include "test_iterators.h" #include "count_new.h" -#include "filesystem_test_helper.h" - +#include "make_string.h" +#include "test_iterators.h" +#include "test_macros.h" struct AppendOperatorTestcase { MultiStringType lhs; diff --git a/libcxx/test/std/input.output/filesystems/class.path/path.member/path.gen/lexically_relative_and_proximate.pass.cpp b/libcxx/test/std/input.output/filesystems/class.path/path.member/path.gen/lexically_relative_and_proximate.pass.cpp --- a/libcxx/test/std/input.output/filesystems/class.path/path.member/path.gen/lexically_relative_and_proximate.pass.cpp +++ b/libcxx/test/std/input.output/filesystems/class.path/path.member/path.gen/lexically_relative_and_proximate.pass.cpp @@ -23,7 +23,6 @@ #include "count_new.h" #include "filesystem_test_helper.h" - int main(int, char**) { // clang-format off struct { diff --git a/libcxx/test/std/input.output/filesystems/class.path/path.nonmember/append_op.pass.cpp b/libcxx/test/std/input.output/filesystems/class.path/path.nonmember/append_op.pass.cpp --- a/libcxx/test/std/input.output/filesystems/class.path/path.nonmember/append_op.pass.cpp +++ b/libcxx/test/std/input.output/filesystems/class.path/path.nonmember/append_op.pass.cpp @@ -17,7 +17,6 @@ #include #include "test_macros.h" -#include "filesystem_test_helper.h" // This is mainly tested via the member append functions. int main(int, char**) diff --git a/libcxx/test/std/input.output/filesystems/class.path/path.nonmember/path.io.pass.cpp b/libcxx/test/std/input.output/filesystems/class.path/path.nonmember/path.io.pass.cpp --- a/libcxx/test/std/input.output/filesystems/class.path/path.nonmember/path.io.pass.cpp +++ b/libcxx/test/std/input.output/filesystems/class.path/path.nonmember/path.io.pass.cpp @@ -28,10 +28,10 @@ #include #include -#include "test_macros.h" -#include "test_iterators.h" #include "count_new.h" -#include "filesystem_test_helper.h" +#include "test_iterators.h" +#include "test_macros.h" +#include "test_string.h" MultiStringType InStr = MKSTR("abcdefg/\"hijklmnop\"/qrstuvwxyz/123456789"); MultiStringType OutStr = MKSTR("\"abcdefg/\\\"hijklmnop\\\"/qrstuvwxyz/123456789\""); diff --git a/libcxx/test/std/input.output/filesystems/class.path/path.nonmember/swap.pass.cpp b/libcxx/test/std/input.output/filesystems/class.path/path.nonmember/swap.pass.cpp --- a/libcxx/test/std/input.output/filesystems/class.path/path.nonmember/swap.pass.cpp +++ b/libcxx/test/std/input.output/filesystems/class.path/path.nonmember/swap.pass.cpp @@ -18,7 +18,6 @@ #include "test_macros.h" #include "count_new.h" -#include "filesystem_test_helper.h" // NOTE: this is tested in path.members/path.modifiers via the member swap. int main(int, char**) diff --git a/libcxx/test/std/input.output/filesystems/class.path/path_helper.h b/libcxx/test/std/input.output/filesystems/class.path/path_helper.h new file mode 100644 --- /dev/null +++ b/libcxx/test/std/input.output/filesystems/class.path/path_helper.h @@ -0,0 +1,25 @@ +// -*- C++ -*- +//===----------------------------------------------------------------------===// +// +// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions. +// See https://llvm.org/LICENSE.txt for license information. +// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception +// +//===----------------------------------------------------------------------===// + +#ifndef TEST_STD_INPUT_OUTPUT_FILESYSTEMS_CLASS_PATH_PATH_HELPER_H +#define TEST_STD_INPUT_OUTPUT_FILESYSTEMS_CLASS_PATH_PATH_HELPER_H + +#include + +#include "filesystem_include.h" + +// Testing the allocation behavior of the code_cvt functions requires +// *knowing* that the allocation was not done by "path::__str_". +// This hack forces path to allocate enough memory. +inline void PathReserve(fs::path& p, std::size_t N) { + auto const& native_ref = p.native(); + const_cast(native_ref).reserve(N); +} + +#endif // TEST_STD_INPUT_OUTPUT_FILESYSTEMS_CLASS_PATH_PATH_HELPER_H diff --git a/libcxx/test/std/input.output/filesystems/lit.local.cfg b/libcxx/test/std/input.output/filesystems/class.rec.dir.itr/lit.local.cfg copy from libcxx/test/std/input.output/filesystems/lit.local.cfg copy to libcxx/test/std/input.output/filesystems/class.rec.dir.itr/lit.local.cfg diff --git a/libcxx/test/std/input.output/filesystems/fs.filesystem.synopsis/enable_view.compile.pass.cpp b/libcxx/test/std/input.output/filesystems/fs.filesystem.synopsis/enable_view.compile.pass.cpp --- a/libcxx/test/std/input.output/filesystems/fs.filesystem.synopsis/enable_view.compile.pass.cpp +++ b/libcxx/test/std/input.output/filesystems/fs.filesystem.synopsis/enable_view.compile.pass.cpp @@ -7,6 +7,7 @@ //===----------------------------------------------------------------------===// // UNSUPPORTED: c++03, c++11, c++14, c++17 +// UNSUPPORTED: no-filesystem // diff --git a/libcxx/test/std/input.output/filesystems/lit.local.cfg b/libcxx/test/std/input.output/filesystems/fs.op.funcs/lit.local.cfg rename from libcxx/test/std/input.output/filesystems/lit.local.cfg rename to libcxx/test/std/input.output/filesystems/fs.op.funcs/lit.local.cfg diff --git a/libcxx/test/std/time/time.clock/time.clock.file/now.pass.cpp b/libcxx/test/std/time/time.clock/time.clock.file/now.pass.cpp --- a/libcxx/test/std/time/time.clock/time.clock.file/now.pass.cpp +++ b/libcxx/test/std/time/time.clock/time.clock.file/now.pass.cpp @@ -7,7 +7,6 @@ //===----------------------------------------------------------------------===// // UNSUPPORTED: c++03, c++11, c++14, c++17 -// UNSUPPORTED: no-filesystem // UNSUPPORTED: availability-filesystem-missing diff --git a/libcxx/test/std/time/time.clock/time.clock.file/to_from_sys.pass.cpp b/libcxx/test/std/time/time.clock/time.clock.file/to_from_sys.pass.cpp --- a/libcxx/test/std/time/time.clock/time.clock.file/to_from_sys.pass.cpp +++ b/libcxx/test/std/time/time.clock/time.clock.file/to_from_sys.pass.cpp @@ -7,7 +7,6 @@ //===----------------------------------------------------------------------===// // UNSUPPORTED: c++03, c++11, c++14, c++17 -// UNSUPPORTED: no-filesystem // UNSUPPORTED: availability-filesystem-missing diff --git a/libcxx/test/std/utilities/format/format.formattable/concept.formattable.compile.pass.cpp b/libcxx/test/std/utilities/format/format.formattable/concept.formattable.compile.pass.cpp --- a/libcxx/test/std/utilities/format/format.formattable/concept.formattable.compile.pass.cpp +++ b/libcxx/test/std/utilities/format/format.formattable/concept.formattable.compile.pass.cpp @@ -22,16 +22,17 @@ #include #include #include +#include #include #include #include -#include #include +#include #include #include #include -#include #include +#include #include #include #include @@ -42,9 +43,6 @@ #include "test_macros.h" #include "min_allocator.h" -#ifndef TEST_HAS_NO_FILESYSTEM -# include -#endif #ifndef TEST_HAS_NO_LOCALIZATION # include #endif @@ -182,9 +180,7 @@ assert_is_not_formattable, CharT>(); assert_is_not_formattable, CharT>(); assert_is_not_formattable(); -#ifndef TEST_HAS_NO_FILESYSTEM assert_is_not_formattable(); -#endif assert_is_not_formattable, CharT>(); #ifndef TEST_HAS_NO_LOCALIZATION if constexpr (!std::same_as) // sub_match only works with proper character types diff --git a/libcxx/test/std/utilities/format/format.range/format.range.fmtkind/format_kind.compile.pass.cpp b/libcxx/test/std/utilities/format/format.range/format.range.fmtkind/format_kind.compile.pass.cpp --- a/libcxx/test/std/utilities/format/format.range/format.range.fmtkind/format_kind.compile.pass.cpp +++ b/libcxx/test/std/utilities/format/format.range/format.range.fmtkind/format_kind.compile.pass.cpp @@ -20,6 +20,7 @@ #include #include +#include #include #include #include @@ -28,17 +29,13 @@ #include #include #include -#include #include #include #include +#include #include "test_macros.h" -#ifndef TEST_HAS_NO_FILESYSTEM -# include -#endif - // [format.range.fmtkind] // If same_as>, R> is true, // format_kind is range_format::disabled. @@ -67,9 +64,7 @@ static_assert(std::ranges::input_range, "format_kind requires an input range"); static_assert(std::format_kind == std::range_format::disabled); -#ifndef TEST_HAS_NO_FILESYSTEM static_assert(std::format_kind == std::range_format::disabled); -#endif static_assert(std::format_kind> == std::range_format::map); static_assert(std::format_kind> == std::range_format::map);