Skip to content

Commit 3b90ed6

Browse files
author
redi
committed
Implement C++17 Filesystem library
Based on Filesystem TS implementation, with the changes applied by: - P0219R1 Relative Paths for Filesystem - P0317R1 Directory Entry Caching for Filesystem - P0492R2 Resolution of C++17 National Body Comments Where appropriate code is shared between the TS and C++17 implementations. * include/Makefile.am: Add new headers for C++17 filesystem library. * include/Makefile.in: Regenerate. * include/bits/fs_dir.h: New header, based on Filesystem TS code in include/experimental/bits directory. * include/bits/fs_fwd.h: Likewise. * include/bits/fs_ops.h: Likewise. * include/bits/fs_path.h: Likewise. * include/experimental/bits/fs_dir.h: Rename Doxygen group. * include/experimental/bits/fs_fwd.h: Likewise. * include/experimental/bits/fs_ops.h: Likewise. * include/experimental/bits/fs_path.h: Likewise. * include/experimental/filesystem (filesystem_error::_M_gen_what): Remove inline definition. * include/precompiled/stdc++.h: Add <filesystem> to precompiled header. * include/std/filesystem: New header. * python/libstdcxx/v6/printers.py: Enable printer for std::filesystem paths. * src/filesystem/Makefile.am: Add new files. Compile as C++17. * src/filesystem/Makefile.in: Regenerate. * src/filesystem/cow-dir.cc: Update comment. * src/filesystem/cow-ops.cc: Likewise. * src/filesystem/cow-path.cc: Likewise. * src/filesystem/cow-std-dir.cc: New file. * src/filesystem/cow-std-ops.cc: New file. * src/filesystem/cow-std-path.cc: New file. * src/filesystem/dir-common.h (_Dir_base, get_file_type): New header for common code. * src/filesystem/dir.cc (_Dir): Derive from _Dir_base. (open_dir): Move to _Dir_base constructor. (get_file_type): Move to dir-common.h. (recurse): Move to _Dir_base::should_recurse. * src/filesystem/ops-common.h: New header for common code. * src/filesystem/ops.cc (is_set, make_file_type, make_file_status) (is_not_found_errno, file_time, do_copy_file): Move to ops-common.h. * src/filesystem/path.cc (filesystem_error::_M_gen_what): Define. * src/filesystem/std-dir.cc: New file, based on Filesystem TS code. * src/filesystem/std-ops.cc: Likewise. * src/filesystem/std-dir.cc: Likewise. * testsuite/27_io/filesystem/iterators/directory_iterator.cc: New test. * testsuite/27_io/filesystem/iterators/pop.cc: New test. * testsuite/27_io/filesystem/iterators/recursive_directory_iterator.cc: New test. * testsuite/27_io/filesystem/operations/absolute.cc: New test. * testsuite/27_io/filesystem/operations/canonical.cc: New test. * testsuite/27_io/filesystem/operations/copy.cc: New test. * testsuite/27_io/filesystem/operations/copy_file.cc: New test. * testsuite/27_io/filesystem/operations/create_directories.cc: New test. * testsuite/27_io/filesystem/operations/create_directory.cc: New test. * testsuite/27_io/filesystem/operations/create_symlink.cc: New test. * testsuite/27_io/filesystem/operations/current_path.cc: New test. * testsuite/27_io/filesystem/operations/equivalent.cc: New test. * testsuite/27_io/filesystem/operations/exists.cc: New test. * testsuite/27_io/filesystem/operations/file_size.cc: New test. * testsuite/27_io/filesystem/operations/is_empty.cc: New test. * testsuite/27_io/filesystem/operations/last_write_time.cc: New test. * testsuite/27_io/filesystem/operations/permissions.cc: New test. * testsuite/27_io/filesystem/operations/proximate.cc: New test. * testsuite/27_io/filesystem/operations/read_symlink.cc: New test. * testsuite/27_io/filesystem/operations/relative.cc: New test. * testsuite/27_io/filesystem/operations/remove_all.cc: New test. * testsuite/27_io/filesystem/operations/space.cc: New test. * testsuite/27_io/filesystem/operations/status.cc: New test. * testsuite/27_io/filesystem/operations/symlink_status.cc: New test. * testsuite/27_io/filesystem/operations/temp_directory_path.cc: New test. * testsuite/27_io/filesystem/operations/weakly_canonical.cc: New test. * testsuite/27_io/filesystem/path/append/path.cc: New test. * testsuite/27_io/filesystem/path/assign/assign.cc: New test. * testsuite/27_io/filesystem/path/assign/copy.cc: New test. * testsuite/27_io/filesystem/path/compare/compare.cc: New test. * testsuite/27_io/filesystem/path/compare/path.cc: New test. * testsuite/27_io/filesystem/path/compare/strings.cc: New test. * testsuite/27_io/filesystem/path/concat/path.cc: New test. * testsuite/27_io/filesystem/path/concat/strings.cc: New test. * testsuite/27_io/filesystem/path/construct/copy.cc: New test. * testsuite/27_io/filesystem/path/construct/default.cc: New test. * testsuite/27_io/filesystem/path/construct/locale.cc: New test. * testsuite/27_io/filesystem/path/construct/range.cc: New test. * testsuite/27_io/filesystem/path/construct/string_view.cc: New test. * testsuite/27_io/filesystem/path/decompose/extension.cc: New test. * testsuite/27_io/filesystem/path/decompose/filename.cc: New test. * testsuite/27_io/filesystem/path/decompose/parent_path.cc: New test. * testsuite/27_io/filesystem/path/decompose/relative_path.cc: New test. * testsuite/27_io/filesystem/path/decompose/root_directory.cc: New test. * testsuite/27_io/filesystem/path/decompose/root_name.cc: New test. * testsuite/27_io/filesystem/path/decompose/root_path.cc: New test. * testsuite/27_io/filesystem/path/decompose/stem.cc: New test. * testsuite/27_io/filesystem/path/generation/normal.cc: New test. * testsuite/27_io/filesystem/path/generation/proximate.cc: New test. * testsuite/27_io/filesystem/path/generation/relative.cc: New test. * testsuite/27_io/filesystem/path/generic/generic_string.cc: New test. * testsuite/27_io/filesystem/path/itr/traversal.cc: New test. * testsuite/27_io/filesystem/path/modifiers/clear.cc: New test. * testsuite/27_io/filesystem/path/modifiers/make_preferred.cc: New test. * testsuite/27_io/filesystem/path/modifiers/remove_filename.cc: New test. * testsuite/27_io/filesystem/path/modifiers/replace_extension.cc: New test. * testsuite/27_io/filesystem/path/modifiers/replace_filename.cc: New test. * testsuite/27_io/filesystem/path/modifiers/swap.cc: New test. * testsuite/27_io/filesystem/path/native/string.cc: New test. * testsuite/27_io/filesystem/path/nonmember/hash_value.cc: New test. * testsuite/27_io/filesystem/path/query/empty.cc: New test. * testsuite/27_io/filesystem/path/query/has_extension.cc: New test. * testsuite/27_io/filesystem/path/query/has_filename.cc: New test. * testsuite/27_io/filesystem/path/query/has_parent_path.cc: New test. * testsuite/27_io/filesystem/path/query/has_relative_path.cc: New test. * testsuite/27_io/filesystem/path/query/has_root_directory.cc: New test. * testsuite/27_io/filesystem/path/query/has_root_name.cc: New test. * testsuite/27_io/filesystem/path/query/has_root_path.cc: New test. * testsuite/27_io/filesystem/path/query/has_stem.cc: New test. * testsuite/27_io/filesystem/path/query/is_relative.cc: New test. * testsuite/experimental/filesystem/path/construct/string_view.cc: Define USE_FILESYSTEM_TS. * testsuite/util/testsuite_fs.h: Allow use with C++17 paths as well as Filesystem TS. git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@254008 138bc75d-0d04-0410-961f-82ee72b054a4
1 parent f66b5a8 commit 3b90ed6

