Commit graph

13590 commits

Author SHA1 Message Date
GCC Administrator
1995a0227d Daily bump. 2022-09-14 00:18:07 +00:00
Patrick Palka
7d7e2149cd libstdc++: Implement ranges::slide_view from P2442R1
This also implements the LWG 3711 and 3712 changes to slide_view.

libstdc++-v3/ChangeLog:

	* include/std/ranges (__detail::__slide_caches_nothing): Define.
	(__detail::__slide_caches_last): Define.
	(__detail::__slide_caches_first): Define.
	(slide_view): Define.
	(enable_borrowed_range<slide_view>): Define.
	(slide_view::_Iterator): Define.
	(slide_view::_Sentinel): Define.
	(views::__detail::__can_slide_view): Define.
	(views::_Slide, views::slide): Define.
	* testsuite/std/ranges/adaptors/slide/1.cc: New test.
2022-09-13 11:18:16 -04:00
Patrick Palka
5d84a4418a libstdc++: Implement ranges::chunk_view from P2442R1
This also implements the LWG 3707, 3710 and 3712 changes to chunk_view.

libstdc++-v3/ChangeLog:

	* include/std/ranges (__detail::__div_ceil): Define.
	(chunk_view): Define.
	(chunk_view::_OuterIter): Define.
	(chunk_view::_OuterIter::value_type): Define.
	(chunk_view::_InnerIter): Define.
	(chunk_view<_Vp>): Define partial specialization for forward
	ranges.
	(enable_borrowed_range<chunk_view>): Define.
	(chunk_view<_Vp>::_Iterator): Define.
	(views::__detail::__can_chunk_view): Define.
	(views::_Chunk, views::chunk): Define.
	* testsuite/std/ranges/adaptors/chunk/1.cc: New test.
2022-09-13 11:18:14 -04:00
Patrick Palka
7aa80c82ec libstdc++: Implement LWG 3569 changes to join_view::_Iterator
libstdc++-v3/ChangeLog:

	* include/std/ranges (join_view::_Iterator::_M_satisfy):
	Adjust resetting _M_inner as per LWG 3569.
	(join_view::_Iterator::_M_inner): Wrap in std::optional
	as per LWG 3569.
	(join_view::_Iterator::_Iterator): Relax constraints as
	per LWG 3569.
	(join_view::_Iterator::operator*): Adjust as per LWG 3569.
	(join_view::_Iterator::operator->): Likewise.
	(join_view::_Iterator::operator++): Likewise.
	(join_view::_Iterator::operator--): Likewise.
	(join_view::_Iterator::iter_move): Likewise.
	(join_view::_Iterator::iter_swap): Likewise.
	* testsuite/std/ranges/adaptors/join.cc (test14): New test.
2022-09-13 11:18:07 -04:00
Patrick Palka
edf6fe7800 libstdc++: Avoid -Wparentheses warning with debug iterators
I noticed compiling e.g. std/ranges/adaptors/join.cc with
-D_GLIBCXX_DEBUG -Wsystem-headers -Wall gives the warning:

  gcc/libstdc++-v3/include/debug/safe_iterator.h:477:9: warning: suggest parentheses around ‘&&’ within ‘||’ [-Wparentheses]

libstdc++-v3/ChangeLog:

	* include/debug/safe_iterator.h (_GLIBCXX_DEBUG_VERIFY_OPERANDS):
	Add parentheses to avoid -Wparentheses warning.
2022-09-13 10:41:47 -04:00
GCC Administrator
b5f09bd766 Daily bump. 2022-09-13 00:18:20 +00:00
Patrick Palka
db19cfdac8 libstdc++: Add already-accepted <ranges> testcase [PR106320]
Although PR106320 affected only the 10 and 11 branches, and the testcase
from there is already correctly accepted on trunk and the 12 branch, we
still should add the testcase to trunk/12 too for inter-branch consistency.

	PR libstdc++/106320

libstdc++-v3/ChangeLog:

	* testsuite/std/ranges/adaptors/join.cc (test13): New test.
2022-09-12 15:05:04 -04:00
Jonathan Wakely
c092d89426 libstdc++: Fix comments in tests to match code
libstdc++-v3/ChangeLog:

	* testsuite/19_diagnostics/error_code/cons/lwg3629.cc: Fix
	comments.
	* testsuite/19_diagnostics/error_condition/cons/lwg3629.cc:
	Likewise.
