PR libstdc++/86756 Move rest of std::filesystem to libstdc++.so
authorJonathan Wakely <jwakely@redhat.com>
Sun, 6 Jan 2019 22:34:37 +0000 (22:34 +0000)
committerJonathan Wakely <redi@gcc.gnu.org>
Sun, 6 Jan 2019 22:34:37 +0000 (22:34 +0000)
commitde4db54fd997c42dc8761a8057435187ebe63aa7
tree133080ebf668711aaa3a120d08501618325b1bdc
parent2b5225352e9267152dc714e256576563a949a8f4
PR libstdc++/86756 Move rest of std::filesystem to libstdc++.so

Move std::filesystem directory iterators and operations from
libstdc++fs.a to main libstdc++ library. These components have many
dependencies on OS support, which is not available on all targets. Some
additional autoconf checks and conditional compilation is needed to
ensure the files will build for all targets. Previously this code was
not compiled without --enable-libstdcxx-filesystem-ts but the C++17
components should be available for all hosted builds.

The tests for these components no longer need to link to libstdc++fs.a,
but are not expected to pass on all targets. To avoid numerous failures
on targets which are not expected to pass the tests (due to missing OS
functionality) leave the dg-require-filesystem-ts directives in place
for now. This will ensure the tests only run for builds where the
filesystem-ts library is built, which presumably means some level of OS
support is present.

PR libstdc++/86756
* acinclude.m4 (GLIBCXX_CHECK_FILESYSTEM_DEPS): Check for utime and
lstat and define _GLIBCXX_USE_UTIME and _GLIBCXX_USE_LSTAT.
* config.h.in: Regenerate.
* config/abi/pre/gnu.ver (GLIBCXX_3.4.26): Export symbols for
remaining std::filesystem types and functions.
* configure: Regenerate.
* src/c++17/Makefile.am: Add C++17 filesystem sources.
* src/c++17/Makefile.in: Regenerate.
* src/c++17/cow-fs_dir.cc: Move src/filesystem/cow-std-dir.cc to
here, and change name of included file.
* src/c++17/cow-fs_ops.cc: Move src/filesystem/cow-std-ops.cc to
here, and change name of included file.
* src/c++17/fs_dir.cc: Move src/filesystem/std-dir.cc to here. Change
path to dir-common.h.
* src/c++17/fs_ops.cc: Move src/filesystem/std-ops.cc to here. Change
path to ops-common.h. Disable -Wunused-parameter warnings.
(internal_file_clock): Define unconditionally.
[!_GLIBCXX_HAVE_SYS_STAT_H] (internal_file_clock::from_stat): Do not
define.
(do_copy_file, do_space): Move definitions to ops.common.h.
(copy, file_size, hard_link_count, last_write_time, space): Only
perform operation when _GLIBCXX_HAVE_SYS_STAT_H is defined, otherwise
report an error.
(last_write_time, read_symlink): Remove unused attributes from
parameters.
* src/filesystem/Makefile.am: Remove C++17 filesystem sources.
* src/filesystem/Makefile.in: Regenerate.
* src/filesystem/cow-std-dir.cc: Move to src/c++17/cow-fs_dir.cc.
* src/filesystem/cow-std-ops.cc: Move to src/c++17/cow-fs_ops.cc.
* src/filesystem/std-dir.cc: Move to src/c++17/fs_dir.cc.
* src/filesystem/std-ops.cc: Move to src/c++17/fs_ops.cc.
* src/filesystem/dir-common.h [!_GLIBCXX_HAVE_DIRENT_H]: Define
dummy types and functions instead of using #error.
* src/filesystem/dir.cc [!_GLIBCXX_HAVE_DIRENT_H]: Use #error.
* src/filesystem/ops-common.h [!_GLIBCXX_USE_LSTAT] (lstat): Define
in terms of stat.
[!_GLIBCXX_HAVE_UNISTD_H]: Define dummy types and functions.
(do_copy_file, do_space): Move definitions here from std-ops.cc.
* src/filesystem/ops.cc: Adjust calls to do_copy_file and do_space
to account for new namespace.
* testsuite/27_io/filesystem/directory_entry/86597.cc: Remove
-lstdc++fs from dg-options.
* testsuite/27_io/filesystem/directory_entry/lwg3171.cc: Likewise.
* testsuite/27_io/filesystem/file_status/1.cc: Likewise.
* testsuite/27_io/filesystem/filesystem_error/cons.cc: Likewise.
* testsuite/27_io/filesystem/filesystem_error/copy.cc: Likewise.
* testsuite/27_io/filesystem/iterators/directory_iterator.cc:
Likewise.
* testsuite/27_io/filesystem/iterators/pop.cc: Likewise.
* testsuite/27_io/filesystem/iterators/recursive_directory_iterator.cc:
Likewise.
* testsuite/27_io/filesystem/operations/absolute.cc: Likewise.
* testsuite/27_io/filesystem/operations/canonical.cc: Likewise.
* testsuite/27_io/filesystem/operations/copy.cc: Likewise.
* testsuite/27_io/filesystem/operations/copy_file.cc: Likewise.
* testsuite/27_io/filesystem/operations/create_directories.cc:
Likewise.
* testsuite/27_io/filesystem/operations/create_directory.cc: Likewise.
* testsuite/27_io/filesystem/operations/create_symlink.cc: Likewise.
* testsuite/27_io/filesystem/operations/current_path.cc: Likewise.
* testsuite/27_io/filesystem/operations/equivalent.cc: Likewise.
* testsuite/27_io/filesystem/operations/exists.cc: Likewise.
* testsuite/27_io/filesystem/operations/file_size.cc: Likewise.
* testsuite/27_io/filesystem/operations/is_empty.cc: Likewise.
* testsuite/27_io/filesystem/operations/last_write_time.cc: Likewise.
* testsuite/27_io/filesystem/operations/permissions.cc: Likewise.
* testsuite/27_io/filesystem/operations/proximate.cc: Likewise.
* testsuite/27_io/filesystem/operations/read_symlink.cc: Likewise.
* testsuite/27_io/filesystem/operations/relative.cc: Likewise.
* testsuite/27_io/filesystem/operations/remove.cc: Likewise.
* testsuite/27_io/filesystem/operations/remove_all.cc: Likewise.
* testsuite/27_io/filesystem/operations/space.cc: Likewise.
* testsuite/27_io/filesystem/operations/status.cc: Likewise.
* testsuite/27_io/filesystem/operations/symlink_status.cc: Likewise.
* testsuite/27_io/filesystem/operations/temp_directory_path.cc:
Likewise.
* testsuite/27_io/filesystem/operations/weakly_canonical.cc: Likewise.

