Commit Graph

9918 Commits

Author SHA1 Message Date
GCC Administrator
a72e938d71 Daily bump. 2020-08-08 00:16:34 +00:00
GCC Administrator
74d91e8bb7 Daily bump. 2020-08-07 00:16:33 +00:00
GCC Administrator
aa5ea20c2b Daily bump. 2020-08-06 00:16:26 +00:00
GCC Administrator
4967ca2f8b Daily bump. 2020-08-02 00:16:21 +00:00
GCC Administrator
48cc2e468c Daily bump. 2020-08-01 00:16:25 +00:00
Jonathan Wakely
89db36b05e libstdc++: Add PR number to ChangeLog entry 2020-07-31 14:15:43 +01:00
GCC Administrator
d48cca8f21 Daily bump. 2020-07-31 00:16:26 +00:00
GCC Administrator
bea7a39103 Daily bump. 2020-07-30 00:16:24 +00:00
GCC Administrator
7ebb7d0ce1 Daily bump. 2020-07-29 00:16:24 +00:00
GCC Administrator
e71dab8774 Daily bump. 2020-07-28 00:16:25 +00:00
GCC Administrator
3ea9abca71 Daily bump. 2020-07-23 00:16:28 +00:00
GCC Administrator
0933f50859 Daily bump. 2020-07-21 00:16:28 +00:00
GCC Administrator
ab660b01c3 Daily bump. 2020-07-18 00:16:24 +00:00
GCC Administrator
8ca07a3072 Daily bump. 2020-07-15 00:16:35 +00:00
GCC Administrator
ea69fcf9a0 Daily bump. 2020-07-14 00:16:30 +00:00
GCC Administrator
50873cc588 Daily bump. 2020-07-09 00:16:44 +00:00
GCC Administrator
f60ee68de3 Daily bump. 2020-07-08 00:16:40 +00:00
Jonathan Wakely
92cae0785e libstdc++: Add PR number to ChangeLog entry and fix typos 2020-07-07 08:23:12 +01:00
GCC Administrator
4077d74c6d Daily bump. 2020-07-07 00:16:40 +00:00
GCC Administrator
b5f2473963 Daily bump. 2020-07-03 00:16:25 +00:00
GCC Administrator
64f761e4ac Daily bump. 2020-07-02 00:16:26 +00:00
GCC Administrator
458f12eda1 Daily bump. 2020-06-30 09:02:21 +00:00
GCC Administrator
69273534c6 Daily bump. 2020-06-29 00:16:29 +00:00
GCC Administrator
2e546c261b Daily bump. 2020-06-25 00:16:30 +00:00
GCC Administrator
4543acc874 Daily bump. 2020-06-24 00:16:31 +00:00
GCC Administrator
605a8f3bbc Daily bump. 2020-06-23 00:16:23 +00:00
GCC Administrator
f86e11a267 Daily bump. 2020-06-22 00:16:23 +00:00
GCC Administrator
bbac3886a2 Daily bump. 2020-06-21 00:16:21 +00:00
GCC Administrator
e37658dffd Daily bump. 2020-06-20 00:16:27 +00:00
GCC Administrator
aff95ee7cc Daily bump. 2020-06-18 00:16:37 +00:00
GCC Administrator
56638b9b18 Daily bump. 2020-06-17 00:16:36 +00:00
GCC Administrator
6fb94d67f1 Daily bump. 2020-06-16 00:16:28 +00:00
GCC Administrator
8e3b453e08 Daily bump. 2020-06-13 00:16:25 +00:00
GCC Administrator
e68e80c8dd Daily bump. 2020-06-12 00:16:29 +00:00
GCC Administrator
ec6ffbb919 Daily bump. 2020-06-11 00:16:45 +00:00
GCC Administrator
b952c2cfcd Daily bump. 2020-06-10 00:16:47 +00:00
GCC Administrator
2c455ae06c Daily bump. 2020-06-09 00:16:47 +00:00
GCC Administrator
3add342502 Daily bump. 2020-06-05 00:16:30 +00:00
GCC Administrator
a9312a7926 Daily bump. 2020-06-03 00:16:34 +00:00
GCC Administrator
4a9aa9dec7 Daily bump. 2020-06-02 00:16:25 +00:00
GCC Administrator
e7340ed74a Daily bump. 2020-06-01 00:16:26 +00:00
GCC Administrator
885ef72f27 Daily bump. 2020-05-30 00:16:27 +00:00
GCC Administrator
61f3b60556 Daily bump. 2020-05-28 04:23:50 +00:00
GCC Administrator
c3a4169be9 Daily bump. 2020-05-27 07:45:56 +00:00
Patrick Palka
a57aa11191 libstdc++: Compile PR93978 testcase with -Wall
Now that the frontend issue PR c++/94038 is thoroughly fixed, the
testcase for PR93978 no longer fails to compile with -O -Wall, so add
-Wall to the testcase's compile flags to help ensure we don't regress
here.

libstdc++-v3/ChangeLog:

	PR libstdc++/93978
	* testsuite/std/ranges/adaptors/93978.cc: Add -Wall to
	dg-additional-options.  Avoid unused-but-set-variable warning.
2020-05-23 15:25:40 -04:00
Jonathan Wakely
3cb0c7cc16 libstdc++: Fix function that can't be constexpr in C++11 (PR 95289)
The body of this function isn't just a return statement, so it can't be
constexpr until C++14.

	PR libstdc++/95289
	* include/debug/helper_functions.h (__get_distance): Only declare
	as a constexpr function for C++14 and up.
	* testsuite/25_algorithms/copy/debug/95289.cc: New test.
2020-05-23 18:27:35 +01:00
Jonathan Wakely
584d52b088 libstdc++: Refactor filesystem::path string conversions
This simplifies the logic of converting Source arguments and pairs of
InputIterator arguments into the native string format. For any input
that is a contiguous range of path::value_type (or char8_t for POSIX)
a string view can be created and the conversion can be done directly,
with no intermediate allocation. Previously some cases created a
basic_string unnecessarily, for example construction from a pair of
path::string_type::iterators, or a pair of non-const value_type*
pointers.

	* include/bits/fs_path.h (__detail::_S_range_begin)
	(__detail::_S_range_end, path::_S_string_from_iter): Replace with
	overloaded function template __detail::__effective_range.
	(__detail::__effective_range): New overloaded function template to
	create a basic_string or basic_string_view for an effective range.
	(__detail::__value_type_is_char): Use __detail::__effective_range.
	Do not use remove_const on value type.
	(__detail::__value_type_is_char_or_char8_t): Likewise.
	(path::path(const Source&, format))
	(path::path(const Source&, const locale&))
	(path::operator/=(const Source&), path::append(const Source&))
	(path::concat(const Source&)): Use __detail::__effective_range.
	(path::_S_to_string(InputIterator, InputIterator)): New function
	template to create a string view if possible, or string otherwise.
	(path::_S_convert): Add overloads that convert a string returned
	by __detail::__effective_range. Use if-constexpr to inline conversion
	logic from all overloads of _Cvt::_S_convert.
	(path::_S_convert_loc): Add overload that converts a string. Use
	_S_to_string to avoid allocation when possible.
	(path::_Cvt): Remove.
	(path::operator+=(CharT)): Remove indirection through path::concat.
	* include/experimental/bits/fs_path.h (path::_S_convert_loc): Add
	overload for non-const pointers, to avoid constructing a std::string.
	* src/c++17/fs_path.cc (path::_S_convert_loc): Replace conditional
	compilation with call to _S_convert.
2020-05-23 09:40:16 +01:00
Jonathan Wakely
00c8f2a5e3 libstdc++: Remove incorrect static specifiers
These functions were originally static members of the path class, but
the 'static' specifiers were not removed when they were moved to
namespace scope. This causes ODR violations when the functions are
called from functions defined in the header, which is incompatible with
Nathan's modules branch.  Change them to 'inline' instead.

	* include/bits/fs_path.h (__detail::_S_range_begin)
	(__detail::_S_range_end): Remove unintentional static specifiers.
	* include/experimental/bits/fs_path.h (__detail::_S_range_begin)
	(__detail::_S_range_end): Likewise.
2020-05-23 09:40:16 +01:00
Jonathan Wakely
988b853f9c libstdc++: Simplify filesystem::path SFINAE constraints
This replaces the filesystem::__detail::_Path SFINAE helper with two
separate helpers, _Path and _Path2. This avoids having one helper which
tries to check two different sets of requirements.

The _Path helper now uses variable templates instead of a set of
overloaded functions to detect specializations of basic_string or
basic_string_view.

The __not_<is_void<remove_pointer_t<_Tp1>> check is not necessary in
C++20 because iterator_traits<void*> is now empty. For C++17 replace
that check with a __safe_iterator_traits helper with partial
specializations for void pointers.

Finally, the __is_encoded_char check no longer uses remove_const_t,
which means that iterators with a const value_type will no longer be
accepted as arguments for path creation. Such iterators resulted in
undefined behaviour anyway, so it's still conforming to reject them in
the constraint checks.

	* include/bits/fs_path.h (filesystem::__detail::__is_encoded_char):
	Replace alias template with variable template. Don't remove const.
	(filesystem::__detail::__is_path_src): Replace overloaded function
	template with variable template and specializations.
	(filesystem::__detail::__is_path_iter_src): Replace alias template
	with class template.
	(filesystem::__detail::_Path): Use __is_path_src. Remove support for
	iterator pairs.
	(filesystem::__detail::_Path2): New alias template for checking
	InputIterator requirements.
	(filesystem::__detail::__constructible_from): Remove.
	(filesystem::path): Replace _Path<Iter, Iter> with _Path2<Iter>.
	* testsuite/27_io/filesystem/path/construct/80762.cc: Check with two
	constructor arguments of void and void* types.
2020-05-23 09:40:16 +01:00
Matthias Kretz
bc7a4f2f9e libstdc++: Enable simple invocation of runtest in testsuite
2020-05-21  Matthias Kretz  <kretz@kde.org>

	* testsuite/Makefile.am: Remove dup target_triplet and set tool,
	allowing runtest to work without arguments.
	* testsuite/Makefile.in: Regenerate.

Signed-off-by: Jonathan Wakely <jwakely@redhat.com>
2020-05-21 14:16:19 +01:00
Jonathan Wakely
f094665d46 libstdc++: Avoid constraint recursion with iterator_traits (PR 93983)
Checking whether a filesystem::path constructor argument is an iterator
requires instantiating std::iterator_traits. In C++20 that checks for
satisfaction of std::iterator_traits constraints, which checks if the
type is copyable, which can end up recursing back to the path
constructor. The fix in LWG 3420 is to reorder the cpp17-iterator
concept's constraints to check if the type looks vaguely like an
iterator before checking copyable. That avoids the recursion for types
which definitely aren't iterators, but isn't foolproof.

	PR libstdc++/93983
	* include/bits/iterator_concepts.h (__detail::__cpp17_iterator):
	Reorder constraints to avoid recursion when constructors use
	iterator_traits (LWG 3420).
	* testsuite/24_iterators/customization_points/lwg3420.cc: New test.