2022-09-12 12:03:45 +01:00
Jakub Jelinek
723ef5a937 libstdc++: Outline the overlapping case of string _M_replace into a separate function [PR105329]
The following patch is partially a workaround for bogus warnings
when the compiler isn't able to fold _M_disjunct call into constant
false, but also an optimization attempt - assuming _M_disjunct (__s)
is rare, the patch should shrink code size for the common case and
use library or for non-standard instantiations an out of line
function to handle the rare case.

2022-09-12  Jakub Jelinek  <jakub@redhat.com>

	PR tree-optimization/105329
	* acinclude.m4 (libtool_VERSION): Change to 6:31:0.
	* config/abi/pre/gnu.ver (GLIBCXX_3.4.21): Don't export
	std::basic_string methods with name length of 15.
	(GLIBCXX_3.4.31): Export std::basic_string::_M_replace_cold.
	* testsuite/util/testsuite_abi.cc (check_version): Handle
	GLIBCXX_3.4.31.
	* include/bits/basic_string.h (std::basic_string::_M_replace_cold):
	Declare.
	* include/bits/basic_string.tcc (std::basic_string::_M_replace_cold):
	Define and export even for C++20.
	(std::basic_string::_M_replace): Use __builtin_expect, outline
	the overlapping case to _M_replace_cold.
	* configure: Regenerated.
2022-09-12 11:36:58 +02:00
GCC Administrator
861d1a11c0 Daily bump. 2022-09-10 00:17:21 +00:00
Jonathan Wakely
007680f946 libstdc++: Rename parameter to avoid darwin __weak qualifier
libstdc++-v3/ChangeLog:

	* include/bits/atomic_base.h (__atomic_impl::__compare_exchange):
	Rename __weak to __is_weak.
	* testsuite/17_intro/names.cc: Add __weak and __strong.
2022-09-09 21:11:14 +01:00
Patrick Palka
8298427f6b libstdc++: Fix return type of empty zip_/adjacent_transform [PR106803]
PR libstdc++/106803

libstdc++-v3/ChangeLog:

	* include/std/ranges (views::_ZipTransform::operator()): Correct
	return type in the empty case.
	(views::_AdjacentTransform::operator()): Likewise.
2022-09-09 14:59:14 -04:00
Patrick Palka
e469506b7f libstdc++: Fix typo in adjacent_view::_Iterator [PR106798]
PR libstdc++/106798

libstdc++-v3/ChangeLog:

	* include/std/ranges (adjacent_view::_Iterator::_Iterator): Fix
	typo.
	* testsuite/std/ranges/adaptors/adjacent/1.cc (test04): New test.
2022-09-09 14:56:37 -04:00
Patrick Palka
718a6d475b libstdc++: Fix zip_view's operator- for integer-class difference type [PR106766]
The difference type of an underlying iterator could be an integer-class
type, which make_unsigned_t doesn't handle, so we need to use the more
general __make_unsigned_like_t / __to_unsigned_like here instead.

	PR libstdc++/106766

libstdc++-v3/ChangeLog:

	* include/std/ranges (zip_view::_Iterator::operator-): Use
	__to_unsigned_like instead of make_unsigned_t.
	(zip_view::_Sentinel::operator-): Likewise.
	* testsuite/std/ranges/zip/1.cc (test04): New test.
2022-09-09 14:56:32 -04:00
GCC Administrator
2e7ad70c4a Daily bump. 2022-09-09 00:18:05 +00:00
François Dumont
a0f8350118 libstdc++: mallinfo deprecated, use mallinfo2 when glibc => 2.33
glibc mallinfo is now deprecated resulting in make check-performance
failure. When glibc => 2.33 prefer mallinfo2.

libstdc++-v3/ChangeLog:

	* testsuite/util/testsuite_performance.h (__gnu_test::MallocInfo): New.
	(__gnu_test::malloc_info): New, replace mallinfo on current platform
	supporting it and use mallinfo2 when glibc >= 2.33.
2022-09-08 21:21:13 +02:00
Jonathan Wakely
30c811f2ba c++: Fix type completeness checks for type traits [PR106838]
The check_trait_type function is used for a number of different type
traits that have different requirements on their arguments. For example,
__is_constructible allows arrays of unknown bound even if the array
element is an incomplete type, but __is_aggregate does not, it always
requires the array element type to be complete. Other traits have
different requirements again, e.g. __is_empty allows incomplete unions,
and arrays (of known or unknown bound) of incomplete types.