From-SVN: r267616
53 files changed:
libstdc++-v3/ChangeLog
libstdc++-v3/acinclude.m4
libstdc++-v3/config.h.in
libstdc++-v3/config/abi/pre/gnu.ver
libstdc++-v3/configure
libstdc++-v3/src/c++17/Makefile.am
libstdc++-v3/src/c++17/Makefile.in
libstdc++-v3/src/c++17/cow-fs_dir.cc [new file with mode: 0644]
libstdc++-v3/src/c++17/cow-fs_ops.cc [new file with mode: 0644]
libstdc++-v3/src/c++17/fs_dir.cc [new file with mode: 0644]
libstdc++-v3/src/c++17/fs_ops.cc [new file with mode: 0644]
libstdc++-v3/src/filesystem/Makefile.am
libstdc++-v3/src/filesystem/Makefile.in
libstdc++-v3/src/filesystem/cow-std-dir.cc [deleted file]
libstdc++-v3/src/filesystem/cow-std-ops.cc [deleted file]
libstdc++-v3/src/filesystem/dir-common.h
libstdc++-v3/src/filesystem/dir.cc
libstdc++-v3/src/filesystem/ops-common.h
libstdc++-v3/src/filesystem/ops.cc
libstdc++-v3/src/filesystem/std-dir.cc [deleted file]
libstdc++-v3/src/filesystem/std-ops.cc [deleted file]
libstdc++-v3/testsuite/27_io/filesystem/directory_entry/86597.cc
libstdc++-v3/testsuite/27_io/filesystem/directory_entry/lwg3171.cc
libstdc++-v3/testsuite/27_io/filesystem/file_status/1.cc
libstdc++-v3/testsuite/27_io/filesystem/filesystem_error/cons.cc
libstdc++-v3/testsuite/27_io/filesystem/filesystem_error/copy.cc
libstdc++-v3/testsuite/27_io/filesystem/iterators/directory_iterator.cc
libstdc++-v3/testsuite/27_io/filesystem/iterators/pop.cc
libstdc++-v3/testsuite/27_io/filesystem/iterators/recursive_directory_iterator.cc
libstdc++-v3/testsuite/27_io/filesystem/operations/absolute.cc
libstdc++-v3/testsuite/27_io/filesystem/operations/canonical.cc
libstdc++-v3/testsuite/27_io/filesystem/operations/copy.cc
libstdc++-v3/testsuite/27_io/filesystem/operations/copy_file.cc
libstdc++-v3/testsuite/27_io/filesystem/operations/create_directories.cc
libstdc++-v3/testsuite/27_io/filesystem/operations/create_directory.cc
libstdc++-v3/testsuite/27_io/filesystem/operations/create_symlink.cc
libstdc++-v3/testsuite/27_io/filesystem/operations/current_path.cc
libstdc++-v3/testsuite/27_io/filesystem/operations/equivalent.cc
libstdc++-v3/testsuite/27_io/filesystem/operations/exists.cc
libstdc++-v3/testsuite/27_io/filesystem/operations/file_size.cc
libstdc++-v3/testsuite/27_io/filesystem/operations/is_empty.cc
libstdc++-v3/testsuite/27_io/filesystem/operations/last_write_time.cc
libstdc++-v3/testsuite/27_io/filesystem/operations/permissions.cc
libstdc++-v3/testsuite/27_io/filesystem/operations/proximate.cc
libstdc++-v3/testsuite/27_io/filesystem/operations/read_symlink.cc
libstdc++-v3/testsuite/27_io/filesystem/operations/relative.cc
libstdc++-v3/testsuite/27_io/filesystem/operations/remove.cc
libstdc++-v3/testsuite/27_io/filesystem/operations/remove_all.cc
libstdc++-v3/testsuite/27_io/filesystem/operations/space.cc
libstdc++-v3/testsuite/27_io/filesystem/operations/status.cc
libstdc++-v3/testsuite/27_io/filesystem/operations/symlink_status.cc
libstdc++-v3/testsuite/27_io/filesystem/operations/temp_directory_path.cc
libstdc++-v3/testsuite/27_io/filesystem/operations/weakly_canonical.cc