Commit Graph

1060 Commits

Author SHA1 Message Date
Nobody 791447f986 libstdc++-v3 with MCST patches 2022-08-11 23:09:28 +03:00
Jonathan Wakely b520d0cffb PR libstdc++/83626 simplify filesystem::remove and filesystem::remove_all
Backport from mainline
2018-01-05  Jonathan Wakely  <jwakely@redhat.com>

	PR libstdc++/83626
	* src/filesystem/ops.cc (remove(const path&, error_code&)): Remove
	unnecessary symlink_status call.
	(remove_all(const path&, error_code&)): Use filesystem::remove.

From-SVN: r256603
2018-01-13 01:53:47 +00:00
Jonathan Wakely 0070e3297e PR libstdc++/83279 handle sendfile not copying entire file
Backport from mainline
2017-12-14  Jonathan Wakely  <jwakely@redhat.com>

	PR libstdc++/83279
	* src/filesystem/std-ops.cc (do_copy_file): Handle sendfile not
	copying entire file.

From-SVN: r256290
2018-01-05 22:22:12 +00:00
Jonathan Wakely 72eaf75b30 PR libstdc++/83626 Don't report errors when removing non-existent files
Backport from mainline
2018-01-05  Jonathan Wakely  <jwakely@redhat.com>

	PR libstdc++/83626
	* src/filesystem/ops.cc (remove(const path&, error_code&)): Do not
	report an error for ENOENT.
	(remove_all(const path&)): Fix type of result variable.
	(remove_all(const path&, error_code&)): Use non-throwing increment
	for directory iterator. Call POSIX remove directly to avoid redundant
	calls to symlink_status. Do not report errors for ENOENT.
	* testsuite/experimental/filesystem/operations/remove_all.cc: Test
        throwing overload.

Backport from mainline
2018-01-04  Jonathan Wakely  <jwakely@redhat.com>

	PR libstdc++/83626
	* src/filesystem/ops.cc (remove(const path&, error_code&))): Remove
	redundant call to ec.clear().
	(remove_all(const path&, error_code&))): Do not return an error for
	non-existent paths.
	* testsuite/experimental/filesystem/operations/remove.cc: New test.
	* testsuite/experimental/filesystem/operations/remove_all.cc: Fix
	expected results for non-existent paths.

From-SVN: r256287
2018-01-05 21:27:25 +00:00
Jonathan Wakely df7dd7127c PR libstdc++/79283 fix filesystem::read_symlink for /proc
Backport from mainline
2017-10-25  Jonathan Wakely  <jwakely@redhat.com>

	PR libstdc++/79283
	* src/filesystem/ops.cc (read_symlink): Handle st_size being zero.

From-SVN: r256286
2018-01-05 21:27:20 +00:00
Jonathan Wakely d951e75dfe Fix alignment bugs in std::codecvt_utf16
* src/c++11/codecvt.cc (range): Add non-type template parameter and
	define oerloaded operators for reading and writing code units.
	(range<Elem, false>): Define partial specialization for accessing
	wide characters in potentially unaligned byte ranges.
	(ucs2_span(const char16_t*, const char16_t*, ...))
	(ucs4_span(const char16_t*, const char16_t*, ...)): Change parameters
	to range<const char16_t, false> in order to avoid unaligned reads.
	(__codecvt_utf16_base<char16_t>::do_out)
	(__codecvt_utf16_base<char32_t>::do_out)
	(__codecvt_utf16_base<wchar_t>::do_out): Use range specialization for
	unaligned data to avoid unaligned writes.
	(__codecvt_utf16_base<char16_t>::do_in)
	(__codecvt_utf16_base<char32_t>::do_in)
	(__codecvt_utf16_base<wchar_t>::do_in): Likewise for writes. Return
	error if there are unprocessable trailing bytes.
	(__codecvt_utf16_base<char16_t>::do_length)
	(__codecvt_utf16_base<char32_t>::do_length)
	(__codecvt_utf16_base<wchar_t>::do_length): Pass arguments of type
	range<const char16_t, false> to span functions.
	* testsuite/22_locale/codecvt/codecvt_utf16/misaligned.cc: New test.

From-SVN: r246245
2017-03-17 19:28:05 +00:00
Jonathan Wakely e363c939cb PR libstdc++/79980 fix target type of cast
PR libstdc++/79980
	* src/c++11/codecvt.cc (to_integer(codecvt_mode)): Fix target type.

From-SVN: r246205
2017-03-16 17:22:47 +00:00
Jonathan Wakely a4c687d64b PR libstdc++/80041 fix codecvt_utf16<wchar_t> to use UTF-16 not UTF-8
PR libstdc++/80041
	* src/c++11/codecvt.cc (__codecvt_utf16_base<wchar_t>::do_out)
	(__codecvt_utf16_base<wchar_t>::do_in): Convert char arguments to
	char16_t to work with UTF-16 instead of UTF-8.
	* testsuite/22_locale/codecvt/codecvt_utf16/80041.cc: New test.

