Commit Graph

8 Commits

Author SHA1 Message Date
Ville Voutilainen 4b386db092 backport: re PR libstdc++/71313 ([Filesystem TS] remove_all fails to remove directory contents recursively)
Backport from mainline
        2016-07-04  Ville Voutilainen  <ville.voutilainen@gmail.com>

	PR libstdc++/71313
	* src/filesystem/ops.cc (remove_all(const path&, error_code&)):
	Call remove_all for children of a directory.
	* testsuite/experimental/filesystem/operations/create_directories.cc:
	Adjust.

From-SVN: r237981
2016-07-04 16:52:21 +03:00
Jonathan Wakely 2218243ebd libstdc++/71038 fix error checks in filesystem::copy_file
Backport from mainline
2016-05-10  Jonathan Wakely  <jwakely@redhat.com>

	PR libstdc++/71038
	* src/filesystem/ops.cc (do_copy_file): Fix backwards conditions.
	* testsuite/experimental/filesystem/operations/copy_file.cc: New test.

From-SVN: r236717
2016-05-25 16:43:12 +01:00
Jonathan Wakely d67dba4a96 libstdc++/71036 Handle EEXIST in filesystem::create_directory
Backport from mainline
2016-05-10  Jonathan Wakely  <jwakely@redhat.com>

	PR libstdc++/71036
	* src/filesystem/ops.cc (create_dir): Handle EEXIST from mkdir.
	* testsuite/experimental/filesystem/operations/create_directory.cc:
	New test.

From-SVN: r236715
2016-05-25 16:43:02 +01:00
Jonathan Wakely aecaeabf8d libstdc++/71037 Add base path to filesystem::canonical exceptions
Backport from mainline
2016-05-10  Jonathan Wakely  <jwakely@redhat.com>

	PR libstdc++/71037
	* src/filesystem/ops.cc (canonical(const path&, const path&)): Add
	base path to exception.
	* testsuite/experimental/filesystem/operations/canonical.cc: Test
	paths contained in exception.

From-SVN: r236714
2016-05-25 16:42:57 +01:00
Jonathan Wakely 8a1d215a4a libstdc++/70609 fix filesystem::copy()
Backport from mainline
2016-04-19  Jonathan Wakely  <jwakely@redhat.com>

	PR libstdc++/70609
	* src/filesystem/ops.cc (close_fd): New function.
	(do_copy_file): Set permissions before copying file contents. Check
	result of closing file descriptors. Don't copy streambuf when file
	is empty.
	(copy(const path&, const path&, copy_options, error_code&)): Use
	lstat for source file when copy_symlinks is set.
	* testsuite/experimental/filesystem/operations/copy.cc: Test copy().

From-SVN: r236711
2016-05-25 16:42:40 +01:00
Jonathan Wakely 3b6a1ea62e Add noexcept to Filesystem TS operators
Backport from mainline
2016-04-19  Jonathan Wakely  <jwakely@redhat.com>

	* include/experimental/bits/fs_fwd.h (operator&, operator|, operator^,
	operator~ operator&=, operator|=, operator^=): Add noexcept to
	overloaded operators for copy_options, perms and directory_options.
	* src/filesystem/ops.cc (make_file_type, make_file_status,
	is_not_found_errno, file_time): Add noexcept.

