Commit graph

13772 commits

Author SHA1 Message Date
Jonathan Wakely
5814816641 libstdc++: Fix accidental duplicate test [PR91456]
It looks like I committed the testcase for std::function twice, instead
of one for std::function and one for std::is_invocable_r. This replaces
the is_invocable_r one with the example from the PR.

libstdc++-v3/ChangeLog:

	PR libstdc++/91456
	* testsuite/20_util/function/91456.cc: Add comment with PR
	number.
	* testsuite/20_util/is_invocable/91456.cc: Likewise. Replace
	std::function checks with std::is_invocable_r checks.
2022-09-21 15:01:37 +01:00
Jonathan Wakely
16fe325a43 libstdc++: Remove main() from some compile-only tests
libstdc++-v3/ChangeLog:

	* testsuite/17_intro/headers/c++1998/all_attributes.cc: Remove
	unnecessary main function.
	* testsuite/17_intro/headers/c++2011/all_attributes.cc:
	Likewise.
	* testsuite/17_intro/headers/c++2014/all_attributes.cc:
	Likewise.
	* testsuite/17_intro/headers/c++2017/all_attributes.cc:
	Likewise.
	* testsuite/17_intro/headers/c++2020/all_attributes.cc:
	Likewise.
2022-09-21 15:01:28 +01:00
Jonathan Wakely
980aa91e9c libstdc++: Update <memory> synopsis test for C++11 and later
libstdc++-v3/ChangeLog:

	* testsuite/20_util/headers/memory/synopsis.cc: Add declarations
	from C++11 and later.
2022-09-21 15:01:28 +01:00
Jonathan Wakely
9c23fe08c1 libstdc++: Remove trailing whitespace in documentation sources
libstdc++-v3/ChangeLog:

	* doc/xml/manual/documentation_hacking.xml: Remove trailing
	whitespace.
	* doc/xml/manual/policy_data_structures.xml: Likewise.
2022-09-21 08:44:22 +01:00
Jonathan Wakely
cb29396e67 libstdc++: Add _Exit to <stdlib.h> for freestanding
When I added std::_Exit to the freestanding declarations in <cstdlib> I
should also have added it to <stdlib.h>.

libstdc++-v3/ChangeLog:

	* include/c_compatibility/stdlib.h [!_GLIBCXX_HOSTED]: Add
	using-declaration for _Exit.
2022-09-21 08:44:21 +01:00
Jonathan Wakely
d784c5cfe6 libstdc++: Qualify std::abort() in test
This test includes <cstdlib> so should use std::abort not ::abort.

libstdc++-v3/ChangeLog:

	* testsuite/18_support/uncaught_exception/14026.cc: Qualify
	call to std::abort.
2022-09-21 08:44:21 +01:00
Jonathan Wakely
26cb69f8b4 libstdc++: Add <initializer_list> to ranges_base.h header
The header should be included explicitly to use std::initializer_list.
With the upcoming changes to make <ranges> available for freestanding
this becomes an error, because <initializer_list> is no longer provided
by any of the other headers involved here.

libstdc++-v3/ChangeLog:

	* include/bits/ranges_base.h: Include <initializer_list>.
2022-09-21 08:42:00 +01:00
GCC Administrator
5e4f5c25d6 Daily bump. 2022-09-21 00:19:14 +00:00
Jonathan Wakely
5ed0c11ec2 libstdc++: Fix typo in <cstdlib> for freestanding
libstdc++-v3/ChangeLog:

	* include/c_global/cstdlib [!_GLIBCXX_HOSTED] (quick_exit): Fix
	missing space.