From-SVN: r246202
2017-03-16 15:28:02 +00:00
Jonathan Wakely 516231de73 Fix encoding() and max_length() values for codecvt facets
* src/c++11/codecvt.cc (codecvt<char16_t, char, mbstate_t>)
	(codecvt<char32_t, char, mbstate_t>, __codecvt_utf8_base<char16_t>)
	(__codecvt_utf8_base<char32_t>, __codecvt_utf8_base<wchar_t>)
	(__codecvt_utf16_base<char16_t>, __codecvt_utf16_base<char32_t>)
	(__codecvt_utf16_base<wchar_t>, __codecvt_utf8_utf16_base<char16_t>)
	(__codecvt_utf8_utf16_base<char32_t>)
	(__codecvt_utf8_utf16_base<wchar_t>): Fix do_encoding() and
	do_max_length() return values.
	* testsuite/22_locale/codecvt/codecvt_utf16/members.cc: New test.
	* testsuite/22_locale/codecvt/codecvt_utf8/members.cc: New test.
	* testsuite/22_locale/codecvt/codecvt_utf8_utf16/members.cc: New test.

From-SVN: r246201
2017-03-16 15:27:57 +00:00
Jonathan Wakely bcd682e1fa PR libstdc++/79980 fix BOM detection, maxcode checks, UCS2 handling
PR libstdc++/79980
	* include/bits/locale_conv.h (__do_str_codecvt): Set __count on
	error path.
	* src/c++11/codecvt.cc (operator&=, operator|=, operator~): Overloads
	for manipulating codecvt_mode values.
	(read_utf16_bom): Compare input to BOM constants instead of integral
	constants that depend on endianness.  Take mode parameter by
	reference and adjust it, to distinguish between no BOM present and
	UTF-16BE BOM present.
	(ucs4_in, ucs2_span, ucs4_span): Adjust calls to read_utf16_bom.
	(surrogates): New enumeration type.
	(utf16_in, utf16_out): Add surrogates parameter to choose between
	UTF-16 and UCS2 behaviour.
	(utf16_span, ucs2_span): Use std::min not std::max.
	(ucs2_out): Use std::min not std::max.  Disallow surrogate pairs.
	(ucs2_in): Likewise. Adjust calls to read_utf16_bom.
	* testsuite/22_locale/codecvt/codecvt_utf16/79980.cc: New test.
	* testsuite/22_locale/codecvt/codecvt_utf8/79980.cc: New test.

From-SVN: r246200
2017-03-16 15:27:51 +00:00
Jonathan Wakely 02e12bda2d PR libstdc++/79511 fix endianness of UTF-16 data
PR libstdc++/79511
	* src/c++11/codecvt.cc (write_utf16_code_point): Don't write 0xffff
	as a surrogate pair.
	(__codecvt_utf8_utf16_base<char32_t>::do_in): Use native endianness
	for internal representation.
	(__codecvt_utf8_utf16_base<wchar_t>::do_in): Likewise.
	* testsuite/22_locale/codecvt/codecvt_utf8_utf16/79511.cc: New test.

From-SVN: r246199
2017-03-16 15:27:45 +00:00
Jonathan Wakely 728e81e3bc PR libstdc++/60936 fix length calculation
PR libstdc++/60936
	* src/c++11/snprintf_lite.cc (__concat_size_t): Calculate length
	written to buffer, not length remaining in buffer.

From-SVN: r245505
2017-02-16 12:06:28 +00:00
Gerald Pfeifer a8fc7e0765 * src/c++11/snprintf_lite.cc (__err): Use https for bug reporting.
From-SVN: r245288
2017-02-08 21:50:59 +00:00
Gerald Pfeifer 97355ece9c * src/c++11/snprintf_lite.cc (__err): Update bug reporting URL.
From-SVN: r245268
2017-02-08 07:17:19 +00:00
Jonathan Wakely b333e8ebb0 PR libstdc++/60936 reduce coupling between objects in libstdc++.a
Move explicit instantiation definitions for string I/O functions into
their own files so that iostream and locale definitions are not needed
for uses of strings without I/O. Move functions for throwing C++11
exceptions into the individual files defining the exception types, so
that using any of the functions from functexcept.cc doesn't pull in
large pieces of the C++11 library. Finally, avoid using __int_to_char in
snprintf_lite.cc to avoid pulling in locale-inst.cc for one function.

	PR libstdc++/60936
	* src/c++11/Makefile.am: Add new files.
	* src/c++11/Makefile.in: Regenerate.
	* src/c++11/cow-string-inst.cc [!_GLIBCXX_USE_CXX11_ABI]
	(operator<<, operator>>, getline): Move explicit instantiations to ...
	* src/c++11/cow-string-io-inst.cc: ... new file.
	* src/c++11/cow-wstring-inst.cc [!_GLIBCXX_USE_CXX11_ABI]
	(operator<<, operator>>, getline): Move explicit instantiations to ...
	* src/c++11/cow-wstring-io-inst.cc: ... new file.
	* src/c++11/functexcept.cc (__throw_ios_failure, __throw_system_error)
	(__throw_future_error, __throw_bad_function_call):
	(__throw_regex_error): Move functions for C++11 exceptions to the
	files that define the exception types.
	* src/c++11/functional.cc (__throw_bad_function_call): Move here.
	* src/c++11/future.cc (__throw_future_error): Likewise.
	* src/c++11/ios.cc (__throw_ios_failure): Likewise.
	* src/c++11/regex.cc (__throw_regex_error): Likewise.
	* src/c++11/snprintf_lite.cc (__concat_size_t): Print decimal
	representation directly instead of calling __int_to_char.
	* src/c++11/sso_string.cc (__sso_string): New file for definition
	of __sso_string type.
	* src/c++11/string-io-inst.cc [_GLIBCXX_USE_CXX11_ABI]: New file for
	explicit instantiations of narrow string I/O functions.
	* src/c++11/system_error.cc (__throw_system_error): Move here.
	(__sso_string): Move to new file.
	* src/c++11/wstring-io-inst.cc [_GLIBCXX_USE_CXX11_ABI]: New file for
	explicit instantiations of wide string I/O functions.
	* src/c++98/misc-inst.cc [_GLIBCXX_USE_CXX11_ABI] (operator<<)
	(operator>>, getline): Remove explicit instantiations from here.