From-SVN: r236710
2016-05-25 16:42:35 +01:00
Jonathan Wakely 789a05c3be Backport Filesystem TS fixes from mainline.
PR libstdc++/67173
	PR libstdc++/67747
	* acinclude.m4 (GLIBCXX_CHECK_FILESYSTEM_DEPS): Check _XOPEN_VERSION
	and PATH_MAX for _GLIBCXX_USE_REALPATH.  Remove _GLIBCXX_ prefix
	from HAVE_STRUCT_DIRENT_D_TYPE.
	* config.h.in: Regenerate.
	* configure: Regenerate.
	* include/bits/locale_conv.h [!_GLIBCXX_USE_WCHAR_T]
	(__do_str_codecvt, __str_codecvt_in, __str_codecvt_out): Enable.
	* include/experimental/fs_dir.h (operator==, operator==):
	Use owner_before instead of pointer equality.
	(directory_iterator(std::shared_ptr<_Dir>, error_code*)): Remove.
	* include/experimental/fs_path.h (operator==, operator==):
	* include/experimental/fs_path.h [!_GLIBCXX_USE_WCHAR_T]
	(path::wstring, path::generic_wstring): Disable.
	* src/filesystem/path.cc (path::_S_convert_loc)
	[!_GLIBCXX_USE_WCHAR_T]: Skip conversion.
	* src/filesystem/Makefile.am: Add cxx11_abi_sources.
	* src/filesystem/Makefile.in: Regenerate.
	* src/filesystem/cow-dir.cc: New.
	* src/filesystem/cow-ops.cc: New.
	* src/filesystem/cow-path.cc: New.
	* src/filesystem/dir.cc: Define macro for new ABI.
	(native_readdir): Remove.
	(_Dir::advance): Use readdir instead of native_readdir.
	(recursive_directory_iterator(const path&, directory_options,
	error_code*)): Use swap instead of reset.
	(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.
	* src/filesystem/ops.cc: Define macro for new ABI.
	(canonical) [!_GLIBCXX_USE_REALPATH]: Add alternative implementation.
	(is_dot, is_dotdot): Define new helpers.
	(create_directories): Fix error handling.
	* src/filesystem/path.cc: Define macro for new ABI.
	(path::_S_convert_loc) [!_GLIBCXX_USE_WCHAR_T]: Skip conversion.
	* testsuite/experimental/filesystem/iterators/directory_iterator.cc:
	New.
	* testsuite/experimental/filesystem/iterators/
	recursive_directory_iterator.cc: New.
	* testsuite/experimental/filesystem/operations/canonical.cc: New.
	* testsuite/experimental/filesystem/operations/create_directories.cc:
	New.
	* testsuite/experimental/filesystem/operations/exists.cc: Add more
	tests.
	* testsuite/experimental/filesystem/operations/absolute.cc: Add test
	variables.
	* testsuite/experimental/filesystem/operations/copy.cc: Likewise.
	* testsuite/experimental/filesystem/operations/current_path.cc:
	Likewise.
	* testsuite/experimental/filesystem/operations/file_size.cc: Likewise.
	* testsuite/experimental/filesystem/operations/status.cc: Likewise.
	* testsuite/experimental/filesystem/operations/temp_directory_path.cc:
	Likewise.
	* testsuite/experimental/filesystem/path/assign/assign.cc: Check for
	wchar_t support.
	* testsuite/experimental/filesystem/path/concat/strings.cc: Likewise.
	* testsuite/experimental/filesystem/path/construct/range.cc: Likewise.

From-SVN: r228584
2015-10-07 22:00:50 +01:00
Jonathan Wakely 526d05cc56 backport: acinclude.m4 (GLIBCXX_ENABLE_FILESYSTEM_TS, [...]): Define.
Backport Filesystem TS from mainline
	* acinclude.m4 (GLIBCXX_ENABLE_FILESYSTEM_TS,
	GLIBCXX_CHECK_FILESYSTEM_DEPS): Define.
	* configure.ac: Use them.
	* configure: Regenerate.
	* config.h.in: Regenerate.
	* include/Makefile.am: Add filesystem headers. Fix order of headers.
	* include/Makefile.in: Regenerate.
	* include/bits/locale_conv.h (__do_str_codecvt, __str_codecvt_in,
	__str_codecvt_out, wstring_convert): Refactor to move all conversion
	logic to non-member functions.
	* include/bits/quoted_string.h (_Quoted_string, operator<<,
	operator>>): Move from <iomanip> to new header.
	* include/experimental/filesystem: New.
	* include/experimental/fs_dir.h: New.
	* include/experimental/fs_fwd.h: New.
	* include/experimental/fs_ops.h: New.
	* include/experimental/fs_path.h: New.
	* include/std/iomanip (_Quoted_string, operator<<, operator>>): Move
	to <bits/quoted_string.h>.
	* libstdcxx/v6/printers.py (StdExpPathPrinter): Define.
	* scripts/testsuite_flags.in: Add filesystem dir to ldflags.
	* src/Makefile.am: Add filesystem sub-dir.
	* src/Makefile.in: Regenerate.
	* src/filesystem/Makefile.am: New.
	* src/filesystem/Makefile.in: New.
	* src/filesystem/dir.cc: New.
	* src/filesystem/ops.cc: New.
	* src/filesystem/path.cc: New.
	* testsuite/experimental/filesystem/operations/absolute.cc: New.
	* testsuite/experimental/filesystem/operations/copy.cc: New.
	* testsuite/experimental/filesystem/operations/current_path.cc: New.
	* testsuite/experimental/filesystem/operations/exists.cc: New.
	* testsuite/experimental/filesystem/operations/file_size.cc: New.
	* testsuite/experimental/filesystem/operations/status.cc: New.
	* testsuite/experimental/filesystem/operations/temp_directory_path.cc:
	New.
	* testsuite/experimental/filesystem/path/append/path.cc: New.
	* testsuite/experimental/filesystem/path/assign/assign.cc: New.
	* testsuite/experimental/filesystem/path/assign/copy.cc: New.
	* testsuite/experimental/filesystem/path/compare/compare.cc: New.
	* testsuite/experimental/filesystem/path/compare/path.cc: New.
	* testsuite/experimental/filesystem/path/compare/strings.cc: New.
	* testsuite/experimental/filesystem/path/concat/path.cc: New.
	* testsuite/experimental/filesystem/path/concat/strings.cc: New.
	* testsuite/experimental/filesystem/path/construct/copy.cc: New.
	* testsuite/experimental/filesystem/path/construct/default.cc: New.
	* testsuite/experimental/filesystem/path/construct/locale.cc: New.
	* testsuite/experimental/filesystem/path/construct/range.cc: New.
	* testsuite/experimental/filesystem/path/decompose/extension.cc: New.
	* testsuite/experimental/filesystem/path/decompose/filename.cc: New.
	* testsuite/experimental/filesystem/path/decompose/parent_path.cc:
	New.
	* testsuite/experimental/filesystem/path/decompose/relative_path.cc:
	New.
	* testsuite/experimental/filesystem/path/decompose/root_directory.cc:
	New.
	* testsuite/experimental/filesystem/path/decompose/root_name.cc: New.
	* testsuite/experimental/filesystem/path/decompose/root_path.cc: New.
	* testsuite/experimental/filesystem/path/decompose/stem.cc: New.
	* testsuite/experimental/filesystem/path/generic/generic_string.cc:
	New.
	* testsuite/experimental/filesystem/path/itr/traversal.cc: New.
	* testsuite/experimental/filesystem/path/modifiers/clear.cc: New.
	* testsuite/experimental/filesystem/path/modifiers/make_preferred.cc:
	New.
	* testsuite/experimental/filesystem/path/modifiers/remove_filename.cc:
	New.
	* testsuite/experimental/filesystem/path/modifiers/
	replace_extension.cc: New.
	* testsuite/experimental/filesystem/path/modifiers/replace_filename.cc:
	New.
	* testsuite/experimental/filesystem/path/modifiers/swap.cc: New.
	* testsuite/experimental/filesystem/path/nonmember/hash_value.cc:
	New.
	* testsuite/experimental/filesystem/path/query/empty.cc: New.
	* testsuite/experimental/filesystem/path/query/has_extension.cc: New.
	* testsuite/experimental/filesystem/path/query/has_filename.cc: New.
	* testsuite/experimental/filesystem/path/query/has_parent_path.cc:
	New.
	* testsuite/experimental/filesystem/path/query/has_relative_path.cc:
	New.
	* testsuite/experimental/filesystem/path/query/has_root_directory.cc:
	New.
	* testsuite/experimental/filesystem/path/query/has_root_name.cc: New.
	* testsuite/experimental/filesystem/path/query/has_root_path.cc: New.
	* testsuite/experimental/filesystem/path/query/has_stem.cc: New.
	* testsuite/experimental/filesystem/path/query/is_relative.cc: New.
	* testsuite/lib/dg-options.exp (dg-require-filesystem-ts): Define.
	* testsuite/lib/libstdc++.exp (check_v3_target_filesystem_ts): Define.
	* testsuite/util/testsuite_fs.h: New.

From-SVN: r226983
2015-08-18 18:58:22 +01:00