Commit Graph

11510 Commits

Author SHA1 Message Date
Jonathan Wakely
5b6215083b libstdc++: Fix some -Wsystem-headers warnings (PR 95765)
PR libstdc++/95765
	* include/bits/stl_algobase.h (__size_to_integer(float))
	(__size_to_integer(double), __size_to_integer(long double))
	(__size_to_integer(__float128)): Cast return type explicitly.
	* include/bits/stl_uninitialized.h (__uninitialized_default_1<true>):
	Remove unused typedef.
2020-06-19 18:20:05 +01:00
Jonathan Wakely
a7a3932e4b libstdc++: Remove redundant std:: qualification
* include/bits/stl_pair.h (_Index_tuple): Remove redundant
	namespace qualification.
	(pair::pair(tuple<>&, tuple<>&, _Index_tuple, _Index_tuple)):
	Likewise.
	* include/std/tuple (_Head_base, _Tuple_impl, tuple_size)
	(tuple_element, __get_helper, get, __make_tuple_impl)
	(__make_1st_indices, __tuple_concater)
	(pair::pair(tuple<>&, tuple<>&, _Index_tuple, _Index_tuple)):
	Likewise.
	* include/std/utility (tuple_element, __is_tuple_like_impl)
	(tuple_size, __pair_get, get): Likewise.
2020-06-19 15:02:54 +01:00
Jonathan Wakely
abed8b56b9 libstdc++: Define all std::function members inline
* include/bits/std_function.h (function): Define all member
	functions inline.
2020-06-19 14:37:52 +01:00
Marc Glisse
465520e3eb libstdc++: std::includes performance tweak
A small tweak to the implementation of __includes, which in my
application saves 20% of the running time. I noticed it because using
range-v3 was giving unexpected performance gains.

Some of the gain comes from pulling the 2 calls ++__first1 out of the
condition so there is just one call. And most of the gain comes from
replacing the resulting

if (__comp(__first1, __first2))
  ;
else
  ++__first2;

with

if (!__comp(__first1, __first2))
  ++__first2;

I was very surprised that the code ended up being so different for such
a change, and I still don't really understand where the extra time is
going...

Anyway, while I blame the compiler for not generating very good code
with the current implementation, I believe the change can be seen as a
simplification.

libstdc++-v3/ChangeLog:

	* include/bits/stl_algo.h (__includes): Simplify the code.
2020-06-19 13:03:45 +01:00
Marc Glisse
bafd12cb22 libstdc++: Optimize std::optional default constructor
The attached patch changes the code generated for

std::optional<std::array<int,1024>>f(){return{};}

from

        movq    $0, (%rdi)
        movq    %rdi, %r8
        leaq    8(%rdi), %rdi
        xorl    %eax, %eax
        movq    $0, 4084(%rdi)
        movq    %r8, %rcx
        andq    $-8, %rdi
        subq    %rdi, %rcx
        addl    $4100, %ecx
        shrl    $3, %ecx
        rep stosq
        movq    %r8, %rax

or with different tuning

        subq    $8, %rsp
        movl    $4100, %edx
        xorl    %esi, %esi
        call    memset
        addq    $8, %rsp

to the much shorter

        movb    $0, 4096(%rdi)
        movq    %rdi, %rax

i.e. the same as the nullopt constructor.

The constructor was already non-trivial, so we don't lose that. It passes the
testsuite without regression, but there is no new testcase to verify the
better codegen.

libstdc++-v3/ChangeLog:

	* include/std/optional (optional()): Explicitly define it.
2020-06-19 12:15:43 +01:00
GCC Administrator
aff95ee7cc Daily bump. 2020-06-18 00:16:37 +00:00
Jonathan Wakely
632183ddcc libstdc++: Avoid stack overflow in std::vector (PR 94540)
The std::__uninitialized_default_n algorithm used by std::vector creates
an initial object as a local variable then copies that into the
destination range. If the object is too large for the stack this
crashes. We should create the first object directly into the
destination and then copy it from there.