From-SVN: r245162
2017-02-03 18:59:05 +00:00
Jakub Jelinek 3c36aa6ba2 re PR other/79046 (g++ -print-file-name=plugin uses full version number in path)
PR other/79046
	* configure: Regenerated.
config/
	* acx.m4 (GCC_BASE_VER): New m4 function.
	(ACX_TOOL_DIRS): Require GCC_BASE_VER, for
	--with-gcc-major-version-only use just major number from BASE-VER.
gcc/
	* configure.ac: Add GCC_BASE_VER.
	* Makefile.in (version): Use @get_gcc_base_ver@ instead of cat to get
	version from BASE-VER file.
	(CFLAGS-gcc.o): Add -DBASEVER=$(BASEVER_s).
	(gcc.o): Depend on $(BASEVER).
	* common.opt (dumpfullversion): New option.
	* gcc.c (driver_handle_option): Handle OPT_dumpfullversion.
	* doc/invoke.texi: Document -dumpfullversion.
	* doc/install.texi: Document --with-gcc-major-version-only.
	* configure: Regenerated.
libatomic/
	* configure.ac: Add GCC_BASE_VER.
	* Makefile.am (gcc_version): Use @get_gcc_base_ver@ instead of cat to
	get version from BASE-VER file.
	* testsuite/Makefile.in: Regenerated.
	* configure: Regenerated.
	* Makefile.in: Regenerated.
libgomp/
	* configure.ac: Add GCC_BASE_VER.
	* Makefile.am (gcc_version): Use @get_gcc_base_ver@ instead of cat to
	get version from BASE-VER file.
	* testsuite/Makefile.in: Regenerated.
	* configure: Regenerated.
	* Makefile.in: Regenerated.
libgcc/
	* configure.ac: Add GCC_BASE_VER.
	* Makefile.in (version): Use @get_gcc_base_ver@ instead of cat to get
	version from BASE-VER file.
	* configure: Regenerated.
libssp/
	* configure.ac: Add GCC_BASE_VER.
	* Makefile.am (gcc_version): Use @get_gcc_base_ver@ instead of cat to
	get version from BASE-VER file.
	* configure: Regenerated.
	* Makefile.in: Regenerated.
liboffloadmic/
	* configure.ac: Add GCC_BASE_VER.
	* Makefile.am (gcc_version): Use @get_gcc_base_ver@ instead of cat to
	get version from BASE-VER file.
	* aclocal.m4: Include ../config/acx.m4.
	* configure: Regenerated.
	* Makefile.in: Regenerated.
libquadmath/
	* configure.ac: Add GCC_BASE_VER.
	* Makefile.am (gcc_version): Use @get_gcc_base_ver@ instead of cat to
	get version from BASE-VER file.
	* configure: Regenerated.
	* Makefile.in: Regenerated.
libmpx/
	* configure.ac: Add GCC_BASE_VER.
	* Makefile.am (gcc_version): Use @get_gcc_base_ver@ instead of cat to
	get version from BASE-VER file.
	* configure: Regenerated.
	* Makefile.in: Regenerated.
libada/
	* configure.ac: Add GCC_BASE_VER.
	* Makefile.in (version): Use @get_gcc_base_ver@ instead of cat to get
	version from BASE-VER file.
	* configure: Regenerated.
lto-plugin/
	* configure.ac: Add GCC_BASE_VER.
	* Makefile.am (gcc_version): Use @get_gcc_base_ver@ instead of cat to
	get version from BASE-VER file.
	* configure: Regenerated.
	* Makefile.in: Regenerated.
libitm/
	* configure.ac: Add GCC_BASE_VER.
	* Makefile.am (gcc_version): Use @get_gcc_base_ver@ instead of cat to
	get version from BASE-VER file.
	* testsuite/Makefile.in: Regenerated.
	* configure: Regenerated.
	* Makefile.in: Regenerated.
fixincludes/
	* configure.ac: Add GCC_BASE_VER.
	* Makefile.in (gcc_version): Use @get_gcc_base_ver@ instead of cat to
	get version from BASE-VER file.
	* configure: Regenerated.