This alters the check_trait_type function to take an additional KIND
parameter which indicates which set of type trait requirements to check.

As noted in a comment, the requirements for __is_aggregate deviate from
the ones for std::is_aggregate in the standard. It's not necessary for
the elements of an array to be complete types, because arrays are always
aggregates.

The type_has_virtual_destructor change is needed to avoid an ICE.
Previously it could never be called for incomplete union types as they
were (incorrectly) rejected by check_trait_type.

This change causes some additional diagnostics in some libstdc++ tests,
where the front end was not previously complaining about invalid types
that the library assertions diagnosed. We should consider removing the
library assertions from traits where the front end implements the
correct checks now.

	PR c++/106838

gcc/cp/ChangeLog:

	* class.cc (type_has_virtual_destructor): Return false for
	union types.
	* semantics.cc (check_trait_type): Add KIND parameter to support
	different sets of requirements.
	(finish_trait_expr): Pass KIND argument for relevant traits.

gcc/ChangeLog:

	* doc/extend.texi (Type Traits): Fix requirements. Document
	__is_aggregate and __is_final.

gcc/testsuite/ChangeLog:

	* g++.dg/ext/array4.C: Fix invalid use of __is_constructible.
	* g++.dg/ext/unary_trait_incomplete.C: Fix tests for traits with
	different requirements.

libstdc++-v3/ChangeLog:

	* testsuite/20_util/is_complete_or_unbounded/memoization_neg.cc:
	Prune additional errors from front-end.
	* testsuite/20_util/is_move_constructible/incomplete_neg.cc:
	Likewise.
	* testsuite/20_util/is_nothrow_swappable/incomplete_neg.cc:
	Likewise.
	* testsuite/20_util/is_nothrow_swappable_with/incomplete_neg.cc:
	Likewise.
	* testsuite/20_util/is_swappable_with/incomplete_neg.cc:
	Likewise.
2022-09-08 19:29:13 +01:00
Jonathan Wakely
4977507e32 libstdc++: Add always_inline attribute to std::byte operators
libstdc++-v3/ChangeLog:

	* include/c_global/cstddef (byte): Add always_inline attribute
	to all operator overloads.
	(to_integer): Add always_inline attribute.
2022-09-08 19:29:12 +01:00
Thomas Rodgers
157236dbd6 libstdc++: Clear padding bits in atomic compare_exchange
This change implements P0528 which requires that padding bits not
participate in atomic compare exchange operations. All arguments to the
generic template are 'sanitized' by the __builtin_clear_padding intrinsic
before they are used in comparisons. This requires that any stores
also sanitize the incoming value.

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

Signed-off-by: Thomas Rodgers <trodgers@redhat.com>

libstdc++-v3/ChangeLog:

	* include/bits/atomic_base.h (__atomic_impl::__maybe_has_padding):
	New function.
	(__atomic_impl::clear_padding): Likewise.
	(__atomic_impl::__compare_exchange): Likewise.
	(__atomic_impl::compare_exchange_weak): Delegate to
	__compare_exchange.
	(__atomic_impl::compare_exchange_strong): Likewise.
	* include/std/atomic (atomic<T>::atomic(T)): Clear padding when
	possible in a constexpr function.
	(atomic::store): Clear padding.
	(atomic::exchange): Likewise.
	(atomic::compare_exchange_weak): Use __compare_exchange.
	(atomic::compare_exchange_strong): Likewise.
	* testsuite/29_atomics/atomic/compare_exchange_padding.cc: New
	test.
	* testsuite/29_atomics/atomic_ref/compare_exchange_padding.cc:
	New test.
2022-09-08 19:29:12 +01:00
Jonathan Wakely
d3883dc77b libstdc++: Find make_error_code and make_error_condition via ADL only
The new proposed resolution for LWG 3629 says that std::error_code and
std::error_condition should only use ADL to find their customization
points. This means we need to use a poison pill to prevent lookup from
finding overloads in the enclosing namespaces.

We can also remove the forward declarations of std::make_error_code and
std::make_error_condition, because they aren't needed now. ADL can find
them anyway (when std is an associated namespace), and unqualified name
lookup will not (and should not) find them.