2022-09-20 13:21:36 +01:00
GCC Administrator
7ee0fa100f Daily bump. 2022-09-17 00:17:20 +00:00
Jonathan Wakely
cf0fded5d8 libstdc++: Add preprocessor conditions for freestanding [PR106953]
This adds checks for _GLIBCXX_HOSTED to a number of headers which are
not currently installed for freestanding, but need to be for P1642R11
support. For example, <iterator> needs to be installed for C++23
freestanding mode, but without stream iterators and streambuf iterators.
Similarly, <memory> needs to be installed, but without std::allocator
and std::shared_ptr. This change disables the non-freestanding parts of
those headers.

libstdc++-v3/ChangeLog:

	PR libstdc++/106953
	* include/backward/auto_ptr.h [!_GLIBCXX_HOSTED]: Do not define
	shared_ptr members.
	* include/bits/alloc_traits.h [!_GLIBCXX_HOSTED]: Do not declare
	std::allocator_traits<std::allocator<T>> specializations for
	freestanding.
	* include/bits/memoryfwd.h [!_GLIBCXX_HOSTED] (allocator): Do
	not declare for freestanding.
	* include/bits/stl_algo.h [!_GLIBCXX_HOSTED] (stable_partition):
	Do not define for freestanding.
	[!_GLIBCXX_HOSTED] (merge, stable_sort): Do not use temporary
	buffers for freestanding.
	* include/bits/stl_algobase.h [!_GLIBCXX_HOSTED]: Do not declare
	streambuf iterators and overloaded algorithms using them.
	* include/bits/stl_uninitialized.h [!_GLIBCXX_HOSTED]: Do not
	define specialized overloads for std::allocator.
	* include/bits/unique_ptr.h [!_GLIBCXX_HOSTED] (make_unique)
	(make_unique_for_overwrite, operator<<): Do not define for
	freestanding.
	* include/c_global/cstdlib [!_GLIBCXX_HOSTED] (_Exit): Declare.
	Use _GLIBCXX_NOTHROW instead of throw().
	* include/debug/assertions.h [!_GLIBCXX_HOSTED]: Ignore
	_GLIBCXX_DEBUG for freestanding.
	* include/debug/debug.h [!_GLIBCXX_DEBUG]: Likewise.
	* include/std/bit [!_GLIBCXX_HOSTED]: Do not use the custom
	__int_traits if <ext/numeric_traits.h> is available.
	* include/std/functional [!_GLIBCXX_HOSTED]: Do not include
	headers that aren't valid for freestanding.
	(boyer_moore_searcher, boyer_moore_horspool_searcher): Do not
	define for freestanding.
	* include/std/iterator [!_GLIBCXX_HOSTED]: Do not include
	headers that aren't valid for freestanding.
	* include/std/memory [!_GLIBCXX_HOSTED]: Likewise.
	* include/std/ranges [!_GLIBCXX_HOSTED] (istream_view): Do not
	define for freestanding.
	(views::__detail::__is_basic_string_view) [!_GLIBCXX_HOSTED]:
	Do not define partial specialization for freestanding.
2022-09-16 21:47:19 +01:00
Jonathan Wakely
7f4c37099a libstdc++: Move allocator-related helpers to <bits/alloc_traits.h>
The __alloc_swap and __shrink_to_fit_aux helpers are not specific to
std::allocator, so don't belong in <bits/allocator.h>. This also
simplifies enabling <memory> for freestanding, as now we can just omit
the whole of <bits/allocator.h> for freestanding.

libstdc++-v3/ChangeLog:

	* include/bits/alloc_traits.h (__alloc_swap)
	(__shrink_to_fit_aux): Move here, from ...
	* include/bits/allocator.h: ... here.
	* include/ext/alloc_traits.h: Do not include allocator.h.
2022-09-16 21:35:43 +01:00
Jonathan Wakely
d31e19e440 libstdc++: Make more internal headers include their own dependencies
This adds required headers to a few internal headers that currently
assume their deps will be included first. It's more robust to make them
include their own dependencies, so that later refactoring or reuse of
those headers in new contexts doesn't break.