libcilkrts/
	* configure.ac: Add GCC_BASE_VER.
	* Makefile.am (gcc_version): Use @get_gcc_base_ver@ instead of cat to
	get version from BASE-VER file.
	* aclocal.m4: Include ../config/acx.m4.
	* configure: Regenerated.
	* Makefile.in: Regenerated.
libcc1/
	* configure.ac: Add GCC_BASE_VER.  For --with-gcc-major-version-only
	use just major number from BASE-VER.
	* configure: Regenerated.
	* Makefile.in: Regenerated.
libobjc/
	* configure.ac: Add GCC_BASE_VER.
	* Makefile.in (gcc_version): Use @get_gcc_base_ver@ instead of cat to
	get version from BASE-VER file.
	* configure: Regenerated.
libstdc++-v3/
	* configure.ac: Add GCC_BASE_VER.
	* fragment.am (gcc_version): Use @get_gcc_base_ver@ instead of cat to
	get version from BASE-VER file.
	* po/Makefile.in: Regenerated.
	* libsupc++/Makefile.in: Regenerated.
	* testsuite/Makefile.in: Regenerated.
	* src/Makefile.in: Regenerated.
	* configure: Regenerated.
	* Makefile.in: Regenerated.
	* include/Makefile.in: Regenerated.
	* doc/Makefile.in: Regenerated.
	* python/Makefile.in: Regenerated.
	* src/c++11/Makefile.in: Regenerated.
	* src/c++98/Makefile.in: Regenerated.
	* src/filesystem/Makefile.in: Regenerated.
libvtv/
	* configure.ac: Add GCC_BASE_VER.
	* Makefile.am (gcc_version): Use @get_gcc_base_ver@ instead of cat to
	get version from BASE-VER file.
	* testsuite/Makefile.in: Regenerated.
	* configure: Regenerated.
	* Makefile.in: Regenerated.
libsanitizer/
	* configure.ac: Add GCC_BASE_VER.
	* Makefile.am (gcc_version): Use @get_gcc_base_ver@ instead of cat to
	get version from BASE-VER file.
	* libbacktrace/Makefile.in: Regenerated.
	* interception/Makefile.in: Regenerated.
	* asan/Makefile.in: Regenerated.
	* ubsan/Makefile.in: Regenerated.
	* configure: Regenerated.
	* sanitizer_common/Makefile.in: Regenerated.
	* lsan/Makefile.in: Regenerated.
	* Makefile.in: Regenerated.
	* tsan/Makefile.in: Regenerated.
libgfortran/
	* configure.ac: Add GCC_BASE_VER.
	* Makefile.am (gcc_version): Use @get_gcc_base_ver@ instead of cat to
	get version from BASE-VER file.
	* configure: Regenerated.
	* Makefile.in: Regenerated.

From-SVN: r244521
2017-01-17 10:38:48 +01:00
Jonathan Wakely 83291b8b8c PR66145 use new ABI for std::ios::failure exceptions
PR libstdc++/66145
	* src/c++11/functexcept.cc: Use new ABI for std::ios_base::failure
	exceptions.
	* testsuite/27_io/basic_ios/copyfmt/char/1.cc: Don't override ABI
	for test, so new ios::failure can be caught.
	* testsuite/27_io/basic_ios/exceptions/char/1.cc: Likewise.
	* testsuite/27_io/basic_istream/extractors_arithmetic/char/
	exceptions_failbit.cc: Likewise.
	* testsuite/27_io/basic_istream/extractors_arithmetic/wchar_t/
	exceptions_failbit.cc: Likewise.
	* testsuite/27_io/basic_istream/extractors_other/char/
	exceptions_null.cc: Likewise.
	* testsuite/27_io/basic_istream/extractors_other/wchar_t/
	exceptions_null.cc: Likewise.
	* testsuite/27_io/basic_istream/sentry/char/12297.cc: Likewise.
	* testsuite/27_io/basic_istream/sentry/wchar_t/12297.cc: Likewise.
	* testsuite/27_io/basic_ostream/inserters_other/char/
	exceptions_null.cc: Likewise.
	* testsuite/27_io/basic_ostream/inserters_other/wchar_t/
	exceptions_null.cc: Likewise.
	* testsuite/27_io/ios_base/storage/2.cc: Likewise.

From-SVN: r244498
2017-01-16 15:58:06 +00:00
Jonathan Wakely b497fbc10a PR78702 fix accessibility of locale::facet::__shim
PR libstdc++/78702
	* include/bits/locale_classes.h (locale::facet::__shim): Change from
	private to protected.
	* src/c++11/cxx11-shim_facets.cc (__shim_accessor): Define helper to
	make locale::facet::__shim accessible.

From-SVN: r244491
2017-01-16 11:41:41 +00:00
Rainer Orth 1ec62aa9e1 Build libgo with -Wa,-nH if possible (PR go/78978) [non-libgo parts]
libstdc++-v3:
	PR go/78978
	* acinclude.m4 (GLIBCXX_CHECK_ASSEMBLER_HWCAP): Remove.
	* configure.ac: Call GCC_CHECK_ASSEMBLER_HWCAP instead of
	GLIBCXX_CHECK_ASSEMBLER_HWCAP.
	* fragment.am (CONFIG_CXXFLAGS): Use HWCAP_CFLAGS instead of
	HWCAP_FLAGS.
	* aclocal.m4: Regenerate.
	* configure: Regenerate.
	* Makefile.in, doc/Makefile.in, include/Makefile.in,
	libsupc++/Makefile.in, po/Makefile.in, python/Makefile.in,
	src/Makefile.in, src/c++11/Makefile.in, src/c++98/Makefile.in,
	src/filesystem/Makefile.in, testsuite/Makefile.in: Regenerate.

	config:
	PR go/78978
	* hwcaps.m4 (GCC_CHECK_ASSEMBLER_HWCAP): New macro.