libstdc++-v3/ChangeLog:

	* include/std/system_error (__adl_only::make_error_code): Add
	deleted function.
	(__adl_only::make_error_condition): Likewise.
	(error_code::error_code(ErrorCodeEnum)): Add using-declaration
	for deleted function.
	(error_condition::error_condition(ErrorConditionEnum)):
	Likewise.
	* testsuite/19_diagnostics/error_code/cons/lwg3629.cc: New test.
	* testsuite/19_diagnostics/error_condition/cons/lwg3629.cc: New test.
2022-09-08 19:29:12 +01:00
GCC Administrator
fe2a8ce93c Daily bump. 2022-09-08 00:18:33 +00:00
Jonathan Wakely
d7f282c424 libstdc++: Add missing runtime exception to licence notice
This file is missing the GCC Runtime Library Exception text in the
licence header. That is unintentional, and it should have been present.

libstdc++-v3/ChangeLog:

	* include/std/barrier: Add missing runtime exception.
2022-09-07 20:25:00 +01:00
Patrick Palka
cdcc27c1ca libstdc++: Optimize is_reference
Instead of defining is_reference in terms of is_[lr]value_reference,
just define it directly.

libstdc++-v3/ChangeLog:

	* include/std/type_traits (is_reference): Make the primary
	template derive from false_type.  Define two partial
	specializations that derive from true_type.
2022-09-07 10:21:51 -04:00
Patrick Palka
66af6e991b libstdc++: Optimize is_void and is_null_pointer
Instead of defining these in terms of a helper class template
and the relatively expensive __remove_cv_t, just declare four
explicit specializations of the main template, one for each choice
of cv-quals.

libstdc++-v3/ChangeLog:

	* include/std/type_traits (__is_void_helper): Remove.
	(is_void): Make the primary template derive from false_type,
	and define four explicit specializations that derive from
	true_type.
	(__is_null_pointer_helper, is_null_pointer): Likewise.
2022-09-07 10:21:45 -04:00
Jason Merrill
873d395c29 libstdc++: small dynamic_cast optimization
This change speeds up the simple benchmark below by about 40%.

struct A { virtual ~A() {} };
struct B: A { } b;
A* ap = &b;
void *sink;
int main()
{
  for (long i = 0; i < 4000000000L; ++i)
    sink = dynamic_cast<B*>(ap);
}

libstdc++-v3/ChangeLog:

	* libsupc++/dyncast.cc (__dynamic_cast): Avoid virtual function
	call in simple success case.
2022-09-07 10:11:54 -04:00
GCC Administrator
25aeb92221 Daily bump. 2022-09-07 00:17:51 +00:00
Philipp Fent
190c644c06 libstdc++: Fix pretty printer tests of tuple indexes
Signed-off-by: Philipp Fent <fent@in.tum.de>

libstdc++-v3/ChangeLog:

	* testsuite/libstdc++-prettyprinters/48362.cc: Fix expected
	tuple indices.
	* testsuite/libstdc++-prettyprinters/cxx11.cc: Likewise.
2022-09-06 12:12:00 +01:00
GCC Administrator
47d2dcd139 Daily bump. 2022-09-06 00:17:07 +00:00
Jonathan Wakely
8492f7dd51 libstdc++: Move __success_type and __failure_type later in file
libstdc++-v3/ChangeLog:

	* include/std/type_traits (__success_type, __failure_type): Move
	definitions later in the file.
2022-09-05 17:44:33 +01:00
Jonathan Wakely
7b3587b3c2 libstdc++: Use built-ins for more variable templates
libstdc++-v3/ChangeLog:

	* include/std/type_traits (is_trivial_v, is_trivially_copyable_v)
	(is_standard_layout_v, is_pod_v, is_literal_type_v): Use
	built-in instead of class template.
	(is_same_v): Add partial specialization for true case.
2022-09-05 15:58:51 +01:00
GCC Administrator
c64b09471a Daily bump. 2022-09-03 00:17:21 +00:00
Patrick Palka
68c23af0dd libstdc++: Consistently use ::type when deriving from __and/or/not_
Now that these internal type traits are (again) class templates, it's
better to derive from the trait's ::type instead of from the trait
itself, for sake of a shallower inheritance chain.

libstdc++-v3/ChangeLog:

	* include/std/tuple (tuple::_UseOtherCtor): Use ::type when
	deriving from __and_, __or_ or __not_.
	* include/std/type_traits (negation): Likewise.
	(is_unsigned): Likewise.
	(__is_implicitly_default_constructible): Likewise.
	(is_trivially_destructible): Likewise.
	(__is_nt_invocable_impl): Likewise.