libstdc++-v3/ChangeLog:

	* include/bits/stl_algo.h: Include <bits/stl_algobase.h>.
	* include/bits/stl_tempbuf.h: Include headers for __try and
	__catch macros, std::pair, and __gnu_cxx::__numeric_traits.
	* include/bits/stream_iterator.h: Include <iosfwd> and headers
	for std::addressof and std::iterator.
	* include/bits/streambuf_iterator.h: Include header for
	std::iterator.
	* include/std/iterator: Do not include <iosfwd>.
2022-09-16 21:23:24 +01:00
Jonathan Wakely
47deb1ef87 libstdc++: Fix compare_exchange_padding.cc test for std::atomic_ref
This test was written assuming that std::atomic_ref clears its target's
padding on construction, but that could introduce data races. Change the
test to store a value after construction and check that its padding is
cleared by the store.

libstdc++-v3/ChangeLog:

	* testsuite/29_atomics/atomic_ref/compare_exchange_padding.cc:
	Store value with non-zero padding bits after construction.
2022-09-16 21:19:09 +01:00
Jonathan Wakely
b6adc6255f libstdc++: Fix tr1::variate_generator::engine_value_type
The tr1/5_numerical_facilities/random/variate_generator/37986.cc test
fails for strict -std=c++98 mode because _Adaptor(const _Engine&) is
ill-formed in C++98 when _Engine is a reference type.

Rather than attempt to make the _Adaptor handle references and pointers,
just strip references and pointers from the _Engine type before we adapt
it. That removes the need for the _Adaptor<_Engine*> partial
specialization and avoids the reference-to-reference problem for c++98
mode.

While looking into this I noticed that the TR1 spec requires the
variate_generator<E,D>::engine_value_type to be the underlying engine
type, whereas we make it the _Adaptor<E> type that wraps the engine.

libstdc++-v3/ChangeLog:

	* include/tr1/random.h (__detail::_Adaptor::_BEngine): Remove.
	(__detail::_Adaptor::_M_g): Make public.
	(__detail::_Adaptor<_Engine*, _Dist>): Remove partial
	specialization.
	(variate_generate::_Value): New helper to simplify handling of
	_Engine* and _Engine& template arguments.
	(variate_generate::engine_value_type): Define to underlying
	engine type, not adapted type.
	(variate_generate::engine()): Return underlying engine instead
	of adaptor.
	* testsuite/tr1/5_numerical_facilities/random/variate_generator/37986.cc:
	Fix comment.
	* testsuite/tr1/5_numerical_facilities/random/variate_generator/requirements/typedefs.cc:
	Check member typedefs have the correct types.
2022-09-16 15:54:42 +01:00
Jonathan Wakely
5ad435f2a0 libstdc++: Do not use nullptr in C++03-compatible code
This has to be valid as C++98/C++03.

libstdc++-v3/ChangeLog:

	* include/debug/formatter.h [_GLIBCXX_DEBUG_BACKTRACE]
	(_Error_formatter): Use 0 as null pointer constant.
2022-09-16 15:54:42 +01:00
Jonathan Wakely
1594328586 libstdc++: Remove __alloc_neq helper
This class template and partial specialization were added 15 years ago
to optimize allocator equality comparisons in std::list. I think it's
safe to assume that GCC is now capable of optimizing an inline
operator!= that just returns false at least as well as an inline member
function that just returns false.

libstdc++-v3/ChangeLog:

	* include/bits/allocator.h (__alloc_neq): Remove.
	* include/bits/stl_list.h (list::_M_check_equal_allocators):
	Compare allocators directly, without __alloc_neq.
2022-09-16 15:54:41 +01:00
Jonathan Wakely
64f9580423 libstdc++: Fix Doxygen commands
Remove the bogus -D__allocator_base=std::__new_allocator macro
definition for Doxygen, because that's an alias template for C++11 and
later, not a macro.

Fix the @cond/@endcond pair that span the end of an @addtogroup group.
Add another @endcond inside the group, and another @cond after it.

