diff options
author | Jonathan Wakely <jwakely@redhat.com> | 2018-05-23 17:11:06 +0100 |
---|---|---|
committer | Jonathan Wakely <redi@gcc.gnu.org> | 2018-05-23 17:11:06 +0100 |
commit | cf290ea3255625513b6ad5a5c4e189c833a67a92 (patch) | |
tree | ef3d41a212735827f10935b6954e5389c86704c2 /libstdc++-v3/ChangeLog | |
parent | 7aa132501308fcb42ee2b189b9971df5a04ea0e7 (diff) | |
download | gcc-cf290ea3255625513b6ad5a5c4e189c833a67a92.zip gcc-cf290ea3255625513b6ad5a5c4e189c833a67a92.tar.gz gcc-cf290ea3255625513b6ad5a5c4e189c833a67a92.tar.bz2 |
Fix handling of an empty filename at end of a path
The C++17 std::filesystem::path grammar allows an empty filename as the
last component (to signify a trailing slash). The existing code does not
handle this consistently, sometimes an empty filename has type _Multi
and sometimes it has type _Filename. This can result in a non-empty
iterator range for an empty filename component.
This change ensures that empty paths always have type _Filename and will
yield an empty iterator range.
* include/bits/fs_path.h (path::_M_type): Change default member
initializer to _Filename.
(path::begin): Create past-the-end iterator for empty path.
* src/filesystem/std-path.cc (path::remove_filename()): Remove
debugging check.
(path::has_relative_path()): Return false for empty filenames.
(path::_M_split_cmpts): Set _M_type to _Filename for empty paths.
Fix offset of empty final component.
* testsuite/27_io/filesystem/path/itr/components.cc: New.
* testsuite/27_io/filesystem/path/itr/traversal.cc: Add new inputs.
From-SVN: r260616
Diffstat (limited to 'libstdc++-v3/ChangeLog')
-rw-r--r-- | libstdc++-v3/ChangeLog | 13 |
1 files changed, 13 insertions, 0 deletions
diff --git a/libstdc++-v3/ChangeLog b/libstdc++-v3/ChangeLog index 9ca6ec6..f5d6b10 100644 --- a/libstdc++-v3/ChangeLog +++ b/libstdc++-v3/ChangeLog @@ -1,3 +1,16 @@ +2018-05-23 Jonathan Wakely <jwakely@redhat.com> + + * include/bits/fs_path.h (path::_M_type): Change default member + initializer to _Filename. + (path::begin): Create past-the-end iterator for empty path. + * src/filesystem/std-path.cc (path::remove_filename()): Remove + debugging check. + (path::has_relative_path()): Return false for empty filenames. + (path::_M_split_cmpts): Set _M_type to _Filename for empty paths. + Fix offset of empty final component. + * testsuite/27_io/filesystem/path/itr/components.cc: New. + * testsuite/27_io/filesystem/path/itr/traversal.cc: Add new inputs. + 2018-05-21 Jonathan Wakely <jwakely@redhat.com> Add support for opening file streams from wide character strings. |