2022-09-02 15:16:37 -04:00
Jonathan Wakely
45433832a1 libstdc++: Optimize constructible/assignable variable templates
This defines the is_xxx_constructible_v and is_xxx_assignable_v variable
templates by using the built-ins directly. The actual logic for each one
is the same as the corresponding class template, but way using the
variable template doesn't need to instantiate the class template.

This means that the variable templates won't use the static assertions
checking for complete types, cv void or unbounded arrays, but that's OK
because the built-ins check those anyway. We could probably remove the
static assertions from the class templates, and maybe from all type
traits that use a built-in.

libstdc++-v3/ChangeLog:

	* include/std/type_traits (is_constructible_v)
	(is_default_constructible_v, is_copy_constructible_v)
	(is_move_constructible_v): Define using __is_constructible.
	(is_assignable_v, is_copy_assignable_v, is_move_assignable_v):
	Define using __is_assignable.
	(is_trivially_constructible_v)
	(is_trivially_default_constructible_v)
	(is_trivially_copy_constructible_v)
	(is_trivially_move_constructible_v): Define using
	__is_trivially_constructible.
	(is_trivially_assignable_v, is_trivially_copy_assignable_v)
	(is_trivially_move_assignable_v): Define using
	__is_trivially_assignable.
	(is_nothrow_constructible_v)
	(is_nothrow_default_constructible_v)
	(is_nothrow_copy_constructible_v)
	(is_nothrow_move_constructible_v): Define using
	__is_nothrow_constructible.
	(is_nothrow_assignable_v, is_nothrow_copy_assignable_v)
	(is_nothrow_move_assignable_v): Define using
	__is_nothrow_assignable.
2022-09-02 16:57:49 +01:00
Patrick Palka
51c42b38e4 libstdc++: Fix laziness of __and/or/not_
r13-2230-g390f94eee1ae69 redefined the internal logical operator traits
__and_, __or_ and __not_ as alias templates that directly resolve to
true_type or false_type.  But it turns out using an alias template here
causes the traits to be less lazy than before because we now compute the
logical result immediately upon _specialization_ of the trait, and not
later upon _completion_ of the specialization.

So for example, in

  using type = __and_<A, __not_<B>>;

we now compute the conjunction and thus instantiate A even though we're
in a context that doesn't require completion of the __and_.  What's
worse is that we also compute the inner negation and thus instantiate B
(for the same reason), independent of the __and_ and the value of A!
Thus the traits are now less lazy and composable than before.

Fortunately, the fix is cheap and straightforward: redefine these traits
as class templates instead of as alias templates so that computation of
the logical result is triggered by completion, not by specialization.

libstdc++-v3/ChangeLog:

	* include/std/type_traits (__or_, __and_, __not_): Redefine as a
	class template instead of as an alias template.
	* testsuite/20_util/logical_traits/requirements/short_circuit.cc:
	Add more tests for conjunction and disjunction.  Add corresponding
	tests for __and_ and __or_.
2022-09-02 11:19:51 -04:00
GCC Administrator
bb0a1556df Daily bump. 2022-09-02 00:16:33 +00:00
Jonathan Wakely
42e489088b libstdc++: Add 'typename' for Clang compatibility
Clang doesn't yet implement the C++20 change that makes 'typename'
optional here.

libstdc++-v3/ChangeLog:

	* include/std/ranges (adjacent_transform_view::_Iterator): Add
	typename keyword before dependent qualified-id.
2022-09-01 20:36:06 +01:00
Jonathan Wakely
56bb34e3d2 libstdc++: Remove __is_referenceable helper
We only use the __is_referenceable helper in three places now:
add_pointer, add_lvalue_reference, and add_rvalue_reference. But lots of
other traits depend on add_[lr]value_reference, and decay depends on
add_pointer, so removing the instantiation of __is_referenceable helps
compile all those other traits slightly faster.

We can just use void_t<T&> to check for a referenceable type in the
add_[lr]value_reference traits.

Then we can specialize add_pointer for reference types, so that we don't
need to use remove_reference, and then use void_t<T*> for all
non-reference types to detect when we can form a pointer to the type.

libstdc++-v3/ChangeLog:

	* include/std/type_traits (__is_referenceable): Remove.
	(__add_lvalue_reference_helper, __add_rvalue_reference_helper):
	Use __void_t instead of __is_referenceable.
	(__add_pointer_helper): Likewise.
	(add_pointer): Add partial specializations for reference types.