This doesn't fix the bug for C++98, because in that case the initial
value is created as a default argument of the vector constructor i.e. in
the user's code, not inside libstdc++. We can't prevent that.

	PR libstdc++/94540
	* include/bits/stl_uninitialized.h (__uninitialized_default_1<true>):
	Construct the first value at *__first instead of on the stack.
	(__uninitialized_default_n_1<true>): Likewise.
	Improve comments on several of the non-standard algorithms.
	* testsuite/20_util/specialized_algorithms/uninitialized_default/94540.cc:
	New test.
	* testsuite/20_util/specialized_algorithms/uninitialized_default_n/94540.cc:
	New test.
	* testsuite/20_util/specialized_algorithms/uninitialized_value_construct/94540.cc:
	New test.
	* testsuite/20_util/specialized_algorithms/uninitialized_value_construct_n/94540.cc:
	New test.
	* testsuite/23_containers/vector/cons/94540.cc: New test.
2020-06-17 22:49:06 +01:00
Jonathan Wakely
94b94c0bb1 libstdc++: Fix tests for uninitialized_value_construct_n
In my recent r11-1460 commit the tests had been "improved" before
commit, and no longer exercised the code paths changed by the patch.

This restores what I originally tested, so that the tests fail before
the r11-1460 change and pass after it.

	* testsuite/20_util/specialized_algorithms/uninitialized_default_n/sizes.cc:
	Replace Value type with int so trivial code path is used.
	* testsuite/20_util/specialized_algorithms/uninitialized_value_construct_n/sizes.cc:
	Likewise.
2020-06-17 21:23:35 +01:00
Jonathan Wakely
c9dce3b15e libstdc++: Handle non-integral sizes in std::uninitialized_fill_n
The std::uninitialized_fill_n algorithm uses sd::fill_n for trivial
types, but that algorithm has a stronger requirement that the Size
parameter is convertible to an integral type. As the new test shows,
there are types which are valid for std::uninitialized_fill_n but which
produce a different result when converted to an integral type, or cannot
be converted at all. Only use the std::fill_n optimization when the Size
type is already an integral type.

The std::__uninitialized_default_n extension has the same problem, and
so does C++17's std::uninitialized_value_construct_n which uses it.

	* include/bits/stl_uninitialized.h (uninitialized_fill_n): Only
	use std::fill_n when the size is an integral type.
	(__uninitialized_default_n): Likewise.
	* testsuite/20_util/specialized_algorithms/uninitialized_default_n/sizes.cc:
	New test.
	* testsuite/20_util/specialized_algorithms/uninitialized_fill_n/sizes.cc:
	New test.
	* testsuite/20_util/specialized_algorithms/uninitialized_value_construct_n/sizes.cc:
	New test.
2020-06-17 20:55:06 +01:00
GCC Administrator
56638b9b18 Daily bump. 2020-06-17 00:16:36 +00:00
Jonathan Wakely
e40b11a91c libstdc++: Strip cv-qualifiers in std::atomic<FP> (PR 95282)
This improves the previous fix for PR 95282, and extends it to also
apply to the exchange function (which has a similar problem and would
become ill-formed with my proposed fix for PR 95378).

	PR libstdc++/95282
	* include/bits/atomic_base.h (__atomic_impl::load): Use the _Val
	alias instead of deducing _Tp as an unqualified type.
	(__atomic_impl::exchange): Use the _Val alias to remove volatile
	from the reinterpret_cast result type.
2020-06-16 22:34:55 +01:00
Jonathan Wakely
cc799df98f libstdc++: Enforce copyable/movable checks in std::atomic
C++20 adds some new preconditions to std::atomic, which weren't
previously checked by our implementation.

	* include/std/atomic (atomic): Add static assertions.
	* testsuite/29_atomics/atomic/requirements/types_neg.cc: New test.
2020-06-16 22:34:55 +01:00
Patrick Palka
92bed03609 c++: Improve access checking inside templates [PR41437]
This patch generalizes our existing functionality for deferring access
checking of typedefs when parsing a function or class template to now
defer all kinds of access checks until template instantiation time,
including member function and member object accesses.

Since all access checks eventually go through enforce_access, the main
component of this patch is new handling inside enforce_access to defer
the current access check if we're inside a template.  The bulk of the
rest of the patch consists of removing now-unneeded code pertaining to
suppressing access checks inside templates or pertaining to
typedef-specific access handling.  Renamings and other changes with no
functional impact have been split off into the followup patch.