libstdc++-v3/ChangeLog:

	* doc/doxygen/user.cfg.in (PREDEFINED): Remove __allocator_base.
	* include/bits/allocator.h: Fix nesting of Doxygen commands.
2022-09-16 15:54:41 +01:00
Jonathan Wakely
4c156ead37 libstdc++: Document new libstdc++.so symbol versions
libstdc++-v3/ChangeLog:

	* doc/xml/manual/abi.xml: Document GLIBCXX_3.4.30 and
	GLIBCXX_3.4.31 versions.
	* doc/html/manual/abi.html: Regenerate.
2022-09-16 10:50:28 +01:00
GCC Administrator
d0fc05e860 Daily bump. 2022-09-16 00:16:53 +00:00
Jonathan Wakely
d6ccad7641 libstdc++: Remove unnecessary header from <memory>
Previously <memory> included <bits/stl_algobase.h> so that std::copy,
std::fill etc. could be used by <bits/stl_uninitialized.h>. But that
includes it explicitly now, so that it can be compiled as a header unit.
There's no need to include it in <memory>, where its purpose isn't
obvious.

libstdc++-v3/ChangeLog:

	* include/std/memory: Do not include <bits/stl_algobase.h>.
2022-09-15 23:57:32 +01:00
Jonathan Wakely
ecbdfa8b31 libstdc++: Tweak TSan annotations for std::atomic<shared_ptr<T>>
Do not use the __tsan_mutex_not_static flag for annotation functions
where it's not a valid flag.  Also use the try_lock and try_lock_failed
flags to more precisely annotate the CAS loop used to acquire a lock.

libstdc++-v3/ChangeLog:

	* include/bits/shared_ptr_atomic.h (_GLIBCXX_TSAN_MUTEX_PRE_LOCK):
	Replace with ...
	(_GLIBCXX_TSAN_MUTEX_TRY_LOCK): ... this, add try_lock flag.
	(_GLIBCXX_TSAN_MUTEX_TRY_LOCK_FAILED): New macro using
	try_lock_failed flag
	(_GLIBCXX_TSAN_MUTEX_POST_LOCK): Rename to ...
	(_GLIBCXX_TSAN_MUTEX_LOCKED): ... this.
	(_GLIBCXX_TSAN_MUTEX_PRE_UNLOCK): Remove invalid flag.
	(_GLIBCXX_TSAN_MUTEX_POST_UNLOCK): Remove invalid flag.
	(_Sp_atomic::_Atomic_count::lock): Use new macros.
2022-09-15 21:04:36 +01:00
Patrick Palka
29b39d4b0e libstdc++: Implement ranges::chunk_by_view from P2443R1
libstdc++-v3/ChangeLog:

	* include/bits/ranges_algo.h (__adjacent_find_fn, adjacent_find):
	Move to ...
	* include/bits/ranges_util.h: ... here.
	* include/std/ranges (chunk_by_view): Define.
	(chunk_by_view::_Iterator): Define.
	(__detail::__can_chunk_by_view): Define.
	(_ChunkBy, chunk_by): Define.
	* testsuite/std/ranges/adaptors/chunk_by/1.cc: New test.
2022-09-15 13:16:51 -04:00
François Dumont
db58fa0b05 libstdc++: [_GLIBCXX_INLINE_VERSION] Fix test dg-prune-output
libstdc++-v3/ChangeLog:

	* testsuite/20_util/is_complete_or_unbounded/memoization_neg.cc:
	Adapt dg-prune-output to _GLIBCXX_INLINE_VERSION mode.
2022-09-15 18:59:49 +02:00
François Dumont
d26bcff991 libstdc++: [_GLIBCXX_INLINE_VERSION] Cleanup gnu-versioned-namespace.ver
Remove expressions for symbols in std::__detail::__8 namespace, they are obsolete since
version namespace applies only at std:: level, not at sub-levels.