2022-09-01 20:31:00 +01:00
Jonathan Wakely
9bcedbbfc5 libstdc++: Optimize is_constructible traits
We can replace some class template helpers with alias templates, which
are cheaper to instantiate.

For example, replace the __is_copy_constructible_impl class template
with an alias template that uses just evaluates the __is_constructible
built-in, using add_lvalue_reference<const T> to get the argument type
in a way that works for non-referenceable types. For a given
specialization of is_copy_constructible this results in the same number
of class templates being instantiated (for the common case of non-void,
non-function types), but the add_lvalue_reference instantiations are not
specific to the is_copy_constructible specialization and so can be
reused by other traits. Previously __is_copy_constructible_impl was a
distinct class template and its specializations were never used for
anything except is_copy_constructible.

With the new definitions of these traits that don't depend on helper
classes, it becomes more practical to optimize the
is_xxx_constructible_v variable templates to avoid instantiations.
Previously doing so would have meant two entirely separate
implementation strategies for these traits.

libstdc++-v3/ChangeLog:

	* include/std/type_traits (__is_constructible_impl): Replace
	class template with alias template.
	(is_default_constructible, is_nothrow_constructible)
	(is_nothrow_constructible): Simplify base-specifier.
	(__is_copy_constructible_impl, __is_move_constructible_impl)
	(__is_nothrow_copy_constructible_impl)
	(__is_nothrow_move_constructible_impl): Remove class templates.
	(is_copy_constructible, is_move_constructible)
	(is_nothrow_constructible, is_nothrow_default_constructible)
	(is_nothrow_copy_constructible, is_nothrow_move_constructible):
	Adjust base-specifiers to use __is_constructible_impl.
	(__is_copy_assignable_impl, __is_move_assignable_impl)
	(__is_nt_copy_assignable_impl, __is_nt_move_assignable_impl):
	Remove class templates.
	(__is_assignable_impl): New alias template.
	(is_assignable, is_copy_assignable, is_move_assignable):
	Adjust base-specifiers to use new alias template.
	(is_nothrow_copy_assignable, is_nothrow_move_assignable):
	Adjust base-specifiers to use existing alias template.
	(__is_trivially_constructible_impl): New alias template.
	(is_trivially_constructible, is_trivially_default_constructible)
	(is_trivially_copy_constructible)
	(is_trivially_move_constructible): Adjust base-specifiers to use
	new alias template.
	(__is_trivially_assignable_impl): New alias template.
	(is_trivially_assignable, is_trivially_copy_assignable)
	(is_trivially_move_assignable): Adjust base-specifier to use
	new alias template.
	(__add_lval_ref_t, __add_rval_ref_t): New alias templates.
	(add_lvalue_reference, add_rvalue_reference): Use new alias
	templates.
2022-09-01 20:31:00 +01:00
Jonathan Wakely
775fe01b38 libstdc++: Optimize std::decay
Define partial specializations of std::decay and its __decay_selector
helper so that remove_reference, is_array and is_function are not
instantiated for every type, and remove_extent is not instantiated for
arrays.

libstdc++-v3/ChangeLog:

	* include/std/type_traits (__decay_selector): Add partial
	specializations for array types. Only check for function types
	when not dealing with an array.
	(decay): Add partial specializations for reference types.
2022-09-01 20:31:00 +01:00
Jonathan Wakely
33005a4be4 libstdc++: Add specializations for some variable templates
This avoids having to instantiate a class template when we can detect
the true cases easily with a partial specialization.

libstdc++-v3/ChangeLog:

	* include/std/type_traits (is_lvalue_reference_v)
	(is_rvalue_reference_v, is_reference_v, is_const_v)
	(is_volatile_v): Define using partial specializations instead
	of instantiating class templates.
2022-09-01 20:31:00 +01:00
Jonathan Wakely
cd20d9482a libstdc++: Use built-ins for some variable templates
This avoids having to instantiate a class template that just uses the
same built-in anyway.

None of the corresponding class templates have any type-completeness
static assertions, so we're not losing any diagnostics by using the
built-ins directly.

libstdc++-v3/ChangeLog:

	* include/std/type_traits (is_enum_v, is_class_v, is_union_v)
	(is_empty_v, is_polymoprhic_v, is_abstract_v, is_final_v)
	(is_base_of_v, is_aggregate_v): Use built-in directly instead of
	instantiating class template.