gcc/cp/ChangeLog:

	PR c++/41437
	PR c++/47346
	* call.c (enforce_access): Move to semantics.c.
	* cp-tree.h (enforce_access): Delete.
	(get_types_needing_access_check): Delete.
	(add_typedef_to_current_template_for_access_check): Delete.
	* decl.c (make_typename_type): Adjust accordingly.  Use
	check_accessibility_of_qualified_id instead of directly using
	perform_or_defer_access_check.
	* parser.c (cp_parser_template_declaration_after_parameters):
	Don't push a dk_no_check access state when parsing a template.
	* pt.c (get_types_needing_access_check): Delete.
	(append_type_to_template_for_access_check_1): Delete.
	(perform_typedefs_access_check): Adjust.  If type_decl is a
	FIELD_DECL, also check its DECL_CONTEXT for dependence. Use
	tsubst_copy instead of tsubst to substitute into type_decl so
	that we substitute into the DECL_CONTEXT of a FIELD_DECL.
	(append_type_to_template_for_access_check): Delete.
	* search.c (accessible_p): Remove the processing_template_decl
	early exit.
	* semantics.c (enforce_access): Moved from call.c.  If we're
	parsing a template and the access check failed, add the check to
	TI_TYPEDEFS_NEEDING_ACCESS_CHECKING.
	(perform_or_defer_access_check): Adjust comment.
	(add_typedef_to_current_template_for_access_check): Delete.
	(check_accessibility_of_qualified_id):  Adjust accordingly.
	Exit early if the scope is dependent.

gcc/testsuite/ChangeLog:

	PR c++/41437
	PR c++/47346
	* g++.dg/cpp2a/concepts-using2.C: Adjust.
	* g++.dg/lto/20081219_1.C: Adjust.
	* g++.dg/lto/20091002-1_0.C: Adjust.
	* g++.dg/lto/pr65475c_0.C: Adjust.
	* g++.dg/opt/dump1.C: Adjust.
	* g++.dg/other/pr53574.C: Adjust.
	* g++.dg/template/access30.C: New test.
	* g++.dg/template/access31.C: New test.
	* g++.dg/wrappers/wrapper-around-type-pack-expansion.C: Adjust.

libstdc++-v3/ChangeLog:

	PR libstdc++/94003
	* testsuite/20_util/is_constructible/94003.cc: New test.
2020-06-16 08:21:33 -04:00
GCC Administrator
6fb94d67f1 Daily bump. 2020-06-16 00:16:28 +00:00
Jonathan Wakely
b6ab9ecd55 libstdc++: Update value of __cpp_lib_constexpr_char_traits for C++20
Although not required by SD-6 or the C++20 draft, we define the macro
__cpp_lib_constexpr_char_traits to indicate support for P0432R1. This
updates the value in C++20 mode for the P1032R1 changes to char_traits.

	* include/bits/char_traits.h (__cpp_lib_constexpr_char_traits):
	Update value for C++20.
	* include/std/version (__cpp_lib_constexpr_char_traits): Likewise.
	* testsuite/21_strings/char_traits/requirements/constexpr_functions_c++17.cc:
	Update expected value.
	* testsuite/21_strings/char_traits/requirements/constexpr_functions_c++20.cc:
	Likewise.
2020-06-15 14:31:26 +01:00
Paul Keir
eb11134d0c libstdc++: Fix char_traits move with overlap
Upon constexpr evaluation, char_traits move uses copy_backward, but its
last argument should be to the range end rather than its beginning.

2020-06-12  Paul Keir  <paul.keir@uws.ac.uk>

	* include/bits/char_traits.h (char_traits::move): constexpr move with
	overlap was using copy_backward incorrectly.
	* testsuite/21_strings/char_traits/requirements/constexpr_functions_c++20.cc:
	New test.
2020-06-15 14:31:26 +01:00
GCC Administrator
8e3b453e08 Daily bump. 2020-06-13 00:16:25 +00:00
Jonathan Wakely
e784f98027 libstdc++: Improve tests for std::atomic_flag
The tests for clear() and test_and_set() didn't cover all cases.

	* testsuite/29_atomics/atomic_flag/clear/1.cc: Also test clear()
	when the value is currently set.
	* testsuite/29_atomics/atomic_flag/test_and_set/explicit.cc:
	Actually check the return value.
	* testsuite/29_atomics/atomic_flag/test_and_set/implicit.cc:
	Likewise.