From-SVN: r244162
2017-01-06 14:33:47 +00:00
Pauli Nieminen ed3cb49703 Support exception propagation without lock-free atomic int
2017-01-04  Pauli Nieminen  <suokkos@gmail.com>
	    Jonathan Wakely  <jwakely@redhat.com>

	PR libstdc++/64735
	* acinclude.m4 (GLIBCXX_CHECK_EXCEPTION_PTR_SYMVER): Define.
	* config.h.in: Regenerate.
	* config/abi/pre/gnu.ver [HAVE_EXCEPTION_PTR_SINCE_GCC46]
	(GLIBCXX_3.4.15, GLIBCXX_3.4.21, CXXABI_1.3.3, CXXABI_1.3.5): Make
	exports for exception_ptr, nested_exception, and future conditional.
	[HAVE_EXCEPTION_PTR_SINCE_GCC46] (GLIBCXX_3.4.23, CXXABI_1.3.11): Add
	exports for exception_ptr, nested_exception, and future conditional.
	* configure: Regenerate.
	* configure.ac: Use GLIBCXX_CHECK_EXCEPTION_PTR_SYMVER.
	* include/std/future: Remove check for ATOMIC_INT_LOCK_FREE
	* libsupc++/eh_atomics.h: New file for internal use only.
	(__eh_atomic_inc, __eh_atomic_dec): New.
	* libsupc++/eh_ptr.cc (exception_ptr::_M_addref)
	(exception_ptr::_M_release) (__gxx_dependent_exception_cleanup)
	(rethrow_exception): Use eh_atomics.h reference counting helpers.
	* libsupc++/eh_throw.cc (__gxx_exception_cleanup): Likewise.
	* libsupc++/eh_tm.cc (free_any_cxa_exception): Likewise.
	* libsupc++/exception: Remove check for ATOMIC_INT_LOCK_FREE.
	* libsupc++/exception_ptr.h: Likewise.
	* libsupc++/guard.cc: Include header for ATOMIC_INT_LOCK_FREE macro.
	* libsupc++/nested_exception.cc: Remove check for
	ATOMIC_INT_LOCK_FREE.
	* libsupc++/nested_exception.h: Likewise.
	* src/c++11/future.cc: Likewise.
	* testsuite/18_support/exception_ptr/*: Remove atomic builtins checks.
	* testsuite/18_support/nested_exception/*: Likewise.
	* testsuite/30_threads/async/*: Likewise.
	* testsuite/30_threads/future/*: Likewise.
	* testsuite/30_threads/headers/future/types_std_c++0x.cc: Likewise.
	* testsuite/30_threads/packaged_task/*: Likewise.
	* testsuite/30_threads/promise/*: Likewise.
	* testsuite/30_threads/shared_future/*: Likewise.

Co-Authored-By: Jonathan Wakely <jwakely@redhat.com>

From-SVN: r244051
2017-01-04 10:54:59 +00:00
Jakub Jelinek cbe34bb5ed Update copyright years.
From-SVN: r243994
2017-01-01 13:07:43 +01:00
Felipe Magno de Almeida f68963c092 Add #ifdef case for 16 bits in cow-stdexcept.cc
Added #ifdef case for when void* is 16 bits so it compiles in AVR
target.

2016-12-06  Felipe Magno de Almeida  <felipe@expertisesolutions.com.br>

	* src/c++11/cow-stdexcept.cc: Add special case for 16 bit pointers.

From-SVN: r243310
2016-12-06 17:58:10 +00:00
Aditya Kumar b6f684ae25 Add missing noexcept on std::_Sp_locker constructors
2016-12-06  Aditya Kumar  <hiraditya@msn.com>

	* src/c++11/shared_ptr.cc (_Sp_locker::_Sp_locker(const void* p)): Add
	noexcept on constructor.
	(_Sp_locker::_Sp_locker(const void* p1, const void* p2)): Same.

From-SVN: r243291
2016-12-06 10:43:49 +00:00
Jonathan Wakely 5485c81829 * src/filesystem/ops.cc (is_empty): Fix typo in exception message.
From-SVN: r242341
2016-11-12 20:28:55 +00:00
François Dumont 28d1bf4464 debug.cc (format_word): Delete.
2016-11-10  François Dumont  <fdumont@gcc.gnu.org>

	* src/c++11/debug.cc (format_word): Delete.
	(print_literal): New. Replace call to print_word for literals.

From-SVN: r242055
2016-11-10 21:29:43 +00:00
Uros Bizjak 47ffb5d95e PR70975 Pass valid offset argument to sendfile
PR libstdc++/70975
	* src/filesystem/ops.cc (do_copy_file) [_GLIBCXX_USE_SENDFILE]:
	Pass non-null pointer to sendfile for offset argument.

From-SVN: r241629
2016-10-27 20:55:55 +02:00
Jonathan Wakely ec0b1056a7 Add recursive_directory_iterator::pop(error_code&)
* include/experimental/bits/fs_dir.h (recursive_directory_iterator):
	Overload pop (LWG 2706).
	* src/filesystem/dir.cc (recursive_directory_iterator::pop): Define
	new overload.
	* testsuite/experimental/filesystem/iterators/pop.cc: New test.

From-SVN: r241559
2016-10-26 16:20:04 +01:00
Jonathan Wakely b4e7e6bf22 Fix error handling in recursive_directory_iterator::increment
* src/filesystem/dir.cc (recursive_directory_iterator::increment):
	Reset state on error.
	* testsuite/experimental/filesystem/iterators/
	recursive_directory_iterator.cc: Check state after increment error.

From-SVN: r241552
2016-10-26 14:34:34 +01:00
Jonathan Wakely 9dbe100a41 PR78111 fix fallback code for filesystem::canonical
PR libstdc++/78111
	* src/filesystem/ops.cc (canonical): Set error for non-existent path.

From-SVN: r241549
2016-10-26 12:29:36 +01:00
Jonathan Wakely 7195dfe9b6 Handle negative times in filesystem::last_write_time
* src/filesystem/ops.cc
	(last_write_time(const path&, file_time_type, error_code&)): Handle
	negative times correctly.
	* testsuite/experimental/filesystem/operations/last_write_time.cc:
	Test writing file times.

From-SVN: r241522
2016-10-25 16:32:52 +01:00
Jonathan Wakely ec04aad76d Fix error handling in copy_file and equivalent
* src/filesystem/ops.cc (do_copy_file): Report an error if source or
	destination is not a regular file (LWG 2712).
	(equivalent): Fix error handling and result when only one file exists.
	* testsuite/experimental/filesystem/operations/copy.cc: Remove files
	created by tests. Test copying directories.
	* testsuite/experimental/filesystem/operations/copy_file.cc: Remove
	files created by tests.
	* testsuite/experimental/filesystem/operations/equivalent.cc: New.
	* testsuite/experimental/filesystem/operations/is_empty.cc: New.
	* testsuite/experimental/filesystem/operations/read_symlink.cc: Remove
	file created by test.
	* testsuite/experimental/filesystem/operations/remove_all.cc: New.
	* testsuite/util/testsuite_fs.h (~scoped_file): Only try to remove
	file if path is non-empty, to support removal by other means.

From-SVN: r241521
2016-10-25 16:32:37 +01:00
Jonathan Wakely 94caf86019 Fix error handling in filesystem::is_empty
* src/filesystem/ops.cc (is_empty): Fix error handling.
	* testsuite/experimental/filesystem/operations/is_empty.cc: New test.

From-SVN: r241488
2016-10-24 17:45:55 +01:00
Jonathan Wakely 6daff2d946 PR71337 fix filesystem::temp_directory_path error handling
PR libstdc++/71337
	* src/filesystem/ops.cc (temp_directory_path): Pass error_code
	argument to other filesystem operations.
	* testsuite/experimental/filesystem/operations/temp_directory_path.cc:
	Add testcase for inaccessible directory.

From-SVN: r241487
2016-10-24 17:45:51 +01:00
Jonathan Wakely bb52a7e324 Make directory iterators become end iterator on error
* src/filesystem/dir.cc (open_dir): Return same value for errors
	whether ignored or not.
	(_Dir::advance(error_code*, directory_options)): Return false on
	error.
	(directory_iterator(const path&, directory_options, error_code*)):
	Create end iterator on error (LWG 2723).
	(recursive_directory_iterator(const path&, directory_options,
	error_code*)): Likewise.
	* testsuite/experimental/filesystem/iterators/directory_iterator.cc:
	Update expected behaviour on error.
	* testsuite/experimental/filesystem/iterators/
	recursive_directory_iterator.cc: Likewise.

From-SVN: r241486
2016-10-24 17:45:45 +01:00
Jonathan Wakely cfef9c1ea7 Do not retry failed close(3) in filesystem::copy
* src/filesystem/ops.cc (close_fd): Remove.
	(do_copy_file): Just use close(3) instead of close_fd, to prevent
	retrying on error.

From-SVN: r241485
2016-10-24 17:45:40 +01:00
Jonathan Wakely b3dec9e57e Implement DR resolutions for filesystem::copy
* src/filesystem/ops.cc (do_copy_file): Return an error if either
	source or destination is not a regular file.
	(copy): Update comment to refer to LWG 2681. Implement 2682 and 2683
	resolutions.
	(read_symlink): Add missing ec.clear().
	* testsuite/experimental/filesystem/operations/copy.cc: Update
	expected behaviour for copying directories with create_symlinks.
	Verify that error_code arguments are cleared if there's no error.
	* testsuite/experimental/filesystem/operations/read_symlink.cc: New.

From-SVN: r241484
2016-10-24 17:45:31 +01:00
Jonathan Wakely 4e04812da2 Ignore perms::symlink_nofollow on non-symlinks
* src/filesystem/ops.cc (permissions(const path&, perms, error_code&)):
	Ignore symlink_nofollow flag if file is not a symlink.
	* testsuite/experimental/filesystem/operations/permissions.cc: Test
	symlink_nofollow on non-symlinks.

From-SVN: r241438
2016-10-22 12:42:16 +01:00
Jonathan Wakely d17f7088fb LWG2720 implement filesystem::perms::symlink_nofollow
* include/experimental/bits/fs_fwd.h (perms::resolve_symlinks):
	Replace with symlink_nofollow (LWG 2720).
	* src/filesystem/ops.cc (permissions(const path&, perms, error_code&)):
	Handle symlink_nofollow.
	* testsuite/experimental/filesystem/operations/create_symlink.cc: New
	test.
	* testsuite/experimental/filesystem/operations/permissions.cc: Test
	overload taking error_code.

From-SVN: r241418
2016-10-21 18:01:05 +01:00
Jonathan Wakely 2be9212713 LWG2725 Fix error reporting for filesystem::exists
* include/experimental/bits/fs_ops.h
	(exists(const path&, error_code&)): Clear error if status is known
	(LWG 2725).
	(status(const path&, error_code&)): Handle EOVERFLOW.
	* testsuite/experimental/filesystem/operations/exists.cc: Test
	overload taking an error_code.

From-SVN: r241417
2016-10-21 18:00:59 +01:00
Jonathan Wakely c05986b936 Split <functional> into smaller pieces
* include/Makefile.am: Add <bits/refwrap.h> and <bits/std_function.h>.
	Order alphabetically.
	* include/Makefile.in: Regenerate.
	* include/bits/refwrap.h: New header.
	(_Maybe_get_result_type,_Weak_result_type_impl, _Weak_result_type)
	(_Reference_wrapper_base_impl, _Reference_wrapper_base)
	(reference_wrapper, ref, cref): Move here from <functional>.
	* include/bits/shared_ptr_base.h: Include <bits/refwrap.h> and
	<bits/stl_function.h> instead of <functional>.
	* include/bits/std_function.h: New header.
	(_Maybe_unary_or_binary_function, bad_function_call)
	(__is_location_invariant, _Nocopy_types, _Any_data)
	(_Simple_type_wrapper, _Function_base, _Function_handler, function):
	Move here from <functional>.
	* include/bits/unique_ptr.h: Include <bits/stl_function.h>.
	* include/std/functional: Include new headers and move components to
	them.
	* include/std/future: Include <bits/std_function.h> instead of
	<functional>.
	* include/std/mutex: Likewise.
	* include/std/regex: Likewise.
	* src/c++11/compatibility-thread-c++0x.cc: Include <functional>.
	* testsuite/20_util/default_delete/48631_neg.cc: Adjust dg-error line.
	* testsuite/20_util/default_delete/void_neg.cc: Likewise.
	* testsuite/20_util/unique_ptr/assign/48635_neg.cc: Adjust dg-error
	lines.
	* testsuite/20_util/unique_ptr/cons/cv_qual_neg.cc: Likewise.
	* testsuite/30_threads/packaged_task/49668.cc: Include <functional>.

From-SVN: r241410
2016-10-21 16:32:25 +01:00
Jonathan Wakely de1d079440 Make std::bind use std::invoke
* include/std/functional (_Mu<A, false, true>, _Mu<A, true, false>):
	Simplify forwarding from tuple of references.
	(_Maybe_wrap_member_pointer): Remove.
	(_Bind::__call, _Bind::__call_c, _Bind::__call_v, _Bind::__call_c_v):
	Use std::__invoke.
	(_Bind::_Mu_type, _Bind::_Res_type_impl, _Bind::_Res_type)
	(_Bind::__dependent, _Bind::_Res_type_cv): New helpers to simplify
	return type deduction.
	(_Bind::operator(), _Bind::operator() const): Use new helpers.
	(_Bind::operator() volatile, _Bind::operator() const volatile):
	Likewise. Add deprecated attribute for C++17 mode.
	(_Bind_result::__call): Use std::__invoke.
	(_Bind_result::operator() volatile)
	(_Bind_result::operator() const volatile): Add deprecated attribute.
	(_Bind_helper::__maybe_type, _Bindres_helper::__maybe_type): Remove.
	(_Bind_helper, _Bindres_helper): Don't use _Maybe_wrap_member_pointer.
	(bind, bind<R>): Don't use __maybe_type.
	* src/c++11/compatibility-thread-c++0x.cc
	(_Maybe_wrap_member_pointer): Define here for compatibility symbols.
	* testsuite/20_util/bind/68912.cc: Don't test volatile-qualification
	in C++17 mode.
	* testsuite/20_util/bind/cv_quals.cc: Likewise.
	* testsuite/20_util/bind/cv_quals_2.cc: Likewise.

From-SVN: r241178
2016-10-14 20:04:56 +01:00
Jonathan Wakely 3396fcc095 Restore __bind_simple for compat symbols
* src/c++11/compatibility-thread-c++0x.cc (_Bind_simple)
	(_Bind_simple_helper, __bind_simple): Restore for ABI compat symbols.

From-SVN: r241111
2016-10-13 13:39:19 +01:00
François Dumont 38aee22c7d shared_ptr.cc (mask, [...]): Move declaration...
2016-10-03  François Dumont  <fdumont@gcc.gnu.org>

	* src/c++11/shared_ptr.cc (mask, invalid, get_mutex): Move
	declaration...
	* src/c++11/mutex_pool.h: ... here. New.
	* src/c++11/debug.cc: Use latter.

From-SVN: r240732
2016-10-03 20:23:13 +00:00
Alan Modra 6d49b790fd Disable .gnu.attributes tags in compatibility-ldbl.o
compatibility-ldbl.o is compiled with -mlong-double-64.  When
long double .gnu.attributes tags are checked by the linker, it
complains about the mismatch between this file and others in
libstdc++.

	* configure.ac (LONG_DOUBLE_COMPAT_FLAGS): New ACSUBST.
	* src/Makefile.am (compatibility-ldbl.o, compatibility-ldbl.lo):
	Use LONG_DOUBLE_COMPAT_FLAGS.
	* Makefile.in: Regenerate.
	* configure: Regenerate.
	* doc/Makefile.in: Regenerate.
	* include/Makefile.in: Regenerate.
	* libsupc++/Makefile.in: Regenerate.
	* po/Makefile.in: Regenerate.
	* python/Makefile.in: Regenerate.
	* src/Makefile.in: Regenerate.
	* src/c++11/Makefile.in: Regenerate.
	* src/c++98/Makefile.in: Regenerate.
	* src/filesystem/Makefile.in: Regenerate.
	* testsuite/Makefile.in: Regenerate.

From-SVN: r240602
2016-09-29 07:33:17 +09:30
Jonathan Wakely fd5effb17e Check for overflow in filesystem::last_write_time
* include/experimental/bits/fs_fwd.h (file_time_type): Simplify
	definition.
	* src/filesystem/ops.cc (file_time): Take error_code parameter and
	check for overflow.
	(do_copy_file, last_write_time): Pass error_code in file_time calls.
	* testsuite/experimental/filesystem/operations/last_write_time.cc:
	New.
	* testsuite/util/testsuite_fs.h (scoped_file): Define RAII helper.

From-SVN: r240587
2016-09-28 19:02:25 +01:00
François Dumont d8bbd665a1 debug.cc: Include debug/vector.
2016-09-25  François Dumont  <fdumont@gcc.gnu.org>

	* src/c++11/debug.cc: Include debug/vector. Include cctype. Remove
	functional.
	(get_safe_base_mutex): Get mutex based on address lowest non nil bits.
	* testsuite/23_containers/vector/debug/mutex_association.cc: New.

From-SVN: r240479
2016-09-25 20:26:02 +00:00
Uros Bizjak 0657379e3b ops.cc: Always include ostream and ext/stdio_filebuf.h.
* src/filesystem/ops.cc: Always include ostream and
	ext/stdio_filebuf.h.
	(do_copy_file): Check if _GLIBCXX_USE_FCHMODAT is defined.
	[_GLIBCXX_USE_SENDFILE]: Fallback to read/write operations in case
	sendfile fails with ENOSYS or EINVAL.

From-SVN: r239479
2016-08-15 13:40:37 +02:00
Ville Voutilainen e12880f96f re PR libstdc++/71313 ([Filesystem TS] remove_all fails to remove directory contents recursively)
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: r237978
2016-07-04 15:52:49 +03:00
François Dumont 29dbb034cb re PR libstdc++/71181 (Reserving in unordered_map doesn't reserve enough)
2016-06-20  François Dumont  <fdumont@gcc.gnu.org>

	PR libstdc++/71181
	* include/tr1/hashtable_policy.h
	(_Prime_rehash_policy::_M_next_bkt): Make past-the-end iterator
	dereferenceable to avoid check on lower_bound result.
	(_Prime_rehash_policy::_M_bkt_for_elements): Call latter.
	(_Prime_rehash_policy::_M_need_rehash): Likewise.
	* src/c++11/hashtable_c++0x.cc (_Prime_rehash_policy::_M_next_bkt):
	Always return a value greater than input value. Set _M_next_resize to
	max value when reaching highest prime number.
	* src/shared/hashtable-aux.cc (__prime_list): Add comment about sentinel
	being now useless.
	* testsuite/23_containers/unordered_set/hash_policy/71181.cc: New.
	* testsuite/23_containers/unordered_set/hash_policy/power2_rehash.cc
	(test02): New.
	* testsuite/23_containers/unordered_set/hash_policy/prime_rehash.cc: New.
	* testsuite/23_containers/unordered_set/hash_policy/rehash.cc:
	Fix indentation.

From-SVN: r237617
2016-06-20 20:04:25 +00:00
Jonathan Wakely 94229fb6dc libstdc++/71320 Add or remove file permissions correctly
PR libstdc++/71320
	* src/filesystem/ops.cc (permissions(const path&, perms, error_code&)):
	Add or remove permissions according to perms argument.
	* testsuite/experimental/filesystem/operations/permissions.cc: New
	test.

From-SVN: r237136
2016-06-06 16:50:01 +01:00