2022-09-01 20:31:00 +01:00
Jonathan Wakely
37ff51a985 libstdc++: Remove FIXME for ICE with remove_cvref_t in requires-expression
PR c++/99968 is fixed since GCC 12.1 so we can remove the workaround.

libstdc++-v3/ChangeLog:

	* include/std/type_traits (is_scoped_enum): Remove workaround.
2022-09-01 15:47:30 +01:00
Patrick Palka
0cb8d96157 libstdc++: Implement ranges::adjacent_transform_view from P2321R2
libstdc++-v3/ChangeLog:

	* include/std/ranges (__detail::__unarize): Define.
	(adjacent_view::_Iterator): Befriend adjacent_transform_view.
	(adjacent_transform_view): Define.
	(adjacent_transform_view::_Iterator): Define.
	(adjacent_transform_view::_Sentinel): Define.
	(views::__detail::__can_adjacent_transform_view): Define.
	(views::_AdjacentTransform): Define.
	(views::adjacent_transform): Define.
	(views::pairwise_transform): Define.
	* testsuite/std/ranges/adaptors/adjacent_transform/1.cc: New test.
2022-09-01 09:54:57 -04:00
Jonathan Wakely
0e1b1222af libstdc++: Optimize array traits
Improve compile times by avoiding unnecessary class template
instantiations.

__is_array_known_bounds and __is_array_unknown_bounds can be defined
without instantiating extent, by providing partial specializations for
the true cases.

std::extent can avoid recursing down through a multidimensional array,
so it stops after providing the result. Previously extent<T[n][m], 0>
would instantiate extent<T[n], -1u> and extent<T, -2u> as well.

std::is_array_v can use partial specializations to avoid instantiating
std::is_array, and similarly for std::rank_v and std::extent_v.

std::is_bounded_array_v and std::is_unbounded_array_v can also use
partial specializations, and then the class templates can be defined in
terms of the variable templates. This makes sense for these traits,
because they are new in C++20 and so the variable templates are always
available, which isn't true in general for C++11 and C++14 traits.

libstdc++-v3/ChangeLog:

	* include/std/type_traits (__is_array_known_bounds): Add partial
	specialization instead of using std::extent.
	(__is_array_unknown_bounds): Likewise.
	(extent): Add partial specializations to stop recursion after
	the result is found.
	(is_array_v): Add partial specializations instead of
	instantiating the class template.
	(rank_v, extent_v): Likewise.
	(is_bounded_array_v, is_unbounded_array_v): Likewise.
	(is_bounded_array, is_unbounded_array): Define in terms of the
	variable templates.
2022-09-01 10:22:07 +01:00
GCC Administrator
542c60c4fb Daily bump. 2022-09-01 00:17:39 +00:00
Patrick Palka
26aafae4e5 libstdc++: A few more minor <ranges> cleanups
libstdc++-v3/ChangeLog:

	* include/bits/ranges_base.h (__advance_fn::operator()): Add
	parentheses in assert condition to avoid -Wparentheses warning.
	* include/std/ranges: (take_view::take_view): Uglify 'base'.
	(take_while_view::take_while_view): Likewise.
	(elements_view::elements_view): Likewise.
	(views::_Zip::operator()): Adjust position of [[nodiscard]] for
	compatibility with -fconcepts-ts.
	(zip_transform_view::_Sentinel): Uglify 'OtherConst'.
	(views::_ZipTransform::operator()): Adjust position of
	[[nodiscard]] for compatibilty with -fconcepts-ts.
2022-08-31 16:45:30 -04:00
Martin Liska
dc832fb39f 32-bit PA-RISC with HP-UX: remove deprecated ports
ChangeLog:

	* configure: Regenerate.
	* configure.ac: Delete hpux9 and hpux10.

config/ChangeLog:

	* mh-pa-hpux10: Removed.

contrib/ChangeLog:

	* config-list.mk: Remove deprecated ports.

contrib/header-tools/ChangeLog:

	* README: Remove deprecated ports.
	* reduce-headers: Likewise.

gcc/ChangeLog:

	* config.build: Remove deprecated ports.
	* config.gcc: Likewise.
	* config.host: Likewise.
	* configure.ac: Likewise.
	* configure: Regenerate.
	* config/pa/pa-hpux10.h: Removed.
	* config/pa/pa-hpux10.opt: Removed.
	* config/pa/t-dce-thr: Removed.

gnattools/ChangeLog:

	* configure.ac: Remove deprecated ports.
	* configure: Regenerate.