2020-06-12 10:43:06 +01:00
Jonathan Wakely
17412a74c5 libstdc++: Make std::atomic_flag::test members const
Also fix the tests so they run without an explicit -std=gnu++2a in the
RUNTESTFLAGS, and test the new function on const-qualified objects.

	* include/bits/atomic_base.h (atomic_flag::test): Add missing
	const qualifiers.
	* testsuite/29_atomics/atomic_flag/test/explicit.cc: Add
	dg-options and verify results of test function.
	* testsuite/29_atomics/atomic_flag/test/implicit.cc: Likewise.
2020-06-12 10:31:07 +01:00
GCC Administrator
e68e80c8dd Daily bump. 2020-06-12 00:16:29 +00:00
Jonathan Wakely
b32eea9c0c libstdc++: Fix istream::ignore discarding too many chars (PR 94749)
The current code assumes that if the next character in the stream is
equal to the delimiter then we stopped because we saw that delimiter,
and so discards it.  But in the testcase for the PR we stop because we
reached the maximum number of characters, and it's coincidence that the
next character equals the delimiter. We should not discard the next
character in that case.

The fix is to check that we haven't discarded __n characters already,
instead of checking whether the next character equals __delim. Because
we've already checked for EOF, if we haven't discarded __n yet then we
know we stopped because we saw the delimiter. On the other hand, if the
next character is the delimiter we don't know if that's why we stopped.

	PR libstdc++/94749
	* include/bits/istream.tcc (basic_istream::ignore(streamsize, CharT)):
	Only discard an extra character if we didn't already reach the
	maximum number.
	* src/c++98/istream.cc (istream::ignore(streamsiz, char))
	(wistream::ignore(streamsize, wchar_t)): Likewise.
	* testsuite/27_io/basic_istream/ignore/char/94749.cc: New test.
	* testsuite/27_io/basic_istream/ignore/wchar_t/94749.cc: New test.
2020-06-11 18:41:37 +01:00
GCC Administrator
ec6ffbb919 Daily bump. 2020-06-11 00:16:45 +00:00
Patrick Palka
a73051a0ea libstdc++: Fix some ranges algos optimizations [PR95578]
ranges::copy and a number of other ranges algorithms have unwrapping
optimizations for iterators of type __normal_iterator, move_iterator and
reverse_iterator.  But in the checks that guard these optimizations we
currently only test that the iterator of the iterator/sentinel pair has
the appropriate type before proceeding with the corresponding
optimization, and do not also test the sentinel type.

This breaks the testcase in this PR because this testcase constructs via
range adaptors a range whose begin() is a __normal_iterator and whose
end() is a custom sentinel type, and then performs ranges::copy on it.
From there we bogusly perform the __normal_iterator unwrapping
optimization on this iterator/sentinel pair, which immediately leads to
a constraint failure since the custom sentinel type does not model
sentinel_for<int*>.

This patch fixes this issue by refining each of the problematic checks
to also test that the iterator and sentinel types are the same before
applying the corresponding unwrapping optimization.  Along the way, some
code simplifications are made.

libstdc++-v3/ChangeLog:

	PR libstdc++/95578
	* include/bits/ranges_algo.h (__lexicographical_compare_fn):
	Also check that the iterator and sentinel have the same type before
	applying the unwrapping optimization for __normal_iterator.
	Split the check into two, one for the first iterator/sentinel
	pair and another for second iterator/sentinel pair.  Remove uses
	of __niter_base, and remove uses of std::move on a
	__normal_iterator.
	* include/bits/ranges_algobase.h (__equal_fn): Likewise.
	(__copy_or_move): Likewise.  Perform similar adjustments for
	the reverse_iterator and move_iterator optimizations.  Inline
	the checks into the if-constexprs, and use using-declarations to
	make them less visually noisy.  Remove uses of __niter_wrap.
	(__copy_or_move_backward): Likewise.
	* testsuite/25_algorithms/copy/95578.cc: New test.
	* testsuite/25_algorithms/copy_backward/95578.cc: New test.
	* testsuite/25_algorithms/equal/95578.cc: New test.
	* testsuite/25_algorithms/lexicographical_compare/95578.cc: New test.
	* testsuite/25_algorithms/move/95578.cc: New test.
	* testsuite/25_algorithms/move_backward/95578.cc: New test.
2020-06-10 17:37:53 -04:00
François Dumont
3a391adf7a libstdc++: Extend memcmp optimization in std::lexicographical_compare
Make the memcmp optimization work for std::deque iterators and safe
iterators.

Co-authored-by: Jonathan Wakely  <jwakely@redhat.com>

libstdc++-v3/ChangeLog:

