gcc/libstdc++-v3
Jonathan Wakely cf290ea325 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
2018-05-23 17:11:06 +01:00
..
config Add support for opening file streams from wide character strings 2018-05-21 18:18:35 +01:00
doc Document Dual ABI for std::ios_base::failure 2018-05-10 20:13:42 +01:00
include Fix handling of an empty filename at end of a path 2018-05-23 17:11:06 +01:00
libsupc++ Some libstdc++ fixes for -Wdeprecated-copy. 2018-05-18 16:02:14 -04:00
po Update copyright years. 2018-01-03 11:03:58 +01:00
python printers.py (build_libstdcxx_dictionary): Fix std::_Fwd_list_iterator and std::_Fwd_list_const_iterator printers registration. 2018-03-09 05:56:07 +00:00
scripts Update copyright years. 2018-01-03 11:03:58 +01:00
src Fix handling of an empty filename at end of a path 2018-05-23 17:11:06 +01:00
testsuite Fix handling of an empty filename at end of a path 2018-05-23 17:11:06 +01:00
ChangeLog Fix handling of an empty filename at end of a path 2018-05-23 17:11:06 +01:00
ChangeLog-1998
ChangeLog-1999
ChangeLog-2000
ChangeLog-2001
ChangeLog-2002
ChangeLog-2003
ChangeLog-2004
ChangeLog-2005
ChangeLog-2006
ChangeLog-2007
ChangeLog-2008
ChangeLog-2009
ChangeLog-2010
ChangeLog-2011
ChangeLog-2012
ChangeLog-2013
ChangeLog-2014
ChangeLog-2015
ChangeLog-2016 Update copyright years. 2017-01-01 13:07:43 +01:00
ChangeLog-2017 Update copyright years. 2018-01-03 11:03:58 +01:00
Makefile.am Update copyright years. 2018-01-03 11:03:58 +01:00
Makefile.in Enable building libstdc++-v3 with Intel CET 2017-11-17 22:28:10 +01:00
README
acinclude.m4 PR libstdc++/84654 Disable __float128 specializations for -mno-float128 2018-05-01 23:47:33 +01:00
aclocal.m4 Build libgo with -Wa,-nH if possible (PR go/78978) [non-libgo parts] 2017-01-06 14:33:47 +00:00
config.h.in Add support for opening file streams from wide character strings 2018-05-21 18:18:35 +01:00
configure Add support for opening file streams from wide character strings 2018-05-21 18:18:35 +01:00
configure.ac Add support for opening file streams from wide character strings 2018-05-21 18:18:35 +01:00
configure.host Separate Solaris/SPARC and x86 baselines 2017-02-02 16:24:03 +00:00
crossconfig.m4 Add support for opening file streams from wide character strings 2018-05-21 18:18:35 +01:00
fragment.am re PR other/79046 (g++ -print-file-name=plugin uses full version number in path) 2017-01-17 10:38:48 +01:00
linkage.m4

README

file: libstdc++-v3/README

New users may wish to point their web browsers to the file
index.html in the 'doc/html' subdirectory.  It contains brief
building instructions and notes on how to configure the library in
interesting ways.