gcc/libstdc++-v3/ChangeLog

1087 lines
48 KiB
Plaintext
Raw Normal View History

2020-02-19 Jonathan Wakely <jwakely@redhat.com>
* include/std/memory_resource (polymorphic_allocator::allocate_bytes)
(polymorphic_allocator::allocate_object)
(polymorphic_allocator::new_object): Add nodiscard attribute (LWG3304).
LWG 3379. "safe" in several library names is misleading
* include/bits/range_access.h (enable_safe_range): Rename to
enable_borrowed_range.
(__detail::__maybe_safe_range): Rename to __maybe_borrowed_range.
(safe_range): Rename to borrowed_range.
* include/bits/ranges_algo.h: Adjust to use new names.
* include/bits/ranges_algobase.h: Likewise.
* include/bits/ranges_uninitialized.h: Likewise.
* include/std/ranges: Likewise.
(safe_iterator_t): Rename to borrowed_iterator_t.
(safe_subrange_t): Rename to borrowed_subrange_t.
* include/std/span: Adjust to use new names.
* include/std/string_view: Likewise.
* include/experimental/string_view: Likewise.
* testsuite/std/ranges/access/begin.cc: Likewise.
* testsuite/std/ranges/access/cbegin.cc: Likewise.
* testsuite/std/ranges/access/cdata.cc: Likewise.
* testsuite/std/ranges/access/cend.cc: Likewise.
* testsuite/std/ranges/access/crbegin.cc: Likewise.
* testsuite/std/ranges/access/crend.cc: Likewise.
* testsuite/std/ranges/access/data.cc: Likewise.
* testsuite/std/ranges/access/end.cc: Likewise.
* testsuite/std/ranges/access/rbegin.cc: Likewise.
* testsuite/std/ranges/access/rend.cc: Likewise.
* testsuite/std/ranges/safe_range.cc: Likewise.
* testsuite/std/ranges/safe_range_types.cc: Likewise.
* testsuite/util/testsuite_iterators.h: Likewise.
* include/std/ranges (tuple_element<0, const subrange<I, S, K>>)
(tuple_element<1, const subrange<I, S, K>>): Add partial
specializations (LWG 3398).
* testsuite/std/ranges/subrange/tuple_like.cc: New test.
* include/bits/ranges_algo.h (__find_fn, __find_first_of_fn)
(__adjacent_find_fn, __remove_if_fn, __remove_copy_if_fn)
(__unique_fn, __unique_copy_fn): Remove redundant conversions to bool.
2020-02-18 Patrick Palka <ppalka@redhat.com>
P1983R0 Wording for GB301, US296, US292, US291, and US283
* include/std/ranges (filter_view::pred): New member function.
(join_view::_Iterator::_Iterator): Remove now-redundant comment since
P1983R0 fixes the highlighted issue in the same way.
(join_view::_Iterator<_Const>): Add friend
join_view::_Iterator<!_Const>.
(join_view::_M_inner): Remove mutable specifier, effectively reverting
the proposed wording changes of P3278.
(join_view::begin): Refine the condition for when to return a const
iterator.
(split_view::_OuterIter::_OuterIter): Adjust constraints.
* testsuite/std/ranges/adaptors/filter.cc: Test that filter_view::pred
exists and works.
2020-02-18 Jonathan Wakely <jwakely@redhat.com>
PR libstdc++/93818
* include/std/ranges (_RangeAdaptor): Add deduction guide.
(filter_view::_Iterator): Add alias _Vp_iter and use in place of
iterator_t<_Vp>.
(filter_view::_Iterator::_S_iter_cat()): Add 'typename'.
(transform_view::_Iterator): Add alias _Base_iter and use in place of
iterator_t<_Base>.
(transform_view::_Iterator::_S_iter_cat()): Add 'typename'.
(join_view::_Iterator): Add _Outer_iter and _Inner_iter aliases.
(join_view::_Iterator::_S_iter_cat()): Add 'typename'.
(split_view::_InnerIter::_S_iter_cat()): Likewise.
* testsuite/20_util/integer_comparisons/equal.cc: Fix invalid
assumption that long is wider than int.
* testsuite/20_util/integer_comparisons/greater_equal.cc: Likewise.
* testsuite/20_util/integer_comparisons/less.cc: Likewise.
* testsuite/20_util/integer_comparisons/less_equal.cc: Likewise.
* testsuite/20_util/integer_comparisons/not_equal.cc: Likewise.
P1976R2 Fixed-size span construction from dynamic range
* include/std/span (__cpp_lib_span): Update value.
(span(It, size_type), span(It, End)): Make conditionally explicit. Add
assertion.
(span(R&&), span(const span<OType, OExtent>&)): Likewise and relax
constraints.
(span::first<Count>(), span::last<Count>()): Use explicit type in
return statement.
(as_bytes, as_writable_bytes): Likewise.
* include/std/version (__cpp_lib_span): Update value.
* testsuite/23_containers/span/1.cc: Check new value.
* testsuite/23_containers/span/2.cc: Check new value.
* testsuite/23_containers/span/explicit.cc: New test.
* include/std/span (span::__is_compatible_array): Simplify alias
template by using requires-clause.
(span::__is_compatible_ref): New alias template for constraining
constructors.
(span::__is_compatible_iterator, span::__is_compatible_range): Remove.
(span(It, size_type), span(It, End)): Use __is_compatible_ref.
(span(T(&)[N], span(array<T, N>&), span(const array<T, N>&)): Remove
redundant parentheses.
(span(R&&)): Add missing constraints.
* include/std/span (span): Reorder members and rename template
parameters to match declarations in the C++2a working paper.
P2116R0 Remove tuple-like protocol support from fixed-extent span
* include/std/span (get, tuple_size, tuple_element): Remove.
* testsuite/23_containers/span/everything.cc: Remove checks for
tuple-like API.
* testsuite/23_containers/span/get_neg.cc: Remove.
* testsuite/23_containers/span/tuple_element_dynamic_neg.cc: Remove.
* testsuite/23_containers/span/tuple_element_oob_neg.cc: Remove.
* testsuite/23_containers/span/tuple_size_neg.cc: Remove.
2020-02-17 Patrick Palka <ppalka@redhat.com>
libstdc++: P2106R0 Alternative wording for GB315 and GB316 libstdc++-v3/ChangeLog: P2106R0 Alternative wording for GB315 and GB316 * include/bits/ranges_algo.h (in_fun_result): New. (for_each_result, for_each_n_result): Change into an alias of in_fun_result. (in_in_result): New. (mismatch_result): Change into an alias of in_in_result. (copy_if_result): Change into an alias of in_out_result. (swap_ranges_result): Change into an alias of in_in_result. (unary_transform_result): Change into an alias of in_out_result. (in_in_out_result): New. (binary_transform_result): Change into an alias of in_in_out_result. (replace_copy_result, replace_copy_if_result, remove_copy_if_result, remove_copy_result, unique_copy_result, reverse_copy_result, rotate_copy_result, partial_sort_copy_result): Change into an alias of in_out_result. (in_out_out_result): New. (partition_copy_result, merge_result): Change into an alias of in_out_out_result. (set_union_result, set_intersection_result): Change into an alias of in_in_out_result. (set_difference_result): Change into an alias of in_out_result. (set_symmetric_difference): Change into an alias of in_in_out_result. (min_max_result): New. (minmax_result, minmax_element_result): Change into an alias of min_max_result. (in_found_result): New. (next_permutation_result, prev_permutation_result): Change into an alias of in_found_result. (__next_permutation_fn::operator(), __prev_permutation_fn::operator()): Adjust following changes to next_permutation_result and prev_permutation_result. * include/bits/ranges_algobase.h (in_out_result): New. (copy_result, move_result, move_backward_result, copy_backward_result, copy_n_result): Change into an alias of in_out_result. * include/bits/ranges_uninitialized.h (uninitialized_copy_result, uninitialized_copy_n_result, uninitialized_move_result, uninitialized_move_n_result): Likewise. * testsuite/25_algorithms/next_permutation/constrained.cc: Adjust uses of structured bindings. * testsuite/25_algorithms/prev_permutation/constrained.cc: Likewise.
2020-02-17 22:13:28 +01:00
P2106R0 Alternative wording for GB315 and GB316
* include/bits/ranges_algo.h (in_fun_result): New.
(for_each_result, for_each_n_result): Change into an alias of
in_fun_result.
(in_in_result): New.
(mismatch_result): Change into an alias of in_in_result.
(copy_if_result): Change into an alias of in_out_result.
(swap_ranges_result): Change into an alias of in_in_result.
(unary_transform_result): Change into an alias of in_out_result.
(in_in_out_result): New.
(binary_transform_result): Change into an alias of in_in_out_result.
(replace_copy_result, replace_copy_if_result, remove_copy_if_result,
remove_copy_result, unique_copy_result, reverse_copy_result,
rotate_copy_result, partial_sort_copy_result): Change into an alias of
in_out_result.
(in_out_out_result): New.
(partition_copy_result, merge_result): Change into an alias of
in_out_out_result.
(set_union_result, set_intersection_result): Change into an alias of
in_in_out_result.
(set_difference_result): Change into an alias of in_out_result.
(set_symmetric_difference): Change into an alias of in_in_out_result.
(min_max_result): New.
(minmax_result, minmax_element_result): Change into an alias of
min_max_result.
(in_found_result): New.
(next_permutation_result, prev_permutation_result): Change into an alias
of in_found_result.
(__next_permutation_fn::operator(), __prev_permutation_fn::operator()):
Adjust following changes to next_permutation_result and
prev_permutation_result.
* include/bits/ranges_algobase.h (in_out_result): New.
(copy_result, move_result, move_backward_result, copy_backward_result,
copy_n_result): Change into an alias of in_out_result.
* include/bits/ranges_uninitialized.h (uninitialized_copy_result,
uninitialized_copy_n_result, uninitialized_move_result,
uninitialized_move_n_result): Likewise.
* testsuite/25_algorithms/next_permutation/constrained.cc: Adjust uses of
structured bindings.
* testsuite/25_algorithms/prev_permutation/constrained.cc: Likewise.
P1243R4 Rangify new algorithms
* include/bits/ranges_algo.h (for_each_n_result, __for_each_n_fn,
for_each_n, __sample_fn, sample, __clamp_fn, clamp): New.
* testsuite/25_algorithms/clamp/constrained.cc: New test.
* testsuite/25_algorithms/for_each/constrained.cc: Augment test.
* testsuite/25_algorithms/sample/constrained.cc: New test.
2020-02-17 Jonathan Wakely <jwakely@redhat.com>
P1964R2 Wording for boolean-testable
* include/bits/ranges_algo.h (__find_fn, __find_first_of_fn)
(__adjacent_find_fn): Cast result of predicate to bool.
* include/std/concepts (__boolean): Remove.
(__detail::__boolean_testable_impl, __detail::__boolean_testable): Add
new helper concepts.
(__detail::__weakly_eq_cmp_with, totally_ordered, totally_ordered_with)
(predicate): Use __boolean_testable instead of boolean.
* libsupc++/compare (__detail::__partially_ordered, _Synth3way):
Likewise.
P1970R2 Consistency for size() functions: Add ranges::ssize
* include/bits/range_access.h (_SSize, ssize): Define for C++20.
* testsuite/std/ranges/access/ssize.cc: New test.
P1956R1 On the names of low-level bit manipulation functions
* include/bits/hashtable_policy.h: Update comment.
* include/std/bit (__ispow2, __ceil2, __floor2, __log2p1): Rename.
(ispow2, ceil2, floor2, log2p1): Likewise.
(__cpp_lib_int_pow2): Add feature test macro.
* include/std/charconv (__to_chars_len_2): Adjust use of __log2p1.
* include/std/memory (assume_aligned): Adjust use of ispow2.
* include/std/version (__cpp_lib_int_pow2): Add.
* libsupc++/new_opa.cc: Adjust use of __ispow2.
* src/c++17/memory_resource.cc: Likewise, and for __ceil2 and __log2p1.
* testsuite/17_intro/freestanding.cc: Adjust use of ispow2.
* testsuite/26_numerics/bit/bit.pow.two/ceil2.cc: Rename to ...
* testsuite/26_numerics/bit/bit.pow.two/bit_ceil.cc: ... here.
* testsuite/26_numerics/bit/bit.pow.two/ceil2_neg.cc: Rename to ...
* testsuite/26_numerics/bit/bit.pow.two/bit_ceil_neg.cc: ... here.
* testsuite/26_numerics/bit/bit.pow.two/floor2.cc: Rename to ...
* testsuite/26_numerics/bit/bit.pow.two/bit_floor.cc: ... here.
* testsuite/26_numerics/bit/bit.pow.two/log2p1.cc: Rename to ...
* testsuite/26_numerics/bit/bit.pow.two/bit_width.cc: ... here.
* testsuite/26_numerics/bit/bit.pow.two/ispow2.cc: Rename to ...
* testsuite/26_numerics/bit/bit.pow.two/has_single_bit.cc: ... here.
* include/std/charconv: Add comment.
PR libstdc++/92546 (partial)
* include/bits/random.h (uniform_random_bit_generator): Move definition
to <bits/uniform_int_dist.h>.
* include/bits/ranges_algo.h: Include <bits/uniform_int_dist.h> instead
of <bits/random.h>.
* include/bits/ranges_algobase.h: Do not include <cmath>.
* include/bits/uniform_int_dist.h (uniform_random_bit_generator):
Move here.
* include/std/ranges: Do not include <limits>.
* testsuite/26_numerics/random/pr60037-neg.cc: Adjust dg-error lineno.
libstdc++: Add lightweight replacement for std::numeric_limits (PR 92546) Many uses of std::numeric_limits in C++17 and C++20 features only really need the min(), max() and digits constants for integral types. By adding __detail::__int_limits we can avoid including the whole <limits> header. The <limits> header isn't especially large, but avoiding it still gives small savings in compilation time and memory usage for the compiler. There are also C++11 features that could benefit from this change (e.g. <bits/hashtable_policy.h> and <bits/uniform_int_dist.h>) but I won't change those until stage 1. The implementation of __int_limits assumes two's complement integers, which is true for all targets supported by GCC. PR libstdc++/92546 (partial) * include/Makefile.am: Add new header. * include/Makefile.in: Regenerate. * include/bits/int_limits.h: New header. * include/bits/parse_numbers.h (__select_int::_Select_int): Replace numeric_limits with __detail::__int_limits. * include/std/bit (__rotl, __rotr, __countl_zero, __countl_one) (__countr_zero, __countr_one, __popcount, __ceil2, __floor2, __log2p1): Likewise. * include/std/charconv (__to_chars_8, __from_chars_binary) (__from_chars_alpha_to_num, from_chars): Likewise. * include/std/memory_resource (polymorphic_allocator::allocate) (polymorphic_allocator::allocate_object): Likewise. * include/std/string_view (basic_string_view::_S_compare): Likewise. * include/std/utility (in_range): Likewise. * testsuite/20_util/integer_comparisons/in_range_neg.cc: Adjust for extra error about incomplete type __int_limits<bool>. * testsuite/26_numerics/bit/bit.count/countl_one.cc: Include <limits>. * testsuite/26_numerics/bit/bit.count/countl_zero.cc: Likewise. * testsuite/26_numerics/bit/bit.count/countr_one.cc: Likewise. * testsuite/26_numerics/bit/bit.count/countr_zero.cc: Likewise. * testsuite/26_numerics/bit/bit.count/popcount.cc: Likewise. * testsuite/26_numerics/bit/bit.pow.two/ceil2_neg.cc: Likewise. * testsuite/26_numerics/bit/bit.pow.two/ceil2.cc: Likewise. * testsuite/26_numerics/bit/bit.pow.two/floor2.cc: Likewise. * testsuite/26_numerics/bit/bit.pow.two/ispow2.cc: Likewise. * testsuite/26_numerics/bit/bit.pow.two/log2p1.cc: Likewise. * testsuite/26_numerics/bit/bit.rotate/rotl.cc: Likewise. * testsuite/26_numerics/bit/bit.rotate/rotr.cc: Likewise.
2020-02-17 15:30:02 +01:00
PR libstdc++/92546 (partial)
* include/Makefile.am: Add new header.
* include/Makefile.in: Regenerate.
* include/bits/int_limits.h: New header.
* include/bits/parse_numbers.h (__select_int::_Select_int): Replace
numeric_limits with __detail::__int_limits.
* include/std/bit (__rotl, __rotr, __countl_zero, __countl_one)
(__countr_zero, __countr_one, __popcount, __ceil2, __floor2, __log2p1):
Likewise.
* include/std/charconv (__to_chars_8, __from_chars_binary)
(__from_chars_alpha_to_num, from_chars): Likewise.
* include/std/memory_resource (polymorphic_allocator::allocate)
(polymorphic_allocator::allocate_object): Likewise.
* include/std/string_view (basic_string_view::_S_compare): Likewise.
* include/std/utility (in_range): Likewise.
* testsuite/20_util/integer_comparisons/in_range_neg.cc: Adjust for
extra error about incomplete type __int_limits<bool>.
* testsuite/26_numerics/bit/bit.count/countl_one.cc: Include <limits>.
* testsuite/26_numerics/bit/bit.count/countl_zero.cc: Likewise.
* testsuite/26_numerics/bit/bit.count/countr_one.cc: Likewise.
* testsuite/26_numerics/bit/bit.count/countr_zero.cc: Likewise.
* testsuite/26_numerics/bit/bit.count/popcount.cc: Likewise.
* testsuite/26_numerics/bit/bit.pow.two/ceil2_neg.cc: Likewise.
* testsuite/26_numerics/bit/bit.pow.two/ceil2.cc: Likewise.
* testsuite/26_numerics/bit/bit.pow.two/floor2.cc: Likewise.
* testsuite/26_numerics/bit/bit.pow.two/ispow2.cc: Likewise.
* testsuite/26_numerics/bit/bit.pow.two/log2p1.cc: Likewise.
* testsuite/26_numerics/bit/bit.rotate/rotl.cc: Likewise.
* testsuite/26_numerics/bit/bit.rotate/rotr.cc: Likewise.
* python/libstdcxx/v6/printers.py (StdCmpCatPrinter.to_string): Update
value for partial_ordering::unordered.
* include/bits/iterator_concepts.h (indirectly_copyable_storable): Add
const-qualified expression variations.
* include/std/concepts (copyable): Likewise.
* include/std/type_traits (__is_standard_integer): New helper trait.
* include/std/utility (cmp_equal, cmp_not_equal, cmp_less, cmp_greater)
(cmp_less_equal, cmp_greater_equal, in_range): Define for C++20.
* include/std/version (__cpp_lib_integer_comparison_functions): Define.
* testsuite/20_util/integer_comparisons/1.cc: New test.
* testsuite/20_util/integer_comparisons/2.cc: New test.
* testsuite/20_util/integer_comparisons/equal.cc: New test.
* testsuite/20_util/integer_comparisons/equal_neg.cc: New test.
* testsuite/20_util/integer_comparisons/greater_equal.cc: New test.
* testsuite/20_util/integer_comparisons/greater_equal_neg.cc: New test.
* testsuite/20_util/integer_comparisons/greater_neg.cc: New test.
* testsuite/20_util/integer_comparisons/in_range.cc: New test.
* testsuite/20_util/integer_comparisons/in_range_neg.cc: New test.
* testsuite/20_util/integer_comparisons/less.cc: New test.
* testsuite/20_util/integer_comparisons/less_equal.cc: New test.
* testsuite/20_util/integer_comparisons/less_equal_neg.cc: New test.
* testsuite/20_util/integer_comparisons/less_neg.cc: New test.
* testsuite/20_util/integer_comparisons/not_equal.cc: New test.
* testsuite/20_util/integer_comparisons/not_equal_neg.cc: New test.
2020-02-16 Patrick Palka <ppalka@redhat.com>
* include/bits/ranges_algo.h (__lexicographical_compare_fn::operator()):
Move code after an early exit constexpr if to under an else branch.
* include/bits/ranges_algobase.h (__equal_fn::operator()): Likewise.
2020-02-15 Patrick Palka <ppalka@redhat.com>
* include/bits/ranges_algo.h: Adjust whitespace and formatting.
* include/bits/ranges_algobase.h: Likewise.
* include/bits/ranges_uninitialized.h: Likewise.
libstdc++: Convert the ranges algorithm entities into function objects This is the standard way to inhibit ADL for these entities, which is required as per [algorithms.requirements] p2 and [specialized.algorithms] p4. The conversion was done mostly mechanically with a custom Vim macro. libstdc++-v3/ChangeLog: * include/bits/ranges_algo.h: (adjacent_find, all_of, any_of, binary_search, copy_if, count, count_if, equal_range, find, find_end, find_first_of, find_if, find_if_not, for_each, generate, generate_n, includes, inplace_merge, is_heap, is_heap_until, is_partitioned, is_permutation, is_sorted, is_sorted_until, lexicographical_compare, lower_bound, make_heap, max, max_element, merge, min, min_element, minmax, minmax_element, mismatch, next_permutation, none_of, nth_element, partial_sort, partial_sort_copy, partition, partition_copy, partition_point, pop_heap, prev_permutation, push_heap, remove, remove_copy, remove_copy_if, remove_if, replace, replace_copy, replace_copy_if, replace_if, reverse, reverse_copy, rotate, rotate_copy, search, search_n, set_difference, set_intersection, set_symmetric_difference, set_union, shuffle, sort, sort_heap, stable_partition, stable_sort, swap_ranges, transform, unique, unique_copy, upper_bound): Convert into function objects. * include/bits/ranges_algobase.h: (equal, copy, move, copy_n, fill_n, fill, move_backward, copy_backward): Likewise. * include/bits/ranges_uninitialized.h (uninitialized_default_construct, uninitialized_default_construct_n, uninitialized_value_construct, uninitialized_value_construct_n, uninitialized_copy, uninitialized_copy_n, uninitialized_move, uninitialized_move_n, uninitialized_fill, uninitialized_fill_n, construct_at, destroy_at, destroy, destroy_n): Likewise.
2020-02-13 18:17:01 +01:00
* include/bits/ranges_algo.h: (adjacent_find, all_of, any_of,
binary_search, copy_if, count, count_if, equal_range, find, find_end,
find_first_of, find_if, find_if_not, for_each, generate, generate_n,
includes, inplace_merge, is_heap, is_heap_until, is_partitioned,
is_permutation, is_sorted, is_sorted_until, lexicographical_compare,
lower_bound, make_heap, max, max_element, merge, min, min_element,
minmax, minmax_element, mismatch, next_permutation, none_of,
nth_element, partial_sort, partial_sort_copy, partition, partition_copy,
partition_point, pop_heap, prev_permutation, push_heap, remove,
remove_copy, remove_copy_if, remove_if, replace, replace_copy,
replace_copy_if, replace_if, reverse, reverse_copy, rotate, rotate_copy,
search, search_n, set_difference, set_intersection,
set_symmetric_difference, set_union, shuffle, sort, sort_heap,
stable_partition, stable_sort, swap_ranges, transform, unique,
unique_copy, upper_bound): Convert into function objects.
* include/bits/ranges_algobase.h: (equal, copy, move, copy_n, fill_n,
fill, move_backward, copy_backward): Likewise.
* include/bits/ranges_uninitialized.h (uninitialized_default_construct,
uninitialized_default_construct_n, uninitialized_value_construct,
uninitialized_value_construct_n, uninitialized_copy,
uninitialized_copy_n, uninitialized_move, uninitialized_move_n,
uninitialized_fill, uninitialized_fill_n, construct_at, destroy_at,
destroy, destroy_n): Likewise.
* include/bits/ranges_algo.h (ranges::__find_end): Fold into ...
(ranges::find_end): ... here.
(ranges::__lexicographical_compare): Fold into ...
(ranges::lexicographical_compare): ... here.
* include/bits/ranges_algobase.h (ranges::__equal): Fold into ...
(ranges::equal): ... here.
2020-02-15 Jonathan Wakely <jwakely@redhat.com>
* include/bits/erase_if.h (__cpp_lib_erase_if): Define to 202002L.
* include/std/deque: Likewise.
* include/std/forward_list: Likewise.
* include/std/list: Likewise.
* include/std/string: Likewise.
* include/std/vector: Likewise.
* include/std/version: Likewise.
* testsuite/23_containers/deque/erasure.cc: Test for new value.
* 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-02-15 Jonathan Wakely <jwakely@redhat.com>
* include/bits/random.h (uniform_random_bit_generator): Require min()
and max() to be constant expressions and min() to be less than max().
* testsuite/26_numerics/random/concept.cc: Check additional cases.
* testsuite/26_numerics/random/pr60037-neg.cc: Adjust dg-error lineno.
2020-02-13 Patrick Palka <ppalka@redhat.com>
* include/Makefile.am: Add <bits/ranges_uninitialized.h>.
* include/Makefile.in: Regenerate.
* include/bits/ranges_uninitialized.h: New header.
* include/std/memory: Include it.
* testsuite/20_util/specialized_algorithms/destroy/constrained.cc: New
test.
* .../uninitialized_copy/constrained.cc: New test.
* .../uninitialized_default_construct/constrained.cc: New test.
* .../uninitialized_fill/constrained.cc: New test.
* .../uninitialized_move/constrained.cc: New test.
* .../uninitialized_value_construct/constrained.cc: New test.
* include/Makefile.am: Add bits/ranges_algobase.h
* include/Makefile.in: Regenerate.
* bits/ranges_algo.h: Include <bits/ranges_algobase.h> and refactor
existing #includes.
(__detail::__is_normal_iterator, __detail::is_reverse_iterator,
__detail::__is_move_iterator, copy_result, move_result,
__equal, equal, copy_result, move_result, move_backward_result,
copy_backward_result, __copy_or_move_backward, __copy_or_move, copy,
move, copy_backward, move_backward, copy_n_result, copy_n, fill_n,
fill): Split out into ...
* bits/range_algobase.h: ... this new header.
2020-02-12 Patrick Palka <ppalka@redhat.com>
LWG 3389 and LWG 3390
* include/bits/stl_iterator.h (move_move_iterator): Use std::move when
constructing the move_iterator with __i.
(counted_iterator::counted_iterator): Use std::move when initializing
M_current with __i.
* testsuite/24_iterators/counted_iterator/lwg3389.cc: New test.
* testsuite/24_iterators/move_iterator/lwg3390.cc: New test.
2020-02-12 Sandra Loosemore <sandra@codesourcery.com>
PR libstdc++/79193
PR libstdc++/88999
* configure: Regenerated.
2020-02-12 François Dumont <fdumont@gcc.gnu.org>
* include/bits/hashtable.h
(_Hashtable<>(_Hashtable&&, std::allocator_type&)): Add
missing std namespace qualification to forward call.
2020-02-09 Jonathan Wakely <jwakely@redhat.com>
* testsuite/20_util/function_objects/range.cmp/equal_to.cc: Fix
comment.
* testsuite/20_util/function_objects/range.cmp/less.ccL Likewise.
* include/std/ranges: Fix non-ASCII characters in comment.
* include/bits/range_cmp.h (__detail::__eq_builtin_ptr_cmp): Require
equality comparison to be valid and return bool.
(__detail::__less_builtin_ptr_cmp): Likewise for less-than comparison.
* testsuite/20_util/function_objects/range.cmp/equal_to.cc: Check
type with ambiguous conversion to fundamental types.
* testsuite/20_util/function_objects/range.cmp/less.cc: Likewise.
2020-02-07 Jonathan Wakely <jwakely@redhat.com>
* include/bits/iterator_concepts.h (iter_difference_t, iter_value_t):
Use remove_cvref_t.
(readable_traits): Rename to indirectly_readable_traits.
(readable): Rename to indirectly_readable.
(writable): Rename to indirectly_writable.
(__detail::__iter_exchange_move): Do not use remove_reference_t.
(indirectly_swappable): Adjust requires expression parameter types.
expression.
* include/bits/ranges_algo.h (ranges::transform, ranges::replace)
(ranges::replace_if, ranges::generate_n, ranges::generate)
(ranges::remove): Use new name for writable.
* include/bits/stl_iterator.h (__detail::__common_iter_has_arrow):
Use new name for readable.
* include/ext/pointer.h (readable_traits<_Pointer_adapter<P>>): Use
new name for readable_traits.
* testsuite/24_iterators/associated_types/readable.traits.cc: Likewise.
* testsuite/24_iterators/indirect_callable/projected.cc: Adjust for
new definition of indirectly_readable.
* include/bits/stl_iterator.h (__detail::__common_iter_ptr): Change
to take parameters of common_iterator, instead of the common_iterator
type itself. Fix argument for __common_iter_has_arrow constraint.
(iterator_traits<common_iterator<I, S>>::pointer): Adjust.
2020-02-07 Jonathan Wakely <jwakely@redhat.com>
* include/std/ranges (iota_view): Add braces to prevent -Wempty-body
warning.
(basic_istream_view::_Iterator::operator++()): Add missing return.
libstdc++: Implement C++20 range adaptors This patch implements [range.adaptors]. It also includes the changes from P3280 and P3278 and P3323, without which many standard examples won't work. The implementation is mostly dictated by the spec and there was not much room for implementation discretion. The most interesting part that was not specified by the spec is the design of the range adaptors and range adaptor closures, which I tried to design in a way that minimizes boilerplate and statefulness (so that e.g. the composition of two stateless closures is stateless). What is left unimplemented is caching of calls to begin() in filter_view, drop_view and reverse_view, which is required to guarantee that begin() has amortized constant time complexity. I can implement this in a subsequent patch. "Interesting" parts of the patch are marked with XXX comments. libstdc++-v3/ChangeLog: Implement C++20 range adaptors * include/std/ranges: Include <bits/refwrap.h> and <tuple>. (subrange::_S_store_size): Mark as const instead of constexpr to avoid what seems to be a bug in GCC. (__detail::__box): Give it defaulted copy and move constructors. (views::_Single::operator()): Mark constexpr. (views::_Iota::operator()): Mark constexpr. (__detail::Empty): Define. (views::_RangeAdaptor, views::_RangeAdaptorClosure, ref_view, all_view, views::all, filter_view, views::filter, transform_view, views::transform, take_view, views::take, take_while_view, views::take_while, drop_view, views::drop, join_view, views::join, __detail::require_constant, __detail::tiny_range, split_view, views::split, views::_Counted, views::counted, common_view, views::common, reverse_view, views::reverse, views::__detail::__is_reversible_subrange, views::__detail::__is_reverse_view, reverse_view, views::reverse, __detail::__has_tuple_element, elements_view, views::elements, views::keys, views::values): Define. * testsuite/std/ranges/adaptors/all.cc: New test. * testsuite/std/ranges/adaptors/common.cc: Likewise. * testsuite/std/ranges/adaptors/counted.cc: Likewise. * testsuite/std/ranges/adaptors/drop.cc: Likewise. * testsuite/std/ranges/adaptors/drop_while.cc: Likewise. * testsuite/std/ranges/adaptors/elements.cc: Likewise. * testsuite/std/ranges/adaptors/filter.cc: Likewise. * testsuite/std/ranges/adaptors/join.cc: Likewise. * testsuite/std/ranges/adaptors/reverse.cc: Likewise. * testsuite/std/ranges/adaptors/split.cc: Likewise. * testsuite/std/ranges/adaptors/take.cc: Likewise. * testsuite/std/ranges/adaptors/take_while.cc: Likewise. * testsuite/std/ranges/adaptors/transform.cc: Likewise.
2020-01-30 23:37:07 +01:00
2020-02-07 Patrick Palka <ppalka@redhat.com>
2020-02-07 16:08:06 +01:00
* include/bits/ranges_algo.h: Remove extraneous &&.
* include/std/ranges (ranges::__detail::__stream_extractable,
ranges::basic_istream_view, ranges::istream_view): Define.
* testsuite/std/ranges/istream_view: New test.
libstdc++: Implement C++20 range adaptors This patch implements [range.adaptors]. It also includes the changes from P3280 and P3278 and P3323, without which many standard examples won't work. The implementation is mostly dictated by the spec and there was not much room for implementation discretion. The most interesting part that was not specified by the spec is the design of the range adaptors and range adaptor closures, which I tried to design in a way that minimizes boilerplate and statefulness (so that e.g. the composition of two stateless closures is stateless). What is left unimplemented is caching of calls to begin() in filter_view, drop_view and reverse_view, which is required to guarantee that begin() has amortized constant time complexity. I can implement this in a subsequent patch. "Interesting" parts of the patch are marked with XXX comments. libstdc++-v3/ChangeLog: Implement C++20 range adaptors * include/std/ranges: Include <bits/refwrap.h> and <tuple>. (subrange::_S_store_size): Mark as const instead of constexpr to avoid what seems to be a bug in GCC. (__detail::__box): Give it defaulted copy and move constructors. (views::_Single::operator()): Mark constexpr. (views::_Iota::operator()): Mark constexpr. (__detail::Empty): Define. (views::_RangeAdaptor, views::_RangeAdaptorClosure, ref_view, all_view, views::all, filter_view, views::filter, transform_view, views::transform, take_view, views::take, take_while_view, views::take_while, drop_view, views::drop, join_view, views::join, __detail::require_constant, __detail::tiny_range, split_view, views::split, views::_Counted, views::counted, common_view, views::common, reverse_view, views::reverse, views::__detail::__is_reversible_subrange, views::__detail::__is_reverse_view, reverse_view, views::reverse, __detail::__has_tuple_element, elements_view, views::elements, views::keys, views::values): Define. * testsuite/std/ranges/adaptors/all.cc: New test. * testsuite/std/ranges/adaptors/common.cc: Likewise. * testsuite/std/ranges/adaptors/counted.cc: Likewise. * testsuite/std/ranges/adaptors/drop.cc: Likewise. * testsuite/std/ranges/adaptors/drop_while.cc: Likewise. * testsuite/std/ranges/adaptors/elements.cc: Likewise. * testsuite/std/ranges/adaptors/filter.cc: Likewise. * testsuite/std/ranges/adaptors/join.cc: Likewise. * testsuite/std/ranges/adaptors/reverse.cc: Likewise. * testsuite/std/ranges/adaptors/split.cc: Likewise. * testsuite/std/ranges/adaptors/take.cc: Likewise. * testsuite/std/ranges/adaptors/take_while.cc: Likewise. * testsuite/std/ranges/adaptors/transform.cc: Likewise.
2020-01-30 23:37:07 +01:00
Implement C++20 range adaptors
* include/std/ranges: Include <bits/refwrap.h> and <tuple>.
(subrange::_S_store_size): Mark as const instead of constexpr to
avoid what seems to be a bug in GCC.
(__detail::__box): Give it defaulted copy and move constructors.
2020-02-07 15:30:53 +01:00
(ranges::views::_Single::operator()): Mark constexpr.
(ranges::views::_Iota::operator()): Mark constexpr.
libstdc++: Implement C++20 range adaptors This patch implements [range.adaptors]. It also includes the changes from P3280 and P3278 and P3323, without which many standard examples won't work. The implementation is mostly dictated by the spec and there was not much room for implementation discretion. The most interesting part that was not specified by the spec is the design of the range adaptors and range adaptor closures, which I tried to design in a way that minimizes boilerplate and statefulness (so that e.g. the composition of two stateless closures is stateless). What is left unimplemented is caching of calls to begin() in filter_view, drop_view and reverse_view, which is required to guarantee that begin() has amortized constant time complexity. I can implement this in a subsequent patch. "Interesting" parts of the patch are marked with XXX comments. libstdc++-v3/ChangeLog: Implement C++20 range adaptors * include/std/ranges: Include <bits/refwrap.h> and <tuple>. (subrange::_S_store_size): Mark as const instead of constexpr to avoid what seems to be a bug in GCC. (__detail::__box): Give it defaulted copy and move constructors. (views::_Single::operator()): Mark constexpr. (views::_Iota::operator()): Mark constexpr. (__detail::Empty): Define. (views::_RangeAdaptor, views::_RangeAdaptorClosure, ref_view, all_view, views::all, filter_view, views::filter, transform_view, views::transform, take_view, views::take, take_while_view, views::take_while, drop_view, views::drop, join_view, views::join, __detail::require_constant, __detail::tiny_range, split_view, views::split, views::_Counted, views::counted, common_view, views::common, reverse_view, views::reverse, views::__detail::__is_reversible_subrange, views::__detail::__is_reverse_view, reverse_view, views::reverse, __detail::__has_tuple_element, elements_view, views::elements, views::keys, views::values): Define. * testsuite/std/ranges/adaptors/all.cc: New test. * testsuite/std/ranges/adaptors/common.cc: Likewise. * testsuite/std/ranges/adaptors/counted.cc: Likewise. * testsuite/std/ranges/adaptors/drop.cc: Likewise. * testsuite/std/ranges/adaptors/drop_while.cc: Likewise. * testsuite/std/ranges/adaptors/elements.cc: Likewise. * testsuite/std/ranges/adaptors/filter.cc: Likewise. * testsuite/std/ranges/adaptors/join.cc: Likewise. * testsuite/std/ranges/adaptors/reverse.cc: Likewise. * testsuite/std/ranges/adaptors/split.cc: Likewise. * testsuite/std/ranges/adaptors/take.cc: Likewise. * testsuite/std/ranges/adaptors/take_while.cc: Likewise. * testsuite/std/ranges/adaptors/transform.cc: Likewise.
2020-01-30 23:37:07 +01:00
(__detail::Empty): Define.
2020-02-07 15:30:53 +01:00
(ranges::views::__closure::_RangeAdaptor,
ranges::views::__closure::_RangeAdaptorClosure, ref_view, all_view,
ranges::views::all, ranges::__detail::find_if,
ranges::__detail::find_if_not, ranges::__detail::mismatch,
ranges::detail::min, filter_view, ranges::views::filter, transform_view,
ranges::views::transform, take_view, ranges::views::take,
take_while_view, ranges::views::take_while, drop_view,
ranges::views::drop, join_view, ranges::views::join,
libstdc++: Implement C++20 range adaptors This patch implements [range.adaptors]. It also includes the changes from P3280 and P3278 and P3323, without which many standard examples won't work. The implementation is mostly dictated by the spec and there was not much room for implementation discretion. The most interesting part that was not specified by the spec is the design of the range adaptors and range adaptor closures, which I tried to design in a way that minimizes boilerplate and statefulness (so that e.g. the composition of two stateless closures is stateless). What is left unimplemented is caching of calls to begin() in filter_view, drop_view and reverse_view, which is required to guarantee that begin() has amortized constant time complexity. I can implement this in a subsequent patch. "Interesting" parts of the patch are marked with XXX comments. libstdc++-v3/ChangeLog: Implement C++20 range adaptors * include/std/ranges: Include <bits/refwrap.h> and <tuple>. (subrange::_S_store_size): Mark as const instead of constexpr to avoid what seems to be a bug in GCC. (__detail::__box): Give it defaulted copy and move constructors. (views::_Single::operator()): Mark constexpr. (views::_Iota::operator()): Mark constexpr. (__detail::Empty): Define. (views::_RangeAdaptor, views::_RangeAdaptorClosure, ref_view, all_view, views::all, filter_view, views::filter, transform_view, views::transform, take_view, views::take, take_while_view, views::take_while, drop_view, views::drop, join_view, views::join, __detail::require_constant, __detail::tiny_range, split_view, views::split, views::_Counted, views::counted, common_view, views::common, reverse_view, views::reverse, views::__detail::__is_reversible_subrange, views::__detail::__is_reverse_view, reverse_view, views::reverse, __detail::__has_tuple_element, elements_view, views::elements, views::keys, views::values): Define. * testsuite/std/ranges/adaptors/all.cc: New test. * testsuite/std/ranges/adaptors/common.cc: Likewise. * testsuite/std/ranges/adaptors/counted.cc: Likewise. * testsuite/std/ranges/adaptors/drop.cc: Likewise. * testsuite/std/ranges/adaptors/drop_while.cc: Likewise. * testsuite/std/ranges/adaptors/elements.cc: Likewise. * testsuite/std/ranges/adaptors/filter.cc: Likewise. * testsuite/std/ranges/adaptors/join.cc: Likewise. * testsuite/std/ranges/adaptors/reverse.cc: Likewise. * testsuite/std/ranges/adaptors/split.cc: Likewise. * testsuite/std/ranges/adaptors/take.cc: Likewise. * testsuite/std/ranges/adaptors/take_while.cc: Likewise. * testsuite/std/ranges/adaptors/transform.cc: Likewise.
2020-01-30 23:37:07 +01:00
__detail::require_constant, __detail::tiny_range, split_view,
2020-02-07 15:30:53 +01:00
ranges::views::split, ranges::views::_Counted, ranges::views::counted,
common_view, ranges::views::common, reverse_view,
ranges::views::reverse,
ranges::views::__detail::__is_reversible_subrange,
ranges::views::__detail::__is_reverse_view, reverse_view,
ranges::views::reverse, __detail::__has_tuple_element, elements_view,
ranges::views::elements, ranges::views::keys, ranges::views::values):
Define.
(views): Alias for ranges::views.
(tuple_size<ranges::subrange<>>, tuple_element<0, ranges::subrange>,
tuple_element<1, ranges::subrange>): New partial specializations.
libstdc++: Implement C++20 range adaptors This patch implements [range.adaptors]. It also includes the changes from P3280 and P3278 and P3323, without which many standard examples won't work. The implementation is mostly dictated by the spec and there was not much room for implementation discretion. The most interesting part that was not specified by the spec is the design of the range adaptors and range adaptor closures, which I tried to design in a way that minimizes boilerplate and statefulness (so that e.g. the composition of two stateless closures is stateless). What is left unimplemented is caching of calls to begin() in filter_view, drop_view and reverse_view, which is required to guarantee that begin() has amortized constant time complexity. I can implement this in a subsequent patch. "Interesting" parts of the patch are marked with XXX comments. libstdc++-v3/ChangeLog: Implement C++20 range adaptors * include/std/ranges: Include <bits/refwrap.h> and <tuple>. (subrange::_S_store_size): Mark as const instead of constexpr to avoid what seems to be a bug in GCC. (__detail::__box): Give it defaulted copy and move constructors. (views::_Single::operator()): Mark constexpr. (views::_Iota::operator()): Mark constexpr. (__detail::Empty): Define. (views::_RangeAdaptor, views::_RangeAdaptorClosure, ref_view, all_view, views::all, filter_view, views::filter, transform_view, views::transform, take_view, views::take, take_while_view, views::take_while, drop_view, views::drop, join_view, views::join, __detail::require_constant, __detail::tiny_range, split_view, views::split, views::_Counted, views::counted, common_view, views::common, reverse_view, views::reverse, views::__detail::__is_reversible_subrange, views::__detail::__is_reverse_view, reverse_view, views::reverse, __detail::__has_tuple_element, elements_view, views::elements, views::keys, views::values): Define. * testsuite/std/ranges/adaptors/all.cc: New test. * testsuite/std/ranges/adaptors/common.cc: Likewise. * testsuite/std/ranges/adaptors/counted.cc: Likewise. * testsuite/std/ranges/adaptors/drop.cc: Likewise. * testsuite/std/ranges/adaptors/drop_while.cc: Likewise. * testsuite/std/ranges/adaptors/elements.cc: Likewise. * testsuite/std/ranges/adaptors/filter.cc: Likewise. * testsuite/std/ranges/adaptors/join.cc: Likewise. * testsuite/std/ranges/adaptors/reverse.cc: Likewise. * testsuite/std/ranges/adaptors/split.cc: Likewise. * testsuite/std/ranges/adaptors/take.cc: Likewise. * testsuite/std/ranges/adaptors/take_while.cc: Likewise. * testsuite/std/ranges/adaptors/transform.cc: Likewise.
2020-01-30 23:37:07 +01:00
* testsuite/std/ranges/adaptors/all.cc: New test.
* testsuite/std/ranges/adaptors/common.cc: Likewise.
* testsuite/std/ranges/adaptors/counted.cc: Likewise.
* testsuite/std/ranges/adaptors/drop.cc: Likewise.
* testsuite/std/ranges/adaptors/drop_while.cc: Likewise.
* testsuite/std/ranges/adaptors/elements.cc: Likewise.
* testsuite/std/ranges/adaptors/filter.cc: Likewise.
* testsuite/std/ranges/adaptors/join.cc: Likewise.
* testsuite/std/ranges/adaptors/reverse.cc: Likewise.
* testsuite/std/ranges/adaptors/split.cc: Likewise.
* testsuite/std/ranges/adaptors/take.cc: Likewise.
* testsuite/std/ranges/adaptors/take_while.cc: Likewise.
* testsuite/std/ranges/adaptors/transform.cc: Likewise.
2020-02-07 Jonathan Wakely <jwakely@redhat.com>
* libsupc++/compare (__cmp_cat::type): Define typedef for underlying
type of enumerations and comparison category types.
(__cmp_cat::_Ord, __cmp_cat::_Ncmp): Add underlying type.
(__cmp_cat::_Ncmp::unordered): Change value to 2.
(partial_ordering::_M_value, weak_ordering::_M_value)
(strong_ordering::_M_value): Change type to __cmp_cat::type.
(partial_ordering::_M_is_ordered): Remove data member.
(partial_ordering): Use second bit of _M_value for unordered. Adjust
comparison operators.
(weak_ordering::operator partial_ordering): Simplify to remove
branches.
(operator<=>(unspecified, weak_ordering)): Likewise.
(strong_ordering::operator partial_ordering): Likewise.
(strong_ordering::operator weak_ordering): Likewise.
(operator<=>(unspecified, strong_ordering)): Likewise.
* testsuite/18_support/comparisons/categories/partialord.cc: New test.
* testsuite/18_support/comparisons/categories/strongord.cc: New test.
* testsuite/18_support/comparisons/categories/weakord.cc: New test.
* include/std/ranges (iota_view::_Iterator): Fix typo in name of
__cpp_lib_three_way_comparison macro and use deduced return type for
operator<=>.
* testsuite/std/ranges/iota/iterator.cc: New test.
libstdc++: Implement C++20 constrained algorithms This patch implements the C++20 ranges overloads for the algorithms in [algorithms]. Most of the algorithms were reimplemented, with each of their implementations very closely following the existing implementation in bits/stl_algo.h and bits/stl_algobase.h. The reason for reimplementing most of the algorithms instead of forwarding to their STL-style overload is because forwarding cannot be conformantly and efficiently performed for algorithms that operate on non-random-access iterators. But algorithms that operate on random access iterators can safely and efficiently be forwarded to the STL-style implementation, and this patch does so for push_heap, pop_heap, make_heap, sort_heap, sort, stable_sort, nth_element, inplace_merge and stable_partition. What's missing from this patch is debug-iterator and container specializations that are present for some of the STL-style algorithms that need to be ported over to the ranges algos. I marked them missing at TODO comments. There are also some other minor outstanding TODOs. The code that could use the most thorough review is ranges::__copy_or_move, ranges::__copy_or_move_backward, ranges::__equal and ranges::__lexicographical_compare. In the tests, I tried to test the interface of each new overload, as well as the correctness of the new implementation. libstdc++-v3/ChangeLog: Implement C++20 constrained algorithms * include/Makefile.am: Add new header. * include/Makefile.in: Regenerate. * include/std/algorithm: Include <bits/ranges_algo.h>. * include/bits/ranges_algo.h: New file. * testsuite/25_algorithms/adjacent_find/constrained.cc: New test. * testsuite/25_algorithms/all_of/constrained.cc: New test. * testsuite/25_algorithms/any_of/constrained.cc: New test. * testsuite/25_algorithms/binary_search/constrained.cc: New test. * testsuite/25_algorithms/copy/constrained.cc: New test. * testsuite/25_algorithms/copy_backward/constrained.cc: New test. * testsuite/25_algorithms/copy_if/constrained.cc: New test. * testsuite/25_algorithms/copy_n/constrained.cc: New test. * testsuite/25_algorithms/count/constrained.cc: New test. * testsuite/25_algorithms/count_if/constrained.cc: New test. * testsuite/25_algorithms/equal/constrained.cc: New test. * testsuite/25_algorithms/equal_range/constrained.cc: New test. * testsuite/25_algorithms/fill/constrained.cc: New test. * testsuite/25_algorithms/fill_n/constrained.cc: New test. * testsuite/25_algorithms/find/constrained.cc: New test. * testsuite/25_algorithms/find_end/constrained.cc: New test. * testsuite/25_algorithms/find_first_of/constrained.cc: New test. * testsuite/25_algorithms/find_if/constrained.cc: New test. * testsuite/25_algorithms/find_if_not/constrained.cc: New test. * testsuite/25_algorithms/for_each/constrained.cc: New test. * testsuite/25_algorithms/generate/constrained.cc: New test. * testsuite/25_algorithms/generate_n/constrained.cc: New test. * testsuite/25_algorithms/heap/constrained.cc: New test. * testsuite/25_algorithms/includes/constrained.cc: New test. * testsuite/25_algorithms/inplace_merge/constrained.cc: New test. * testsuite/25_algorithms/is_partitioned/constrained.cc: New test. * testsuite/25_algorithms/is_permutation/constrained.cc: New test. * testsuite/25_algorithms/is_sorted/constrained.cc: New test. * testsuite/25_algorithms/is_sorted_until/constrained.cc: New test. * testsuite/25_algorithms/lexicographical_compare/constrained.cc: New test. * testsuite/25_algorithms/lower_bound/constrained.cc: New test. * testsuite/25_algorithms/max/constrained.cc: New test. * testsuite/25_algorithms/max_element/constrained.cc: New test. * testsuite/25_algorithms/merge/constrained.cc: New test. * testsuite/25_algorithms/min/constrained.cc: New test. * testsuite/25_algorithms/min_element/constrained.cc: New test. * testsuite/25_algorithms/minmax/constrained.cc: New test. * testsuite/25_algorithms/minmax_element/constrained.cc: New test. * testsuite/25_algorithms/mismatch/constrained.cc: New test. * testsuite/25_algorithms/move/constrained.cc: New test. * testsuite/25_algorithms/move_backward/constrained.cc: New test. * testsuite/25_algorithms/next_permutation/constrained.cc: New test. * testsuite/25_algorithms/none_of/constrained.cc: New test. * testsuite/25_algorithms/nth_element/constrained.cc: New test. * testsuite/25_algorithms/partial_sort/constrained.cc: New test. * testsuite/25_algorithms/partial_sort_copy/constrained.cc: New test. * testsuite/25_algorithms/partition/constrained.cc: New test. * testsuite/25_algorithms/partition_copy/constrained.cc: New test. * testsuite/25_algorithms/partition_point/constrained.cc: New test. * testsuite/25_algorithms/prev_permutation/constrained.cc: New test. * testsuite/25_algorithms/remove/constrained.cc: New test. * testsuite/25_algorithms/remove_copy/constrained.cc: New test. * testsuite/25_algorithms/remove_copy_if/constrained.cc: New test. * testsuite/25_algorithms/remove_if/constrained.cc: New test. * testsuite/25_algorithms/replace/constrained.cc: New test. * testsuite/25_algorithms/replace_copy/constrained.cc: New test. * testsuite/25_algorithms/replace_copy_if/constrained.cc: New test. * testsuite/25_algorithms/replace_if/constrained.cc: New test. * testsuite/25_algorithms/reverse/constrained.cc: New test. * testsuite/25_algorithms/reverse_copy/constrained.cc: New test. * testsuite/25_algorithms/rotate/constrained.cc: New test. * testsuite/25_algorithms/rotate_copy/constrained.cc: New test. * testsuite/25_algorithms/search/constrained.cc: New test. * testsuite/25_algorithms/search_n/constrained.cc: New test. * testsuite/25_algorithms/set_difference/constrained.cc: New test. * testsuite/25_algorithms/set_intersection/constrained.cc: New test. * testsuite/25_algorithms/set_symmetric_difference/constrained.cc: New test. * testsuite/25_algorithms/set_union/constrained.cc: New test. * testsuite/25_algorithms/shuffle/constrained.cc: New test. * testsuite/25_algorithms/sort/constrained.cc: New test. * testsuite/25_algorithms/stable_partition/constrained.cc: New test. * testsuite/25_algorithms/stable_sort/constrained.cc: New test. * testsuite/25_algorithms/swap_ranges/constrained.cc: New test. * testsuite/25_algorithms/transform/constrained.cc: New test. * testsuite/25_algorithms/unique/constrained.cc: New test. * testsuite/25_algorithms/unique_copy/constrained.cc: New test. * testsuite/25_algorithms/upper_bound/constrained.cc: New test.
2020-01-10 23:11:07 +01:00
2020-02-07 Patrick Palka <ppalka@redhat.com>
Jonathan Wakely <jwakely@redhat.com>
Implement C++20 constrained algorithms
* include/Makefile.am: Add new header.
* include/Makefile.in: Regenerate.
* include/std/algorithm: Include <bits/ranges_algo.h>.
* include/bits/ranges_algo.h: New file.
* testsuite/25_algorithms/adjacent_find/constrained.cc: New test.
* testsuite/25_algorithms/all_of/constrained.cc: New test.
* testsuite/25_algorithms/any_of/constrained.cc: New test.
* testsuite/25_algorithms/binary_search/constrained.cc: New test.
* testsuite/25_algorithms/copy/constrained.cc: New test.
* testsuite/25_algorithms/copy_backward/constrained.cc: New test.
* testsuite/25_algorithms/copy_if/constrained.cc: New test.
* testsuite/25_algorithms/copy_n/constrained.cc: New test.
* testsuite/25_algorithms/count/constrained.cc: New test.
* testsuite/25_algorithms/count_if/constrained.cc: New test.
* testsuite/25_algorithms/equal/constrained.cc: New test.
* testsuite/25_algorithms/equal_range/constrained.cc: New test.
* testsuite/25_algorithms/fill/constrained.cc: New test.
* testsuite/25_algorithms/fill_n/constrained.cc: New test.
* testsuite/25_algorithms/find/constrained.cc: New test.
* testsuite/25_algorithms/find_end/constrained.cc: New test.
* testsuite/25_algorithms/find_first_of/constrained.cc: New test.
* testsuite/25_algorithms/find_if/constrained.cc: New test.
* testsuite/25_algorithms/find_if_not/constrained.cc: New test.
* testsuite/25_algorithms/for_each/constrained.cc: New test.
* testsuite/25_algorithms/generate/constrained.cc: New test.
* testsuite/25_algorithms/generate_n/constrained.cc: New test.
* testsuite/25_algorithms/heap/constrained.cc: New test.
* testsuite/25_algorithms/includes/constrained.cc: New test.
* testsuite/25_algorithms/inplace_merge/constrained.cc: New test.
* testsuite/25_algorithms/is_partitioned/constrained.cc: New test.
* testsuite/25_algorithms/is_permutation/constrained.cc: New test.
* testsuite/25_algorithms/is_sorted/constrained.cc: New test.
* testsuite/25_algorithms/is_sorted_until/constrained.cc: New test.
* testsuite/25_algorithms/lexicographical_compare/constrained.cc: New
test.
* testsuite/25_algorithms/lower_bound/constrained.cc: New test.
* testsuite/25_algorithms/max/constrained.cc: New test.
* testsuite/25_algorithms/max_element/constrained.cc: New test.
* testsuite/25_algorithms/merge/constrained.cc: New test.
* testsuite/25_algorithms/min/constrained.cc: New test.
* testsuite/25_algorithms/min_element/constrained.cc: New test.
* testsuite/25_algorithms/minmax/constrained.cc: New test.
* testsuite/25_algorithms/minmax_element/constrained.cc: New test.
* testsuite/25_algorithms/mismatch/constrained.cc: New test.
* testsuite/25_algorithms/move/constrained.cc: New test.
* testsuite/25_algorithms/move_backward/constrained.cc: New test.
* testsuite/25_algorithms/next_permutation/constrained.cc: New test.
* testsuite/25_algorithms/none_of/constrained.cc: New test.
* testsuite/25_algorithms/nth_element/constrained.cc: New test.
* testsuite/25_algorithms/partial_sort/constrained.cc: New test.
* testsuite/25_algorithms/partial_sort_copy/constrained.cc: New test.
* testsuite/25_algorithms/partition/constrained.cc: New test.
* testsuite/25_algorithms/partition_copy/constrained.cc: New test.
* testsuite/25_algorithms/partition_point/constrained.cc: New test.
* testsuite/25_algorithms/prev_permutation/constrained.cc: New test.
* testsuite/25_algorithms/remove/constrained.cc: New test.
* testsuite/25_algorithms/remove_copy/constrained.cc: New test.
* testsuite/25_algorithms/remove_copy_if/constrained.cc: New test.
* testsuite/25_algorithms/remove_if/constrained.cc: New test.
* testsuite/25_algorithms/replace/constrained.cc: New test.
* testsuite/25_algorithms/replace_copy/constrained.cc: New test.
* testsuite/25_algorithms/replace_copy_if/constrained.cc: New test.
* testsuite/25_algorithms/replace_if/constrained.cc: New test.
* testsuite/25_algorithms/reverse/constrained.cc: New test.
* testsuite/25_algorithms/reverse_copy/constrained.cc: New test.
* testsuite/25_algorithms/rotate/constrained.cc: New test.
* testsuite/25_algorithms/rotate_copy/constrained.cc: New test.
* testsuite/25_algorithms/search/constrained.cc: New test.
* testsuite/25_algorithms/search_n/constrained.cc: New test.
* testsuite/25_algorithms/set_difference/constrained.cc: New test.
* testsuite/25_algorithms/set_intersection/constrained.cc: New test.
* testsuite/25_algorithms/set_symmetric_difference/constrained.cc: New
test.
* testsuite/25_algorithms/set_union/constrained.cc: New test.
* testsuite/25_algorithms/shuffle/constrained.cc: New test.
* testsuite/25_algorithms/sort/constrained.cc: New test.
* testsuite/25_algorithms/stable_partition/constrained.cc: New test.
* testsuite/25_algorithms/stable_sort/constrained.cc: New test.
* testsuite/25_algorithms/swap_ranges/constrained.cc: New test.
* testsuite/25_algorithms/transform/constrained.cc: New test.
* testsuite/25_algorithms/unique/constrained.cc: New test.
* testsuite/25_algorithms/unique_copy/constrained.cc: New test.
* testsuite/25_algorithms/upper_bound/constrained.cc: New test.
2020-02-06 Jonathan Wakely <jwakely@redhat.com>
* include/bits/stl_iterator.h (__detail::__common_iter_ptr): Fix PR
number in comment. Fix indentation.
* include/bits/stl_algobase.h (__iter_swap, __iter_swap<true>): Remove
redundant _GLIBCXX20_CONSTEXPR.
* include/std/ranges (viewable_range): Replace decay_t with
remove_cvref_t (LWG 3375).
2020-02-05 Jonathan Wakely <jwakely@redhat.com>
* include/bits/iterator_concepts.h (iter_reference_t)
(iter_rvalue_reference_t, iter_common_reference_t, indirect_result_t):
Remove workarounds for PR c++/67704.
* testsuite/24_iterators/aliases.cc: New test.
2020-02-05 Patrick Palka <ppalka@redhat.com>
* include/bits/stl_iterator.h (move_iterator::move_iterator): Move __i
when initializing _M_current.
(move_iterator::base): Split into two overloads differing in
ref-qualifiers as in P1207R4 for C++20.
2020-02-04 Jonathan Wakely <jwakely@redhat.com>
* include/std/functional (_GLIBCXX_NOT_FN_CALL_OP): Un-define after
use.
PR libstdc++/93562
* include/bits/unique_ptr.h (__uniq_ptr_impl::swap): Define.
(unique_ptr::swap, unique_ptr<T[], D>::swap): Call it.
* testsuite/20_util/unique_ptr/modifiers/93562.cc: New test.
2020-02-01 Andrew Burgess <andrew.burgess@embecosm.com>
* configure: Regenerate.
2020-01-31 Patrick Palka <ppalka@redhat.com>
* testsuite/24_iterators/range_operations/distance.cc: Do not assume
test_range::end() returns the same type as test_range::begin().
* testsuite/24_iterators/range_operations/next.cc: Likewise.
* testsuite/24_iterators/range_operations/prev.cc: Likewise.
* testsuite/util/testsuite_iterators.h (__gnu_test::test_range::end):
Always return a sentinel<I>.
2020-01-29 Jonathan Wakely <jwakely@redhat.com>
libstdc++: Fix conformance issues in <stop_token> (PR92895) Fix synchronization issues in <stop_token>. Replace shared_ptr with _Stop_state_ref and a reference count embedded in the shared state. Replace std::mutex with spinlock using one bit of a std::atomic<> that also tracks whether a stop request has been made and how many stop_source objects share ownership of the state. PR libstdc++/92895 * include/std/stop_token (stop_token::stop_possible()): Call new _M_stop_possible() function. (stop_token::stop_requested()): Do not use stop_possible(). (stop_token::binary_semaphore): New class, as temporary stand-in for std::binary_semaphore. (stop_token::_Stop_cb::_M_callback): Add noexcept to type. (stop_token::_Stop_cb::_M_destroyed, stop_token::_Stop_cb::_M_done): New data members for symchronization with stop_callback destruction. (stop_token::_Stop_cb::_Stop_cb): Make non-template. (stop_token::_Stop_cb::_M_linked, stop_token::_Stop_cb::_S_execute): Remove. (stop_token::_Stop_cb::_M_run): New member function. (stop_token::_Stop_state::_M_stopped, stop_token::_Stop_state::_M_mtx): Remove. (stop_token::_Stop_state::_M_owners): New data member to track reference count for ownership. (stop_token::_Stop_state::_M_value): New data member combining a spinlock, the stop requested flag, and the reference count for associated stop_source objects. (stop_token::_Stop_state::_M_requester): New data member for synchronization with stop_callback destruction. (stop_token::_Stop_state::_M_stop_possible()): New member function. (stop_token::_Stop_state::_M_stop_requested()): Inspect relevant bit of _M_value. (stop_token::_Stop_state::_M_add_owner) (stop_token::_Stop_state::_M_release_ownership) (stop_token::_Stop_state::_M_add_ssrc) (stop_token::_Stop_state::_M_sub_ssrc): New member functions for updating reference counts. (stop_token::_Stop_state::_M_lock, stop_token::_Stop_state::_M_unlock) (stop_token::_Stop_state::_M_lock, stop_token::_Stop_state::_M_unlock) (stop_token::_Stop_state::_M_try_lock) (stop_token::_Stop_state::_M_try_lock_and_stop) (stop_token::_Stop_state::_M_do_try_lock): New member functions for managing spinlock. (stop_token::_Stop_state::_M_request_stop): Use atomic operations to read and update state. Release lock while running callbacks. Use new data members to synchronize with callback destruction. (stop_token::_Stop_state::_M_remove_callback): Likewise. (stop_token::_Stop_state::_M_register_callback): Use atomic operations to read and update state. (stop_token::_Stop_state_ref): Handle type to manage _Stop_state, replacing shared_ptr. (stop_source::stop_source(const stop_source&)): Update reference count. (stop_source::operator=(const stop_source&)): Likewise. (stop_source::~stop_source()): Likewise. (stop_source::stop_source(stop_source&&)): Define as defaulted. (stop_source::operator=(stop_source&&)): Establish postcondition on parameter. (stop_callback): Enforce preconditions on template parameter. Replace base class with data member of new _Cb_impl type. (stop_callback::stop_callback(const stop_token&, Cb&&)) (stop_callback::stop_callback(stop_token&&, Cb&&)): Fix TOCTTOU race. (stop_callback::_Cb_impl): New type wrapping _Callback member and defining the _S_execute member function. * testsuite/30_threads/stop_token/stop_callback/deadlock-mt.cc: New test. * testsuite/30_threads/stop_token/stop_callback/deadlock.cc: New test. * testsuite/30_threads/stop_token/stop_callback/destroy.cc: New test. * testsuite/30_threads/stop_token/stop_callback/destructible_neg.cc: New test. * testsuite/30_threads/stop_token/stop_callback/invocable_neg.cc: New test. * testsuite/30_threads/stop_token/stop_callback/invoke.cc: New test. * testsuite/30_threads/stop_token/stop_source/assign.cc: New test. * testsuite/30_threads/stop_token/stop_token/stop_possible.cc: New test.
2020-01-23 17:46:17 +01:00
PR libstdc++/92895
* include/std/stop_token (stop_token::stop_possible()): Call new
_M_stop_possible() function.
(stop_token::stop_requested()): Do not use stop_possible().
(stop_token::binary_semaphore): New class, as temporary stand-in for
std::binary_semaphore.
(stop_token::_Stop_cb::_M_callback): Add noexcept to type.
(stop_token::_Stop_cb::_M_destroyed, stop_token::_Stop_cb::_M_done):
New data members for symchronization with stop_callback destruction.
(stop_token::_Stop_cb::_Stop_cb): Make non-template.
(stop_token::_Stop_cb::_M_linked, stop_token::_Stop_cb::_S_execute):
Remove.
(stop_token::_Stop_cb::_M_run): New member function.
(stop_token::_Stop_state::_M_stopped, stop_token::_Stop_state::_M_mtx):
Remove.
(stop_token::_Stop_state::_M_owners): New data member to track
reference count for ownership.
(stop_token::_Stop_state::_M_value): New data member combining a
spinlock, the stop requested flag, and the reference count for
associated stop_source objects.
(stop_token::_Stop_state::_M_requester): New data member for
synchronization with stop_callback destruction.
(stop_token::_Stop_state::_M_stop_possible()): New member function.
(stop_token::_Stop_state::_M_stop_requested()): Inspect relevant bit
of _M_value.
(stop_token::_Stop_state::_M_add_owner)
(stop_token::_Stop_state::_M_release_ownership)
(stop_token::_Stop_state::_M_add_ssrc)
(stop_token::_Stop_state::_M_sub_ssrc): New member functions for
updating reference counts.
(stop_token::_Stop_state::_M_lock, stop_token::_Stop_state::_M_unlock)
(stop_token::_Stop_state::_M_lock, stop_token::_Stop_state::_M_unlock)
(stop_token::_Stop_state::_M_try_lock)
(stop_token::_Stop_state::_M_try_lock_and_stop)
(stop_token::_Stop_state::_M_do_try_lock): New member functions for
managing spinlock.
(stop_token::_Stop_state::_M_request_stop): Use atomic operations to
read and update state. Release lock while running callbacks. Use new
data members to synchronize with callback destruction.
(stop_token::_Stop_state::_M_remove_callback): Likewise.
(stop_token::_Stop_state::_M_register_callback): Use atomic operations
to read and update state.
(stop_token::_Stop_state_ref): Handle type to manage _Stop_state,
replacing shared_ptr.
(stop_source::stop_source(const stop_source&)): Update reference count.
(stop_source::operator=(const stop_source&)): Likewise.
(stop_source::~stop_source()): Likewise.
(stop_source::stop_source(stop_source&&)): Define as defaulted.
(stop_source::operator=(stop_source&&)): Establish postcondition on
parameter.
(stop_callback): Enforce preconditions on template parameter. Replace
base class with data member of new _Cb_impl type.
(stop_callback::stop_callback(const stop_token&, Cb&&))
(stop_callback::stop_callback(stop_token&&, Cb&&)): Fix TOCTTOU race.
(stop_callback::_Cb_impl): New type wrapping _Callback member and
defining the _S_execute member function.
* testsuite/30_threads/stop_token/stop_callback/deadlock-mt.cc: New
test.
* testsuite/30_threads/stop_token/stop_callback/deadlock.cc: New test.
* testsuite/30_threads/stop_token/stop_callback/destroy.cc: New test.
* testsuite/30_threads/stop_token/stop_callback/destructible_neg.cc:
New test.
* testsuite/30_threads/stop_token/stop_callback/invocable_neg.cc: New
test.
* testsuite/30_threads/stop_token/stop_callback/invoke.cc: New test.
* testsuite/30_threads/stop_token/stop_source/assign.cc: New test.
* testsuite/30_threads/stop_token/stop_token/stop_possible.cc: New
test.
* libsupc++/compare (__detail::__3way_builtin_ptr_cmp): Use
three_way_comparable_with.
(__detail::__3way_cmp_with): Remove workaround for fixed bug.
(compare_three_way::operator()): Remove redundant constraint from
requires-clause.
(__detail::_Synth3way::operator()): Use three_way_comparable_with
instead of workaround.
* testsuite/18_support/comparisons/object/93479.cc: Prune extra
output due to simplified constraints on compare_three_way::operator().
PR libstdc++/93479
* libsupc++/compare (__3way_builtin_ptr_cmp): Require <=> to be valid.
* testsuite/18_support/comparisons/object/93479.cc: New test.
* testsuite/std/ranges/access/end.cc: Do not assume test_range::end()
returns the same type as test_range::begin(). Add comments.
* testsuite/std/ranges/access/rbegin.cc: Likewise.
* testsuite/std/ranges/access/rend.cc: Likewise.
* testsuite/std/ranges/range.cc: Do not assume the sentinel for
test_range is the same as its iterator type.
* testsuite/util/testsuite_iterators.h (test_range::sentinel): Add
operator- overloads to satisfy sized_sentinel_for when the iterator
satisfies random_access_iterator.
2020-01-28 Jonathan Wakely <jwakely@redhat.com>
PR libstdc++/93470
* include/bits/refwrap.h (reference_wrapper::operator()): Restrict
static assertion to object types.
PR libstdc++/93325
* acinclude.m4 (GLIBCXX_ENABLE_LIBSTDCXX_TIME): Use AC_SEARCH_LIBS for
clock_gettime instead of explicit glibc version check.
* configure: Regenerate.
2020-01-28 Martin Liska <mliska@suse.cz>
PR libstdc++/93478
* include/std/atomic: Fix typo.
* include/std/optional: Likewise.
2020-01-27 Andrew Burgess <andrew.burgess@embecosm.com>
* configure: Regenerate.
2020-01-27 Jonathan Wakely <jwakely@redhat.com>
PR libstdc++/93426
* include/std/span (span): Fix deduction guide.
* testsuite/23_containers/span/deduction.cc: New test.
2020-01-24 Jonathan Wakely <jwakely@redhat.com>
* libsupc++/compare (__cmp_cat::_Eq): Remove enumeration type.
(__cmp_cat::_Ord::equivalent): Add enumerator.
(__cmp_cat::_Ord::_Less, __cmp_cat::_Ord::_Greater): Rename to less
and greater.
(partial_ordering, weak_ordering, strong_ordering): Remove
constructors taking __cmp_cat::_Eq parameters. Use renamed
enumerators.
Add `--with-toolexeclibdir=' configuration option Provide means, in the form of a `--with-toolexeclibdir=' configuration option, to override the default installation directory for target libraries, otherwise known as $toolexeclibdir. This is so that it is possible to get newly-built libraries, particularly the shared ones, installed in a common place, so that they can be readily used by the target system as their host libraries, possibly over NFS, without a need to manually copy them over from the currently hardcoded location they would otherwise be installed in. In the presence of the `--enable-version-specific-runtime-libs' option and for configurations building native GCC the option is ignored. config/ * toolexeclibdir.m4: New file. gcc/ * doc/install.texi (Cross-Compiler-Specific Options): Document `--with-toolexeclibdir' option. libada/ * Makefile.in (configure_deps): Add `toolexeclibdir.m4'. * configure.ac: Handle `--with-toolexeclibdir='. * configure: Regenerate. libatomic/ * configure.ac: Handle `--with-toolexeclibdir='. * Makefile.in: Regenerate. * aclocal.m4: Regenerate. * configure: Regenerate. * testsuite/Makefile.in: Regenerate. libffi/ * configure.ac: Handle `--with-toolexeclibdir='. * Makefile.in: Regenerate. * aclocal.m4: Regenerate. * configure: Regenerate. * include/Makefile.in: Regenerate. * man/Makefile.in: Regenerate. * testsuite/Makefile.in: Regenerate. libgcc/ * Makefile.in (configure_deps): Add `toolexeclibdir.m4'. * configure.ac: Handle `--with-toolexeclibdir='. * configure: Regenerate. libgfortran/ * configure.ac: Handle `--with-toolexeclibdir='. * Makefile.in: Regenerate. * aclocal.m4: Regenerate. * configure: Regenerate. libgomp/ * configure.ac: Handle `--with-toolexeclibdir='. * Makefile.in: Regenerate. * aclocal.m4: Regenerate. * configure: Regenerate. * testsuite/Makefile.in: Regenerate. libhsail-rt/ * configure.ac: Handle `--with-toolexeclibdir='. * Makefile.in: Regenerate. * aclocal.m4: Regenerate. * configure: Regenerate. libitm/ * configure.ac: Handle `--with-toolexeclibdir='. * Makefile.in: Regenerate. * aclocal.m4: Regenerate. * configure: Regenerate. * testsuite/Makefile.in: Regenerate. libobjc/ * Makefile.in (aclocal_deps): Add `toolexeclibdir.m4'. * aclocal.m4: Include `toolexeclibdir.m4'. * configure.ac: Handle `--with-toolexeclibdir='. * configure: Regenerate. liboffloadmic/ * plugin/configure.ac: Handle `--with-toolexeclibdir='. * plugin/Makefile.in: Regenerate. * plugin/aclocal.m4: Regenerate. * plugin/configure: Regenerate. * configure.ac: Handle `--with-toolexeclibdir='. * Makefile.in: Regenerate. * aclocal.m4: Regenerate. * configure: Regenerate. libphobos/ * m4/druntime.m4: Handle `--with-toolexeclibdir='. * m4/Makefile.in: Regenerate. * libdruntime/Makefile.in: Regenerate. * src/Makefile.in: Regenerate. * testsuite/Makefile.in: Regenerate. * Makefile.in: Regenerate. * aclocal.m4: Regenerate. * configure: Regenerate. libquadmath/ * configure.ac: Handle `--with-toolexeclibdir='. * Makefile.in: Regenerate. * aclocal.m4: Regenerate. * configure: Regenerate. libsanitizer/ * configure.ac: Handle `--with-toolexeclibdir='. * Makefile.in: Regenerate. * aclocal.m4: Regenerate. * configure: Regenerate. * asan/Makefile.in: Regenerate. * interception/Makefile.in: Regenerate. * libbacktrace/Makefile.in: Regenerate. * lsan/Makefile.in: Regenerate. * sanitizer_common/Makefile.in: Regenerate. * tsan/Makefile.in: Regenerate. * ubsan/Makefile.in: Regenerate. libssp/ * configure.ac: Handle `--with-toolexeclibdir='. * Makefile.in: Regenerate. * aclocal.m4: Regenerate. * configure: Regenerate. libstdc++-v3/ * acinclude.m4: Handle `--with-toolexeclibdir='. * Makefile.in: Regenerate. * aclocal.m4: Regenerate. * configure: Regenerate. * doc/Makefile.in: Regenerate. * include/Makefile.in: Regenerate. * libsupc++/Makefile.in: Regenerate. * po/Makefile.in: Regenerate. * python/Makefile.in: Regenerate. * src/Makefile.in: Regenerate. * src/c++11/Makefile.in: Regenerate. * src/c++17/Makefile.in: Regenerate. * src/c++98/Makefile.in: Regenerate. * src/filesystem/Makefile.in: Regenerate. * testsuite/Makefile.in: Regenerate. libvtv/ * configure.ac: Handle `--with-toolexeclibdir='. * Makefile.in: Regenerate. * aclocal.m4: Regenerate. * configure: Regenerate. * testsuite/Makefile.in: Regenerate. zlib/ * configure.ac: Handle `--with-toolexeclibdir='. * Makefile.in: Regenerate. * aclocal.m4: Regenerate. * configure: Regenerate.
2020-01-24 12:24:25 +01:00
2020-01-24 Maciej W. Rozycki <macro@wdc.com>
* acinclude.m4: Handle `--with-toolexeclibdir='.
* Makefile.in: Regenerate.
* aclocal.m4: Regenerate.
* configure: Regenerate.
* doc/Makefile.in: Regenerate.
* include/Makefile.in: Regenerate.
* libsupc++/Makefile.in: Regenerate.
* po/Makefile.in: Regenerate.
* python/Makefile.in: Regenerate.
* src/Makefile.in: Regenerate.
* src/c++11/Makefile.in: Regenerate.
* src/c++17/Makefile.in: Regenerate.
* src/c++98/Makefile.in: Regenerate.
* src/filesystem/Makefile.in: Regenerate.
* testsuite/Makefile.in: Regenerate.
2020-01-23 Alexandre Oliva <oliva@adacore.com>
* crossconfig.m4 (GLIBCXX_CHECK_MATH_DECL): Reject macros.
* configure: Rebuild.
* testsuite/27_io/fpos/mbstate_t/1.cc: Zero-init mbstate_t.
2020-01-23 Jonathan Wakely <jwakely@redhat.com>
PR libstdc++/91947
* include/Makefile.am (${host_builddir}/largefile-config.h): Simplify
rule.
* include/Makefile.in: Regenerate.
2020-01-20 Jonathan Wakely <jwakely@redhat.com>
* doc/xml/faq.xml: Fix grammar.
* doc/xml/manual/appendix_contributing.xml: Improve instructions.
* doc/xml/manual/spine.xml: Update copyright years.
* doc/html/*: Regenerate.
2020-01-19 Eric S. Raymond <esr@thyrsus.com>
* doc/xml/faq.xml: Update for SVN -> Git transition.
* doc/xml/manual/appendix_contributing.xml: Likewise.
* doc/xml/manual/status_cxx1998.xml: Likewise.
* doc/xml/manual/status_cxx2011.xml: Likewise.
* doc/xml/manual/status_cxx2014.xml: Likewise.
* doc/xml/manual/status_cxx2017.xml: Likewise.
* doc/xml/manual/status_cxx2020.xml: Likewise.
* doc/xml/manual/status_cxxtr1.xml: Likewise.
* doc/xml/manual/status_cxxtr24733.xml: Likewise.
[C++ coroutines] Initial implementation. This is the squashed version of the first 6 patches that were split to facilitate review. The changes to libiberty (7th patch) to support demangling the co_await operator stand alone and are applied separately. The patch series is an initial implementation of a coroutine feature, expected to be standardised in C++20. Standardisation status (and potential impact on this implementation) -------------------------------------------------------------------- The facility was accepted into the working draft for C++20 by WG21 in February 2019. During following WG21 meetings, design and national body comments have been reviewed, with no significant change resulting. The current GCC implementation is against n4835 [1]. At this stage, the remaining potential for change comes from: * Areas of national body comments that were not resolved in the version we have worked to: (a) handling of the situation where aligned allocation is available. (b) handling of the situation where a user wants coroutines, but does not want exceptions (e.g. a GPU). * Agreed changes that have not yet been worded in a draft standard that we have worked to. It is not expected that the resolution to these can produce any major change at this phase of the standardisation process. Such changes should be limited to the coroutine-specific code. ABI --- The various compiler developers 'vendors' have discussed a minimal ABI to allow one implementation to call coroutines compiled by another. This amounts to: 1. The layout of a public portion of the coroutine frame. Coroutines need to preserve state across suspension points, the storage for this is called a "coroutine frame". The ABI mandates that pointers into the coroutine frame point to an area begining with two function pointers (to the resume and destroy functions described below); these are immediately followed by the "promise object" described in the standard. This is sufficient that the builtins can take a coroutine frame pointer and determine the address of the promise (or call the resume/destroy functions). 2. A number of compiler builtins that the standard library might use. These are implemented by this patch series. 3. This introduces a new operator 'co_await' the mangling for which is also agreed between vendors (and has an issue filed for that against the upstream c++abi). Demangling for this is added to libiberty in a separate patch. The ABI has currently no target-specific content (a given psABI might elect to mandate alignment, but the common ABI does not do this). Standard Library impact ----------------------- The current implementations require addition of only a single header to the standard library (no change to the runtime). This header is part of the patch. GCC Implementation outline -------------------------- The standard's design for coroutines does not decorate the definition of a coroutine in any way, so that a function is only known to be a coroutine when one of the keywords (co_await, co_yield, co_return) is encountered. This means that we cannot special-case such functions from the outset, but must process them differently when they are finalised - which we do from "finish_function ()". At a high level, this design of coroutine produces four pieces from the original user's function: 1. A coroutine state frame (taking the logical place of the activation record for a regular function). One item stored in that state is the index of the current suspend point. 2. A "ramp" function This is what the user calls to construct the coroutine frame and start the coroutine execution. This will return some object representing the coroutine's eventual return value (or means to continue it when it it suspended). 3. A "resume" function. This is what gets called when a the coroutine is resumed when suspended. 4. A "destroy" function. This is what gets called when the coroutine state should be destroyed and its memory released. The standard's coroutines involve cooperation of the user's authored function with a provided "promise" class, which includes mandatory methods for handling the state transitions and providing output values. Most realistic coroutines will also have one or more 'awaiter' classes that implement the user's actions for each suspend point. As we parse (or during template expansion) the types of the promise and awaiter classes become known, and can then be verified against the signatures expected by the standard. Once the function is parsed (and templates expanded) we are able to make the transformation into the four pieces noted above. The implementation here takes the approach of a series of AST transforms. The state machine suspend points are encoded in three internal functions (one of which represents an exit from scope without cleanups). These three IFNs are lowered early in the middle end, such that the majority of GCC's optimisers can be run on the resulting output. As a design choice, we have carried out the outlining of the user's function in the front end, and taken advantage of the existing middle end's abilities to inline and DCE where that is profitable. Since the state machine is actually common to both resumer and destroyer functions, we make only a single function "actor" that contains both the resume and destroy paths. The destroy function is represented by a small stub that sets a value to signal the use of the destroy path and calls the actor. The idea is that optimisation of the state machine need only be done once - and then the resume and destroy paths can be identified allowing the middle end's inline and DCE machinery to optimise as profitable as noted above. The middle end components for this implementation are: A pass that: 1. Lowers the coroutine builtins that allow the standard library header to interact with the coroutine frame (these fairly simple logical or numerical substitution of values, given a coroutine frame pointer). 2. Lowers the IFN that represents the exit from state without cleanup. Essentially, this becomes a gimple goto. 3. Sets the final size of the coroutine frame at this stage. A second pass (that requires the revised CFG that results from the lowering of the scope exit IFNs in the first). 1. Lower the IFNs that represent the state machine paths for the resume and destroy cases. Patches squashed into this commit: [C++ coroutines 1] Common code and base definitions. This part of the patch series provides the gating flag, the keywords, cpp defines etc. [C++ coroutines 2] Define builtins and internal functions. This part of the patch series provides the builtin functions used by the standard library code and the internal functions used to implement lowering of the coroutine state machine. [C++ coroutines 3] Front end parsing and transforms. There are two parts to this. 1. Parsing, template instantiation and diagnostics for the standard- mandated class entries. The user authors a function that becomes a coroutine (lazily) by making use of any of the co_await, co_yield or co_return keywords. Unlike a regular function, where the activation record is placed on the stack, and is destroyed on function exit, a coroutine has some state that persists between calls - the 'coroutine frame' (thus analogous to a stack frame). We transform the user's function into three pieces: 1. A so-called ramp function, that establishes the coroutine frame and begins execution of the coroutine. 2. An actor function that contains the state machine corresponding to the user's suspend/resume structure. 3. A stub function that calls the actor function in 'destroy' mode. The actor function is executed: * from "resume point 0" by the ramp. * from resume point N ( > 0 ) for handle.resume() calls. * from the destroy stub for destroy point N for handle.destroy() calls. The C++ coroutine design described in the standard makes use of some helper methods that are authored in a so-called "promise" class provided by the user. At parse time (or post substitution) the type of the coroutine promise will be determined. At that point, we can look up the required promise class methods and issue diagnostics if they are missing or incorrect. To avoid repeating these actions at code-gen time, we make use of temporary 'proxy' variables for the coroutine handle and the promise - which will eventually be instantiated in the coroutine frame. Each of the keywords will expand to a code sequence (although co_yield is just syntactic sugar for a co_await). We defer the analysis and transformatin until template expansion is complete so that we have complete types at that time. 2. AST analysis and transformation which performs the code-gen for the outlined state machine. The entry point here is morph_fn_to_coro () which is called from finish_function () when we have completed any template expansion. This is preceded by helper functions that implement the phases below. The process proceeds in four phases. A Initial framing. The user's function body is wrapped in the initial and final suspend points and we begin building the coroutine frame. We build empty decls for the actor and destroyer functions at this time too. When exceptions are enabled, the user's function body will also be wrapped in a try-catch block with the catch invoking the promise class 'unhandled_exception' method. B Analysis. The user's function body is analysed to determine the suspend points, if any, and to capture local variables that might persist across such suspensions. In most cases, it is not necessary to capture compiler temporaries, since the tree-lowering nests the suspensions correctly. However, in the case of a captured reference, there is a lifetime extension to the end of the full expression - which can mean across a suspend point in which case it must be promoted to a frame variable. At the conclusion of analysis, we have a conservative frame layout and maps of the local variables to their frame entry points. C Build the ramp function. Carry out the allocation for the coroutine frame (NOTE; the actual size computation is deferred until late in the middle end to allow for future optimisations that will be allowed to elide unused frame entries). We build the return object. D Build and expand the actor and destroyer function bodies. The destroyer is a trivial shim that sets a bit to indicate that the destroy dispatcher should be used and then calls into the actor. The actor function is the implementation of the user's state machine. The current suspend point is noted in an index. Each suspend point is encoded as a pair of internal functions, one in the relevant dispatcher, and one representing the suspend point. During this process, the user's local variables and the proxies for the self-handle and the promise class instanceare re-written to their coroutine frame equivalents. The complete bodies for the ramp, actor and destroy function are passed back to finish_function for folding and gimplification. [C++ coroutines 4] Middle end expanders and transforms. The first part of this is a pass that provides: * expansion of the library support builtins, these are simple boolean or numerical substitutions. * The functionality of implementing an exit from scope without cleanup is performed here by lowering an IFN to a gimple goto. This pass has to run for non-coroutine functions, since functions calling the builtins are not necessarily coroutines (i.e. they are implementing the library interfaces which may be called from anywhere). The second part is the expansion of the coroutine IFNs that describe the state machine connections to the dispatchers. This only has to be run for functions that are coroutine components. The work done by this pass is: In the front end we construct a single actor function that contains the coroutine state machine. The actor function has three entry conditions: 1. from the ramp, resume point 0 - to initial-suspend. 2. when resume () is executed (resume point N). 3. from the destroy () shim when that is executed. The actor function begins with two dispatchers; one for resume and one for destroy (where the initial entry from the ramp is a special- case of resume point 0). Each suspend point and each dispatch entry is marked with an IFN such that we can connect the relevant dispatchers to their target labels. So, if we have: CO_YIELD (NUM, FINAL, RES_LAB, DEST_LAB, FRAME_PTR) This is await point NUM, and is the final await if FINAL is non-zero. The resume point is RES_LAB, and the destroy point is DEST_LAB. We expect to find a CO_ACTOR (NUM) in the resume dispatcher and a CO_ACTOR (NUM+1) in the destroy dispatcher. Initially, the intent of keeping the resume and destroy paths together is that the conditionals controlling them are identical, and thus there would be duplication of any optimisation of those paths if the split were earlier. Subsequent inlining of the actor (and DCE) is then able to extract the resume and destroy paths as separate functions if that is found profitable by the optimisers. Once we have remade the connections to their correct postions, we elide the labels that the front end inserted. [C++ coroutines 5] Standard library header. This provides the interfaces mandated by the standard and implements the interaction with the coroutine frame by means of inline use of builtins expanded at compile-time. There should be a 1:1 correspondence with the standard sections which are cross-referenced. There is no runtime content. At this stage, we have the content in an inline namespace "__n4835" for the CD we worked to. [C++ coroutines 6] Testsuite. There are two categories of test: 1. Checks for correctly formed source code and the error reporting. 2. Checks for transformation and code-gen. The second set are run as 'torture' tests for the standard options set, including LTO. These are also intentionally run with no options provided (from the coroutines.exp script). gcc/ChangeLog: 2020-01-18 Iain Sandoe <iain@sandoe.co.uk> * Makefile.in: Add coroutine-passes.o. * builtin-types.def (BT_CONST_SIZE): New. (BT_FN_BOOL_PTR): New. (BT_FN_PTR_PTR_CONST_SIZE_BOOL): New. * builtins.def (DEF_COROUTINE_BUILTIN): New. * coroutine-builtins.def: New file. * coroutine-passes.cc: New file. * function.h (struct GTY function): Add a bit to indicate that the function is a coroutine component. * internal-fn.c (expand_CO_FRAME): New. (expand_CO_YIELD): New. (expand_CO_SUSPN): New. (expand_CO_ACTOR): New. * internal-fn.def (CO_ACTOR): New. (CO_YIELD): New. (CO_SUSPN): New. (CO_FRAME): New. * passes.def: Add pass_coroutine_lower_builtins, pass_coroutine_early_expand_ifns. * tree-pass.h (make_pass_coroutine_lower_builtins): New. (make_pass_coroutine_early_expand_ifns): New. * doc/invoke.texi: Document the fcoroutines command line switch. gcc/c-family/ChangeLog: 2020-01-18 Iain Sandoe <iain@sandoe.co.uk> * c-common.c (co_await, co_yield, co_return): New. * c-common.h (RID_CO_AWAIT, RID_CO_YIELD, RID_CO_RETURN): New enumeration values. (D_CXX_COROUTINES): Bit to identify coroutines are active. (D_CXX_COROUTINES_FLAGS): Guard for coroutine keywords. * c-cppbuiltin.c (__cpp_coroutines): New cpp define. * c.opt (fcoroutines): New command-line switch. gcc/cp/ChangeLog: 2020-01-18 Iain Sandoe <iain@sandoe.co.uk> * Make-lang.in: Add coroutines.o. * cp-tree.h (lang_decl-fn): coroutine_p, new bit. (DECL_COROUTINE_P): New. * lex.c (init_reswords): Enable keywords when the coroutine flag is set, * operators.def (co_await): New operator. * call.c (add_builtin_candidates): Handle CO_AWAIT_EXPR. (op_error): Likewise. (build_new_op_1): Likewise. (build_new_function_call): Validate coroutine builtin arguments. * constexpr.c (potential_constant_expression_1): Handle CO_AWAIT_EXPR, CO_YIELD_EXPR, CO_RETURN_EXPR. * coroutines.cc: New file. * cp-objcp-common.c (cp_common_init_ts): Add CO_AWAIT_EXPR, CO_YIELD_EXPR, CO_RETRN_EXPR as TS expressions. * cp-tree.def (CO_AWAIT_EXPR, CO_YIELD_EXPR, (CO_RETURN_EXPR): New. * cp-tree.h (coro_validate_builtin_call): New. * decl.c (emit_coro_helper): New. (finish_function): Handle the case when a function is found to be a coroutine, perform the outlining and emit the outlined functions. Set a bit to signal that this is a coroutine component. * parser.c (enum required_token): New enumeration RT_CO_YIELD. (cp_parser_unary_expression): Handle co_await. (cp_parser_assignment_expression): Handle co_yield. (cp_parser_statement): Handle RID_CO_RETURN. (cp_parser_jump_statement): Handle co_return. (cp_parser_operator): Handle co_await operator. (cp_parser_yield_expression): New. (cp_parser_required_error): Handle RT_CO_YIELD. * pt.c (tsubst_copy): Handle CO_AWAIT_EXPR. (tsubst_expr): Handle CO_AWAIT_EXPR, CO_YIELD_EXPR and CO_RETURN_EXPRs. * tree.c (cp_walk_subtrees): Likewise. libstdc++-v3/ChangeLog: 2020-01-18 Iain Sandoe <iain@sandoe.co.uk> * include/Makefile.am: Add coroutine to the std set. * include/Makefile.in: Regenerated. * include/std/coroutine: New file. gcc/testsuite/ChangeLog: 2020-01-18 Iain Sandoe <iain@sandoe.co.uk> * g++.dg/coroutines/co-await-syntax-00-needs-expr.C: New test. * g++.dg/coroutines/co-await-syntax-01-outside-fn.C: New test. * g++.dg/coroutines/co-await-syntax-02-outside-fn.C: New test. * g++.dg/coroutines/co-await-syntax-03-auto.C: New test. * g++.dg/coroutines/co-await-syntax-04-ctor-dtor.C: New test. * g++.dg/coroutines/co-await-syntax-05-constexpr.C: New test. * g++.dg/coroutines/co-await-syntax-06-main.C: New test. * g++.dg/coroutines/co-await-syntax-07-varargs.C: New test. * g++.dg/coroutines/co-await-syntax-08-lambda-auto.C: New test. * g++.dg/coroutines/co-return-syntax-01-outside-fn.C: New test. * g++.dg/coroutines/co-return-syntax-02-outside-fn.C: New test. * g++.dg/coroutines/co-return-syntax-03-auto.C: New test. * g++.dg/coroutines/co-return-syntax-04-ctor-dtor.C: New test. * g++.dg/coroutines/co-return-syntax-05-constexpr-fn.C: New test. * g++.dg/coroutines/co-return-syntax-06-main.C: New test. * g++.dg/coroutines/co-return-syntax-07-vararg.C: New test. * g++.dg/coroutines/co-return-syntax-08-bad-return.C: New test. * g++.dg/coroutines/co-return-syntax-09-lambda-auto.C: New test. * g++.dg/coroutines/co-yield-syntax-00-needs-expr.C: New test. * g++.dg/coroutines/co-yield-syntax-01-outside-fn.C: New test. * g++.dg/coroutines/co-yield-syntax-02-outside-fn.C: New test. * g++.dg/coroutines/co-yield-syntax-03-auto.C: New test. * g++.dg/coroutines/co-yield-syntax-04-ctor-dtor.C: New test. * g++.dg/coroutines/co-yield-syntax-05-constexpr.C: New test. * g++.dg/coroutines/co-yield-syntax-06-main.C: New test. * g++.dg/coroutines/co-yield-syntax-07-varargs.C: New test. * g++.dg/coroutines/co-yield-syntax-08-needs-expr.C: New test. * g++.dg/coroutines/co-yield-syntax-09-lambda-auto.C: New test. * g++.dg/coroutines/coro-builtins.C: New test. * g++.dg/coroutines/coro-missing-gro.C: New test. * g++.dg/coroutines/coro-missing-promise-yield.C: New test. * g++.dg/coroutines/coro-missing-ret-value.C: New test. * g++.dg/coroutines/coro-missing-ret-void.C: New test. * g++.dg/coroutines/coro-missing-ueh-1.C: New test. * g++.dg/coroutines/coro-missing-ueh-2.C: New test. * g++.dg/coroutines/coro-missing-ueh-3.C: New test. * g++.dg/coroutines/coro-missing-ueh.h: New test. * g++.dg/coroutines/coro-pre-proc.C: New test. * g++.dg/coroutines/coro.h: New file. * g++.dg/coroutines/coro1-ret-int-yield-int.h: New file. * g++.dg/coroutines/coroutines.exp: New file. * g++.dg/coroutines/torture/alloc-00-gro-on-alloc-fail.C: New test. * g++.dg/coroutines/torture/alloc-01-overload-newdel.C: New test. * g++.dg/coroutines/torture/call-00-co-aw-arg.C: New test. * g++.dg/coroutines/torture/call-01-multiple-co-aw.C: New test. * g++.dg/coroutines/torture/call-02-temp-co-aw.C: New test. * g++.dg/coroutines/torture/call-03-temp-ref-co-aw.C: New test. * g++.dg/coroutines/torture/class-00-co-ret.C: New test. * g++.dg/coroutines/torture/class-01-co-ret-parm.C: New test. * g++.dg/coroutines/torture/class-02-templ-parm.C: New test. * g++.dg/coroutines/torture/class-03-operator-templ-parm.C: New test. * g++.dg/coroutines/torture/class-04-lambda-1.C: New test. * g++.dg/coroutines/torture/class-05-lambda-capture-copy-local.C: New test. * g++.dg/coroutines/torture/class-06-lambda-capture-ref.C: New test. * g++.dg/coroutines/torture/co-await-00-trivial.C: New test. * g++.dg/coroutines/torture/co-await-01-with-value.C: New test. * g++.dg/coroutines/torture/co-await-02-xform.C: New test. * g++.dg/coroutines/torture/co-await-03-rhs-op.C: New test. * g++.dg/coroutines/torture/co-await-04-control-flow.C: New test. * g++.dg/coroutines/torture/co-await-05-loop.C: New test. * g++.dg/coroutines/torture/co-await-06-ovl.C: New test. * g++.dg/coroutines/torture/co-await-07-tmpl.C: New test. * g++.dg/coroutines/torture/co-await-08-cascade.C: New test. * g++.dg/coroutines/torture/co-await-09-pair.C: New test. * g++.dg/coroutines/torture/co-await-10-template-fn-arg.C: New test. * g++.dg/coroutines/torture/co-await-11-forwarding.C: New test. * g++.dg/coroutines/torture/co-await-12-operator-2.C: New test. * g++.dg/coroutines/torture/co-await-13-return-ref.C: New test. * g++.dg/coroutines/torture/co-ret-00-void-return-is-ready.C: New test. * g++.dg/coroutines/torture/co-ret-01-void-return-is-suspend.C: New test. * g++.dg/coroutines/torture/co-ret-03-different-GRO-type.C: New test. * g++.dg/coroutines/torture/co-ret-04-GRO-nontriv.C: New test. * g++.dg/coroutines/torture/co-ret-05-return-value.C: New test. * g++.dg/coroutines/torture/co-ret-06-template-promise-val-1.C: New test. * g++.dg/coroutines/torture/co-ret-07-void-cast-expr.C: New test. * g++.dg/coroutines/torture/co-ret-08-template-cast-ret.C: New test. * g++.dg/coroutines/torture/co-ret-09-bool-await-susp.C: New test. * g++.dg/coroutines/torture/co-ret-10-expression-evaluates-once.C: New test. * g++.dg/coroutines/torture/co-ret-11-co-ret-co-await.C: New test. * g++.dg/coroutines/torture/co-ret-12-co-ret-fun-co-await.C: New test. * g++.dg/coroutines/torture/co-ret-13-template-2.C: New test. * g++.dg/coroutines/torture/co-ret-14-template-3.C: New test. * g++.dg/coroutines/torture/co-yield-00-triv.C: New test. * g++.dg/coroutines/torture/co-yield-01-multi.C: New test. * g++.dg/coroutines/torture/co-yield-02-loop.C: New test. * g++.dg/coroutines/torture/co-yield-03-tmpl.C: New test. * g++.dg/coroutines/torture/co-yield-04-complex-local-state.C: New test. * g++.dg/coroutines/torture/co-yield-05-co-aw.C: New test. * g++.dg/coroutines/torture/co-yield-06-fun-parm.C: New test. * g++.dg/coroutines/torture/co-yield-07-template-fn-param.C: New test. * g++.dg/coroutines/torture/co-yield-08-more-refs.C: New test. * g++.dg/coroutines/torture/co-yield-09-more-templ-refs.C: New test. * g++.dg/coroutines/torture/coro-torture.exp: New file. * g++.dg/coroutines/torture/exceptions-test-0.C: New test. * g++.dg/coroutines/torture/func-params-00.C: New test. * g++.dg/coroutines/torture/func-params-01.C: New test. * g++.dg/coroutines/torture/func-params-02.C: New test. * g++.dg/coroutines/torture/func-params-03.C: New test. * g++.dg/coroutines/torture/func-params-04.C: New test. * g++.dg/coroutines/torture/func-params-05.C: New test. * g++.dg/coroutines/torture/func-params-06.C: New test. * g++.dg/coroutines/torture/lambda-00-co-ret.C: New test. * g++.dg/coroutines/torture/lambda-01-co-ret-parm.C: New test. * g++.dg/coroutines/torture/lambda-02-co-yield-values.C: New test. * g++.dg/coroutines/torture/lambda-03-auto-parm-1.C: New test. * g++.dg/coroutines/torture/lambda-04-templ-parm.C: New test. * g++.dg/coroutines/torture/lambda-05-capture-copy-local.C: New test. * g++.dg/coroutines/torture/lambda-06-multi-capture.C: New test. * g++.dg/coroutines/torture/lambda-07-multi-yield.C: New test. * g++.dg/coroutines/torture/lambda-08-co-ret-parm-ref.C: New test. * g++.dg/coroutines/torture/local-var-0.C: New test. * g++.dg/coroutines/torture/local-var-1.C: New test. * g++.dg/coroutines/torture/local-var-2.C: New test. * g++.dg/coroutines/torture/local-var-3.C: New test. * g++.dg/coroutines/torture/local-var-4.C: New test. * g++.dg/coroutines/torture/mid-suspend-destruction-0.C: New test. * g++.dg/coroutines/torture/pr92933.C: New test.
2020-01-18 12:54:46 +01:00
2020-01-18 Iain Sandoe <iain@sandoe.co.uk>
* include/Makefile.am: Add coroutine to the std set.
* include/Makefile.in: Regenerated.
* include/std/coroutine: New file.
2020-01-17 Jonathan Wakely <jwakely@redhat.com>
PR libstdc++/92376
* include/bits/c++config: Only do PSTL config when the header is
present, to fix freestanding.
* libsupc++/new_opa.cc [!_GLIBCXX_HOSTED]: Declare allocation
functions if they were detected by configure.
2020-01-16 Kai-Uwe Eckhardt <kuehro@gmx.de>
Matthew Bauer <mjbauer95@gmail.com>
Jonathan Wakely <jwakely@redhat.com>
PR bootstrap/64271 (partial)
* config/os/bsd/netbsd/ctype_base.h (ctype_base::mask): Change type
to unsigned short.
(ctype_base::alpha, ctype_base::digit, ctype_base::xdigit)
(ctype_base::print, ctype_base::graph, ctype_base::alnum): Sync
definitions with NetBSD upstream.
(ctype_base::blank): Use _CTYPE_BL.
* config/os/bsd/netbsd/ctype_configure_char.cc (_C_ctype_): Remove
Declaration.
(ctype<char>::classic_table): Use _C_ctype_tab_ instead of _C_ctype_.
(ctype<char>::do_toupper, ctype<char>::do_tolower): Cast char
parameters to unsigned char.
* config/os/bsd/netbsd/ctype_inline.h (ctype<char>::is): Likewise.
2020-01-16 François Dumont <fdumont@gcc.gnu.org>
PR libstdc++/91263
* include/bits/hashtable.h (_Hashtable<>): Make _Equality<> friend.
* include/bits/hashtable_policy.h: Include <bits/stl_algo.h>.
(_Equality_base): Remove.
(_Equality<>::_M_equal): Review implementation. Use
std::is_permutation.
* testsuite/23_containers/unordered_multiset/operators/1.cc
(Hash, Equal, test02, test03): New.
* testsuite/23_containers/unordered_set/operators/1.cc
(Hash, Equal, test02, test03): New.
2020-01-15 Jonathan Wakely <jwakely@redhat.com>
PR libstdc++/93267
* include/bits/iterator_concepts.h (__max_diff_type, __max_size_type):
Move here from <bits/range_access.h> and define using __int128 when
available.
(__is_integer_like, __is_signed_integer_like): Move here from
<bits/range_access.h>.
(weakly_incrementable): Use __is_signed_integer_like.
* include/bits/range_access.h (__max_diff_type, __max_size_type)
(__is_integer_like, __is_signed_integer_like): Move to
<bits/iterator_concepts.h>.
(__make_unsigned_like_t): Move here from <ranges>.
* include/std/ranges (__make_unsigned_like_t): Move to
<bits/range_access.h>.
(iota_view): Replace using-directive with using-declarations.
* testsuite/std/ranges/iota/93267.cc: New test.
* testsuite/std/ranges/iota_view.cc: Move to new 'iota' sub-directory.
libstdc++: Value-initialize std::atomic for C++20 (P0883R2) This implements the new requirements for C++20 that std::atomic should initialize the atomic variable in its default constructor. This patch does not add the deprecated attribute to atomic_init, but that should be done at some point as it's deprecated in C++20. The paper also deprecates the ATOMIC_FLAG_INIT macro, although we can't apply the deprecated attribute to a macro. PR libstdc++/58605 * include/bits/atomic_base.h (__cpp_lib_atomic_value_initialization): Define. (__atomic_flag_base, __atomic_base, __atomic_base<_PTp*>) (__atomic_float): Add default member initializer for C++20. * include/std/atomic (atomic): Likewise. (atomic::atomic()): Remove noexcept-specifier on default constructor. * include/std/version (__cpp_lib_atomic_value_initialization): Define. * testsuite/29_atomics/atomic/cons/assign_neg.cc: Adjust dg-error line number. * testsuite/29_atomics/atomic/cons/copy_neg.cc: Likewise. * testsuite/29_atomics/atomic/cons/value_init.cc: New test. * testsuite/29_atomics/atomic_flag/cons/value_init.cc: New test. * testsuite/29_atomics/atomic_flag/requirements/trivial.cc: Adjust expected result for is_trivially_default_constructible. * testsuite/29_atomics/atomic_float/requirements.cc: Likewise. * testsuite/29_atomics/atomic_float/value_init.cc: New test. * testsuite/29_atomics/atomic_integral/cons/assign_neg.cc: Likewise. * testsuite/29_atomics/atomic_integral/cons/copy_neg.cc: Likewise. * testsuite/29_atomics/atomic_integral/cons/value_init.cc * testsuite/29_atomics/atomic_integral/requirements/trivial.cc: Adjust expected results for is_trivially_default_constructible. * testsuite/util/testsuite_common_types.h (has_trivial_dtor): Add new test generator.
2020-01-11 01:11:54 +01:00
2020-01-13 Jonathan Wakely <jwakely@redhat.com>
PR libstdc++/93244
* include/bits/fs_path.h (path::generic_string<C,A>)
[_GLIBCXX_FILESYSTEM_IS_WINDOWS]: Convert root-dir to forward-slash.
* testsuite/27_io/filesystem/path/generic/generic_string.cc: Check
root-dir is converted to forward slash in generic pathname.
* testsuite/27_io/filesystem/path/generic/utf.cc: New test.
* testsuite/27_io/filesystem/path/generic/wchar_t.cc: New test.
libstdc++: Value-initialize std::atomic for C++20 (P0883R2) This implements the new requirements for C++20 that std::atomic should initialize the atomic variable in its default constructor. This patch does not add the deprecated attribute to atomic_init, but that should be done at some point as it's deprecated in C++20. The paper also deprecates the ATOMIC_FLAG_INIT macro, although we can't apply the deprecated attribute to a macro. PR libstdc++/58605 * include/bits/atomic_base.h (__cpp_lib_atomic_value_initialization): Define. (__atomic_flag_base, __atomic_base, __atomic_base<_PTp*>) (__atomic_float): Add default member initializer for C++20. * include/std/atomic (atomic): Likewise. (atomic::atomic()): Remove noexcept-specifier on default constructor. * include/std/version (__cpp_lib_atomic_value_initialization): Define. * testsuite/29_atomics/atomic/cons/assign_neg.cc: Adjust dg-error line number. * testsuite/29_atomics/atomic/cons/copy_neg.cc: Likewise. * testsuite/29_atomics/atomic/cons/value_init.cc: New test. * testsuite/29_atomics/atomic_flag/cons/value_init.cc: New test. * testsuite/29_atomics/atomic_flag/requirements/trivial.cc: Adjust expected result for is_trivially_default_constructible. * testsuite/29_atomics/atomic_float/requirements.cc: Likewise. * testsuite/29_atomics/atomic_float/value_init.cc: New test. * testsuite/29_atomics/atomic_integral/cons/assign_neg.cc: Likewise. * testsuite/29_atomics/atomic_integral/cons/copy_neg.cc: Likewise. * testsuite/29_atomics/atomic_integral/cons/value_init.cc * testsuite/29_atomics/atomic_integral/requirements/trivial.cc: Adjust expected results for is_trivially_default_constructible. * testsuite/util/testsuite_common_types.h (has_trivial_dtor): Add new test generator.
2020-01-11 01:11:54 +01:00
PR libstdc++/58605
* include/bits/atomic_base.h (__cpp_lib_atomic_value_initialization):
Define.
(__atomic_flag_base, __atomic_base, __atomic_base<_PTp*>)
(__atomic_float): Add default member initializer for C++20.
* include/std/atomic (atomic): Likewise.
(atomic::atomic()): Remove noexcept-specifier on default constructor.
* include/std/version (__cpp_lib_atomic_value_initialization): Define.
* testsuite/29_atomics/atomic/cons/assign_neg.cc: Adjust dg-error line
number.
* testsuite/29_atomics/atomic/cons/copy_neg.cc: Likewise.
* testsuite/29_atomics/atomic/cons/value_init.cc: New test.
* testsuite/29_atomics/atomic_flag/cons/value_init.cc: New test.
* testsuite/29_atomics/atomic_flag/requirements/trivial.cc: Adjust
expected result for is_trivially_default_constructible.
* testsuite/29_atomics/atomic_float/requirements.cc: Likewise.
* testsuite/29_atomics/atomic_float/value_init.cc: New test.
* testsuite/29_atomics/atomic_integral/cons/assign_neg.cc: Likewise.
* testsuite/29_atomics/atomic_integral/cons/copy_neg.cc: Likewise.
* testsuite/29_atomics/atomic_integral/cons/value_init.cc
* testsuite/29_atomics/atomic_integral/requirements/trivial.cc: Adjust
expected results for is_trivially_default_constructible.
* testsuite/util/testsuite_common_types.h (has_trivial_dtor): Add
new test generator.
2020-01-10 Jonathan Wakely <jwakely@redhat.com>
* testsuite/util/testsuite_iterators.h: Improve comment.
* testsuite/25_algorithms/equal/deque_iterators/1.cc: Don't use C++11
initialization syntax.
PR libstdc++/92285
* include/bits/streambuf_iterator.h (istreambuf_iterator): Make type
of base class independent of __cplusplus value.
[__cplusplus < 201103L] (istreambuf_iterator::reference): Override the
type defined in the base class
* testsuite/24_iterators/istreambuf_iterator/92285.cc: New test.
* testsuite/24_iterators/istreambuf_iterator/requirements/
base_classes.cc: Adjust expected base class for C++98.
2020-01-09 Olivier Hainque <hainque@adacore.com>
* doc/xml/manual/appendix_contributing.xml: Document _C2
as a reserved identifier, by VxWorks.
* include/bits/stl_map.h: Rename _C2 template typenames as _Cmp2.
* include/bits/stl_multimap.h: Likewise.
2020-01-09 Jonathan Wakely <jwakely@redhat.com>
* include/ext/extptr_allocator.h (_ExtPtr_allocator::operator==)
(_ExtPtr_allocator::operator!=): Add missing const qualifiers.
* include/ext/pointer.h (readable_traits<_Pointer_adapter<S>>): Add
partial specialization to disambiguate the two constrained
specializations.
* include/experimental/type_traits (experimental::is_pod_v): Disable
-Wdeprecated-declarations warnings around reference to std::is_pod.
* include/std/type_traits (is_pod_v): Likewise.
* testsuite/18_support/max_align_t/requirements/2.cc: Also check
is_standard_layout and is_trivial. Do not check is_pod for C++20.
* testsuite/20_util/is_pod/requirements/explicit_instantiation.cc:
Add -Wno-deprecated for C++20.
* testsuite/20_util/is_pod/requirements/typedefs.cc: Likewise.
* testsuite/20_util/is_pod/value.cc: Likewise.
* testsuite/experimental/type_traits/value.cc: Likewise.
2020-01-09 JeanHeyd "ThePhD" Meneide <phdofthehouse@gmail.com>
* include/bits/c++config (_GLIBCXX20_DEPRECATED): Add new macro.
* include/std/type_traits (is_pod, is_pod_v): Deprecate for C++20.
* testuite/20_util/is_pod/deprecated-2a.cc: New test.
2020-01-09 Jonathan Wakely <jwakely@redhat.com>
PR libstdc++/93205
* include/bits/random.h (operator>>): Check stream operation succeeds.
* include/bits/random.tcc (operator<<): Remove redundant __ostream_type
typedefs.
(operator>>): Remove redundant __istream_type typedefs. Check stream
operations succeed.
(__extract_params): New function to fill a vector from a stream.
* testsuite/26_numerics/random/pr60037-neg.cc: Adjust dg-error line.
PR libstdc++/93208
* config/abi/pre/gnu.ver: Add new exports.
* include/std/memory_resource (memory_resource::~memory_resource()):
Do not define inline.
(monotonic_buffer_resource::~monotonic_buffer_resource()): Likewise.
* src/c++17/memory_resource.cc (memory_resource::~memory_resource()):
Define.
(monotonic_buffer_resource::~monotonic_buffer_resource()): Define.
* testsuite/20_util/monotonic_buffer_resource/93208.cc: New test.
2020-01-09 François Dumont <fdumont@gcc.gnu.org>
PR libstdc++/92124
* include/bits/hashtable.h (_Hashtable<>::__alloc_node_gen_t): New
template alias.
(_Hashtable<>::__fwd_value_for): New.
(_Hashtable<>::_M_assign_elements<>): Remove _NodeGenerator template
parameter.
(_Hashtable<>::_M_assign<>): Add _Ht template parameter.
(_Hashtable<>::operator=(const _Hashtable<>&)): Adapt.
(_Hashtable<>::_M_move_assign): Adapt. Replace std::move_if_noexcept
with std::move.
(_Hashtable<>::_Hashtable(const _Hashtable&)): Adapt.
(_Hashtable<>::_Hashtable(const _Hashtable&, const allocator_type&)):
Adapt.
(_Hashtable<>::_Hashtable(_Hashtable&&, const allocator_type&)):
Adapt.
* testsuite/23_containers/unordered_set/92124.cc: New.
libstdc++: Fix error handling in filesystem::remove_all (PR93201) When recursing into a directory, any errors that occur while removing a directory entry are ignored, because the subsequent increment of the directory iterator clears the error_code object. This fixes that bug by checking the result of each recursive operation before incrementing. This is a change in observable behaviour, because previously other directory entries would still be removed even if one (or more) couldn't be removed due to errors. Now the operation stops on the first error, which is what the code intended to do all along. The standard doesn't specify what happens in this case (because the order that the entries are processed is unspecified anyway). It also improves the error reporting so that the name of the file that could not be removed is included in the filesystem_error exception. This is done by introducing a new helper type for reporting errors with additional context and a new function that uses that type. Then the overload of std::filesystem::remove_all that throws an exception can use the new function to ensure any exception contains the additional information. For std::experimental::filesystem::remove_all just fix the bug where errors are ignored. PR libstdc++/93201 * src/c++17/fs_ops.cc (do_remove_all): New function implementing more detailed error reporting for remove_all. Check result of recursive call before incrementing iterator. (remove_all(const path&), remove_all(const path&, error_code&)): Use do_remove_all. * src/filesystem/ops.cc (remove_all(const path&, error_code&)): Check result of recursive call before incrementing iterator. * testsuite/27_io/filesystem/operations/remove_all.cc: Check errors are reported correctly. * testsuite/experimental/filesystem/operations/remove_all.cc: Likewise. From-SVN: r280014
2020-01-08 17:44:45 +01:00
2020-01-08 Jonathan Wakely <jwakely@redhat.com>
PR libstdc++/93201
* src/c++17/fs_ops.cc (do_remove_all): New function implementing more
detailed error reporting for remove_all. Check result of recursive
call before incrementing iterator.
(remove_all(const path&), remove_all(const path&, error_code&)): Use
do_remove_all.
* src/filesystem/ops.cc (remove_all(const path&, error_code&)): Check
result of recursive call before incrementing iterator.
* testsuite/27_io/filesystem/operations/remove_all.cc: Check errors
are reported correctly.
* testsuite/experimental/filesystem/operations/remove_all.cc: Likewise.
2020-01-07 Thomas Rodgers <trodgers@redhat.com>
* include/std/condition_variable
(condition_variable_any::wait_on): Rename to match current draft
standard.
(condition_variable_any::wait_on_until): Likewise.
(condition_variable_any::wait_on_for): Likewise.
* testsuite/30_threads/condition_variable_any/stop_token/wait_on.cc:
Adjust tests to account for renamed methods.
2020-01-07 François Dumont <fdumont@gcc.gnu.org>
PR libstdc++/92124
* include/bits/stl_tree.h
(_Rb_tree<>::_M_move_assign(_Rb_tree&, false_type)): Replace
std::move_if_noexcept by std::move.
* testsuite/23_containers/map/92124.cc: New.
* testsuite/23_containers/set/92124.cc: New.
2020-01-06 Jonathan Wakely <jwakely@redhat.com>
* include/std/stop_token (stop_token): Remove operator!= (LWG 3254).
(stop_source): Likewise (LWG 3362).
* testsuite/30_threads/stop_token/stop_source.cc: Test equality
comparisons.
* include/bits/stl_algobase.h (__is_byte_iter, __min_cmp)
(lexicographical_compare_three_way): Do not depend on
__cpp_lib_concepts.
* include/std/version (__cpp_lib_three_way_comparison): Only define
when __cpp_lib_concepts is defined.
* libsupc++/compare (__cpp_lib_three_way_comparison): Likewise.
2020-01-03 Jonathan Wakely <jwakely@redhat.com>
* include/bits/stl_algobase.h (lexicographical_compare_three_way):
Only define four-argument overload when __cpp_lib_concepts is defined.
2020-01-01 John David Anglin <danglin@gcc.gnu.org>
* config/abi/post/hppa-linux-gnu/baseline_symbols.txt: Update.
2020-01-01 Jakub Jelinek <jakub@redhat.com>
Update copyright years.
Copyright (C) 2020 Free Software Foundation, Inc.
Copying and distribution of this file, with or without modification,
are permitted in any medium without royalty provided the copyright
notice and this notice are preserved.