2020-06-08  François Dumont  <fdumont@gcc.gnu.org>
	    Jonathan Wakely  <jwakely@redhat.com>

	* include/bits/deque.tcc (__lex_cmp_dit): New.
	(__lexicographical_compare_aux1): Define overloads for deque
	iterators.
	* include/bits/stl_algobase.h (__lexicographical_compare::__3way):
	New static member function.
	(__lexicographical_compare<true>::__3way): Likewise.
	(__lexicographical_compare<true>::__lc): Use __3way.
	(__lexicographical_compare_aux): Rename to
	__lexicographical_compare_aux1 and declare overloads for deque
	iterators.
	(__lexicographical_compare_aux): Define new forwarding function
	that calls __lexicographical_compare_aux1 and declare new overloads
	for safe iterators.
	(lexicographical_compare): Do not use __niter_base on
	parameters.
	* include/debug/safe_iterator.tcc
	(__lexicographical_compare_aux): Define overloads for safe
	iterators.
	* testsuite/25_algorithms/lexicographical_compare/1.cc: Add
	checks with random access iterators.
	* testsuite/25_algorithms/lexicographical_compare/deque_iterators/1.cc:
	New test.
2020-06-10 17:48:56 +01:00
GCC Administrator
b952c2cfcd Daily bump. 2020-06-10 00:16:47 +00:00
Jonathan Wakely
733167f9d5 libstdc++: Define converting assignment operator for std::move_iterator
As clarified by LWG 3265, std::move_iterator is supposed to have an
assignment operator that converts from a different specialization of
std::move_iterator, which performs an assignment. That has always been
missing from libstdc++, so assigning a different type actually performs
a converting construction, then an assignment. This is non-conforming
for the (fairly contrived) case where the converting assignment is
well-formed but the converting construction is not.

	* include/bits/stl_iterator.h (move_iterator::operator=): Define.
	* testsuite/24_iterators/move_iterator/dr3265.cc: New test.
2020-06-09 22:16:24 +01:00
Jonathan Wakely
d364705791 libstdc++: Define std::bad_optional_access constructor as defaulted
The standard requires that std::bad_optional_access' default
constructor has a non-throwing exception specification.

	* include/std/optional (bad_optional_access): Define default
	constructor and destructor as defaulted.
	* testsuite/20_util/optional/bad_access.cc: New test.
2020-06-09 22:14:43 +01:00
GCC Administrator
2c455ae06c Daily bump. 2020-06-09 00:16:47 +00:00
Jonathan Wakely
a37fbff12c libstdc++: Fix failing tests
These started failing with the previous commit, because I forgot to add
the tests after adjusting them.

	* testsuite/20_util/default_delete/48631_neg.cc: Adjust dg-error
	line number.
	* testsuite/20_util/default_delete/void_neg.cc: Likewise.
2020-06-08 21:34:46 +01:00
Jonathan Wakely
187da2ce31 libstdc++: Implement operator<< for std::unique_ptr (LWG 2948)
libstdc++-v3/ChangeLog:

	* include/bits/unique_ptr.h (operator<<): Define for C++20.
	* testsuite/20_util/unique_ptr/io/lwg2948.cc: New test.
2020-06-08 21:21:31 +01:00
GCC Administrator
3add342502 Daily bump. 2020-06-05 00:16:30 +00:00
Jonathan Wakely
f2242ec0d3 libstdc++: Remove workarounds for constrained nested class templates
With PR c++/92078 and PR c++/92103 both fixed, nested class templates
can now be constrained. That means a number of namespace-scope helpers
can be moved to the class scope, so they're only visible where they're
needed.

	* include/bits/iterator_concepts.h (__detail::__ptr, __detail::__ref)
	(__detail::__cat, __detail::__diff): Move to class scope in the
	relevant __iterator_traits specializations.
	(__iterator_traits<>): Use nested class templates instead of ones from
	namespace __detail.
	* include/bits/stl_iterator.h (__detail::__common_iter_ptr): Move to
	class scope in iterator_traits<common_iterator<I, S>>.
	(iterator_traits<common_iterator<I, S>>): Use nested class template
	instead of __detail::__common_iter_ptr.
2020-06-04 23:20:49 +01:00
François Dumont
4e05c918d2 libstdc++: Specialize copy/copy_n for istreambuf_iterator and deque iterators
Add __copy_n_a overloads for std::deque iterators to replace with C memmove
when possible. Expose std::copy_n implementation details in pre-C++11 modes
and use it for std::copy overloads.