libstdc++-v3/ChangeLog:

	* config/abi/pre/gnu-versioned-namespace.ver: Remove obsolete std::__detail::__8
	symbols.
2022-09-15 18:58:50 +02:00
GCC Administrator
ff822367bb Daily bump. 2022-09-15 00:17:35 +00:00
Jonathan Wakely
0abc63a5ea libstdc++: Add TSan annotations to std::atomic<shared_ptr<T>>
This adds annotations to std::atomic<shared_ptr<T>> to enable TSan to
understand the custom locking. Without this, TSan reports data races for
accesses to the _M_ptr member, even though those are correctly
synchronized using atomic operations on the tagged pointer.

libstdc++-v3/ChangeLog:

	* include/bits/shared_ptr_atomic.h (_GLIBCXX_TSAN_MUTEX_DESTROY)
	(_GLIBCXX_TSAN_MUTEX_PRE_LOCK, _GLIBCXX_TSAN_MUTEX_POST_LOCK)
	(_GLIBCXX_TSAN_MUTEX_PRE_UNLOCK, _GLIBCXX_TSAN_MUTEX_POST_UNLOCK)
	(_GLIBCXX_TSAN_MUTEX_PRE_SIGNAL, _GLIBCXX_TSAN_MUTEX_POST_SIGNAL):
	Define macros for TSan annotation functions.
	(_Sp_atomic::_Atomic_count): Add annotations.
2022-09-14 19:17:37 +01:00
Jonathan Wakely
7f1e3d06bb libstdc++: Add missing <new> header to <bits/stl_tempbuf.h>
This is needed for std::nothrow and the nothrow operator new overload,
so should be included explicitly.

libstdc++-v3/ChangeLog:

	* include/bits/stl_tempbuf.h: Include <new>.
2022-09-14 19:17:36 +01:00
Jonathan Wakely
9a1bc4b463 libstdc++: Add comment to 17_intro/names.cc test
libstdc++-v3/ChangeLog:

	* testsuite/17_intro/names.cc: Explain why poison pragma can't
	be used.
2022-09-14 19:17:36 +01:00
Jonathan Wakely
0bc9aa9c3f libstdc++: Add assertion to std::promise::set_exception (LWG 2276)
Without this assertion, the shared state is made ready, but contains
neither a value nor an exception. Add an assertion to prevent users from
accessing a value that was never initialized in the shared state.

libstdc++-v3/ChangeLog:

	* include/std/future
	(_State_baseV2::__setter(exception_ptr&, promise&)): Add
	assertion for LWG 2276 precondition.
	* testsuite/30_threads/promise/members/set_exception_neg.cc:
	New test.
2022-09-14 19:17:36 +01:00
Jonathan Wakely
8b1bc3051b libstdc++: Document LWG 1203 API change in manual
libstdc++-v3/ChangeLog:

	* doc/xml/manual/intro.xml: Document LWG 1203.
	* doc/html/*: Regenerate.
2022-09-14 19:17:36 +01:00
Philipp Fent
93257ed603 libstdc++: Add pretty printer for std::stringstreams
To display (o-,i-)stringstreams in the common case, we just print the
underlying stringbuf, without the many ios_base members. In the
unconventional case that the underlying streambuf was redirected, we
report the redirected target.

Signed-off-by: Philipp Fent <fent@in.tum.de>

libstdc++-v3/ChangeLog:

	* python/libstdcxx/v6/printers.py (access_streambuf_ptrs):
	New helper function.
	(StdStringBufPrinter, StdStringStreamPrinter): New printers.
	(build_libstdcxx_dictionary): Register stringstream printers.
	* testsuite/libstdc++-prettyprinters/debug.cc: Check string
	streams.
	* testsuite/libstdc++-prettyprinters/simple.cc: Likewise.
	* testsuite/libstdc++-prettyprinters/simple11.cc: Likewise.
2022-09-14 19:17:36 +01:00
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