File tree

103 files changed

+10854
-494
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

103 files changed

+10854
-494
lines changed

libstdc++-v3/ChangeLog

Lines changed: 126 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,131 @@
11
2017-10-23 Jonathan Wakely <[email protected]>
22

3+
* include/Makefile.am: Add new headers for C++17 filesystem library.
4+
* include/Makefile.in: Regenerate.
5+
* include/bits/fs_dir.h: New header, based on Filesystem TS code in
6+
include/experimental/bits directory.
7+
* include/bits/fs_fwd.h: Likewise.
8+
* include/bits/fs_ops.h: Likewise.
9+
* include/bits/fs_path.h: Likewise.
10+
* include/experimental/bits/fs_dir.h: Rename Doxygen group.
11+
* include/experimental/bits/fs_fwd.h: Likewise.
12+
* include/experimental/bits/fs_ops.h: Likewise.
13+
* include/experimental/bits/fs_path.h: Likewise.
14+
* include/experimental/filesystem (filesystem_error::_M_gen_what):
15+
Remove inline definition.
16+
* include/precompiled/stdc++.h: Add <filesystem> to precompiled
17+
header.
18+
* include/std/filesystem: New header.
19+
* python/libstdcxx/v6/printers.py: Enable printer for std::filesystem
20+
paths.
21+
* src/filesystem/Makefile.am: Add new files. Compile as C++17.
22+
* src/filesystem/Makefile.in: Regenerate.
23+
* src/filesystem/cow-dir.cc: Update comment.
24+
* src/filesystem/cow-ops.cc: Likewise.
25+
* src/filesystem/cow-path.cc: Likewise.
26+
* src/filesystem/cow-std-dir.cc: New file.
27+
* src/filesystem/cow-std-ops.cc: New file.
28+
* src/filesystem/cow-std-path.cc: New file.
29+
* src/filesystem/dir-common.h (_Dir_base, get_file_type): New header
30+
for common code.
31+
* src/filesystem/dir.cc (_Dir): Derive from _Dir_base.
32+
(open_dir): Move to _Dir_base constructor.
33+
(get_file_type): Move to dir-common.h.
34+
(recurse): Move to _Dir_base::should_recurse.
35+
* src/filesystem/ops-common.h: New header for common code.
36+
* src/filesystem/ops.cc (is_set, make_file_type, make_file_status)
37+
(is_not_found_errno, file_time, do_copy_file): Move to ops-common.h.
38+
* src/filesystem/path.cc (filesystem_error::_M_gen_what): Define.
39+
* src/filesystem/std-dir.cc: New file, based on Filesystem TS code.
40+
* src/filesystem/std-ops.cc: Likewise.
41+
* src/filesystem/std-dir.cc: Likewise.
42+
* testsuite/27_io/filesystem/iterators/directory_iterator.cc: New
43+
test.
44+
* testsuite/27_io/filesystem/iterators/pop.cc: New test.
45+
* testsuite/27_io/filesystem/iterators/recursive_directory_iterator.cc:
46+
New test.
47+
* testsuite/27_io/filesystem/operations/absolute.cc: New test.
48+
* testsuite/27_io/filesystem/operations/canonical.cc: New test.
49+
* testsuite/27_io/filesystem/operations/copy.cc: New test.
50+
* testsuite/27_io/filesystem/operations/copy_file.cc: New test.
51+
* testsuite/27_io/filesystem/operations/create_directories.cc: New
52+
test.
53+
* testsuite/27_io/filesystem/operations/create_directory.cc: New test.
54+
* testsuite/27_io/filesystem/operations/create_symlink.cc: New test.
55+
* testsuite/27_io/filesystem/operations/current_path.cc: New test.
56+
* testsuite/27_io/filesystem/operations/equivalent.cc: New test.
57+
* testsuite/27_io/filesystem/operations/exists.cc: New test.
58+
* testsuite/27_io/filesystem/operations/file_size.cc: New test.
59+
* testsuite/27_io/filesystem/operations/is_empty.cc: New test.
60+
* testsuite/27_io/filesystem/operations/last_write_time.cc: New test.
61+
* testsuite/27_io/filesystem/operations/permissions.cc: New test.
62+
* testsuite/27_io/filesystem/operations/proximate.cc: New test.
63+
* testsuite/27_io/filesystem/operations/read_symlink.cc: New test.
64+
* testsuite/27_io/filesystem/operations/relative.cc: New test.
65+
* testsuite/27_io/filesystem/operations/remove_all.cc: New test.
66+
* testsuite/27_io/filesystem/operations/space.cc: New test.
67+
* testsuite/27_io/filesystem/operations/status.cc: New test.
68+
* testsuite/27_io/filesystem/operations/symlink_status.cc: New test.
69+
* testsuite/27_io/filesystem/operations/temp_directory_path.cc: New
70+
test.
71+
* testsuite/27_io/filesystem/operations/weakly_canonical.cc: New test.
72+
* testsuite/27_io/filesystem/path/append/path.cc: New test.
73+
* testsuite/27_io/filesystem/path/assign/assign.cc: New test.
74+
* testsuite/27_io/filesystem/path/assign/copy.cc: New test.
75+
* testsuite/27_io/filesystem/path/compare/compare.cc: New test.
76+
* testsuite/27_io/filesystem/path/compare/path.cc: New test.
77+
* testsuite/27_io/filesystem/path/compare/strings.cc: New test.
78+
* testsuite/27_io/filesystem/path/concat/path.cc: New test.
79+
* testsuite/27_io/filesystem/path/concat/strings.cc: New test.
80+
* testsuite/27_io/filesystem/path/construct/copy.cc: New test.
81+
* testsuite/27_io/filesystem/path/construct/default.cc: New test.
82+
* testsuite/27_io/filesystem/path/construct/locale.cc: New test.
83+
* testsuite/27_io/filesystem/path/construct/range.cc: New test.
84+
* testsuite/27_io/filesystem/path/construct/string_view.cc: New test.
85+
* testsuite/27_io/filesystem/path/decompose/extension.cc: New test.
86+
* testsuite/27_io/filesystem/path/decompose/filename.cc: New test.
87+
* testsuite/27_io/filesystem/path/decompose/parent_path.cc: New test.
88+
* testsuite/27_io/filesystem/path/decompose/relative_path.cc: New
89+
test.
90+
* testsuite/27_io/filesystem/path/decompose/root_directory.cc: New
91+
test.
92+
* testsuite/27_io/filesystem/path/decompose/root_name.cc: New test.
93+
* testsuite/27_io/filesystem/path/decompose/root_path.cc: New test.
94+
* testsuite/27_io/filesystem/path/decompose/stem.cc: New test.
95+
* testsuite/27_io/filesystem/path/generation/normal.cc: New test.
96+
* testsuite/27_io/filesystem/path/generation/proximate.cc: New test.
97+
* testsuite/27_io/filesystem/path/generation/relative.cc: New test.
98+
* testsuite/27_io/filesystem/path/generic/generic_string.cc: New test.
99+
* testsuite/27_io/filesystem/path/itr/traversal.cc: New test.
100+
* testsuite/27_io/filesystem/path/modifiers/clear.cc: New test.
101+
* testsuite/27_io/filesystem/path/modifiers/make_preferred.cc: New
102+
test.
103+
* testsuite/27_io/filesystem/path/modifiers/remove_filename.cc: New
104+
test.
105+
* testsuite/27_io/filesystem/path/modifiers/replace_extension.cc: New
106+
test.
107+
* testsuite/27_io/filesystem/path/modifiers/replace_filename.cc: New
108+
test.
109+
* testsuite/27_io/filesystem/path/modifiers/swap.cc: New test.
110+
* testsuite/27_io/filesystem/path/native/string.cc: New test.
111+
* testsuite/27_io/filesystem/path/nonmember/hash_value.cc: New test.
112+
* testsuite/27_io/filesystem/path/query/empty.cc: New test.
113+
* testsuite/27_io/filesystem/path/query/has_extension.cc: New test.
114+
* testsuite/27_io/filesystem/path/query/has_filename.cc: New test.
115+
* testsuite/27_io/filesystem/path/query/has_parent_path.cc: New test.
116+
* testsuite/27_io/filesystem/path/query/has_relative_path.cc: New
117+
test.
118+
* testsuite/27_io/filesystem/path/query/has_root_directory.cc: New
119+
test.
120+
* testsuite/27_io/filesystem/path/query/has_root_name.cc: New test.
121+
* testsuite/27_io/filesystem/path/query/has_root_path.cc: New test.
122+
* testsuite/27_io/filesystem/path/query/has_stem.cc: New test.
123+
* testsuite/27_io/filesystem/path/query/is_relative.cc: New test.
124+
* testsuite/experimental/filesystem/path/construct/string_view.cc:
125+
Define USE_FILESYSTEM_TS.
126+
* testsuite/util/testsuite_fs.h: Allow use with C++17 paths as well
127+
as Filesystem TS.
128+
3129
PR libstdc++/82644
4130
* doc/xml/manual/intro.xml: Include new section.
5131
* doc/xml/manual/status_cxxis29124.xml: New section on IS 29124