libstdc++-v3/ChangeLog

	* include/bits/stl_algo.h (__copy_n_a): Move to ...
	* include/bits/stl_algobase.h (__copy_n_a): ...here. Add __strict
	parameter.
	(__copy_n_a(istreambuf_iterator<>, _Size, _Deque_iterator<>, bool)):
	Declare.
	(__niter_base(const _Safe_iterator<_Ite, _Seq,
	random_access_iterator_tag>&)): Declare.
	(__copy_move_a2(istreambuf_iterator<>, istreambuf_iterator<>,
	_Deque_iterator<>)): Declare.
	* include/bits/deque.tcc
	(__copy_move_a2(istreambuf_iterator<>, istreambuf_iterator<>,
	_Deque_iterator<>)): New.
	(__copy_n_a(istreambuf_iterator<>, _Size, _Deque_iterator<>, bool)):
	New.
	* include/bits/streambuf_iterator.h
	(__copy_n_a(istreambuf_iterator<>, _Size, _CharT*, bool)): Adapt.
	* include/debug/safe_iterator.tcc (__niter_base): New.
	* testsuite/25_algorithms/copy/streambuf_iterators/char/4.cc
	(test03): New.
	* testsuite/25_algorithms/copy/streambuf_iterators/char/debug/deque_neg.cc:
	New test.
	* testsuite/25_algorithms/copy_n/debug/istreambuf_ite_deque_neg.cc:
	New test.
	* testsuite/25_algorithms/copy_n/istreambuf_iterator/2.cc: New test.
	* testsuite/25_algorithms/copy_n/istreambuf_iterator/deque.cc:
	New test.
2020-06-04 22:27:47 +02:00
Jonathan Wakely
e1008cd1d8 libstdc++: Make std::copy_n work with negative and non-integral sizes
Since it was added in C++11, std::copy_n and std::ranges::copy_n should
do nothing given a negative size, but for random access iterators we add
the size to the iterator, possibly resulting in undefined behaviour.

Also, C++20 clarified that std::copy_n requires the Size type to be
convertible to an integral type. We previously assumed that it could be
directly used in arithmetic expressions, without conversion to an
integral type.

This also fixes a bug in the random_access_iterator_wrapper helper adds
some convenience aliases for using the iterator wrappers.

libstdc++-v3/ChangeLog:

	* include/bits/ranges_algobase.h (__copy_n_fn): Only call
	ranges::copy for positive values.
	* include/bits/stl_algo.h (copy_n): Convert Size argument to an
	integral type and only call __copy_n for positive values.
	* testsuite/util/testsuite_iterators.h
	(random_access_iterator_wrapper::operator+=): Fix range check for
	negative values.
	(output_container, input_container, forward_container)
	(bidirectional_container, random_access_container): New alias
	templates.
	* testsuite/25_algorithms/copy_n/5.cc: New test.
2020-06-04 14:21:34 +01:00
GCC Administrator
a9312a7926 Daily bump. 2020-06-03 00:16:34 +00:00
Jonathan Wakely
eca833b812 libstdc++: Make debug containers prefer copy ctor to base ctor (PR 90102)
When given a type which can convert to any container-like type, the
C(const C&) copy constructor and C(const C::_Base&) converting
constructor are ambiguous. This change replaces the converting
constructor's parameter with a reference_wrapper-like type so that
calling that constructor requires an additional user-defined conversion.
This gives it a lower rank than the copy constructor, avoiding the
ambiguity.

While testing this change I discovered that __gnu_debug::forward_list
doesn't have a convering constructor from the std::forward_list base, so
this adds it.

We should probably consider whether the converting constructors should
be 'explicit' but I'm not changing that now.