libstdc++-v3/ChangeLog:

	* configure: Regenerate.
	* crossconfig.m4: Remove deprecated ports.

gcc/testsuite/ChangeLog:

	* g++.dg/cpp0x/lambda/lambda-conv.C: Remove useless test.
	* gcc.c-torture/execute/ieee/hugeval.x: Likewise.
	* gcc.dg/torture/pr47917.c: Likewise.
	* lib/target-supports.exp: Likewise.

libgcc/ChangeLog:

	* config.host: Remove hppa.

libitm/ChangeLog:

	* configure: Regenerate.

fixincludes/ChangeLog:

	* configure: Regenerate.
2022-08-31 22:14:34 +02:00
François Dumont
5f932c9f93 libstdc++: [_GLIBCXX_DEBUG] Review nullptr assertion diagnostics
Review null string checks to show:
_String != nullptr

rather than:
_String != 0

libstdc++-v3/ChangeLog:

	* include/debug/debug.h: Use nullptr rather than '0' in checks in post-C++11.
	* include/debug/string: Likewise.
	* testsuite/21_strings/basic_string/operations/ends_with/char.cc: Use __gnu_test::string.
	* testsuite/21_strings/basic_string/operations/ends_with/nonnull.cc: Likewise.
	* testsuite/21_strings/basic_string/operations/ends_with/wchar_t.cc: Likewise.
	* testsuite/21_strings/basic_string/operations/starts_with/wchar_t.cc: Likewise.
	* testsuite/21_strings/basic_string/operations/starts_with/nonnull.cc: Likewise.
	* testsuite/21_strings/basic_string/operations/starts_with/char.cc: Likewise..
2022-08-31 21:22:09 +02:00
Patrick Palka
f956cadc29 libstdc++: Implement ranges::adjacent_view from P2321R2
libstdc++-v3/ChangeLog:

	* include/std/ranges (adjacent_view): Define.
	(enable_borrowed_range<adjacent_view>): Define.
	(__detail::__repeated_tuple): Define.
	(adjacent_view::_Iterator): Define.
	(adjacent_view::_Sentinel): Define.
	(views::__detail::__can_adjacent_view): Define.
	(views::_Adjacent): Define.
	(views::adjacent): Define.
	(views::pairwise): Define.
	* testsuite/std/ranges/adaptors/adjacent/1.cc: New test.
2022-08-31 15:09:10 -04:00
François Dumont
4d5660907c libstdc++: [_GLIBCXX_DEBUG] Add backtrace generation on demand
Add _GLIBCXX_DEBUG_BACKTRACE macro to activate backtrace generation on
_GLIBCXX_DEBUG assertions. Prerequisite is to have configure the lib with:

--enable-libstdcxx-backtrace=yes

libstdc++-v3/ChangeLog:

	* include/debug/formatter.h
	[_GLIBCXX_HAVE_STACKTRACE](__glibcxx_backtrace_state): Declare.
	[_GLIBCXX_HAVE_STACKTRACE](__glibcxx_backtrace_create_state): Declare.
	[_GLIBCXX_HAVE_STACKTRACE](__glibcxx_backtrace_full_callback): Define.
	[_GLIBCXX_HAVE_STACKTRACE](__glibcxx_backtrace_error_callback): Define.
	[_GLIBCXX_HAVE_STACKTRACE](__glibcxx_backtrace_full_func): Define.
	[_GLIBCXX_HAVE_STACKTRACE](__glibcxx_backtrace_full): Declare.
	[_GLIBCXX_HAVE_STACKTRACE](_Error_formatter::_M_backtrace_state): New.
	[_GLIBCXX_HAVE_STACKTRACE](_Error_formatter::_M_backtrace_full): New.
	* src/c++11/debug.cc [_GLIBCXX_HAVE_STACKTRACE](print_backtrace): New.
	(_Error_formatter::_M_error()): Adapt.
	* src/libbacktrace/Makefile.am: Add backtrace.c.
	* src/libbacktrace/Makefile.in: Regenerate.
	* src/libbacktrace/backtrace-rename.h (backtrace_full): New.
	* testsuite/23_containers/vector/debug/assign4_backtrace_neg.cc: New test.
	* doc/xml/manual/debug_mode.xml: Document _GLIBCXX_DEBUG_BACKTRACE.
	* doc/xml/manual/using.xml: Likewise.
2022-08-31 20:51:10 +02:00