Fix semantics of Filesystem TS directory iterators
authorJonathan Wakely <jwakely@redhat.com>
Wed, 23 Sep 2015 11:26:45 +0000 (12:26 +0100)
committerJonathan Wakely <redi@gcc.gnu.org>
Wed, 23 Sep 2015 11:26:45 +0000 (12:26 +0100)
commit429ee11aa39ba700510d789b446d74b65e202754
tree332f8455f9310ad1295e8550bf2f7b2eca7520ef
parent366703118cd68810da3cc24ad2f9198d2116fa09
Fix semantics of Filesystem TS directory iterators

[class.directory_iterator] p4 and [directory_iterator.members] p4
require that only the default constructor and ignored permission denied
errors can create the end iterator.

* acinclude.m4 (GLIBCXX_CHECK_FILESYSTEM_DEPS): Remove _GLIBCXX_
prefix from HAVE_STRUCT_DIRENT_D_TYPE.
* config.h.in: Regenerate.
* configure: Regenerate.
* include/experimental/fs_dir.h (operator==, operator==):
Use owner_before instead of pointer equality.
(directory_iterator(std::shared_ptr<_Dir>, error_code*)): Remove.
* src/filesystem/dir.cc (ErrorCode): Remove.
(_Dir::advance): Change ErrorCode parameter to error_code*, add
directory_options parameter and check it on error.
(opendir): Rename to open_dir to avoid clashing with macro. Change
ErrorCode parameter to error_code*.
(make_shared_dir): Remove.
(native_readdir) [_GLIBCXX_FILESYSTEM_IS_WINDOWS]: Don't set errno.
(directory_iterator(std::shared_ptr<_Dir>, error_code*)): Remove.
(directory_iterator(const path&, directory_options, error_code*)):
Pass options to _Dir::advance and create non-end iterator on error.
(recursive_directory_iterator(const path&, directory_options,
error_code*)): Clear error_code on ignored error, create non-end
iterator otherwise.
(recursive_directory_iterator::increment): Pass _M_options to
_Dir::advance.
(recursive_directory_iterator::pop): Likewise.
* testsuite/experimental/filesystem/iterators/directory_iterator.cc:
New.
* testsuite/experimental/filesystem/iterators/
recursive_directory_iterator.cc: New.

From-SVN: r228042
libstdc++-v3/ChangeLog
libstdc++-v3/acinclude.m4
libstdc++-v3/config.h.in
libstdc++-v3/configure
libstdc++-v3/include/experimental/fs_dir.h
libstdc++-v3/src/filesystem/dir.cc
libstdc++-v3/testsuite/experimental/filesystem/iterators/directory_iterator.cc [new file with mode: 0644]
libstdc++-v3/testsuite/experimental/filesystem/iterators/recursive_directory_iterator.cc [new file with mode: 0644]