libstdc++-v3/include/Makefile.am

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -37,6 +37,7 @@ std_headers = \
3737
${std_srcdir}/complex \
3838
${std_srcdir}/condition_variable \
3939
${std_srcdir}/deque \
40+
${std_srcdir}/filesystem \
4041
${std_srcdir}/forward_list \
4142
${std_srcdir}/fstream \
4243
${std_srcdir}/functional \
@@ -104,6 +105,10 @@ bits_headers = \
104105
${bits_srcdir}/enable_special_members.h \
105106
${bits_srcdir}/forward_list.h \
106107
${bits_srcdir}/forward_list.tcc \
108+
${bits_srcdir}/fs_dir.h \
109+
${bits_srcdir}/fs_fwd.h \
110+
${bits_srcdir}/fs_ops.h \
111+
${bits_srcdir}/fs_path.h \
107112
${bits_srcdir}/fstream.tcc \
108113
${bits_srcdir}/functexcept.h \
109114
${bits_srcdir}/functional_hash.h \

libstdc++-v3/include/Makefile.in

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -330,6 +330,7 @@ std_headers = \
330330
${std_srcdir}/complex \
331331
${std_srcdir}/condition_variable \
332332
${std_srcdir}/deque \
333+
${std_srcdir}/filesystem \
333334
${std_srcdir}/forward_list \
334335
${std_srcdir}/fstream \
335336
${std_srcdir}/functional \
@@ -397,6 +398,10 @@ bits_headers = \
397398
${bits_srcdir}/enable_special_members.h \
398399
${bits_srcdir}/forward_list.h \
399400
${bits_srcdir}/forward_list.tcc \
401+
${bits_srcdir}/fs_dir.h \
402+
${bits_srcdir}/fs_fwd.h \
403+
${bits_srcdir}/fs_ops.h \
404+
${bits_srcdir}/fs_path.h \
400405
${bits_srcdir}/fstream.tcc \
401406
${bits_srcdir}/functexcept.h \
402407
${bits_srcdir}/functional_hash.h \

0 commit comments

Comments
 (0)