2020-05-21 07:32:15 +01:00
Jonathan Wakely
0a1baad8eb libstdc++: Use macro for nodiscard attribute
* include/experimental/socket (basic_socket::is_open()
	(basic_socket_acceptor::is_open()): Use _GLIBCXX_NODISCARD macro.
2020-05-21 01:03:27 +01:00
Jonathan Wakely
b780db2ea3 libstdc++: Better requirements checking in Networking TS
Define concepts and traits for checking type requirements.

	* include/experimental/bits/net.h (__endpoint, __protocol)
	(__acceptable_protocol, __inet_protocol): New concepts.
	(__detail::__is_endpoint): Move trait from <experimental/socket>.
	(__is_protocol, __is_acceptable_protocol, __is_inet_protocol): New
	traits.
	(__endpoint, __protocol, __acceptable_protocol): New variable
	templates.
	* include/experimental/socket (__is_endpoint): Move to net.h header.
	(basic_socket, basic_socket_acceptor): Check requirements.
2020-05-21 00:59:55 +01:00
Jonathan Wakely
d9d34449bb libstdc++: Fix net::basic_socket::close(error_code&)
Also add some missing member functions, nodiscard attributes, and
noexcept-specifiers.

	* include/experimental/executor (use_future_t::use_future_t()): Fix
	incorrect noexcept-specifier.
	* include/experimental/internet (basic_resolver_results): Adjust
	whitespace.
	* include/experimental/socket (__basic_socket_impl::release): Add
	member function.
	(basic_socket(io_context&, const endpoint_type&)): Fix argument to
	target constructor.
	(basic_socket::release(), basic_socket::release(error_code&)): Add
	missing member functions.
	(basic_socket::is_open()): Add nodiscard attribute.
	(basic_socket::close(error_code&)): Pass argument to base function.
	(basic_socket_acceptor::release())
	(basic_socket_acceptor::release(error_code&)): Add missing member
	functions.
	(basic_socket_acceptor::is_open()): Add nodiscard attribute.
	(basic_socket_streambuf::error()): Add noexcept.
	(basic_socket_iostream::error()): Likewise.
	* testsuite/experimental/net/socket/basic_socket.cc: New test.
2020-05-21 00:59:55 +01:00
Jonathan Wakely
f26e72d831 libstdc++: Use 'using' for types in Networking TS headers
* include/experimental/buffer: Replace typedefs with
	alias-declarations.
	* include/experimental/executor: Likewise.
	* include/experimental/internet: Likewise.
	* include/experimental/socket: Likewise.
	* include/experimental/timer: Likewise.
2020-05-21 00:59:55 +01:00
Jonathan Wakely
a2d196e75c libstdc++: Use RDRAND as fallback if RDSEED keeps failing (PR 94087)
It's not difficult for multiple threads to drain the entropy available
to the RDSEED instruction, at which point we throw an exception. This
change will try to use RDRAND after RDSEED fails repeatedly, and only
throw if RDRAND also fails repeatedly. This doesn't guarantee a random
value can always be read, but reduces the likelihood of failure when
using the RDSEED instruction.

	PR libstdc++/94087
	* src/c++11/random.cc (__x86_rdseed): Allow fallback function to be
	passed in.
	(__x86_rdseed_rdrand): New function that uses rdseed with rdrand
	fallback.
	(random_device::_M_init): Use __x86_rdseed_rdrand when both
	instructions are available.
	* testsuite/26_numerics/random/random_device/94087.cc: New test.
2020-05-19 23:04:45 +01:00
Patrick Palka
864fed4a49 c++: Explain fn template argument type/value mismatches [PR66439]
In fn_type_unifcation, we are passing NULL_TREE as the 'in_decl'
parameter to coerce_template_parms, and this is causing template
type/value mismatch error messages to get suppressed regardless of the
value of 'complain'.

This means that when substitution into a function template fails due to
a type/value mismatch between a template parameter and the provided
template argument, we just say "template argument deduction/substitution
failed:" without a followup explanation of the failure.

Fix this by passing 'fn' instead of NULL_TREE to coerce_template_parms.

gcc/cp/ChangeLog:

	PR c++/66439
	* pt.c (fn_type_unification): Pass 'fn' instead of NULL_TREE as
	the 'in_decl' parameter to coerce_template_parms.

gcc/testsuite/ChangeLog:

	PR c++/66439
	* g++.dg/cpp2a/concepts-ts4.C: Expect a "type/value mismatch"
	diagnostic.
	* g++.dg/cpp2a/concepts-ts6.C: Likewise.
	* g++.dg/template/error56.C: Likewise.
	* g++.dg/template/error59.C: New test.

libstdc++-v3/ChangeLog:

	PR c++/66439
	* testsuite/20_util/pair/astuple/get_neg.cc: Prune "type/value
	mismatch" messages.
	* testsuite/20_util/tuple/element_access/get_neg.cc: Likewise.
2020-05-18 23:50:14 -04:00
H.J. Lu
4c1a5d8b71 x86: Also check if -fcf-protection works
When defaulting CET run-time support to auto, check if -fcf-protection
works.  Even if the stage1 GCC doesn't support -fcf-protection, since
the final GCC does, CET run-time support will be enabled by default if
binutils support CET.

config/

	PR bootstrap/95147
	* cet.m4 (GCC_CET_FLAGS): Also check if -fcf-protection works
	when defaulting to auto.

libatomic/

	PR bootstrap/95147
	* configure: Regenerated.

libbacktrace/

	PR bootstrap/95147
	* configure: Regenerated.

libgcc/

	PR bootstrap/95147
	* configure: Regenerated.

libgfortran/

	PR bootstrap/95147
	* configure: Regenerated.

libgomp/

	PR bootstrap/95147
	* configure: Regenerated.

libitm/

	PR bootstrap/95147
	* configure: Regenerated.

libobjc/

	PR bootstrap/95147
	* configure: Regenerated.

libphobos/

	PR bootstrap/95147
	* configure: Regenerated.

libquadmath/

	PR bootstrap/95147
	* configure: Regenerated.

libsanitizer/

	PR bootstrap/95147
	* configure: Regenerated.

libssp/

	PR bootstrap/95147
	* configure: Regenerated.

libstdc++-v3/

	PR bootstrap/95147
	* configure: Regenerated.

libvtv/

	PR bootstrap/95147
	* configure: Regenerated.

zlib/

	PR bootstrap/95147
	* configure: Regenerated.
2020-05-15 09:07:17 -07:00
H.J. Lu
8d286dd118 x86: Default CET run-time support to auto
CET has been added since GCC 8.  This patch defaults CET run-time support
to auto.  It enables CET run-time support if asssembler supports CET
instructions and multi-byte NOPs are enabled via SSE2.

config/

	* cet.m4 (GCC_CET_FLAGS): Change default to auto.

gcc/

	* configure: Regenerated.

libatomic/

	* configure: Regenerated.

libbacktrace/

	* configure: Regenerated.

libcc1/

	* configure: Regenerated.

libcpp/

	* configure: Regenerated.

libdecnumber/

	* configure: Regenerated.

libgcc/

	* configure: Regenerated.

libgfortran/

	* configure: Regenerated.

libgomp/

	* configure: Regenerated.

libitm/

	* configure: Regenerated.

libobjc/

	* configure: Regenerated.

libquadmath/

	* configure: Regenerated.

libsanitizer/

	* configure: Regenerated.

libssp/

	* configure: Regenerated.

libstdc++-v3/

	* configure: Regenerated.

libvtv/

	* configure: Regenerated.

zlib/

	* configure: Regenerated.
2020-05-14 09:05:02 -07:00
Alexandre Oliva
883246530f x86-vxworks malloc aligns to 8 bytes like solaris
Vxworks 7's malloc, like Solaris', only ensures 8-byte alignment of
returned pointers on 32-bit x86, though GCC's stddef.h defines
max_align_t with 16-byte alignment for __float128.  This patch enables
on x86-vxworks the same memory_resource workaround used for x86-solaris.

The testsuite also had a workaround, defining BAD_MAX_ALIGN_T and
xfailing the test; extend those to x86-vxworks as well, and remove the
check for char-aligned requested allocation to be aligned like
max_align_t.  With that change, the test passes on x86-vxworks; I'm
guessing that's the same reason for the test not to pass on
x86-solaris (and on x86_64-solaris -m32), so with the fix, I'm
tentatively removing the xfail.


for libstdc++-v3/ChangeLog

	PR libstdc++/77691
	* include/experimental/memory_resource
	(__resource_adaptor_imp::do_allocate): Handle max_align_t on
	x86-vxworks as on x86-solaris.
	(__resource_adaptor_imp::do_deallocate): Likewise.
	* testsuite/experimental/memory_resource/new_delete_resource.cc:
	Drop xfail.
	(BAD_MAX_ALIGN_T): Define on x86-vxworks as on x86-solaris.
	(test03): Drop max-align test for char-aligned alloc.
2020-05-13 04:49:00 -03:00
Ulrich Drepper
491ba663e0 Implent C++20 std::atomic_flag::test
* include/bits/atomic_base.h (atomic_flag): Implement test member
        function.
        * include/std/version: Define __cpp_lib_atomic_flag_test.
        * testsuite/29_atomics/atomic_flag/test/explicit.cc: New file.
        * testsuite/29_atomics/atomic_flag/test/implicit.cc: New file.
2020-05-12 07:37:09 +02:00
François Dumont
ffeb6554be Revert "libstdc++ Enhance thread safety of debug mode iterators"
This reverts commit 0b83c4fabb.
2020-05-11 14:07:06 +02:00
François Dumont
0b83c4fabb libstdc++ Enhance thread safety of debug mode iterators
Avoids race condition when checking for an iterator to be singular or
to be comparable to another iterator.

	* src/c++/debug.cc
	(_Safe_sequence_base::_M_attach_single): Set attached iterator
	sequence pointer and version.
	(_Safe_sequence_base::_M_detach_single): Reset detached iterator.
	(_Safe_iterator_base::_M_attach): Remove attached iterator sequence
	pointer and version asignments.
	(_Safe_iterator_base::_M_attach_single): Likewise.
	(_Safe_iterator_base::_M_detach_single): Remove detached iterator
	reset.
	(_Safe_iterator_base::_M_singular): Use atomic load to access parent
	sequence.
	(_Safe_iterator_base::_M_can_compare): Likewise.
	(_Safe_iterator_base::_M_get_mutex): Likewise.
	(_Safe_local_iterator_base::_M_attach): Remove attached iterator container
	pointer and version assignments.
	(_Safe_local_iterator_base::_M_attach_single): Likewise.
	(_Safe_unordered_container_base::_M_attach_local_single):
	Set attached iterator container pointer and version.
	(_Safe_unordered_container_base::_M_detach_local_single): Reset detached
	iterator.
2020-05-10 23:01:41 +02:00
Jonathan Wakely
91d505491c libstdc++: Fix whitespace in Changelog 2020-05-07 21:47:49 +01:00
Jonathan Wakely
9c24e97a97 libstdc++: Fix some C++20 algorithms to work in parallel mode
Some new algorithms need to use _GLIBCXX_STD_A to refer to the "normal"
version of the algorithm, to workaround the namespace dance done for
parallel mode.

	PR libstdc++/94971 (partial)
	* include/bits/ranges_algo.h (ranges::__sample_fn): Qualify
	std::sample using macro to work in parallel mode.
	(__sort_fn): Likewise for std::sort.
	(ranges::__nth_element_fn): Likewise for std::nth_element.
	* include/bits/stl_algobase.h (lexicographical_compare_three_way):
	Likewise for std::__min_cmp.
	* include/parallel/algobase.h (lexicographical_compare_three_way):
	Add to namespace std::__parallel.
2020-05-07 21:43:49 +01:00
Jonathan Wakely
4cbc9d8b34 libstdc++: Make relational operators work with const guarded iterators (PR 92472)
This is a correct fix for the incorrect cppcheck suggestion to make
these parameters const. In order to that, the dereference operators need
to be const. The conversions to the underlying iterator can be const
too.

	PR c/92472
	* include/parallel/multiway_merge.h (_GuardedIterator::operator*)
	(_GuardedIterator::operator _RAIter, _UnguardedIterator::operator*)
	(_UnguardedIterator::operator _RAIter): Add const qualifier.
	(operator<(_GuardedIterator&, _GuardedIterator&)
	(operator<=(_GuardedIterator&, _GuardedIterator&)
	(operator<(_UnguardedIterator&, _UnguardedIterator&)
	(operator<=(_UnguardedIterator&, _UnguardedIterator&): Change
	parameters to const references.
2020-05-07 21:43:49 +01:00
Eric Botcazou
359b19e990 Update the baseline symbols for SPARC64/Linux 2020-05-07 10:56:51 +02:00
François Dumont
72a54e5e81 libstdc++ std::fill overload for std::vector<bool>::iterator
Extend the overload so that it is used even when _GLIBCXX_DEBUG mode
is activated.

	* include/bits/stl_algobase.h (struct _Bit_iterator): New declaration.
	(std::__fill_a1(_Bit_iterator, _Bit_iterator, const bool&)): Likewise.
	* include/bits/stl_bvector.h (__fill_bvector): Move outside
	_GLIBCXX_STD_C namespace.
	(fill(_Bit_iterator, _Bit_iterator, const bool&)): Likewise and rename
	into...
	(__fill_a1): ...this.
	* testsuite/25_algorithms/fill/bvector/1.cc: New.
2020-05-06 23:28:22 +02:00
H.J. Lu
a3f1fc0625 x32: Update baseline_symbols.txt
* config/abi/post/x86_64-linux-gnu/x32/baseline_symbols.txt: Updated.
2020-05-06 06:17:44 -07:00
Rainer Orth
093d95fe34 libstdc++: Update Solaris baselines for GCC 10.1
I just remembered that the libstdc++ ABI baselines haven't been updated
for the GCC 10 release yet.  This patch corrects this for Solaris/SPARC
and x86.

Created on master with make new-abi-baseline on i386-pc-solaris2.11 and
sparc-sun-solaris2.11, bootstrapped on gcc-10 branch without regressions.

	* config/abi/post/i386-solaris/baseline_symbols.txt: Regenerate.
	* config/abi/post/i386-solaris/amd64/baseline_symbols.txt:
	Likewise.
	* config/abi/post/sparc-solaris/baseline_symbols.txt: Likewise.
	* config/abi/post/sparc-solaris/sparcv9/baseline_symbols.txt:
	Likewise.
2020-05-06 14:02:34 +02:00
Martin Liska
6208287fca
Revert "Use const for template argument."
This reverts commit 03f9754665.
2020-05-06 12:09:05 +02:00
Jonathan Wakely
2b6f6aeea1 libstdc++: Document library versioning for 9.[123] and 10.1
* doc/xml/manual/abi.xml (abi.versioning.history): Document library
	versions for GCC 9.[123] and 10.1 releases.
	* doc/html/*: Regenerate.
2020-05-06 10:30:15 +01:00
Jakub Jelinek
19d422201c libstdc++: Update {x86_64,i?86,powerpc64,s390x,aarch64}-linux baselines for GCC 10.1
On Wed, May 06, 2020 at 10:49:13AM +0200, Rainer Orth wrote:
> I just remembered that the libstdc++ ABI baselines haven't been updated
> for the GCC 10 release yet.  This patch corrects this for Solaris/SPARC
> and x86.

Oops, here are the updates from Fedora packages built during the weekend.

2020-05-06  Jakub Jelinek  <jakub@redhat.com>

	* config/abi/post/x86_64-linux-gnu/baseline_symbols.txt: Update.
	* config/abi/post/x86_64-linux-gnu/32/baseline_symbols.txt: Update.
	* config/abi/post/i386-linux-gnu/baseline_symbols.txt: Update.
	* config/abi/post/i486-linux-gnu/baseline_symbols.txt: Update.
	* config/abi/post/aarch64-linux-gnu/baseline_symbols.txt: Update.
	* config/abi/post/s390x-linux-gnu/baseline_symbols.txt: Update.
	* config/abi/post/powerpc64-linux-gnu/baseline_symbols.txt: Update.
2020-05-06 11:21:28 +02:00
Martin Liska
af2311abf8
Add missing ChangeLog entries. 2020-05-05 16:10:13 +02:00
Fangrui Song
1405ed4334 libstdc++: Fix the return type of __cxa_finalize
This should return void according to the Itanium C++ ABI.

2020-05-04  Fangrui Song  <maskray@google.com>

	* libsupc++/cxxabi.h (__cxa_finalize): Fix return type.
2020-05-04 23:07:19 +01:00
Jonathan Wakely
ae8a08ff59 libstdc++: Fix broken link to SGI STL FAQ
The previous URL to an entry in the wayback machine now redirects to a
page saying "SGI.com Tech Archive Resources now retired" so use an older
entry from the archive.

	* doc/xml/faq.xml: Use working link for SGI STL FAQ.
	* doc/html/*: Regenerate.
2020-05-04 22:54:25 +01:00
Jonathan Wakely
bb27781b64 libstdc++: Fix incorrect size calculation in PMR resource (PR 94906)
Calculating the size of a chunk being returned to the upstream allocator
was done with a 32-bit type, so it wrapped if the chunk was 4GB or
larger.

I don't know how to test this without allocating 4GB, so there's no test
in the testsuite. It has been tested manually with allocations sizes and
alignments exceeding 4GB.

	PR libstdc++/94906
	* src/c++17/memory_resource.cc
	(monotonic_buffer_resource::_Chunk::release): Use size_t for shift
	operands.
2020-05-04 22:47:30 +01:00
Nathan Sidwell
e6b31fc717 libstdc++: Avoid negating a size_t [pr 94747]
Although the code here is well formed, it doesn't show intent well.
The reason checkers trigger on this is that it is a cause of real
bugs.  So, negate a ptrdiff_t instead.

	* libsupc++/dyncast.cc (__dynamic_cast): Cast offsetof to
	ptrdiff_t before negation, to show intent more clearly.
2020-05-04 10:08:13 -07:00
Jonathan Wakely
ec40967f13 libstdc++: Make pmr::synchronized_pool_resource work without libpthread (PR 94936)
I implicitly assumed that programs using pmr::synchronized_pool_resource
would also be using multiple threads, and so the weak symbols in
gthr-posix.h would be resolved by linking to libpthread. If that isn't
true then it crashes when trying to use pthread_key_create.

This commit makes the pool resource check __gthread_active_p() before
using thread-specific data, and just use a single set of memory pools
when there's only a single thread.

	PR libstdc++/94936
	* src/c++17/memory_resource.cc (synchronized_pool_resource::_TPools):
	Add comment about single-threaded behaviour.
	(synchronized_pool_resource::_TPools::move_nonempty_chunks()): Hoist
	class member access out of loop.
	(synchronized_pool_resource::synchronized_pool_resource())
	(synchronized_pool_resource::~synchronized_pool_resource())
	(synchronized_pool_resource::release()): Check __gthread_active_p
	before creating and/or deleting the thread-specific data key.
	(synchronized_pool_resource::_M_thread_specific_pools()): Adjust
	assertions.
	(synchronized_pool_resource::do_allocate(size_t, size_t)): Add fast
	path for single-threaded case.
	(synchronized_pool_resource::do_deallocate(void*, size_t, size_t)):
	Likewise. Return if unable to find a pool that owns the allocation.
	* testsuite/20_util/synchronized_pool_resource/allocate_single.cc:
	New test.
	* testsuite/20_util/synchronized_pool_resource/cons_single.cc: New
	test.
	* testsuite/20_util/synchronized_pool_resource/release_single.cc: New
	test.
2020-05-04 13:37:31 +01:00
Jonathan Wakely
22b6b5d6cf libstdc++: Make byte-sized std::fill_n a constant expression (PR 94933)
The overload for byte types uses memset and isn't constexpr. This adds
the specifier and uses std::is_constant_evaluated() to provide a
compile-time alternative.

	PR libstdc++/94933
	* include/bits/stl_algobase.h (__fill_a1): Make overload for byte types
	usable in constant expressions.
	* testsuite/25_algorithms/fill_n/constexpr.cc: Test with bytes and
	non-scalars.
2020-05-03 13:33:15 +01:00
Jonathan Wakely
187c854cc6 libstdc++: Add more tests for _E10, _E11 etc. (PR 94901)
PR libstdc++/94901
	* testsuite/17_intro/badnames.cc: Test values between _E9 and _E24 too.
2020-05-01 14:49:48 +01:00
Jonathan Wakely
a5f2fb1ff1 libstdc++: Replace deduced return type in ranges::iter_move (PR 92894)
The deduced return type causes the instantiation of the function body,
which can then require the instantiation of std::projected::operator*
which is intentionally not defined.

This patch uses a helper trait to define the return type, so that the
function body doesn't need to be instantiated. That helper trait can
then also be used in other places that currently check the return type
of ranges::iter_move (iter_rvalue_reference_t and indirectly_readable).

2020-05-01  Jonathan Wakely  <jwakely@redhat.com>
	    Patrick Palka  <ppalka@redhat.com>

	PR libstdc++/92894
	* include/bits/iterator_concepts.h (ranges::__cust_imove::_IMove):
	Add trait to determine return type and an alias for it.
	(ranges::__cust_imove::_IMove::operator()): Use __result instead of
	deduced return type.
	(iter_rvalue_reference_t): Use _IMove::__type instead of checking
	the result of ranges::iter_move.
	(__detail::__indirectly_readable_impl): Use iter_rvalue_reference_t
	instead of checking the result of ranges::iter_move.
	* testsuite/24_iterators/customization_points/92894.cc: New test.
	* testsuite/24_iterators/indirect_callable/92894.cc: New test.
2020-05-01 14:27:25 +01:00
Jonathan Wakely
070b4df8a0 libstdc++: Replace reserved identifier _T with _Tp (PR 94901)
The libstdc++ manual documents that _T can not be used, because it's a
macro in system headers on some targets.

	PR libstdc++/94901
	* include/std/type_traits (__is_complete_or_unbounded): Replace
	BADNAME _T with _Tp.
	* testsuite/17_intro/badnames.cc: New test.
2020-05-01 13:41:02 +01:00
Jonathan Wakely
b1983f4582 libstdc++: Avoid errors in allocator's noexcept-specifier (PR 89510)
This fixes a regression due to the conditional noexcept-specifier on
std::allocator::construct and std::allocator::destroy, as well as the
corresponding members of new_allocator, malloc_allocator, and
allocator_traits. Those noexcept-specifiers were using expressions which
might be ill-formed, which caused errors outside the immediate context
when checking for the presence of construct and destroy in SFINAE
contexts.

The fix is to use the is_nothrow_constructible and
is_nothrow_destructible type traits instead, because those traits are
safe to use even when the construction/destruction itself is not valid.

The is_nothrow_constructible trait will be false for a type that is not
also nothrow-destructible, even if the new-expression used in the
construct function body is actually noexcept. That's not the correct
answer, but isn't a problem because providing a noexcept-specifier on
these functions is not required by the standard anyway. If the answer is
false when it should be true, that's suboptimal but OK (unlike giving
errors for valid code, or giving a true answer when it should be false).

	PR libstdc++/89510
	* include/bits/alloc_traits.h (allocator_traits::_S_construct)
	(allocator_traits::_S_destroy)
	(allocator_traits<allocator<T>>::construct): Use traits in
	noexcept-specifiers.
	* include/bits/allocator.h (allocator<void>::construct)
	(allocator<void>::destroy): Likewise.
	* include/ext/malloc_allocator.h (malloc_allocator::construct)
	(malloc_allocator::destroy): Likewise.
	* include/ext/new_allocator.h (new_allocator::construct)
	(new_allocator::destroy): Likewise.
	* testsuite/20_util/allocator/89510.cc: New test.
	* testsuite/ext/malloc_allocator/89510.cc: New test.
	* testsuite/ext/new_allocator/89510.cc: New test.
2020-04-30 16:01:43 +01:00
Jonathan Wakely
8f1591763f libstdc++: Fix outdated comment about std::string instantiations (PR 94854)
PR libstdc++/94854
	* include/bits/basic_string.tcc: Update comment about explicit
	instantiations.
2020-04-29 19:00:58 +01:00
Jonathan Wakely
d0330a0360 libstdc++: Fixes for feature test macros (PR 91480)
Remove the non-standard __cpp_lib_allocator_is_always_equal macro and
add the missing macros for P1032R1.

	PR libstdc++/91480
	* include/bits/allocator.h (__cpp_lib_allocator_is_always_equal):
	Remove non-standard macro.
	* include/bits/stl_iterator.h (__cpp_lib_constexpr_iterator): Define
	to indicate P1032R1 support.
	* include/bits/stl_pair.h (__cpp_lib_constexpr_utility): Likewise.
	* include/std/string_view (__cpp_lib_constexpr_string_view): Likewise.
	* include/std/tuple (__cpp_lib_constexpr_tuple): Likewise.
	* include/std/version (__cpp_lib_allocator_is_always_equal): Remove.
	(__cpp_lib_constexpr_iterator, __cpp_lib_constexpr_string_view)
	(__cpp_lib_constexpr_tuple, __cpp_lib_constexpr_utility): Define.
	* testsuite/20_util/function_objects/constexpr_searcher.cc: Check
	feature test macro.
	* testsuite/20_util/tuple/cons/constexpr_allocator_arg_t.cc: Likewise.
	* testsuite/21_strings/basic_string_view/operations/copy/char/
	constexpr.cc: Likewise.
	* testsuite/24_iterators/insert_iterator/constexpr.cc: Likewise.
2020-04-28 23:40:18 +01:00
Jonathan Wakely
162c40a4c1 libstdc++: Fix regression in std::_Construct (PR 94831)
By trying to reuse the existing std::_Construct function as a wrapper
for std::construct_at I introduced regressions, because changing
std::_Construct to return non-void made it ill-formed for array types.

The solution is to revert _Construct to its former state, and change
allocator_traits::construct to explicitly call construct_at instead.
This decouples all the existing callers of _Construct from the new
construct_at requirements.

	PR libstdc++/94831
	* include/bits/alloc_traits.h (_S_construct): Restore placement
	new-expression for C++11/14/17 and call std::construct_at directly
	for C++20.
	* include/bits/stl_construct.h (_Construct): Revert to non-constexpr
	function returning void.
	* testsuite/20_util/specialized_algorithms/
	uninitialized_value_construct/94831.cc: New test.
	* testsuite/23_containers/vector/cons/94831.cc: New test.
2020-04-28 23:39:38 +01:00
Patrick Palka
19667c82e4 libstdc++: Fix subrange::advance and subrange::prev (LWG 3433)
This implements the proposed resolution of LWG 3433, which fixes
subrange::advance when called with a negative argument.

libstdc++-v3/ChangeLog:

	LWG 3433 subrange::advance(n) has UB when n < 0
	* include/std/ranges (subrange::prev): Fix typo.
	(subrange::advance): Handle a negative argument as per the proposed
	resolution of LWG 3433.
	* testsuite/std/ranges/subrange/lwg3433.cc: New test.
2020-04-28 16:43:23 -04:00
Iain Sandoe
b9c91b7f32 coroutines: Fix handling of non-class coroutine returns [PR94759]
From the standard:

The header <coroutine> defines the primary template coroutine_traits
such that if ArgTypes is a parameter pack of types and if the
qualified-id R::promise_type is valid and denotes a type, then
coroutine_traits<R,ArgTypes...> has the following publicly accessible
member:
     using promise_type = typename R::promise_type;

this should not prevent more specialised cases and  the following
code should be accepted, but is currently rejected with:

'error: coroutine return type ‘void’ is not a class'

This is because the check for non-class-ness of the return value was
in the wrong place; it needs to be carried out in a SFINAE context.

The following patch removes the restriction in the traits template
instantiation and allows for the case that the ramp function could
return void.

The <coroutine> header is amended to implement the required
functionality.

gcc/cp/ChangeLog:

2020-04-28  Iain Sandoe  <iain@sandoe.co.uk>

	PR c++/94759
	* coroutines.cc (coro_promise_type_found_p): Do not
	exclude non-classes here (this needs to be handled in the
	coroutine header).
	(morph_fn_to_coro):  Allow for the case where the coroutine
	returns void.

gcc/testsuite/ChangeLog:

2020-04-28  Iain Sandoe  <iain@sandoe.co.uk>

	PR c++/94759
	* g++.dg/coroutines/coro-bad-alloc-00-bad-op-new.C: Adjust for
	updated error messages.
	* g++.dg/coroutines/coro-bad-alloc-01-bad-op-del.C: Likewise.
	* g++.dg/coroutines/coro-bad-alloc-02-no-op-new-nt.C: Likewise.
	* g++.dg/coroutines/coro-missing-promise.C: Likewise.
	* g++.dg/coroutines/pr93458-5-bad-coro-type.C: Liekwise.
	* g++.dg/coroutines/torture/co-ret-17-void-ret-coro.C: New test.

libstdc++-v3/ChangeLog:

2020-04-28  Jonathan Wakely  <jwakely@redhat.com>
	    Iain Sandoe  <iain@sandoe.co.uk>

	PR c++/94759
	* include/std/coroutine: Implement handing for non-
	class coroutine return types.
2020-04-28 02:07:37 +01:00
Jonathan Wakely
00082ff88c libstdc++: Make net::service_already_exists default constructible
The LWG issue I created is Tentatively Ready and proposes to declare a
public default constructor, rather than the private one I added
recently.

	* include/experimental/executor (service_already_exists): Make default
	constructor public (LWG 3414).
	* testsuite/experimental/net/execution_context/make_service.cc: Check
	the service_already_exists can be default constructed.
2020-04-24 14:15:51 +01:00
Jonathan Wakely
d1462b0782 libstdc++: Fix constructor constraints for std::any (PR 90415)
This removes a non-standard extension to std::any which causes errors
for valid code, due to recursive instantiation of a trait that isn't
supposed to be in the constraints.

It also removes some incorrect constraints on the in_place_type<T>
constructors and emplace members, which were preventing creating a
std::any object with another std::any as the contained value.

2020-04-24  Kamlesh Kumar  <kamleshbhalui@gmail.com>
	    Jonathan Wakely  <jwakely@redhat.com>

	PR libstdc++/90415
	PR libstdc++/92156
	* include/std/any (any): Rename template parameters for consistency
	with the standard.
	(any::_Decay): Rename to _Decay_if_not_any.
	(any::any(T&&):: Remove is_constructible from constraints. Remove
	non-standard overload.
	(any::any(in_place_type_t<T>, Args&&...))
	(any::any(in_place_type_t<T>, initializer_list<U>, Args&&...))
	(any::emplace(Args&&...))
	(any::emplace(initializer_list<U>, Args&&...)):
	Use decay_t instead of _Decay.
	* testsuite/20_util/any/cons/90415.cc: New test.
	* testsuite/20_util/any/cons/92156.cc: New Test.
	* testsuite/20_util/any/misc/any_cast_neg.cc: Make dg-error directives
	more robust.
	* testsuite/20_util/any/modifiers/92156.cc: New test.
2020-04-24 00:54:20 +01:00
Thomas Rodgers
8c9d69bafc libstdc++: Mark experimental::net::system_context ctor deleted
* include/experimental/net/executor (system_context): Mark
           system_context::system_context() = delete.
           * testsuite/experimental/net/executor/1.cc: Add new
           test to check system_context is not default constructible.
2020-04-23 13:44:23 -07:00
Jonathan Wakely
be0363c80f libstdc++: Update C++20 library status docs
This reorganises the C++20 status table, grouping the proposals by
category. It also adds more proposals, and documents all the feature
test macros for C++20 library changes.

	* doc/xml/manual/status_cxx2020.xml: Update C++20 status table.
	* doc/html/*: Regenerate.
2020-04-23 21:39:33 +01:00
Jonathan Wakely
40541efe1c libstdc++: Change __cpp_lib_array_constexpr for C++17 again
This partially reverts my previous change related to this macro. The
C++20 constexpr iterator requirements are always met by array:iterator,
because it's just a pointer. So the macro can be set to 201803 even in
C++17 mode.

	* include/bits/stl_iterator.h (__cpp_lib_array_constexpr): Revert
	value for C++17 to 201803L because P0858R0 is supported for C++17.
	* include/std/version (__cpp_lib_array_constexpr): Likewise.
	* testsuite/23_containers/array/element_access/constexpr_c++17.cc:
	Check for value corresponding to P0031R0 features being tested.
	* testsuite/23_containers/array/requirements/constexpr_iter.cc:
	Check for value corresponding to P0858R0 features being tested.
2020-04-23 21:39:33 +01:00
Jonathan Wakely
a2dcb56c94 libstdc++: Define __cpp_lib_three_way_comparison for freestanding
The <compare> header is always supported, not only for hosted configs.

	* include/std/version (__cpp_lib_three_way_comparison): Define for
	freestanding builds.
2020-04-23 21:39:33 +01:00
Iain Sandoe
dcf69ac544 coroutines, libstdc++-v3: Update to n4861 C++20 DIS.
Update the inline namespace to __n4861.
Add '__cpp_lib_coroutine' defined to 201902L per n4861.

libstdc++-v3/ChangeLog:

2020-04-23  Iain Sandoe  <iain@sandoe.co.uk>

	* include/std/coroutine: Update the inline namespace to __n4861.
	Add the __cpp_lib_coroutine define, set to 201902L.
	* include/std/version: Add __cpp_lib_coroutine, set to 201902L.

gcc/testsuite/ChangeLog:

2020-04-23  Iain Sandoe  <iain@sandoe.co.uk>

	* g++.dg/coroutines/coro-bad-alloc-00-bad-op-new.C: Adjust for
	changed inline namespace.
	* g++.dg/coroutines/coro-bad-alloc-01-bad-op-del.C: Likewise.
	* g++.dg/coroutines/coro-bad-alloc-02-no-op-new-nt.C: Likewise
	* g++.dg/coroutines/coro.h: Likewise
2020-04-23 16:27:29 +01:00
Jonathan Wakely
aac39307e8 libstdc++: Define __cpp_lib_execution feature test macro
This macro has never been defined by libstdc++, despite supporting the
parallel algorithms. It should have a different value for C++17 and
C++20, because P1001R2 should not be supported in C++17, but
unsequenced_policy is defined for C++17 (see PR p4702).

	* include/std/execution (__cpp_lib_execution): Define to indicate
	support for P0024R2 and P1001R2.
	* include/std/version (__cpp_lib_execution): Define.
	* testsuite/25_algorithms/pstl/feature_test.cc: Only test macro
	defined by <algorithm>, move other tests to new tests ...
	* testsuite/25_algorithms/pstl/feature_test-2.cc: New test.
	* testsuite/25_algorithms/pstl/feature_test-3.cc: New test.
	* testsuite/25_algorithms/pstl/feature_test-4.cc: New test.
	* testsuite/25_algorithms/pstl/feature_test-5.cc: New test.
2020-04-22 22:54:35 +01:00
Jonathan Wakely
e851aa1703 libstdc++: Update (and revert) value of __cpp_lib_array_constexpr
This macro should have been updated to 201811 when the last C++20
changes were implemented. However those changes are not enabled for
C++17 mode, so the macro should only have the new value in C++20 mode.

This change ensures that the macro is defined to 201603 for C++17 and
201811 for C++20.

	* include/bits/stl_iterator.h (__cpp_lib_array_constexpr): Define
	different values for C++17 and C++20, to indicate different feature
	sets. Update value for C++20 to indicate P1032R1 support.
	* include/std/version (__cpp_lib_array_constexpr): Likewise.
	* testsuite/23_containers/array/comparison_operators/constexpr.cc:
	Check feature test macro.
	* testsuite/23_containers/array/element_access/constexpr_c++17.cc:
	New test.
	* testsuite/23_containers/array/requirements/constexpr_fill.cc: Check
	feature test macro.
	* testsuite/23_containers/array/requirements/constexpr_iter.cc: Test
	in C++17 mode and check feature test macro.
2020-04-22 22:54:35 +01:00
Jonathan Wakely
2025db692e libstdc++: Do not define __cpp_lib_constexpr_algorithms in <utility>
The C++20 draft and SD-6 both say this should only be in <version> and
<algorithm>, not in <utility>.

	* include/std/utility (__cpp_lib_constexpr_algorithms): Do not define
	here.
	* testsuite/20_util/exchange/constexpr.cc: Do not expect macro to be
	defined by <utility>.
2020-04-22 22:54:35 +01:00
Jonathan Wakely
c9313582d8 libstdc++: Update __cpp_lib_concepts value
* include/std/functional (__cpp_lib_concepts): Update macro value to
	indicate P1964R2 support.
	* include/std/version (__cpp_lib_concepts): Likewise.
	* testsuite/std/concepts/1.cc: Adjust expected value.
	* testsuite/std/concepts/2.cc: Likewise.
2020-04-22 22:54:34 +01:00
Jonathan Wakely
eca477d16c libstdc++: Rename __cpp_lib_constexpr_invoke macro
This macro was renamed after it was added to the working draft, but we
never renamed it  in libstdc++. We haven't made a release with the old
macro name, so I see no need to keep it around.

	* include/std/functional (__cpp_lib_constexpr_invoke): Rename to
	__cpp_lib_constexpr_functional.
	* include/std/version (__cpp_lib_constexpr_invoke): Likewise.
	* testsuite/20_util/function_objects/invoke/constexpr.cc: Adjust.
2020-04-22 22:54:34 +01:00
Jonathan Wakely
56772f623e libstdc++: Add missing feature test macros
These macros all correspond to features that are already supported, but
the macro was not defined when the feature was implemented.

	* include/bits/ptr_traits.h (__cpp_lib_constexpr_memory): Define to
	indicate P1006R1 support.
	(__cpp_lib_to_address): Define to indicate P0653R2 support.
	* include/bits/range_access.h (__cpp_lib_ssize): Define to indicate
	P1227R2 support.
	* include/bits/ranges_algo.h (__cpp_lib_shift): Define to indicate
	P0769R2 support.
	* include/std/atomic (__cpp_lib_atomic_float): Define to indicate
	P0020R6 support.
	* include/std/memory (__cpp_lib_assume_aligned): Define to indicate
	P1007R3 support.
	* include/std/memory_resource (__cpp_lib_polymorphic_allocator):
	Define to indicate P0339R6 support.
	* include/std/string_view (__cpp_lib_starts_ends_with): Define to
	indicate P0457R2 support.
	* include/std/type_traits (__cpp_lib_is_nothrow_convertible): Define
	to indicate P0758R1 support.
	(__cpp_lib_remove_cvref): Define to indicate P0550R2 support.
	(__cpp_lib_type_identity): Define to indicate P0887R1 support.
	* include/std/version (__cpp_lib_atomic_float)
	(__cpp_lib_is_nothrow_convertible, __cpp_lib_remove_cvref)
	(__cpp_lib_type_identity, __cpp_lib_assume_aligned)
	(__cpp_lib_constexpr_memory, __cpp_lib_polymorphic_allocator)
	(__cpp_lib_shift, __cpp_lib_ssize, __cpp_lib_starts_ends_with)
	(__cpp_lib_to_address): Define.
	* testsuite/20_util/to_address/1_neg.cc: Adjust dg-error line number.
2020-04-22 22:54:34 +01:00
Jonathan Wakely
0d2dbae406 libstdc++: Remove non-standard feature test macros
These macros were replaced by __cpp_lib_map_try_emplace and
__cpp_lib_unordered_map_try_emplace, because those names are more
descriptive. We've kept both old and new names so far, but I think we
can remove the old ones now.

	* include/bits/stl_map.h (__cpp_lib_map_insertion): Remove old
	macro.
	* include/bits/unordered_map.h (__cpp_lib_unordered_map_insertion):
	Likewise.
	* include/std/version (__cpp_lib_map_insertion)
	(__cpp_lib_unordered_map_insertion): Remove.
2020-04-22 22:54:34 +01:00
Jonathan Wakely
aa12ab2e93 libstdc++: Update value of __cpp_lib_jthread macro
* include/std/condition_variable (__cpp_lib_jthread): Remove
	redundant definition.
	* include/std/stop_token (__cpp_lib_jthread): Update macro value to
	indicate P1869R1 support.
	* include/std/version (__cpp_lib_jthread): Update value.
	* testsuite/30_threads/condition_variable_any/stop_token/1.cc: Check
	for updated macro value.
	* testsuite/30_threads/condition_variable_any/stop_token/2.cc:
	Likewise.
	* testsuite/30_threads/jthread/1.cc: Likewise.
	* testsuite/30_threads/jthread/2.cc: Likewise.
	* testsuite/30_threads/stop_token/1.cc: Likewise.
	* testsuite/30_threads/stop_token/2.cc: Likewise.
2020-04-22 22:54:34 +01:00
Jonathan Wakely
0fe9eaaa08 libstdc++: Improve tests for __cpp_lib_erase_if macro
* testsuite/21_strings/basic_string/erasure.cc: Check for updated
	value of __cpp_lib_erase_if.
	* testsuite/23_containers/deque/erasure.cc: Likewise.
	* testsuite/23_containers/forward_list/erasure.cc: Likewise.
	* testsuite/23_containers/list/erasure.cc: Likewise.
	* testsuite/23_containers/map/erasure.cc: Likewise.
	* testsuite/23_containers/set/erasure.cc: Likewise.
	* testsuite/23_containers/unordered_map/erasure.cc: Likewise.
	* testsuite/23_containers/unordered_set/erasure.cc: Likewise.
	* testsuite/23_containers/vector/erasure.cc: Likewise.
2020-04-22 07:25:02 +01:00
Jonathan Wakely
87841658d4 libstdc++: Fix __normal_iterator comparisons for C++20
This fixes a regression introduced when I replaced __normal_iterator's
relational operators with operator<=>. If the wrapped iterator type
doesn't define operator<=> then __normal_iterator doesdn't either, which
breaks any use of fancy pointers that don't define <=>. The regression
was found when trying to build cmcstl2.

The solution is to use synth-three-way to define __normal_iterator's
spaceship operator, so that it is still defined even if the wrapped type
only supports operator<.

	* include/bits/stl_iterator.h (__normal_iterator): Use synth-three-way
	to define operator<=>.
	* testsuite/24_iterators/normal_iterator/cmp_c++20.cc: New test.
2020-04-21 23:46:54 +01:00
Jonathan Wakely
57ede05c6a libstdc++: Improve C++14 and C++17 status docs
This adds a full table of contents for the C++14 and C++17 standards,
with status for each part.

For C++14 the list of proposals is removed, as it adds little value now
that everything is supported. For C++17 the table of proposals is
retained, because it documents he feature test macros for the features.

	* doc/Makefile.am (xml_sources_manual): Add missing XML files.
	* doc/Makefile.in: Regenerate.
	* doc/xml/manual/status_cxx1998.xml: Refer to "this section" instead
	of "this page".
	* doc/xml/manual/status_cxx2011.xml: Formatting and other corrections
	to the C++11 status table.
	* doc/xml/manual/status_cxx2014.xml: Replace list of C++14 feature
	proposals with table matching contents of the C++14 standard.
	* doc/xml/manual/status_cxx2017.xml: Add table matching contents of
	the C++17 standard.
	* doc/html/*: Regenerate.
2020-04-21 22:18:51 +01:00
Jonathan Wakely
d76925e46f libstdc++: Support arrays in std::is_nothrow_constructible (PR 94149)
The front end now supports parenthesized initialization for arrays in
C++20, so extend std::is_nothrow_constructible to support them too.

gcc/testsuite:

	PR c++/94149
	* g++.dg/cpp2a/paren-init24.C: Fix FIXMEs.

libstdc++-v3:

	PR c++/94149
	* include/std/type_traits (__is_nt_constructible_impl): Add partial
	specializations for bounded arrays with non-empty initializers.
	* testsuite/20_util/is_nothrow_constructible/value_c++20.cc: New test.
2020-04-21 22:18:51 +01:00
Thomas Rodgers
b90ff7a20b libstdc++: Fix PSTL tests to run correctly with newer Thread Building Blocks
* testsuite/lib/libstdc++.exp: Add additional_flags=
	-DTBB_SUPRESS_DEPRECATED_MESSAGES=1 to suppress warnings when
	compiling with a newer Thread Building Blocks.
2020-04-21 01:05:13 -07:00
Jonathan Wakely
86119f1417 libstdc++: Add test for using istreambuf_iterator with sentinel
This test was supposed to be added two months ago as part of commit
120e873484 but was omitted by mistake.

	* testsuite/24_iterators/istreambuf_iterator/sentinel.cc: New test.
2020-04-20 22:06:32 +01:00
Jonathan Wakely
0ea89b1578 libstdc++: Fix tests that fail in C++20 mode
* testsuite/20_util/is_constructible/51185.cc: Make test class a
	non-aggregate so that the test verifies the same thing in all -std
	modes.
	* testsuite/20_util/is_constructible/value-2.cc: Adjust expected
	results for some types when paren-init for aggregates is supported.
2020-04-20 22:06:32 +01:00
Jonathan Wakely
b0146791f0 libstdc++: Correct changelog of previous commit
After committing it I noticed I'd also accidentally added a change to
__synth3way as well, which I meant to do in a separate commit. I've
updated the changelog entry to reflect that additional change.

	* libsupc++/compare (__detail::__synth3way): Add noexcept-specifier.
2020-04-20 17:54:50 +01:00
Jonathan Wakely
73a0a21d22 libstdc++: Update __cpp_lib_three_way_comparison macro
With P1614R2 fully implemented (except for the <chrono> types which we
don't support at all) we can define the feature test macro to the new
value.

	* include/std/version (__cpp_lib_three_way_comparison): Update value.
	* libsupc++/compare (__cpp_lib_three_way_comparison): Likewise.
2020-04-20 17:50:10 +01:00
Jonathan Wakely
93843da697 libstdc++: Add comparison operators to associative containers
The last C++20 changes from P1614R2, "The Mothership has Landed"

	* include/bits/stl_map.h (map): Define operator<=> and remove
	operator< for C++20.
	* include/bits/stl_multimap.h (multimap): Likewise.
	* include/bits/stl_multiset.h (multiset): Likewise.
	* include/bits/stl_set.h (set): Likewise.
	* include/bits/stl_tree.h (_Rb_tree): Likewise.
	(_Rb_tree_iterator, _Rb_tree_const_iterator): Remove redundant
	operator!= for C++20.
	* include/debug/map.h (__gnu_debug::map): Define operator<=> for C++20.
	* include/debug/multimap.h (__gnu_debug::multimap): Likewise.
	* include/debug/multiset.h (__gnu_debug::multiset): Likewise.
	* include/debug/set.h (__gnu_debug::set): Likewise.
	* testsuite/23_containers/map/operators/cmp_c++20.cc: New test.
	* testsuite/23_containers/multimap/operators/cmp_c++20.cc: New test.
	* testsuite/23_containers/multiset/operators/cmp_c++20.cc: New test.
	* testsuite/23_containers/set/operators/cmp_c++20.cc: New test.
2020-04-20 17:50:10 +01:00
Matthias Kretz
697b94cfae libstdc++: Avoid illegal argument to verbose in dg-test callback
If extra_tool_flags starts with a dash, an error like 'ERROR: verbose:
illegal argument: -march=native -O2 -std=c++17' is printed. This is
easily fixed by inserting a double dash before the variable.

2020-04-20  Matthias Kretz  <kretz@kde.org>

	* testsuite/lib/libstdc++.exp: Avoid illegal argument to verbose.
2020-04-20 15:29:44 +01:00
Jonathan Wakely
717e91dbc4 libstdc++: Define operator<=> for std::stack and std::queue
Some more C++20 changes from P1614R2, "The Mothership has Landed".

	* include/bits/stl_queue.h (queue): Define operator<=> for C++20.
	* include/bits/stl_stack.h (stack): Likewise.
	* testsuite/23_containers/queue/cmp_c++20.cc: New test.
	* testsuite/23_containers/stack/cmp_c++20.cc: New test.
2020-04-19 21:30:15 +01:00
Jonathan Wakely
7ab9c2430f libstdc++: Remove operator!= overloads for unordered containers
Some more C++20 changes from P1614R2, "The Mothership has Landed".

	* include/bits/unordered_map.h (unordered_map, unordered_multimap):
	Remove redundant operator!= for C++20.
	* include/bits/unordered_set.h (unordered_set, unordered_multiset):
	Likewise.
	* include/debug/unordered_map (unordered_map, unordered_multimap):
	Likewise.
	* include/debug/unordered_set (unordered_set, unordered_multiset):
	Likewise.
2020-04-19 21:05:32 +01:00
Jonathan Wakely
a2c0fa35d0 libstdc++: Fix redundant assignment (PR 94629)
This appears to be a copy&paste error, which cppcheck diagnoses.

	PR other/94629
	* include/debug/formatter.h (_Error_formatter::_Parameter): Fix
	redundant assignment in constructor.
2020-04-19 21:05:32 +01:00
Jonathan Wakely
27c171775a libstdc++: Add comparison operators to <chrono> types
Some more C++20 changes from P1614R2, "The Mothership has Landed".

	* include/std/chrono (duration, time_point): Define operator<=> and
	remove redundant operator!= for C++20.
	* testsuite/20_util/duration/comparison_operators/three_way.cc: New
	test.
	* testsuite/20_util/time_point/comparison_operators/three_way.cc: New
	test.
2020-04-18 00:47:45 +01:00
Jonathan Wakely
c996029406 libstdc++: Fix testsuite utility's use of allocators
In C++20 the rebind and const_reference members of std::allocator are
gone, so this testsuite utility stopped working, causing
ext/pb_ds/regression/priority_queue_rand_debug.cc to FAIL.

	* testsuite/util/native_type/native_priority_queue.hpp: Use
	allocator_traits to rebind allocator.
2020-04-18 00:12:26 +01:00
Jonathan Wakely
bd2420f8fa libstdc++: Add comparison operators to sequence containers
Some more C++20 changes from P1614R2, "The Mothership has Landed".

This implements <=> for sequence containers (and the __normal_iterator
and _Pointer_adapter class templates).

	* include/bits/forward_list.h (forward_list): Define operator<=> and
	remove redundant comparison operators for C++20.
	* include/bits/stl_bvector.h (vector<bool, Alloc>): Likewise.
	* include/bits/stl_deque.h (deque): Likewise.
	* include/bits/stl_iterator.h (__normal_iterator): Likewise.
	* include/bits/stl_list.h (list): Likewise.
	* include/bits/stl_vector.h (vector): Likewise.
	* include/debug/deque (__gnu_debug::deque): Likewise.
	* include/debug/forward_list (__gnu_debug::forward_list): Likewise.
	* include/debug/list (__gnu_debug::list): Likewise.
	* include/debug/safe_iterator.h (__gnu_debug::_Safe_iterator):
	Likewise.
	* include/debug/vector (__gnu_debug::vector): Likewise.
	* include/ext/pointer.h (__gnu_cxx::_Pointer_adapter): Define
	operator<=> for C++20.
	* testsuite/23_containers/deque/operators/cmp_c++20.cc: New test.
	* testsuite/23_containers/forward_list/cmp_c++20.cc: New test.
	* testsuite/23_containers/list/cmp_c++20.cc: New test.
	* testsuite/23_containers/vector/bool/cmp_c++20.cc: New test.
	* testsuite/23_containers/vector/cmp_c++20.cc: New test.
2020-04-17 23:41:04 +01:00
Jonathan Wakely
875d6cb3b4 libstdc++: Add comparison operators for string and regex types
Some more C++20 changes from P1614R2, "The Mothership has Landed".

This adds three-way comparison support to std::char_traits,
std::basic_string, std::basic_string_view, and std::sub_match.

	* include/bits/basic_string.h (basic_string): Define operator<=> and
	remove redundant comparison operators for C++20.
	* include/bits/char_traits.h (__gnu_cxx::char_traits, char_traits):
	Add comparison_category members.
	(__detail::__char_traits_cmp_cat): New helper to get comparison
	category from char traits class.
	* include/bits/regex.h (regex_traits::_RegexMask::operator!=): Do not
	define for C++20.
	(sub_match): Define operator<=> and remove redundant comparison
	operators for C++20.
	(match_results): Remove redundant operator!= for C++20.
	* include/std/string_view (basic_string_view): Define operator<=> and
	remove redundant comparison operators for C++20.
	* testsuite/21_strings/basic_string/operators/char/cmp_c++20.cc: New
	test.
	* testsuite/21_strings/basic_string/operators/wchar_t/cmp_c++20.cc:
	New test.
	* testsuite/21_strings/basic_string_view/operations/copy/char/
	constexpr.cc: Initialize variable.
	* testsuite/21_strings/basic_string_view/operations/copy/wchar_t/
	constexpr.cc: Likewise.
	* testsuite/21_strings/basic_string_view/operators/char/2.cc: Add
	dg-do directive and remove comments showing incorrect signatures.
	* testsuite/21_strings/basic_string_view/operators/wchar_t/2.cc:
	Likewise.
	* testsuite/21_strings/basic_string_view/operators/char/cmp_c++20.cc:
	New test.
	* testsuite/21_strings/basic_string_view/operators/wchar_t/cmp_c++20.cc:
	New test.
	* testsuite/28_regex/sub_match/compare_c++20.cc: New test.
2020-04-17 16:40:11 +01:00
Jonathan Wakely
c8d88bf26e libstdc++: Fix -Wunused-parameter warning in test
* testsuite/20_util/unsynchronized_pool_resource/allocate.cc: Remove
	name of unused parameter.
2020-04-16 08:44:10 +01:00
Jonathan Wakely
d43919bf88 libstdc++: Add comparison operators to std::filesystem types
Some more C++20 changes from P1614R2, "The Mothership has Landed".

	* include/bits/fs_dir.h (file_status): Define operator== for C++20.
	(directory_entry): Define operator<=> and remove redundant comparison
	operators for C++20.
	* include/bits/fs_fwd.h (space_info): Define operator== for C++20.
	* include/bits/fs_path.h (path): Define operator<=> and remove
	redundant comparison operators for C++20.
	* testsuite/27_io/filesystem/path/compare/compare.cc: Fix comment.
	* testsuite/27_io/filesystem/path/compare/lwg2936.cc: Likewise.
	* testsuite/27_io/filesystem/path/compare/path.cc: Likewise.
	* testsuite/27_io/filesystem/path/compare/strings.cc: Likewise.
2020-04-15 21:01:42 +01:00
Jonathan Wakely
596676d66c libstdc++: Add comparison operators to types from Utilities clause
Some more C++20 changes from P1614R2, "The Mothership has Landed".

This removes all redundant equality and inequality operators in the
Utilities clause, as they can be synthesized from the remaining equality
operators.

It also removes the single redundant operator in the Localization
clause, because it didn't seem worth doing in a separate commit.

	* include/bits/allocator.h (operator!=): Do not define for C++20.
	* include/bits/locale_classes.h (operator!=): Likewise.
	* include/bits/std_function.h (operator==(nullptr_t, const function&))
	(operator!=(const function&, nullptr_t))
	(operator!=(nullptr_t, const function&)): Likewise.
	* include/ext/bitmap_allocator.h (operator!=): Likewise.
	* include/ext/debug_allocator.h (operator!=): Likewise.
	* include/ext/extptr_allocator.h (operator!=): Likewise.
	* include/ext/malloc_allocator.h (operator!=): Likewise.
	* include/ext/mt_allocator.h (operator!=): Likewise.
	* include/ext/new_allocator.h (operator!=): Likewise.
	* include/ext/pool_allocator.h (operator!=): Likewise.
	* include/ext/throw_allocator.h (operator!=): Likewise.
	* include/std/bitset (bitset::operator!=): Likewise.
	* include/std/memory_resource (operator!=): Likewise.
	* include/std/scoped_allocator (operator!=): Likewise.
2020-04-15 19:47:48 +01:00
Jonathan Wakely
4714fd14af libstdc++: Add spaceship operator to std::type_index
Another C++20 change from P1614R2, "The Mothership has Landed".

	* include/std/typeindex (operator<=>): Define for C++20.
	* testsuite/20_util/typeindex/comparison_operators_c++20.cc: New test.
2020-04-15 19:47:47 +01:00
Jonathan Wakely
e1e9e8d7aa libstdc++: Fix constraints on std::compare_three_way
My "simplification" of std::compare_three_way's constraints in commit
f214ffb336 was incorrect, because
std::three_way_comparable_with imposes additional restrictions beyond
the <=> expression being valid.

	* libsupc++/compare (compare_three_way): Fix constraint so that
	BUILTIN-PTR-THREE-WAY does not require three_way_comparable_with.
	* testsuite/18_support/comparisons/object/builtin-ptr-three-way.cc:
	New test.
2020-04-14 21:59:15 +01:00
Jonathan Wakely
f5fa62ed19 libstdc++: Add comparison operators to std::shared_ptr (PR 94562)
This also implements the proposed resolution to LWG issue 3247, so that
the ill-formed <=> expression with nullptr is not used.

	PR libstdc++/94562
	* include/bits/shared_ptr.h (operator<=>): Define for C++20.
	* include/bits/shared_ptr_base.h (operator<=>): Likewise.
	* include/bits/unique_ptr.h (operator<=>): Add inline specifier.
	* testsuite/20_util/shared_ptr/comparison/cmp_c++20.cc: New test.
	* testsuite/20_util/shared_ptr/comparison/less.cc: Do not expect
	std::less<A*> to be used when comparing std::shared_ptr<A> objects in
	C++20.
2020-04-14 21:54:55 +01:00
Jonathan Wakely
fa9a57ed91 libstdc++: Fix order of entries in ChangeLog 2020-04-14 20:42:48 +01:00
Jonathan Wakely
597601aa7a libstdc++: Make comparison category comparisons noexcept (PR 94565)
PR libstdc++/94565
	* libsupc++/compare (__unspec): Add noexcept-specifier to constructor.
	* testsuite/18_support/comparisons/categories/94565.cc: New test.
2020-04-14 11:42:04 +01:00
Iain Sandoe
ee26baf4a8 coroutines: Rename the coroutines cpp builtin.
The current standard draft (n4861) amends the cpp builtin for
coroutines to '__cpp_impl_coroutine', no other change.

gcc/c-family/ChangeLog:

2020-04-13  Iain Sandoe  <iain@sandoe.co.uk>

	* c-cppbuiltin.c (c_cpp_builtins): Update coroutines builtin
	define, per n4861.

gcc/testsuite/ChangeLog:

2020-04-13  Iain Sandoe  <iain@sandoe.co.uk>

	* g++.dg/coroutines/coro-pre-proc.C: Update coroutines builtin
	define, per n4861.
	* g++.dg/coroutines/coro.h: Likewise.

libstdc++-v3/ChangeLog:

2020-04-13  Iain Sandoe  <iain@sandoe.co.uk>

	* include/std/coroutine: Update coroutines builtin define,
	per n4861.
2020-04-13 20:52:03 +01:00
Jonathan Wakely
3fd1c229ad libstdc++: Implement LWG 3324 for [cmp.alg] function objects (LWG 3324)
LWG 3324 changed the [cmp.alg] types to use std::compare_three_way
instead of the <=> operator, but we were still using the old
specification. In order to make the existing tests pass the N::X type
needs to be equality comparable, so that three_way_comparable is
satisfied and compare_three_way can be used.

As part of this change I noticed that the compare_three_way call
operator was unconditionally noexcept, which is incorrect.

	* libsupc++/compare (compare_three_way): Fix noexcept-specifier.
	(strong_order, weak_order, partial_order): Replace uses of <=> with
	compare_three_way function object (LWG 3324).
	* testsuite/18_support/comparisons/algorithms/partial_order.cc: Add
	equality operator so that X satisfies three_way_comparable.
	* testsuite/18_support/comparisons/algorithms/strong_order.cc:
	Likewise.
	* testsuite/18_support/comparisons/algorithms/weak_order.cc: Likewise.
2020-04-09 22:24:57 +01:00
Jonathan Wakely
5b074864f8 libstdc++: Add comparison operators to std::unique_ptr
Some more C++20 changes from P1614R2, "The Mothership has Landed".

This includes the proposed resolution for LWG 3426 to fix the three-way
comparison with nullptr_t.

The existing tests for unique_ptr comparisons don't actually check the
results, only that the expressions compile and are convertible to bool.
This also adds a test for the results of those comparisons for C++11 and
up.

	* include/bits/unique_ptr.h (operator<=>): Define for C++20.
	* 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/comparison/compare.cc: New test.
	* testsuite/20_util/unique_ptr/comparison/compare_c++20.cc: New test.
2020-04-09 21:10:32 +01:00
Jonathan Wakely
ef389dadd4 libstdc++: Add comparison operators to types from Numerics clause
Some more C++20 changes from P1614R2, "The Mothership has Landed".

	* include/bits/slice_array.h (operator==(const slice&, const slice&)):
	Define for C++20.
	* include/std/complex (operator==(const T&, const complex<T>&))
	(operator!=(const complex<T>&, const complex<T>&))
	(operator!=(const complex<T>&, const T&))
	(operator!=(const T&, const complex<T>&)): Do not declare for C++20.
	* testsuite/26_numerics/slice/compare.cc: New test.
2020-04-08 16:51:59 +01:00
Jonathan Wakely
e18cd376e0 libstdc++: Add comparison operators to <charconv> result types
Some more C++20 changes from P1614R2, "The Mothership has Landed".

	* include/std/charconv (to_chars_result, from_chars_result): Add
	defaulted equality comparisons for C++20.
	* testsuite/20_util/from_chars/compare.cc: New test.
	* testsuite/20_util/to_chars/compare.cc: New test.
2020-04-08 16:16:10 +01:00
Jonathan Wakely
c104e8f1b6 libstdc++: Restore ability to use <charconv> in C++14 (PR 94520)
This C++17 header is supported in C++14 as a GNU extension, but stopped
working last year because I made it depend on an internal helper which
is only defined for C++17 and up.

	PR libstdc++/94520
	* include/std/charconv (__integer_to_chars_result_type)
	(__integer_from_chars_result_type): Use __or_ instead of __or_v_ to
	allow use in C++14.
	* testsuite/20_util/from_chars/1.cc: Run test as C++14 and replace
	use of std::string_view with std::string.
	* testsuite/20_util/from_chars/2.cc: Likewise.
	* testsuite/20_util/to_chars/1.cc: Likewise.
	* testsuite/20_util/to_chars/2.cc: Likewise.
2020-04-07 17:18:21 +01:00
Jonathan Wakely
b696698767 libstdc++: Make string_view::copy usable in constant expressions (PR 94498)
PR libstdc++/94498
	* include/bits/char_traits.h (__gnu_cxx::char_traits::move): Make it
	usable in constant expressions for C++20.
	(__gnu_cxx::char_traits::copy, __gnu_cxx::char_traits::assign): Add
	_GLIBCXX20_CONSTEXPR.
	(std::char_traits<char>, std::char_traits<wchar_t>)
	(std::char_traits<char8_t>): Make move, copy and assign usable in
	constant expressions for C++20.
	(std::char_traits<char16_t>, std::char_traits<char32_t>): Make move
	and copy usable in constant expressions for C++20.
	* include/std/string_view (basic_string_view::copy): Add
	_GLIBCXX20_CONSTEXPR.
	* testsuite/21_strings/basic_string_view/operations/copy/char/
	constexpr.cc: New test.
	* testsuite/21_strings/basic_string_view/operations/copy/wchar_t/
	constexpr.cc: New test.
2020-04-06 18:30:53 +01:00
Gerald Pfeifer
2a1a0c8c0d libstdc++: Refer to Git documentation
* doc/xml/manual/appendix_contributing.xml: Refer to Git
	documentation instead of Subversion.  Switch to https.
	* doc/html/manual/appendix_contributing.html: Regenerate.
2020-04-05 23:56:53 +02:00
Jonathan Wakely
24fe8c8e33 libstdc++: Fix std::to_address for debug iterators (PR 93960)
It should be valid to use std::to_address on a past-the-end iterator,
but the debug mode iterators do a check for dereferenceable in their
operator->(). That check is generally useful, so rather than remove it
this changes std::__to_address to identify a debug mode iterator and
use base().operator->() to skip the check.

	PR libstdc++/93960
	* include/bits/ptr_traits.h (__to_address): Add special case for debug
	iterators, to avoid dereferenceable check.
	* testsuite/20_util/to_address/1_neg.cc: Adjust dg-error line number.
	* testsuite/20_util/to_address/debug.cc: New test.
2020-04-03 10:42:20 +01:00
Andrea Corallo
c1effaa209 libstdc++-v3/test: Better skip for "use_service.cc"
2020-04-01  Andrea Corallo  <andrea.corallo@arm.com>

	* testsuite/experimental/net/execution_context/use_service.cc:
	Require pthread and gthreads.
2020-04-02 11:53:58 +02:00
Gerald Pfeifer
6c557ba538 libstdc++: Move "free books" list from fsf.org to gnu.org
* doc/xml/manual/appendix_free.xml: Move "free books" list from
	fsf.org to gnu.org.
	* doc/html/manual/appendix_free.html: Regenerate.
2020-04-01 22:45:35 +02:00
Ville Voutilainen
e06cde870e Library-side tests for parenthesized aggregate init
PR c++/92878
PR c++/92947

* testsuite/20_util/allocator_traits/members/92878_92947.cc: New.
* testsuite/20_util/any/assign/92878_92947.cc: Likewise.
* testsuite/20_util/any/cons/92878_92947.cc: Likewise.
* testsuite/20_util/is_constructible/92878_92947.cc: Likewise.
* testsuite/20_util/optional/assignment/92878_92947.cc: Likewise.
* testsuite/20_util/optional/cons/92878_92947.cc: Likewise.
* testsuite/20_util/pair/cons/92878_92947.cc: Likewise.
* testsuite/20_util/shared_ptr/creation/92878_92947.cc: Likewise.
* testsuite/20_util/specialized_algorithms/construct_at/92878_92947.cc:
Likewise.
* testsuite/20_util/unique_ptr/creation/92878_92947.cc: Likewise.
* testsuite/20_util/uses_allocator/92878_92947.cc: Likewise.
* testsuite/20_util/variant/92878_92947.cc: Likewise.
* testsuite/23_containers/deque/modifiers/emplace/92878_92947.cc:
Likewise.
* testsuite/23_containers/forward_list/modifiers/92878_92947.cc:
Likewise.
* testsuite/23_containers/list/modifiers/emplace/92878_92947.cc:
Likewise.
* testsuite/23_containers/map/modifiers/emplace/92878_92947.cc:
Likewise.
* testsuite/23_containers/multimap/modifiers/emplace/92878_92947.cc:
Likewise.
* testsuite/23_containers/multiset/modifiers/emplace/92878_92947.cc:
Likewise.
* testsuite/23_containers/priority_queue/92878_92947.cc: Likewise.
* testsuite/23_containers/queue/92878_92947.cc: Likewise.
* testsuite/23_containers/set/modifiers/emplace/92878_92947.cc:
Likewise.
* testsuite/23_containers/stack/92878_92947.cc: Likewise.
* testsuite/23_containers/unordered_map/modifiers/92878_92947.cc:
Likewise.
* testsuite/23_containers/unordered_multimap/modifiers/92878_92947.cc:
Likewise.
* testsuite/23_containers/unordered_multiset/modifiers/92878_92947.cc:
Likewise.
* testsuite/23_containers/unordered_set/modifiers/92878_92947.cc:
Likewise.
* testsuite/23_containers/vector/modifiers/emplace/92878_92947.cc:
Likewise.
2020-03-31 17:07:52 +03:00
Jonathan Wakely
f6b2b79040 libstdc++: Fix two tests that fail in C++20 mode
* testsuite/20_util/is_constructible/value-2.cc: Fix test to account
	for changes due to parenthesized aggregate-initialization in C++20.
	* testsuite/20_util/time_point/cons/81468.cc: Fix test to not clash
	with std::chrono::sys_time in C++20.
2020-03-28 21:52:13 +00:00
Jonathan Wakely
42cda3ba45 libstdc++: Fix std::reverse_iterator relational operators
My recent changes to reverse_iterator's comparisons was not the version
of the code (or tests) that I meant to commit, and broke the relational
operators. This fixes them to reverse the order of the comparisons on
the base() iterators.

This also replaces the SFINAE constraints in the return type of the
reverse_iterator and move_iterator comparisons with a requires-clause.
This ensures the constrained overloads are preferred to unconstrained
ones. This means the non-standard same-type overloads can be omitted for
C++20 because they're not needed to solve the problem with std::rel_ops
or the testsuite's greedy_ops::X type.

	* include/bits/stl_iterator.h (reverse_iterator): Use requires-clause
	to constrain C++20 versions of comparison operators. Fix backwards
	logic of relational operators.
	(move_iterator): Use requires-clause to constrain comparison operators
	in C++20. Do not declare non-standard same-type overloads for C++20.
	* testsuite/24_iterators/move_iterator/rel_ops_c++20.cc: Check result
	of comparisons and check using greedy_ops type.
	* testsuite/24_iterators/reverse_iterator/rel_ops_c++20.cc: Likewise.
	* testsuite/24_iterators/move_iterator/greedy_ops.cc: Remove redundant
	main function from compile-only test.
	* testsuite/24_iterators/reverse_iterator/greedy_ops.cc: Likewise.
2020-03-28 21:52:13 +00:00
Jonathan Wakely
b8a28a06ea libstdc++: Define __cpp_lib_ranges macro for C++20
Define the feature test macro now that ranges support is complete.

This also changes the preprocessor checks for the __cpp_concepts macro
so that library components depending on concepts are only enabled when
C++20 concepts are supported, and not just for the Concepts TS (which
uses different syntax in places).

	* include/bits/range_cmp.h (__cpp_lib_ranges): Define.
	* include/bits/stl_iterator.h: Check value of __cpp_concepts so that
	C++20 concepts are required.
	* include/bits/stl_iterator_base_types.h: Likewise.
	* include/std/concepts: Likewise.
	* include/std/version: Likewise.
	* testsuite/std/ranges/headers/ranges/synopsis.cc: Check feature test
	macro.
2020-03-27 23:26:03 +00:00
Jonathan Wakely
81a8d137c2 libstdc++: Add remaining C++20 changes to iterator adaptors
This adds the missing parts of P0896R4 to reverse_iterator and
move_iterator, so that they meet the C++20 requirements. This should be
the last piece of P0896R4, meaning ranges support is now complete.

The PR 94354 bug with reverse_iterator's comparisons is fixed for C++20
only, but that change should be extended to C++11, C++14 and C++17 modes
in stage 1.

	* include/bits/stl_iterator.h (reverse_iterator::iterator_concept)
	(reverse_iterator::iterator_category): Define for C++20.
	(reverse_iterator): Define comparison operators correctly for C++20.
	(__normal_iterator): Add constraints to comparison operators for C++20.
	(move_iterator::operator++(int)) [__cpp_lib_concepts]: Define new
	overload for input iterators.
	(move_iterator): Add constraints to comparison operators for C++20.
	Define operator<=> for C++20.
	* testsuite/24_iterators/move_iterator/input_iterator.cc: New test.
	* testsuite/24_iterators/move_iterator/move_only.cc: New test.
	* testsuite/24_iterators/move_iterator/rel_ops_c++20.cc: New test.
	* testsuite/24_iterators/reverse_iterator/rel_ops_c++20.cc: New test.
2020-03-27 23:26:03 +00:00
Jonathan Wakely
ae6076b5bc libstdc++: Implement C++20 changes to insert iterators
std::insert_iterator and std::inserter need to be adjusted for C++20, so
that they use ranges::iterator_t. That alias template requires
ranges::begin to be defined. Rather than moving the whole of
ranges::begin (and related details like ranges::enable_borrowed_range)
into <iterator>, this defines a new, simpler version of ranges::begin
that is sufficient for ranges::iterator_t to be defined. This works
because ranges::iterator_t uses an lvalue reference type, so the logic
in ranges::begin for non-lvalue ranges (i.e. borrowed ranges) isn't
needed.

This also adds the missing constexpr specifiers to the other insert
iterators.

	* include/bits/iterator_concepts.h (__detail::__decay_copy)
	(__detail::__member_begin, __detail::__adl_begin): Move here from
	<bits/range_access.h>.
	(__detail::__ranges_begin, __detail::__range_iter_t): Define.
	* bits/range_access.h (__cust_access::__decay_copy)
	(__cust_access::__member_begin, __cust_access::__adl_begin): Move to
	<bits/iterator_concepts.h>.
	(ranges::iterator_t): Use __detail::__range_iter_t.
	* include/bits/stl_iterator.h (back_insert_iterator): Simplify
	conditional compilation. Add _GLIBCXX20_CONSTEXPR to all members.
	(front_insert_iterator): Likewise.
	(insert_iterator): Implement changes from P0896R4 for C++20.
	* testsuite/24_iterators/back_insert_iterator/constexpr.cc: New test.
	* testsuite/24_iterators/front_insert_iterator/constexpr.cc: New test.
	* testsuite/24_iterators/headers/iterator/synopsis_c++17.cc: Adjust
	for inclusion in synopsis_c++20.cc which expects different signatures
	for some function templates.
	* testsuite/24_iterators/insert_iterator/constexpr.cc: New test.
2020-03-27 23:26:01 +00:00
Jonathan Wakely
0302a2de7f libstdc++: Move definition earlier in file
This moves __is_array_convertible so it's not between
__is_nothrow_convertible and its helper, since it isn't related to
those.

	* include/std/type_traits (__is_array_convertible): Move definition
	to immediately after is_convertible.
2020-03-27 22:53:04 +00:00
Jonathan Wakely
16948c54b7 libstdc++: Add some C++20 additions to <chrono>
* include/std/chrono (chrono::days, chrono::weeks, chrono::years)
	(chrono::months, chrono::sys_days, chrono::local_t)
	(chrono::local_time, chrono::local_seconds, chrono::local_days):
	Define for C++20.
	(chrono::time_point): Add missing static assert.
	* testsuite/20_util/time_point/requirements/duration_neg.cc: New test.
	* testsuite/std/time/clock/file/overview.cc: New test.
	* testsuite/std/time/clock/file/members.cc: New test.
	* testsuite/std/time/syn_c++20.cc: New test.
2020-03-26 14:00:12 +00:00
Jonathan Wakely
9673d11ec5 libstdc++: Fix author in previous ChangeLog entry
The previous commit added two tests which were written by Mike Crowe,
not by me. This fixes the ChangeLog entry.
2020-03-25 22:20:42 +00:00
Jonathan Wakely
e3ef371982 libstdc++ Add missing tests for std::shared_timed_mutex
These tests were supposed to be committed as part of r278904 (aka
b789efeae8) but I didn't 'git add' them.

	* testsuite/30_threads/shared_timed_mutex/try_lock_until/1.cc: New
	test.
	* testsuite/30_threads/shared_timed_mutex/try_lock_until/2.cc: New
	test.
2020-03-25 22:16:22 +00:00
Jonathan Wakely
bf1fc37bb4 libstdc++: Define and use chrono::is_clock for C++20
For C++20 the wait_until members of mutexes and condition variables are
required to be ill-formed if given a clock that doesn't meet the
requirements for a clock type. To implement that requirement this patch
adds static assertions using the chrono::is_clock trait, and defines
that trait.

To avoid expensive checks for the common cases, the trait (and
associated variable template) are explicitly specialized for the
standard clock types.

This also moves the filesystem::__file_clock type from <filesystem> to
<chrono>, so that chrono::file_clock and chrono::file_time can be
defined in <chrono> as required.

	* include/bits/fs_fwd.h (filesystem::__file_clock): Move to ...
	* include/std/chrono (filesystem::__file_clock): Here.
	(filesystem::__file_clock::from_sys, filesystem::__file_clock::to_sys):
	Define public member functions for C++20.
	(is_clock, is_clock_v): Define traits for C++20.
	* include/std/condition_variable (condition_variable::wait_until): Add
	check for valid clock.
	* include/std/future (_State_baseV2::wait_until): Likewise.
	* include/std/mutex (__timed_mutex_impl::_M_try_lock_until): Likewise.
	* include/std/shared_mutex (shared_timed_mutex::try_lock_shared_until):
	Likewise.
	* include/std/thread (this_thread::sleep_until): Likewise.
	* testsuite/30_threads/condition_variable/members/2.cc: Qualify
	slow_clock with new namespace.
	* testsuite/30_threads/condition_variable/members/clock_neg.cc: New
	test.
	* testsuite/30_threads/condition_variable_any/members/clock_neg.cc:
	New test.
	* testsuite/30_threads/future/members/clock_neg.cc: New test.
	* testsuite/30_threads/recursive_timed_mutex/try_lock_until/3.cc:
	Qualify slow_clock with new namespace.
	* testsuite/30_threads/recursive_timed_mutex/try_lock_until/
	clock_neg.cc: New test.
	* testsuite/30_threads/shared_future/members/clock_neg.cc: New
	test.
	* testsuite/30_threads/shared_lock/locking/clock_neg.cc: New test.
	* testsuite/30_threads/shared_timed_mutex/try_lock_until/clock_neg.cc:
	New test.
	* testsuite/30_threads/timed_mutex/try_lock_until/3.cc: Qualify
	slow_clock with new namespace.
	* testsuite/30_threads/timed_mutex/try_lock_until/4.cc: Likewise.
	* testsuite/30_threads/timed_mutex/try_lock_until/clock_neg.cc: New
	test.
	* testsuite/30_threads/unique_lock/locking/clock_neg.cc: New test.
	* testsuite/std/time/traits/is_clock.cc: New test.
	* testsuite/util/slow_clock.h (slow_clock): Move to __gnu_test
	namespace.
2020-03-25 22:07:02 +00:00
Jonathan Wakely
a577c0c269 libstdc++: Fix experimental::path::generic_string (PR 93245)
This function was unimplemented, simply returning the native format
string instead.

	PR libstdc++/93245
	* include/experimental/bits/fs_path.h (path::generic_string<C,T,A>()):
	* testsuite/experimental/filesystem/path/generic/generic_string.cc:
	Improve test coverage.
2020-03-21 22:11:44 +00:00
Jonathan Wakely
9fc985118d libstdc++: Fix path::generic_string allocator handling (PR 94242)
It's not possible to construct a path::string_type from an allocator of
a different type. Create the correct specialization of basic_string, and
adjust path::_S_str_convert to use a basic_string_view so that it is
independent of the allocator type.

	PR libstdc++/94242
	* include/bits/fs_path.h (path::_S_str_convert): Replace first
	parameter with basic_string_view so that strings with different
	allocators can be accepted.
	(path::generic_string<C,T,A>()): Use basic_string object that uses the
	right allocator type.
	* testsuite/27_io/filesystem/path/generic/94242.cc: New test.
	* testsuite/27_io/filesystem/path/generic/generic_string.cc: Improve
	test coverage.
2020-03-21 22:04:48 +00:00
Jonathan Wakely
b334182653 libstdc++: Fix is_trivially_constructible (PR 94033)
This attempts to make is_nothrow_constructible more robust (and
efficient to compile) by not depending on is_constructible. Instead the
__is_constructible intrinsic is used directly. The helper class
__is_nt_constructible_impl which checks whether the construction is
non-throwing now takes a bool template parameter that is substituted by
the result of the instrinsic. This fixes the reported bug by not using
the already-instantiated (and incorrect) value of std::is_constructible.
I don't think it really fixes the problem in general, because
std::is_nothrow_constructible itself could already have been
instantiated in a context where it gives the wrong result. A proper fix
needs to be done in the compiler.

	PR libstdc++/94033
	* include/std/type_traits (__is_nt_default_constructible_atom): Remove.
	(__is_nt_default_constructible_impl): Remove.
	(__is_nothrow_default_constructible_impl): Remove.
	(__is_nt_constructible_impl): Add bool template parameter. Adjust
	partial specializations.
	(__is_nothrow_constructible_impl): Replace class template with alias
	template.
	(is_nothrow_default_constructible): Derive from alias template
	__is_nothrow_constructible_impl instead of
	__is_nothrow_default_constructible_impl.
	* testsuite/20_util/is_nothrow_constructible/94003.cc: New test.
2020-03-18 23:19:35 +00:00
Jonathan Wakely
e5de406f99 libstdc++ Fix compilation of <stop_token> with Clang
Clang 9 supports C++20 via -std=c++2a but doesn't support three-way
comparisons, so <stop_token> fails to compile. When the compiler doesn't
support default comparisons, this patch defines operator== and
operator!= for the _Stop_state_ref class. That is enough for the header
to be compiled with Clang. It allows operator== for stop_token and
stop_source to work, but not operator!= because that isn't explicitly
defined.

	* include/std/stop_token (stop_token::_Stop_state_ref): Define
	comparison operators explicitly if the compiler won't synthesize them.
2020-03-18 12:55:29 +00:00
Jonathan Wakely
07522ae90b libstdc++: Fix compilation with released versions of Clang
Clang 9 supports C++20 via -std=c++2a but doesn't support Concepts, so
several of the new additions related to the Ranges library fail to
compile with -std=c++2a. The new definition of iterator_traits and the
definition of default_sentinel_t are guarded by __cpp_lib_concepts, so
check that in addition to __cplusplus > 201703L.

	* include/bits/stl_algobase.h (__lexicographical_compare_aux): Check
	__cpp_lib_concepts before using iter_reference_t.
	* include/bits/stream_iterator.h (istream_iterator): Check
	__cpp_lib_concepts before using default_sentinel_t.
	* include/bits/streambuf_iterator.h (istreambuf_iterator): Likewise.
2020-03-18 12:55:29 +00:00
Jonathan Wakely
98f29f5638 libstdc++: Fix type-erasure in experimental::net::executor (PR 94203)
The _Tgt and _TgtImpl types that implement type-erasure didn't agree on
the virtual interface, so failed as soon as they were instantiated. With
Clang they failed even sooner. The interface was also dependent on
whether RTTI was enabled or not.

This patch fixes the broken virtual functions and makes the type work
without RTTI, by using a pointer to a specialization of a function
template (similar to the approaches in std::function and std::any).

The changes to the virtual functions would be an ABI change, except that
the previous code didn't even compile if instantiated. This is
experimental TS material anyway.

	PR libstdc++/94203
	* include/experimental/executor (executor::executor(Executor)): Call
	make_shared directly instead of _M_create. Create _Tgt1 object.
	(executor::executor(allocator_arg_t, const ProtoAlloc&, Executor)):
	Call allocate_shared directly instead of _M_create. Create _Tgt2
	object.
	(executor::target_type): Add cast needed for new _Tgt interface.
	(executor::target): Define when RTTI is disabled. Use _Tgt::_M_func.
	(executor::_Tgt): Define the same interface whether RTTI is enabled or
	not.
	(executor::_Tgt::target_type, executor::_Tgt::target): Do not use
	std::type_info in the interface.
	(executor::_Tgt::_M_func): Add data member.
	(executor::_TgtImpl): Replace with _Tgt1 and _Tgt2 class templates.
	(executor::_Tgt1::_S_func): Define function to access target without
	depending on RTTI.
	(executor::_M_create): Remove.
	(operator==, operator!=): Simplify comparisons for executor.
	* include/experimental/socket (is_error_code_enum<socket_errc>):
	Define specialization before use.
	* testsuite/experimental/net/executor/1.cc: New test.
2020-03-18 00:23:39 +00:00
Jonathan Wakely
c62f5e6e1f libstdc++: Add default constructor to net::service_already_exists (PR 94199)
The service_already_exists exception type specified in the TS doesn't
have any constructors defined. Since its base class isn't default
constructible, that means has no usable constructors. This may be a
defect in the TS.

This patch fixes it by adding a default constructor, but making it
private. The make_service function is declared as a friend to be able to
call that private constructor.

	PR libstdc++/94199
	* include/experimental/executor (service_already_exists): Add default
	constructor. Declare make_service to be a friend.
	* testsuite/experimental/net/execution_context/make_service.cc: New
	test.
2020-03-16 22:53:42 +00:00
Jonathan Wakely
fcc443b97e libstdc++: Fix test failure due to -Wnonnull warnings
This test fails in the Fedora RPM build (but not elsewhere, for unknown
reasons). The warning is correct, we're passing a null pointer.

	* testsuite/tr1/8_c_compatibility/cstdlib/functions.cc: Do not pass
	a null pointer to functions with nonnull(1) attribute.
2020-03-12 11:03:04 +00:00
Patrick Palka
4512b7d851 libstdc++: Add a test that takes the split_view of a non-forward range
This adds a tests that verifies taking the split_view of a non-forward range
works correctly.  Doing so revealed a typo in one of _OuterIter's constructors.

It also revealed that the default constructor of
__gnu_test::test_range::iterator misbehaves, because by delegating to
Iter<T>(nullptr, nullptr) we perform a null-pointer deref at runtime in
input_iterator_wrapper's constructor due to the ITERATOR_VERIFY check therein.
Instead of delegating to this constructor it seems we can just inherit the
protected default constructor, which does not contain this ITERATOR_VERIFY
check.

libstdc++-v3/ChangeLog:

	* include/std/ranges (split_view::_OuterIter::_OuterIter): Typo fix,
	'address' -> 'std::__addressof'.
	* testsuite/std/ranges/adaptors/split.cc: Test taking the split_view of
	a non-forward input_range.
	* testsuite/util/testsuite_iterators.h (output_iterator_wrapper): Make
	default constructor protected instead of deleted, like with
	input_iterator_wrapper.
	(test_range::iterator): Add comment explaining that this type is used
	only when the underlying wrapper is input_iterator_wrapper or
	output_iterator_wrapper.  Remove delegating defaulted constructor so
	that the inherited default constructor is used instead.
2020-03-11 14:56:52 -04:00
Patrick Palka
8f0d8cd852 libstdc++: LWG 3286 ranges::size is not required to be valid after ...
... a call to ranges::begin on an input range.

This implements LWG 3286.  The new wording for the single-argument constructor
for subrange is implemented by splitting the constructor into two delegating
constructors, one constrained by _S_store_size and the other by !_S_store_size.

Tested on x86_64-pc-linux-gnu, both added tests fail before the patch and pass
with the patch.

libstdc++-v3/ChangeLog:

	LWG 3286 ranges::size is not required to be valid after a call to
	ranges::begin on an input range
	* include/std/ranges (subrange::subrange): Split single-argument
	constructor into two, one constrained by _S_store_size and another by
	!_S_store_size.
	(take_view::begin): Call size() before calling ranges::begin(_M_base).
	* testsuite/std/ranges/adaptors/lwg3286.cc: New test.
	* testsuite/std/ranges/subrange/lwg3286.cc: New test.
2020-03-11 00:40:33 -04:00
Jonathan Wakely
0b7f1e2431 libstdc++: Fix uses of _M_current in split_view's outer iterator
These direct uses of _M_current should all be __current() so they are
valid when the base type doesn't satisfy the forward_range concept.

	* include/std/ranges (split_view::_OuterIter::__at_end): Use __current
	instead of _M_current.
	(split_view::_OuterIter::operator++): Likewise.
2020-03-10 22:15:58 +00:00
Jonathan Wakely
cf0c3a4573 libstdc++: Fix noexcept guarantees for ranges::split_view
Also introduce the _M_i_current() accessors to solve the problem of
access to the private member of _OuterIter from the iter_move and
iter_swap overloads (which are only friends of _InnerIter not
_OuterIter).

	* include/std/ranges (transform_view::_Iterator::__iter_move): Remove.
	(transform_view::_Iterator::operator*): Add noexcept-specifier.
	(transform_view::_Iterator::iter_move): Inline __iter_move body here.
	(split_view::_OuterIter::__current): Add noexcept.
	(split_view::_InnerIter::__iter_swap): Remove.
	(split_view::_InnerIter::__iter_move): Remove.
	(split_view::_InnerIter::_M_i_current): New accessors.
	(split_view::_InnerIter::__at_end): Use _M_i_current().
	(split_view::_InnerIter::operator*): Likewise.
	(split_view::_InnerIter::operator++): Likewise.
	(iter_move(const _InnerIter&)): Likewise.
	(iter_swap(const _InnerIter&, const _InnerIter&)): Likewise.
	* testsuite/std/ranges/adaptors/split.cc: Check noexcept-specifier
	for iter_move and iter_swap on split_view's inner iterator.
2020-03-10 17:45:45 +00:00
Jonathan Wakely
c222eabcf8 libstdc++: Fix invalid noexcept-specifier (PR 94117)
G++ fails to diagnose this non-dependent expression, but Clang doesn't
like it.

	PR c++/94117
	* include/std/ranges (ranges::transform_view::_Iterator::iter_move):
	Change expression in noexcept-specifier to match function body.
2020-03-10 10:52:25 +00:00
Jonathan Wakely
3654d49d0f libstdc++: Change compile-only test to run
The 24_iterators/ostream_iterator/1.cc test uses VERIFY and so is
obviously meant to have been run, not just compiled.

	* testsuite/23_containers/unordered_set/allocator/ext_ptr.cc: Add
	comment explaining multiple dg-do directives.
	* testsuite/24_iterators/ostream_iterator/1.cc: Fix do-do directive
	so test is run as well as compiled.
2020-03-10 09:47:15 +00:00
Jonathan Wakely
ea182fe636 libstdc++: Handle type-changing path concatenations (PR 94063)
The filesystem::path::operator+= and filesystem::path::concat functions
operate directly on the native format of the path and so can cause a
path to mutate to a completely different type.

For Windows combining a filename "x" with a filename ":" produces a
root-name "x:". Similarly, a Cygwin root-directory "/" combined with a
root-directory and filename "/x" produces a root-name "//x".

Before this patch the implemenation didn't support those kind of
mutations, assuming that concatenating two filenames would always
produce a filename and concatenating with a root-dir would still have a
root-dir.

This patch fixes it simply by checking for the problem cases and
creating a new path by re-parsing the result of the string
concatenation. This is slightly suboptimal because the argument has
already been parsed if it's a path, but more importantly it doesn't
reuse any excess capacity that the path object being modified might
already have allocated. That can be fixed later though.

	PR libstdc++/94063
	* src/c++17/fs_path.cc (path::operator+=(const path&)): Add kluge to
	handle concatenations that change the type of the first component.
	(path::operator+=(basic_string_view<value_type>)): Likewise.
	* testsuite/27_io/filesystem/path/concat/94063.cc: New test.
2020-03-09 23:22:57 +00:00
Patrick Palka
6aa2ca21a4 libstdc++: Add missing friend declaration to join_view::_Sentinel
The converting constructor of join_view::_Sentinel<true> needs to be able to
access the private members of join_view::_Sentinel<false>.

libstdc++-v3/ChangeLog:

	* include/std/ranges (join_view::_Sentinel<_Const>): Befriend
	join_view::_Sentinel<!_Const>.
	* testsuite/std/ranges/adaptors/join.cc: Augment test.
2020-03-06 09:23:10 -05:00
Patrick Palka
6d082cd901 libstdc++: Give ranges::empty() a concrete return type (PR 93978)
This works around PR 93978 by avoiding having to instantiate the body of
ranges::empty() when checking the constraints of view_interface::operator
bool().  When ranges::empty() has an auto return type, then we must instantiate
its body in order to determine whether the requires expression {
ranges::empty(_M_derived()); } is well-formed.  But this means instantiating
view_interface::empty() and hence view_interface::_M_derived(), all before we've
yet deduced the return type of join_view::end().  (The reason
view_interface::operator bool() is needed in join_view::end() in the first place
is because in this function we perform direct initialization of
join_view::_Sentinel from a join_view, and so we try to find a conversion
sequence from the latter to the former that goes through this conversion
operator.)

Giving ranges::empty() a concrete return type of bool should be safe according
to [range.prim.empty]/4 which says "whenever ranges::empty(E) is a valid
expression, it has type bool."

This fixes the test case in PR 93978 when compiling without -Wall, but with -Wall
the test case still fails due to the issue described in PR c++/94038, I think.
I still don't quite understand why the test case doesn't fail without -O.

libstdc++-v3/ChangeLog:

	PR libstdc++/93978
	* include/bits/range_access.h (__cust_access::_Empty::operator()):
	Declare return type to be bool instead of auto.
	* testsuite/std/ranges/adaptors/93978.cc: New test.
2020-03-06 09:22:54 -05:00
Jonathan Wakely
4cdcb2c92a libstdc++: Fix PR number in ChangeLog (PR 94069) 2020-03-06 12:24:37 +00:00
Jonathan Wakely
b0815713a3 libstdc++: Fix call to __glibcxx_rwlock_init (PR 93244)
When the target doesn't define PTHREAD_RWLOCK_INITIALIZER we use a
wrapper around pthread_wrlock_init, but the wrapper only takes one
argument and we try to call it with two.

This went unnnoticed on most targets because they do define the
PTHREAD_RWLOCK_INITIALIZER macro, but it causes a bootstrap failure on
darwin8.

	PR libstdc++/93244
	* include/std/shared_mutex [!PTHREAD_RWLOCK_INITIALIZER]
	(__shared_mutex_pthread::__shared_mutex_pthread()): Remove incorrect
	second argument to __glibcxx_rwlock_init.
	* testsuite/30_threads/shared_timed_mutex/94069.cc: New test.
2020-03-06 12:03:17 +00:00
Jonathan Wakely
180eeeaeb2 libstdc++: Fix failing filesystem::path tests (PR 93244)
The checks for PR 93244 don't actually pass on Windows (which is the
target where the bug is present) because of a different bug, PR 94063.

This adjusts the tests to not be affected by 94063 so that they verify
that 93244 was fixed.

	PR libstdc++/93244
	* testsuite/27_io/filesystem/path/generic/generic_string.cc: Adjust
	test to not fail due to PR 94063.
	* testsuite/27_io/filesystem/path/generic/utf.cc: Likewise.
	* testsuite/27_io/filesystem/path/generic/wchar_t.cc: Likewise.
2020-03-06 11:30:56 +00:00
Andreas Krebbel
28119fba7f libstdc++: Deal with ENOSYS == ENOTSUP
zTPF uses the same numeric value for ENOSYS and ENOTSUP.

libstdc++-v3/ChangeLog:

2020-03-06  Andreas Krebbel  <krebbel@linux.ibm.com>

	* src/c++11/system_error.cc: Omit the ENOTSUP case statement if it
	would match ENOSYS.
2020-03-06 12:21:24 +01:00
Jonathan Wakely
9412b35aff libstdc++: Fix some warnings in filesystem tests
There's a -Wunused-but-set-variable warning in operations/all.cc which
can be fixed with [[maybe_unused]].

The statements in operations/copy.cc give -Wunused-value warnings. I
think I meant to use |= rather than !=.

And operations/file_size.cc gets -Wsign-compare warnings.

	* testsuite/27_io/filesystem/operations/all.cc: Mark unused variable.
	* testsuite/27_io/filesystem/operations/copy.cc: Fix typo.
	* testsuite/experimental/filesystem/operations/copy.cc: Likewise.
	* testsuite/27_io/filesystem/operations/file_size.cc: Use correct type
	for return value, and in comparison.
	* testsuite/experimental/filesystem/operations/file_size.cc: Likewise.
2020-03-05 17:23:44 +00:00
Jonathan Wakely
6a7052832a libstdc++: allow string_view insertion to work with <iosfwd> (PR 94051)
I don't think this is actually required to compile, because using
operator<< without a definition of the ostream doesn't seem valid to me.
But it's easy to make it work.

	PR libstdc++/94051
	* include/std/string_view: Include <bits/ostream_insert.h>.
	* testsuite/21_strings/basic_string_view/inserters/94051.cc: New test.
2020-03-05 16:46:28 +00:00
Jonathan Wakely
94f7d7ec6e libstdc++: Fix comment on __memcpyable
The discussion of iterator_traits<volatile T*>::value_type and  the
example with three tempalte arguments related to an earlier version of
the patch, not the one committed.

Also improve the comment on __memcmpable.

	* include/bits/cpp_type_traits.h (__memcpyable): Fix comment.
2020-03-04 15:35:20 +00:00
Patrick Palka
712b182a8b libstdc++: Fix incorrect use of memset in ranges::fill_n (PR 94017)
When deciding whether to perform the memset optimization in ranges::fill_n, we
were crucially neglecting to check that the output pointer's value type is a
byte type.  This patch adds such a check to the problematic condition in
ranges::fill_n.

At the same time, this patch relaxes the overly conservative
__is_byte<_Tp>::__value check that requires the fill type be a byte type.  It's
overly conservative because it means we won't enable the memset optimization in
the following example

  char c[100];
  ranges::fill(c, 37);

because the fill type is deduced to be int here.  Rather than requiring that the
fill type be a byte type, it seems safe to just require the fill type be an
integral type, which is what this patch does.

libstdc++-v3/ChangeLog:

	PR libstdc++/94017
	* include/bits/ranges_algobase.h (__fill_n_fn::operator()): Refine
	condition for when to use memset, making sure to additionally check that
	the output pointer's value type is a non-volatile byte type.  Instead of
	requiring that the fill type is a byte type, just require that it's an
	integral type.
	* testsuite/20_util/specialized_algorithms/uninitialized_fill/94017.cc:
	New test.
	* testsuite/20_util/specialized_algorithms/uninitialized_fill_n/94017.cc:
	New test.
	* testsuite/25_algorithms/fill/94013.cc: Uncomment part that was blocked
	by PR 94017.
	* testsuite/25_algorithms/fill/94017.cc: New test.
	* testsuite/25_algorithms/fill_n/94017.cc: New test.
2020-03-03 22:46:39 -05:00
Patrick Palka
144dfc68d0 libstdc++: Move-only input iterator support in <memory> algorithms (LWG 3355)
This adds support for move-only input iterators in the ranges::unitialized_*
algorithms defined in <memory>, as per LWG 3355.  The only changes needed are to
add calls to std::move in the appropriate places and to use operator- instead of
ranges::distance because the latter cannot be used with a move-only iterator
that has a sized sentinel, as is the case here.  (This issue with
ranges::distance is LWG 3392.)

libstdc++-v3/ChangeLog:

	LWG 3355 The memory algorithms should support move-only input iterators
	introduced by P1207
	* include/bits/ranges_uninitialized.h
	(__uninitialized_copy_fn::operator()): Use std::move to avoid attempting
	to copy __ifirst, which could be a move-only input iterator.  Use
	operator- instead of ranges::distance to compute distance from a sized
	sentinel.
	(__uninitialized_copy_n_fn::operator()): Likewise.
	(__uninitialized_move_fn::operator()): Likewise.
	(__uninitialized_move_n_fn::operator()): Likewise.
	(__uninitialized_destroy_fn::operator()): Use std::move to avoid
	attempting to copy __first.
	(__uninitialized_destroy_n_fn::operator()): Likewise.
	* testsuite/20_util/specialized_algorithms/destroy/constrained.cc:
	Augment test.
	* .../specialized_algorithms/uninitialized_copy/constrained.cc:
	Likewise.
	* .../specialized_algorithms/uninitialized_move/constrained.cc:
	Likewise.
2020-03-03 22:44:39 -05:00
Patrick Palka
26af9cd8af libstdc++: Add a testsuite range type that has a sized sentinel
This adds a testsuite range type whose end() is a sized sentinel to
<testsuite_iterators.h>, which will be used in the tests that verify LWG 3355.

libstdc++-v3/ChangeLog:

	* testsuite/util/testsuite_iterators.h (test_range::get_iterator): Make
	protected instead of private.
	(test_sized_range_sized_sent): New.
2020-03-03 22:44:39 -05:00
Patrick Palka
d6d4b339f5 libstdc++: Add a move-only testsuite iterator type
This adds a move-only testsuite iterator wrapper to <testsuite_iterators.h>
which will be used in the tests for LWG 3355.  The tests for LWG 3389 and 3390
are adjusted to use this new iterator wrapper.

libstdc++-v3/ChangeLog:

	* testsuite/util/testsuite_iterators.h (input_iterator_wrapper_nocopy):
	New testsuite iterator.
	* testsuite/24_iterators/counted_iterator/lwg3389.cc: Use it.
	* testsuite/24_iterators/move_iterator/lwg3390.cc: Likewise.
2020-03-03 22:44:35 -05:00
Patrick Palka
05779e2c89 libstdc++: Fix use of is_nothrow_assignable_v in <bits/ranges_uninitialized.h>
We are passing a value type as the first argument to is_nothrow_assignable_v,
but the result of that is inevitably false.  Since this predicate is a part of
the condition that guards the corresponding optimizations for these algorithms,
this bug means these optimizations are never used.  We should be passing a
reference type to is_nothrow_assignable_v instead.

libstdc++-v3/ChangeLog:

	* include/bits/ranges_uninitialized.h
	(uninitialized_copy_fn::operator()): Pass a reference type as the first
	argument to is_nothrow_assignable_v.
	(uninitialized_copy_fn::operator()): Likewise.
	(uninitialized_move_fn::operator()): Likewise.  Return an in_out_result
	with the input iterator stripped of its move_iterator.
	(uninitialized_move_n_fn::operator()): Likewise.
	(uninitialized_fill_fn::operator()): Pass a reference type as the first
	argument to is_nothrow_assignable_v.
	(uninitialized_fill_n_fn::operator()): Likewise.
2020-03-03 22:35:34 -05:00
Jonathan Wakely
462f6c2041 libstdc++: Workaround is_trivially_copyable<volatile T> (PR 94013)
Several algorithms check the is_trivially_copyable trait to decide
whether to dispatch to memmove or memcmp as an optimization. Since
r271435 (CWG DR 2094) the trait is true for volatile-qualified scalars,
but we can't use memmove or memcmp when the type is volatile. We need to
also check for volatile types.

This is complicated by the fact that in C++20 (but not earlier standards)
iterator_traits<volatile T*>::value_type is T, so we can't just check
whether the value_type is volatile.

The solution in this patch is to introduce new traits __memcpyable and
__memcmpable which combine into a single trait the checks for pointers,
the value types being the same, and the type being trivially copyable
but not volatile-qualified.

	PR libstdc++/94013
	* include/bits/cpp_type_traits.h (__memcpyable, __memcmpable): New
	traits to control when to use memmove and memcmp optimizations.
	(__is_nonvolatile_trivially_copyable): New helper trait.
	* include/bits/ranges_algo.h (__lexicographical_compare_fn): Do not
	use memcmp optimization with volatile data.
	* include/bits/ranges_algobase.h (__equal_fn): Use __memcmpable.
	(__copy_or_move, __copy_or_move_backward): Use __memcpyable.
	* include/bits/stl_algobase.h (__copy_move_a2): Use __memcpyable.
	(__copy_move_backward_a2): Likewise.
	(__equal_aux1): Use __memcmpable.
	(__lexicographical_compare_aux): Do not use memcmp optimization with
	volatile data.
	* testsuite/25_algorithms/copy/94013.cc: New test.
	* testsuite/25_algorithms/copy_backward/94013.cc: New test.
	* testsuite/25_algorithms/equal/94013.cc: New test.
	* testsuite/25_algorithms/fill/94013.cc: New test.
	* testsuite/25_algorithms/lexicographical_compare/94013.cc: New test.
	* testsuite/25_algorithms/move/94013.cc: New test.
	* testsuite/25_algorithms/move_backward/94013.cc: New test.
2020-03-03 21:39:19 +00:00
Jonathan Wakely
9b4f00dd3f libstdc++: Micro-optimisations for lexicographical_compare_three_way
As noted in LWG 3410 the specification in the C++20 draft performs more
iterator comparisons than necessary when the end of either range is
reached. Our implementation followed that specification. This removes
the redundant comparisons so that we do no unnecessary work as soon as
we find that we've reached the end of either range.

The odd-looking return statement is because it generates better code
than the original version that copied the global constants.

	* include/bits/stl_algobase.h (lexicographical_compare_three_way):
	Avoid redundant iterator comparisons (LWG 3410).
2020-03-03 11:06:26 +00:00
Jonathan Wakely
d112e173ea libstdc++: Fix std::lexicographic_compare for unsigned char (PR 93972)
The new 25_algorithms/lexicographical_compare/93972.cc test fails on
targets where char is unsigned, revealing an existing regression with
the std::__memcmp helper that had gone unnoticed in
std::lexicographical_compare. When comparing char and unsigned char, the
memcmp optimisation is enabled, but the new std::__memcmp function fails
to compile for mismatched types.

	PR libstdc++/93972
	* include/bits/stl_algobase.h (__memcmp): Allow pointer types to
	differ.
	* testsuite/25_algorithms/lexicographical_compare/uchar.cc: New test.
2020-03-02 17:03:28 +00:00
Jonathan Wakely
4c39156340 libstdc++: Rename __detail::__maybe_empty_t alias template
The key property of this alias is not that it may be an empty type, but
that the type argument may not be used. The fact it's replaced by an
empty type is just an implementation detail.  The name was also
backwards with respect to the bool argument.

This patch changes the name to better reflect its purpose.

	* include/std/ranges (__detail::__maybe_empty_t): Rename to
	__maybe_present_t.
	(__adaptor::_RangeAdaptor, join_view, split_view): Use new name.
2020-03-02 17:03:28 +00:00
Jonathan Wakely
5fad000324 libstdc++: Add 'typename' to fix compilation with Clang
* include/bits/ranges_algo.h (shift_right): Add 'typename' to
	dependent type.
2020-03-02 12:19:46 +00:00
H.J. Lu
fed76afb95 x32: Update baseline_symbols.txt
* config/abi/post/x86_64-linux-gnu/x32/baseline_symbols.txt: Updated.
2020-03-01 06:13:28 -08:00
John David Anglin
566f544c3e Skip charset.cc tests on *-*-hpux*.
2020-02-29  John David Anglin  <danglin@gcc.gnu.org>

	* testsuite/17_intro/headers/c++1998/charset.cc: Skip on *-*-hpux*.
	* testsuite/17_intro/headers/c++2011/charset.cc: Likewise.
	* testsuite/17_intro/headers/c++2014/charset.cc: Likewise.
	* testsuite/17_intro/headers/c++2017/charset.cc: Likewise.
	* testsuite/17_intro/headers/c++2020/charset.cc: Likewise.
2020-02-29 18:28:40 +00:00
John David Anglin
bd55ce6365 Explicitly link with libatomic when needed.
2020-02-29  John David Anglin  <danglin@gcc.gnu.org>

	* testsuite/30_threads/condition_variable_any/stop_token/wait_on.cc:
	Add libatomic option.
	* testsuite/30_threads/jthread/jthread.cc: Likewise.
2020-02-29 17:46:12 +00:00
François Dumont
44c85722dc libstdc++ Hastable: Move std::is_permutation to limit includes
Move std::is_permutation algorithm with associated helpers to stl_algobase.h
to remove stl_algo.h include from hashtable_policy.h and so reduce preprocess
size of unordered_map and unordered_set headers.

	* include/bits/stl_algo.h
	(__find_if, __count_if, __is_permutation, std::is_permutation): Move...
	* include/bits/stl_algobase.h: ...here.
	* include/bits/hashtable_policy.h: Remove <bits/stl_algo.h> include.
2020-02-29 18:40:39 +01:00
John David Anglin
68a1a11fad Explicitly link with libatomic when needed.
2020-02-29  John David Anglin  <danglin@gcc.gnu.org>

	* testsuite/30_threads/stop_token/stop_callback.cc: Add libatomic
	option.
	* testsuite/30_threads/stop_token/stop_callback/deadlock-mt.cc:
	Likewise.
	* testsuite/30_threads/stop_token/stop_callback/deadlock.cc: Likewise.
	* testsuite/30_threads/stop_token/stop_callback/destroy.cc: Likewise.
	* testsuite/30_threads/stop_token/stop_callback/invoke.cc: Likewise.
	* testsuite/30_threads/stop_token/stop_source.cc: Likewise.
	* testsuite/30_threads/stop_token/stop_source/assign.cc: Likewise.
	* testsuite/30_threads/stop_token/stop_token.cc: Likewise.
	* testsuite/30_threads/stop_token/stop_token/stop_possible.cc:
	Likewise.
2020-02-29 17:32:24 +00:00
John David Anglin
d4912dc766 Fix baseline symbols on hppa-linux-gnu
2020-02-29  John David Anglin  <danglin@gcc.gnu.org>

	PR libstdc++/92906
	* config/abi/post/hppa-linux-gnu/baseline_symbols.txt: Update.
2020-02-29 16:18:35 +00:00
Patrick Palka
ce33801fe4 libstdc++: Fix bogus use of memcmp in ranges::lexicographical_compare (PR 93972)
We were enabling the memcmp optimization in ranges::lexicographical_compare for
signed integral types and for integral types wider than a byte.  But memcmp
gives the wrong answer for arrays of such types.  This patch fixes this issue by
refining the condition that enables the memcmp optimization.  It's now
consistent with the corresponding condition used in
std::lexicographical_compare.

libstdc++-v3/ChangeLog:

	PR libstdc++/93972
	* include/bits/ranges_algo.h (__lexicographical_compare_fn::operator()):
	Fix condition for when to use memcmp, making it consistent with the
	corresponding condition used in std::lexicographical_compare.
	* testsuite/25_algorithms/lexicographical_compare/93972.cc: New test.
2020-02-28 17:55:44 -05:00
Patrick Palka
799270b430 libstdc++: Update the <numeric> synopsis test to latest standard
Tested with

  make check RUNTESTFLAGS="conformance.exp=*numeric*synopsis* --target_board=unix/-std=$std"

for std in {c++98, c++11, c++17, c++2a}.

libstdc++-v3/ChangeLog:

	* testsuite/26_numerics/headers/numeric/synopsis.cc: Add signatures for
	functions introduced in C++11, C++17 and C++2a.  Add 'constexpr' to
	existing signatures for C++2a.
2020-02-28 15:08:14 -05:00
Jonathan Wakely
4735f92d48 libstdc++: test for failing assertion should use 'run' not 'compile'
And it only needs to define _GLIBCXX_ASSERTIONS not _GLIBCXX_DEBUG.

	* testsuite/24_iterators/range_operations/advance_debug_neg.cc: Run
	test instead of just compiling it.
2020-02-28 18:41:18 +00:00
Patrick Palka
77e596cf3c libstdc++: Also disable caching of reverse_view::begin() for common_ranges
When the underlying range models common_range, then reverse_view::begin() is
already O(1) without caching.  So we should disable the cache in this case too.

libstdc++-v3/ChangeLog:

	* include/std/ranges (reverse_view::_S_needs_cached_begin): Set to false
	whenever the underlying range models common_range.
2020-02-28 11:55:58 -05:00
Patrick Palka
a153501578 libstdc++: Memoize {drop,drop_while,filter,reverse}_view::begin
This patch adds memoization to these four views so that their begin() has the
required amortized constant time complexity.

The cache is enabled only for forward_ranges and above because we need the
underlying iterator to be copyable and multi-pass in order for the cache to be
usable.  In the general case we represent the cached result of begin() as a bare
iterator.  This takes advantage of the fact that value-initialized forward
iterators can be compared to as per N3644, so we can use a value-initialized
iterator to denote the "empty" state of the cache.

As a special case, when the underlying range models random_access_range and when
it's profitable size-wise, then we cache the offset of the iterator from the
beginning of the range instead of caching the iterator itself.

Additionally, in drop_view and reverse_view we disable the cache when the
underlying range models random_access_range, because in these cases recomputing
begin() takes O(1) time anyway.

libstdc++-v3/ChangeLog:

	* include/std/ranges (__detail::_CachedPosition): New struct.
	(views::filter_view::_S_needs_cached_begin): New member variable.
	(views::filter_view::_M_cached_begin): New member variable.
	(views::filter_view::begin): Use _M_cached_begin to cache its
	result.
	(views::drop_view::_S_needs_cached_begin): New static member variable.
	(views::drop_view::_M_cached_begin): New member variable.
	(views::drop_view::begin): Use _M_cached_begin to cache its result
	when _S_needs_cached_begin.
	(views::drop_while_view::_M_cached_begin): New member variable.
	(views::drop_while_view::begin): Use _M_cached_begin to cache its
	result.
	(views::reverse_view::_S_needs_cached_begin): New static member
	variable.
	(views::reverse_view::_M_cached_begin): New member variable.
	(views::reverse_view::begin): Use _M_cached_begin to cache its result
	when _S_needs_cached_begin.
	* testsuite/std/ranges/adaptors/drop.cc: Augment test to check that
	drop_view::begin caches its result.
	* testsuite/std/ranges/adaptors/drop_while.cc: Augment test to check
	that drop_while_view::begin caches its result.
	* testsuite/std/ranges/adaptors/filter.cc: Augment test to check that
	filter_view::begin caches its result.
	* testsuite/std/ranges/adaptors/reverse.cc: Augment test to check that
	reverse_view::begin caches its result.
2020-02-28 09:33:03 -05:00
Jonathan Wakely
a51a546c17 libstdc++: Fix FS-dependent filesystem tests
These tests were failing on XFS because it doesn't support setting file
timestamps past 2038, so the expected overflow when reading back a huge
timestamp into a file_time_type didn't happen.

Additionally, the std::filesystem::file_time_type::clock has an
epoch that is out of range of 32-bit time_t so testing times around that
epoch may also fail.

This fixes the tests to give up gracefully if the filesystem doesn't
support times that can't be represented in 32-bit time_t.

	* testsuite/27_io/filesystem/operations/last_write_time.cc: Fixes for
	filesystems that silently truncate timestamps.
	* testsuite/experimental/filesystem/operations/last_write_time.cc:
	Likewise.
2020-02-28 12:58:28 +00:00
Jonathan Wakely
86e2dc22c9 libstdc++: Fix failing test in debug mode
This fixes a failure due to a (correct) warning seen when testing with
-D_GLIBCXX_USE_CXX11_ABI=0 -D_GLIBCXX_ASSERTIONS:

include/bits/char_traits.h:365: warning: 'void* __builtin_memcpy(void*, const void*, long unsigned int)'
specified bound 18446744073709551615 exceeds maximum object size 9223372036854775807 [-Wstringop-overflow=]

FAIL: 21_strings/basic_string/cons/char/1.cc (test for excess errors)

	* testsuite/21_strings/basic_string/cons/char/1.cc: Disable
	-Wstringop-overflow warnings.
2020-02-28 12:58:14 +00:00
Jonathan Wakely
449494943e libstdc++: Disable diagnostic URLs in testsuite
* testsuite/lib/libstdc++.exp (v3_target_compile): Add
	-fdiagnostics-urls=never to options.
2020-02-27 20:26:20 +00:00