libstdc++-v3/ChangeLog:

	PR libstdc++/90102
	* include/debug/deque (deque(const _Base&)): Replace parameter
	with a struct that wraps a const _Base&.
	* include/debug/forward_list (forward_list(_Base_ref)): New
	constructor.
	* include/debug/list (list(const _Base&)): Replace parameter
	with a struct that wraps a const _Base&.
	* include/debug/map.h (map(const _Base&)): Likewise.
	* include/debug/multimap.h (multimap(const _Base&)): Likewise.
	* include/debug/multiset.h (multiset(const _Base&)): Likewise.
	* include/debug/set.h (set(const _Base&)): Likewise.
	* include/debug/unordered_map (unordered_map(const _Base&))
	(unordered_multimap(const _Base&)): Likewise.
	* include/debug/unordered_set (unordered_set(const _Base&))
	(unordered_multiset(const _Base&)): Likewise.
	* testsuite/23_containers/vector/cons/destructible_debug_neg.cc:
	Adjust dg-error line number.
	* include/debug/vector (vector(const _Base&)): Likewise.
	* testsuite/23_containers/deque/debug/90102.cc: New test.
	* testsuite/23_containers/forward_list/debug/90102.cc: New test.
	* testsuite/23_containers/list/debug/90102.cc: New test.
	* testsuite/23_containers/map/debug/90102.cc: New test.
	* testsuite/23_containers/multimap/debug/90102.cc: New test.
	* testsuite/23_containers/multiset/debug/90102.cc: New test.
	* testsuite/23_containers/set/debug/90102.cc: New test.
	* testsuite/23_containers/unordered_map/debug/90102.cc: New test.
	* testsuite/23_containers/unordered_multimap/debug/90102.cc: New test.
	* testsuite/23_containers/unordered_multiset/debug/90102.cc: New test.
	* testsuite/23_containers/unordered_set/debug/90102.cc: New test.
	* testsuite/23_containers/vector/debug/90102.cc: New test.
2020-06-02 18:13:33 +01:00
GCC Administrator
4a9aa9dec7 Daily bump. 2020-06-02 00:16:25 +00:00
Jonathan Wakely
cd3f067b82 libstdc++: Fix filesystem::u8path for mingw targets (PR 95392)
When I refactored filesystem::path string conversions in
r11-587-584d52b088f9fcf78704b504c3f1f07e17c1cded I failed to update the
mingw-specific code in filesystem::u8path, causing a bootstrap failure.

This fixes it, and further refactors the mingw-specific code along the
same lines as the previous commit. All conversions from UTF-8 strings to
wide strings now use the same helper function, __wstr_from_utf8.

	PR libstdc++/95392
	* include/bits/fs_path.h (path::_S_to_string): Move to
	namespace-scope and rename to ...
	(__detail::__string_from_range): ... this.
	[WINDOWS] (__detail::__wstr_from_utf8): New function template to
	convert a char sequence containing UTF-8 to wstring.
	(path::_S_convert(Iter, Iter)): Adjust call to _S_to_string.
	(path::_S_convert_loc(Iter, Iter, const locale&)): Likewise.
	(u8path(InputIterator, InputIterator)) [WINDOWS]: Use
	__string_from_range to obtain a contiguous range and
	__wstr_from_utf8 to obtain a wide string.
	(u8path(const Source&)) [WINDOWS]: Use __effective_range to
	obtain a contiguous range and __wstr_from_utf8 to obtain a wide
	string.
	(path::_S_convert(const _EcharT*, const _EcharT)) [WINDOWS]:
	Use __wstr_from_utf8.
2020-06-02 00:07:05 +01:00
Jonathan Wakely
118158b646 libstdc++: Fix __gnu_test::input_iterator_wrapper::operator++(int)
I noticed recently that our input_iterator_wrapper utility for writing
tests has the following post-increment operator:

    void
    operator++(int)
    {
      ++*this;
    }

That fails to meet the Cpp17InputIterator requirement that *r++ is
valid. This change makes it return a non-void proxy type that can be
deferenced to produce another proxy, which is convertible to the
value_type. The second proxy converts to const T& to ensure it can't be
written to.

	* testsuite/util/testsuite_iterators.h:
	(input_iterator_wrapper::operator++(int)): Return proxy object.
2020-06-01 18:30:47 +01:00
Jonathan Wakely
258059d91b libstdc++: Document API changes in GCC 10
* doc/xml/manual/evolution.xml: Document deprecation of
	__is_nullptr_t and removal of std::allocator members.
	* doc/html/manual/api.html: Regenerate.
2020-06-01 16:50:53 +01:00
Jonathan Wakely
a1ffe9b6f4 libstdc++: Fix incorrect Docbook links
The <xref> element creates the link text automatically from the link
target, rather than using the text node child of the element. This can
be changed by using an endterm attribute, but it's simpler to just use
the <link> element instead.

	* doc/xml/manual/containers.xml: Replace <xref> with <link>.
	* doc/xml/manual/evolution.xml: Likewise.
	* doc/html/manual/api.html: Regenerate.
	* doc/html/manual/containers.html: Regenerate.
2020-06-01 16:49:31 +01:00
Gerald Pfeifer
e41b988cc5 libstdc++: Update/streamline Valgrind references
* doc/xml/faq.xml: Adjust Valgrind reference and remove another.
	* doc/html/faq.html: Regenerate.
2020-06-01 17:04:22 +02:00
GCC Administrator
e7340ed74a Daily bump. 2020-06-01 00:16:26 +00:00
Gerald Pfeifer
0feb332152 libstdc++: Remove stray change from previous commit
There is a stray change (introducing a bogus line at the top) that
came via 2babbb6760c43bcd803a5e168ef5ecb0be8a5121; remove that again.

	* doc/xml/manual/policy_data_structures_biblio.xml: Remove
	stray change.
2020-06-01 02:10:24 +02:00
Gerald Pfeifer
2babbb6760 libstdc++: Switch www.cs.princeton.edu to https
* doc/xml/manual/policy_data_structures_biblio.xml: Switch
	www.cs.princeton.edu to https.
	* doc/html/manual/policy_data_structures.html: Regenerate.
2020-06-01 02:03:48 +02:00
Douglas B Rupp
0edfc1fd22 Check for more missing math decls on vxworks.
Use the GLIBCXX_CHECK_MATH_DECL macro to check for the full list of
vxworks math decls.

libstdc++-v3/ChangeLog

	* crossconfig.m4 (<*-vxworks>): Check for more math decls.
	* configure: Rebuild.
2020-05-31 14:32:27 -07:00
GCC Administrator
885ef72f27 Daily bump. 2020-05-30 00:16:27 +00:00
H.J. Lu
9051b54827 Avoid nested save_CFLAGS and save_LDFLAGS
Avoid nested save_CFLAGS and save_LDFLAGS by replacing save_CFLAGS and
save_LDFLAGS with cet_save_CFLAGS and cet_save_LDFLAGS in cet.m4.

config/

	PR bootstrap/95413
	* cet.m4: Replace save_CFLAGS and save_LDFLAGS with
	cet_save_CFLAGS and cet_save_LDFLAGS.

gcc/

	PR bootstrap/95413
	* configure: Regenerated.

libatomic/

	PR bootstrap/95413
	* configure: Regenerated.

libbacktrace/

	PR bootstrap/95413
	* configure: Regenerated.

libcc1/

	PR bootstrap/95413
	* configure: Regenerated.

libcpp/

	PR bootstrap/95413
	* configure: Regenerated.

libdecnumber/

	PR bootstrap/95413
	* configure: Regenerated.

libgcc/

	PR bootstrap/95413
	* configure: Regenerated.

libgfortran/

	PR bootstrap/95413
	* configure: Regenerated.

libgomp/

	PR bootstrap/95413
	* configure: Regenerated.

libiberty/

	PR bootstrap/95413
	* configure: Regenerated.

libitm/

	PR bootstrap/95413
	* configure: Regenerated.

libobjc/

	PR bootstrap/95413
	* configure: Regenerated.

libphobos/

	PR bootstrap/95413
	* configure: Regenerated.

libquadmath/

	PR bootstrap/95413
	* configure: Regenerated.

libsanitizer/

	PR bootstrap/95413
	* configure: Regenerated.

libssp/

	PR bootstrap/95413
	* configure: Regenerated.

libstdc++-v3/

	PR bootstrap/95413
	* configure: Regenerated.

libvtv/

	PR bootstrap/95413
	* configure: Regenerated.

lto-plugin/

	PR bootstrap/95413
	* configure: Regenerated.

zlib/

	PR bootstrap/95413
	* configure: Regenerated.
2020-05-29 12:56:40 -07:00
François Dumont
7688e5e8c4 libstdc++: Review unordered_map insert_or_assign/try_emplace (PR 95079)
Those methods are making a double lookup in case of insertion, they can
perform only one.

	PR libstdc++/95079
	* include/bits/hashtable_policy.h (_Insert_base<>::try_emplace): New.
	* include/bits/unordered_map.h (unordered_map<>::try_emplace): Adapt.
	(unordered_map<>::insert_or_assign): Adapt.
2020-05-29 13:12:36 +02:00
GCC Administrator
61f3b60556 Daily bump. 2020-05-28 04:23:50 +00:00