Commit Graph

13403 Commits

Author SHA1 Message Date
GCC Administrator 4178af1a5f Daily bump. 2022-08-06 00:19:27 +00:00
Jonathan Wakely 61076545cb libstdc++: Make std::string_view(Range&&) constructor explicit
The P2499R0 paper was recently approved for C++23.

libstdc++-v3/ChangeLog:

	* include/std/string_view (basic_string_view(Range&&)): Add
	explicit as per P2499R0.
	* testsuite/21_strings/basic_string_view/cons/char/range_c++20.cc:
	Adjust implicit conversions. Check implicit conversions fail.
	* testsuite/21_strings/basic_string_view/cons/wchar_t/range_c++20.cc:
	Likewise.

(cherry picked from commit 2678386df2)
2022-08-05 13:32:02 +01:00
Jonathan Wakely 0b4d2f5e7b libstdc++: Rename data members of std::unexpected and std::bad_expected_access
The P2549R1 paper was accepted for C++23. I already implemented it for
our <expected>, but I didn't rename the private daata members, only the
public member functions. This renames the data members for consistency
with the working draft.

libstdc++-v3/ChangeLog:

	* include/std/expected (unexpected::_M_val): Rename to _M_unex.
	(bad_expected_access::_M_val): Likewise.

(cherry picked from commit 07c7ee4d2d)
2022-08-05 13:32:02 +01:00
Jonathan Wakely 3a9dcef5c1 libstdc++: Update value of __cpp_lib_ios_noreplace macro
My P2467R1 proposal was accepted for C++23 so there's an official value
for this macro now.

libstdc++-v3/ChangeLog:

	* include/bits/ios_base.h (__cpp_lib_ios_noreplace): Update
	value to 202207L.
	* include/std/version (__cpp_lib_ios_noreplace): Likewise.
	* testsuite/27_io/basic_ofstream/open/char/noreplace.cc: Check
	for new value.
	* testsuite/27_io/basic_ofstream/open/wchar_t/noreplace.cc:
	Likewise.

(cherry picked from commit 3e9bd6b2b1)
2022-08-05 13:32:02 +01:00
GCC Administrator c749de4937 Daily bump. 2022-08-04 00:19:28 +00:00
Jonathan Wakely 3df2f03587 libstdc++: Improve directory iterator abstractions for openat
Currently the _Dir::open_subdir function decides whether to construct a
_Dir_base with just a pathname, or a file descriptor and pathname. But
that means it is tightly coupled to the implementation of
_Dir_base::openat, which is what actually decides whether to use a file
descriptor or not. If the derived class passes a file descriptor and
filename, but the base class expects a full path and ignores the file
descriptor, then recursive_directory_iterator cannot recurse.

This change introduces a new type that provides the union of all the
information available to the derived class (the full pathname, as well
as a file descriptor for a directory and another pathname relative to
that directory). This allows the derived class to be agnostic to how the
base class will use that information.

libstdc++-v3/ChangeLog:

	* src/c++17/fs_dir.cc (_Dir::dir_and_pathname):: Replace with
	current() returning _At_path.
	(_Dir::_Dir, _Dir::open_subdir, _Dir::do_unlink): Adjust.
	* src/filesystem/dir-common.h (_Dir_base::_At_path): New class.
	(_Dir_base::_Dir_Base, _Dir_base::openat): Use _At_path.
	* src/filesystem/dir.cc (_Dir::dir_and_pathname): Replace with
	current() returning _At_path.
	(_Dir::_Dir, _Dir::open_subdir): Adjust.

(cherry picked from commit 198781144f)
2022-08-03 14:38:30 +01:00
Jonathan Wakely 1a9681e609 libstdc++: Tweak common_iterator::operator-> return type [PR104443]
This adjusts the return type to match the resolution of LWG 3672. There
is no functional difference, because decltype(auto) always deduced a
value anyway, but this makes it simpler and consistent with the working
draft.

libstdc++-v3/ChangeLog:

	PR libstdc++/104443
	* include/bits/stl_iterator.h (common_iterator::operator->):
	Change return type to just auto.

(cherry picked from commit b5f5d1b36e)
2022-08-03 12:33:51 +01:00
Jonathan Wakely 7a0ed28d4f libstdc++: Check for EOF if extraction avoids buffer overflow [PR106248]
In r11-2581-g17abcc77341584 (for LWG 2499) I added overflow checks to
the pre-C++20 operator>>(istream&, char*) overload.  Those checks can
cause extraction to stop after filling the buffer, where previously it
would have tried to extract another character and stopped at EOF. When
that happens we no longer set eofbit in the stream state, which is
consistent with the behaviour of the new C++20 overload, but is an
observable and unexpected change in the C++17 behaviour. What makes it
worse is that the behaviour change is dependent on optimization, because
__builtin_object_size is used to detect the buffer size and that only
works when optimizing.

To avoid the unexpected and optimization-dependent change in behaviour,
set eofbit manually if we stopped extracting because of the buffer size
check, but had reached EOF anyway. If the stream's rdstate() != goodbit
or width() is non-zero and smaller than the buffer, there's nothing to
do. Otherwise, we filled the buffer and need to check for EOF, and maybe
set eofbit.

The new check is guarded by #ifdef __OPTIMIZE__ because otherwise
__builtin_object_size is useless. There's no point compiling and
emitting dead code that can't be eliminated because we're not
optimizing.

We could add extra checks that the next character in the buffer is not
whitespace, to detect the case where we stopped early and prevented a
buffer overflow that would have happened otherwise. That would allow us
to assert or set badbit in the stream state when undefined behaviour was
prevented. However, those extra checks would increase the size of the
function, potentially reducing the likelihood of it being inlined, and
so making the buffer size detection less reliable. It seems preferable
to prevent UB and silently truncate, rather than miss the UB and allow
the overflow to happen.

libstdc++-v3/ChangeLog:

	PR libstdc++/106248
	* include/std/istream [C++17] (operator>>(istream&, char*)):
	Set eofbit if we stopped extracting at EOF.
	* testsuite/27_io/basic_istream/extractors_character/char/pr106248.cc:
	New test.
	* testsuite/27_io/basic_istream/extractors_character/wchar_t/pr106248.cc:
	New test.

(cherry picked from commit 5ae74944af)
2022-08-03 12:33:01 +01:00
Jonathan Wakely cff25d209b libstdc++: Add nodiscard attribute to filesystem operations
Some of these are not truly "pure" because they access the file system,
e.g. exists and file_size, but they do not modify anything and are only
useful for the return value.

If you really want to use one of those functions just to check whether
an error is reported (either via an exception or an error_code&
argument) you can still do so, but you need to cast the discarded result
to void.  Several tests need such a change, because they were indeed
only calling the functions to check for expected errors.

libstdc++-v3/ChangeLog:

	* include/bits/fs_ops.h: Add nodiscard to all pure functions.
	* include/experimental/bits/fs_ops.h: Likewise.
	* testsuite/27_io/filesystem/operations/all.cc: Do not discard
	results of absolute and canonical.
	* testsuite/27_io/filesystem/operations/absolute.cc: Cast
	discarded result to void.
	* testsuite/27_io/filesystem/operations/canonical.cc: Likewise.
	* testsuite/27_io/filesystem/operations/exists.cc: Likewise.
	* testsuite/27_io/filesystem/operations/is_empty.cc: Likewise.
	* testsuite/27_io/filesystem/operations/read_symlink.cc:
	Likewise.
	* testsuite/27_io/filesystem/operations/status.cc: Likewise.
	* testsuite/27_io/filesystem/operations/symlink_status.cc:
	Likewise.
	* testsuite/27_io/filesystem/operations/temp_directory_path.cc:
	Likewise.
	* testsuite/experimental/filesystem/operations/canonical.cc:
	Likewise.
	* testsuite/experimental/filesystem/operations/exists.cc:
	Likewise.
	* testsuite/experimental/filesystem/operations/is_empty.cc:
	Likewise.
	* testsuite/experimental/filesystem/operations/read_symlink.cc:
	Likewise.
	* testsuite/experimental/filesystem/operations/temp_directory_path.cc:
	Likewise.

(cherry picked from commit f7a148304a)
2022-08-03 12:32:13 +01:00
Jonathan Wakely e562236851 libstdc++: Support constexpr global std::string for size < 15 [PR105995]
I don't think this is required by the standard, but it's easy to
support.

libstdc++-v3/ChangeLog:

	PR libstdc++/105995
	* include/bits/basic_string.h (_M_use_local_data): Initialize
	the entire SSO buffer.
	* testsuite/21_strings/basic_string/cons/char/105995.cc: New test.

(cherry picked from commit 98a0d72a61)
2022-08-03 12:31:26 +01:00
Jonathan Wakely 2fd16b1c02 libstdc++: Fix indentation in allocator base classes
libstdc++-v3/ChangeLog:

	* include/bits/new_allocator.h: Fix indentation.
	* include/ext/malloc_allocator.h: Likewise.

(cherry picked from commit 29da01709f)
2022-08-03 12:30:26 +01:00
Jonathan Wakely 2ef2de76da libstdc++: Check for size overflow in constexpr allocation [PR105957]
libstdc++-v3/ChangeLog:

	PR libstdc++/105957
	* include/bits/allocator.h (allocator::allocate): Check for
	overflow in constexpr allocation.
	* testsuite/20_util/allocator/105975.cc: New test.

(cherry picked from commit 0a9af7b4ef)
2022-08-03 12:30:01 +01:00
Jonathan Wakely 8a57deb926 libstdc++: Make std::lcm and std::gcd detect overflow [PR105844]
When I fixed PR libstdc++/92978 I introduced a regression whereby
std::lcm(INT_MIN, 1) and std::lcm(50000, 49999) would no longer produce
errors during constant evaluation. Those calls are undefined, because
they violate the preconditions that |m| and the result can be
represented in the return type (which is int in both those cases). The
regression occurred because __absu<unsigned>(INT_MIN) is well-formed,
due to the explicit casts to unsigned in that new helper function, and
the out-of-range multiplication is well-formed, because unsigned
arithmetic wraps instead of overflowing.

To fix 92978 I made std::gcm and std::lcm calculate |m| and |n|
immediately, yielding a common unsigned type that was used to calculate
the result. That was partly correct, but there's no need to use an
unsigned type. Doing so only suppresses the overflow errors so the
compiler can't detect them. This change replaces __absu with __abs_r
that returns the common type (not its corresponding unsigned type). This
way we can detect overflow in __abs_r when required, while still
supporting the most-negative value when it can be represented in the
result type. To detect LCM results that are out of range of the result
type we still need explicit checks, because neither constant evaluation
nor UBsan will complain about unsigned wrapping for cases such as
std::lcm(500000u, 499999u). We can detect those overflows efficiently by
using __builtin_mul_overflow and asserting.

libstdc++-v3/ChangeLog:

	PR libstdc++/105844
	* include/experimental/numeric (experimental::gcd): Simplify
	assertions. Use __abs_r instead of __absu.
	(experimental::lcm): Likewise. Remove use of __detail::__lcm so
	overflow can be detected.
	* include/std/numeric (__detail::__absu): Rename to __abs_r and
	change to allow signed result type, so overflow can be detected.
	(__detail::__lcm): Remove.
	(gcd): Simplify assertions. Use __abs_r instead of __absu.
	(lcm): Likewise. Remove use of __detail::__lcm so overflow can
	be detected.
	* testsuite/26_numerics/gcd/gcd_neg.cc: Adjust dg-error lines.
	* testsuite/26_numerics/lcm/lcm_neg.cc: Likewise.
	* testsuite/26_numerics/gcd/105844.cc: New test.
	* testsuite/26_numerics/lcm/105844.cc: New test.

(cherry picked from commit 671970a562)
2022-08-03 12:29:30 +01:00
GCC Administrator 5e45d078e3 Daily bump. 2022-07-27 00:19:35 +00:00
Thomas Rodgers f281d9dd1e libstdc++: Minor codegen improvement for atomic wait spinloop
This patch merges the spin loops in the atomic wait implementation which is a
minor codegen improvement.

libstdc++-v3/ChangeLog:
	* include/bits/atomic_wait.h (__atomic_spin): Merge spin loops.

(cherry picked from commit e75da2ace6)
2022-07-26 15:28:02 -07:00
GCC Administrator 2a1263d363 Daily bump. 2022-07-23 00:19:16 +00:00
Jonathan Wakely 4be7b79d05 libstdc++: Do not optimize away storing pathname if it's needed
libstdc++-v3/ChangeLog:

	* src/c++17/fs_dir.cc (_Dir::_Dir) [!_GLIBCXX_HAVE_OPENAT]:
	Always store pathname if we don't have openat or unlinkat,
	because the full path is needed to open sub-directories and
	remove entries.

(cherry picked from commit 835b19936b)
2022-07-22 12:52:18 +01:00
Alexandre Oliva 4eb15eceaa libstdc++: check for openat with dirfd in std::filesystem
In the recent patch to check for openat, I missed an occurrence of
dirfd in std::filesystem.

for  libstdc++-v3/ChangeLog

	* src/c++17/fs_dir.cc (dir_and_pathname): Use dirfd if
	_GLIBCXX_HAVE_OPENAT.

(cherry picked from commit 486893b1d3)
2022-07-22 12:52:04 +01:00
Alexandre Oliva ca82e7900f libstdc++: check for openat
rtems6.0 has fdopendir, and fcntl.h defines AT_FDCWD and declares
openat, but there's no openat in libc.  Adjust dir-common.h to not
assume ::openat just because of AT_FDCWD.

for  libstdc++-v3/ChangeLog

	* acinclude.m4 (GLIBCXX_CHECK_FILESYSTEM_DEPS): Check for
	openat.
	* configure, config.h.in: Rebuilt.
	* src/filesystem/dir-common.h (openat): Use ::openat if
	_GLIBCXX_HAVE_OPENAT.
	* src/filesystem/dir.cc (dir_and_pathname): Use dirfd if
	_GLIBCXX_HAVE_OPENAT.

(cherry picked from commit 93070671ea)
2022-07-22 12:51:09 +01:00
Jonathan Wakely 98ce66a48f libstdc++: Do not include <cxxabi.h> in <stacktrace>
This avoids polluting the global namespace with the "abi" namespace
alias.

libstdc++-v3/ChangeLog:

	* include/std/stacktrace: Do not include <cxxabi.h>.
	(__cxa_demangle): Declare.

(cherry picked from commit e112e37f29)
2022-07-22 12:45:51 +01:00
GCC Administrator 64edeadbcc Daily bump. 2022-07-22 00:19:09 +00:00
Jonathan Wakely 06443fa2d4 libstdc++: Fix std::common_iterator assignment [PR100823]
This fixes the following conformance problems reported in the PR:

- Move constructor and move assignment should be defined.
- Copy assignment from a valueless object should be allowed.

Assignment is completely rewritten by this patch, as the previous
version had a number of problems. The converting assignment failed to
handle the case of assigning a new value to a valueless object, which
should work. It only accepted lvalue arguments, so wasn't usable to
implement the move assignment operator. Finally, it enforced the
precondition that the argument is not valueless, which is correct for
the converting assignment but not for the copy assignment.

A new _M_assign member is added to handle all cases of assignment
(copying from an lvalue, moving from an rvalue, and converting from a
different type). The not valueless precondition is checked in the
converting assignment before calling _M_assign, so isn't enforced for
copy and move assignment. The new function no longer uses a switch, so
handles valueless objects as the LHS or RHS of the assignment.

libstdc++-v3/ChangeLog:

	PR libstdc++/100823
	* include/bits/stl_iterator.h (common_iterator): Define move
	constructor and move assignment operator.
	(common_iterator::_M_assign): New function implementing
	assignment.
	(common_iterator::operator=): Use _M_assign.
	(common_iterator::_S_valueless): New constant.
	* testsuite/24_iterators/common_iterator/100823.cc: New test.

(cherry picked from commit 56c999860b)
2022-07-21 09:57:26 +01:00
Jonathan Wakely 6a7ed22522 libstdc++: Fix minor bugs in std::common_iterator
The noexcept-specifier for some std::common_iterator constructors was
incorrectly using an rvalue as the first argument of
std::is_nothrow_assignable_v. This gave the wrong answer for some types,
e.g. std::common_iterator<int*, S>, because an rvalue of scalar type
cannot be assigned to.

Also fix the friend declaration to use the same constraints as on the
definition of the class template. G++ fails to diagnose this error, due
to PR c++/96830.

Finally, the copy constructor was using std::move for its argument
in some cases, which should be removed.

libstdc++-v3/ChangeLog:

	* include/bits/stl_iterator.h (common_iterator): Fix incorrect
	uses of is_nothrow_assignable_v. Fix inconsistent constraints on
	friend declaration. Do not move argument in copy constructor.
	* testsuite/24_iterators/common_iterator/1.cc: Check for
	noexcept constructibnle/assignable.

(cherry picked from commit 3b5567c3ec)
2022-07-21 09:57:26 +01:00
Nathan Sidwell 86fd1b0b4a libstdc++: Make headers include their prerequisites
These headers were relying on their includers having already included
some prerequisites.  That makes them unsuitable to be header-units.

So directly include the needed headers.

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

libstdc++-v3/ChangeLog:

	* include/bits/hashtable.h: Include required headers.
	* include/bits/hashtable_policy.h: Likewise.
	* include/bits/stl_heap.h: Likewise.
	* include/bits/stl_iterator_base_funcs.h: Likewise.

(cherry picked from commit a44380541f)
2022-07-21 09:57:26 +01:00
Jonathan Wakely 545e8fb141 libstdc++: Fix comment typos
libstdc++-v3/ChangeLog:

	* include/bits/utility.h: Fix comment typos.

(cherry picked from commit c1fe8ddf68)
2022-07-21 09:57:26 +01:00
Jonathan Wakely c19fe8ad4e libstdc++: testsuite: Guard use of C99 std::log2
This prevents the test from failing if the only thing not supported is
the text printed to the log about the size of the floating-point type.

libstdc++-v3/ChangeLog:

	* testsuite/20_util/from_chars/4.cc: Only use log2 if C99 math
	functions are available.

(cherry picked from commit 30aea28bd3)
2022-07-21 09:57:25 +01:00
Jonathan Wakely 145ef5e2be libstdc++: Simplify test by not using std::log2
This test uses std::log2 without including <cmath>, but it doesn't need
to use it at all. Just get the number of digits from numeric_limits
instead.

libstdc++-v3/ChangeLog:

	* testsuite/26_numerics/random/random_device/entropy.cc: Use
	numeric_limits<unsigned>::digits.

(cherry picked from commit 78fd15fd4a)
2022-07-21 09:57:25 +01:00
Marco Falke 0bb30f94ac libstdc++: Make __from_chars_alnum_to_val conversion explicit
The optimizations from commit r12-8175-ga54137c88061c7 introduced a
clang integer sanitizer error.

Fix this with an explicit static_cast, similar to the fix for PR 96766.

libstdc++-v3/ChangeLog:

	* include/std/charconv (__from_chars_alnum_to_val): Replace
	implicit conversion from int to unsigned char with explicit
	cast.

(cherry picked from commit 20ab397224)
2022-07-21 09:57:25 +01:00
Jonathan Wakely f3ff78e3db libstdc++: Fix experimental::filesystem::status on Windows [PR88881]
Although the Filesystem TS isn't properly supported on Windows (unlike
the C++17 Filesystem lib), most tests do pass. Two of the failures are
due to PR 88881 which was only fixed for std::filesystem not the TS.
This applies the fix to the TS implementation too.

libstdc++-v3/ChangeLog:

	PR libstdc++/88881
	* src/filesystem/ops.cc (has_trailing_slash): New helper
	function.
	(fs::status): Strip trailing slashes.
	(fs::symlink_status): Likewise.
	* testsuite/experimental/filesystem/operations/temp_directory_path.cc:
	Clean the environment before each test and use TMP instead of
	TMPDIR so the test passes on Windows.

(cherry picked from commit 6c96b14a19)
2022-07-21 09:57:25 +01:00
Jonathan Wakely ade3197134 libstdc++: Fix lifetime bugs for non-TLS eh_globals [PR105880]
This ensures that the single-threaded fallback buffer eh_globals is not
destroyed during program termination, using the same immortalization
technique used for error category objects.

Also ensure that init._M_init can still be read after init has been
destroyed, by making it a static data member.

libstdc++-v3/ChangeLog:

	PR libstdc++/105880
	* libsupc++/eh_globals.cc (eh_globals): Ensure constant init and
	prevent destruction during termination.
	(__eh_globals_init::_M_init): Replace with static member _S_init.
	(__cxxabiv1::__cxa_get_globals_fast): Update.
	(__cxxabiv1::__cxa_get_globals): Likewise.

(cherry picked from commit 1e65f2ed99)
2022-07-21 09:13:08 +02:00
GCC Administrator e02edb338f Daily bump. 2022-07-08 00:19:15 +00:00
Jonathan Wakely ce5b1c3b95 libstdc++: Add missing prerequisite to generated header [PR106162]
The ${host_builddir}/largefile-config.h header can't be written until
its parent directory has been created, so it needs to have the creation
of that directory as a prerequisite.

libstdc++-v3/ChangeLog:

	PR libstdc++/106162
	* include/Makefile.am (largefile-config.h): Add
	stamp-${host_alias} prerequisite.
	* include/Makefile.in: Regenerate.

(cherry picked from commit 8a6ee426c2)
2022-07-07 21:35:09 +01:00
Jonathan Wakely e3b4dcfb58 libstdc++: Properly remove temporary directories in filesystem tests
Although these tests use filesystem::remove_all to clean up, that fails
because it uses recursive_directory_iterator which is intentionally
bodged by the custom readdir defined in the test.

Just use POSIX rmdir to clean up. We don't need to use _rmdir or _wrmdir
for Windows, because we'll never reach test02() on targets where the
custom readdir doesn't interpose the one from libc.

libstdc++-v3/ChangeLog:

	* testsuite/27_io/filesystem/iterators/error_reporting.cc: Use
	rmdir to remove directories.
	* testsuite/experimental/filesystem/iterators/error_reporting.cc:
	Likewise.

(cherry picked from commit 7c1c7e120c)
2022-07-07 21:32:42 +01:00
GCC Administrator e11091012f Daily bump. 2022-06-15 00:19:12 +00:00
Jonathan Wakely d10b3b5c1f libstdc++: Use type_identity_t for non-deducible std::atomic_xxx args
This is LWG 3220 which is about to become Tentatively Ready.

libstdc++-v3/ChangeLog:

	* include/std/atomic (__atomic_val_t): Use __type_identity_t
	instead of atomic<T>::value_type, as per LWG 3220.
	* testsuite/29_atomics/atomic/lwg3220.cc: New test.

(cherry picked from commit 30cc1b65e4)
2022-06-14 20:29:48 +01:00
Mark Mentovai d1201dbf55 libstdc++: Rename __null_terminated to avoid collision with Apple SDK
The macOS 13 SDK (and equivalent-version iOS and other Apple OS SDKs)
contain this definition in <sys/cdefs.h>:

863  #define __null_terminated

This collides with the use of __null_terminated in libstdc++'s
experimental fs_path.h.

As libstdc++'s use of this token is entirely internal to fs_path.h, the
simplest workaround, renaming it, is most appropriate. Here, it's
renamed to __nul_terminated, referencing the NUL ('\0') value that is
used to terminate the strings in the context in which this tag structure
is used.

libstdc++-v3/ChangeLog:

	* include/experimental/bits/fs_path.h (__detail::__null_terminated):
	Rename to __nul_terminated to avoid colliding with a macro in
	Apple's SDK.

Signed-off-by: Mark Mentovai <mark@mentovai.com>
(cherry picked from commit 254e88b3d7)
2022-06-14 20:28:14 +01:00
GCC Administrator 669fc7629e Daily bump. 2022-06-09 00:19:07 +00:00
Jonathan Wakely d47c4f0f1d libstdc++: Mark non-exported function always_inline [PR105671]
This new function was added for gcc 11.1 but is not exported from the
shared library. Depending on inlining decisions, its callers might get
inlined but an external definition be needed for this function. That
then fails to link.

Since we can't add the export to the gcc-11 release branch now, mark it
always_inline. We can consider exporting it for gcc-13 if/when we bump
the shared library version (and maybe also for gcc-12 which is currently
at the same version as trunk). For now, the attribute will solve the
problem on all affected branches. The function is small enough that
force-inlining it shouldn't cause problems.

libstdc++-v3/ChangeLog:

	PR libstdc++/105671
	* include/std/sstream (basic_stringbuf::_M_high_mark): Add
	always_inline attribute.

(cherry picked from commit de57440858)
2022-06-08 10:52:17 +01:00
Jonathan Wakely 6666ca1ab4 libstdc++: Fix narrowing conversions for 16-bit size_t [PR105681]
On a 16-bit target such as msp430 we get errors about narrowing long
values to size_t, which is only 16-bit. When --enable-libstdcxx-pch is
used the <bits/extc++.h> header breaks the build because of these
narrowing errors.

libstdc++-v3/ChangeLog:

	PR libstdc++/105681
	* include/ext/pb_ds/detail/resize_policy/hash_prime_size_policy_imp.hpp:
	Limit ga_sizes array to values that fit in size_t.
	* include/ext/random [__SIZE_WIDTH < 32] (sfmt86243)
	(sfmt86243_64, sfmt132049, sfmt132049_64, sfmt216091)
	(sfmt216091_64): Do not declare.

(cherry picked from commit 367740bf6d)
2022-06-08 10:52:16 +01:00
Jonathan Wakely 64f5d58d81 libstdc++: Only include <ext/atomicity.h> for COW string
Since the COW std::string was moved to its own header, we don't need the
atomic dispatch helpers in the definition of std::__cxx11::string. Move
the inclusion of the <ext/atomicity.h> header to <bits/cow_string.h>
where it's needed.

libstdc++-v3/ChangeLog:

	* include/bits/basic_string.h: Do not include <ext/atomicity.h>
	here.
	* include/bits/cow_string.h: Include it here.

(cherry picked from commit f3e22baec0)
2022-06-08 10:52:16 +01:00
GCC Administrator c2476f7b22 Daily bump. 2022-05-28 00:19:07 +00:00
Jonathan Wakely 01ee07a0dd libstdc++: Fix atomic and error_code printers for versioned namespace
This fixes the printers to work with std::__8::atomic and
std::__v8::ios_errc and std::__v8::future_errc.

libstdc++-v3/ChangeLog:

	* python/libstdcxx/v6/printers.py (StdErrorCodePrinter): Make
	lookup for ios_errc and future_errc check versioned namespace.
	(StdAtomicPrinter): Strip versioned namespace from typename.

(cherry picked from commit 11e1ee1b38)
2022-05-27 18:32:52 +01:00
François Dumont 2a9c87a204 libstdc++: Fix printing of std::span for versioned namespace
libstdc++-v3/ChangeLog:

	* python/libstdcxx/v6/printers.py (StdSpanPrinter.__init__):
	Strip typename from version namespace.

(cherry picked from commit ace4b7f295)
2022-05-27 18:32:52 +01:00
Jonathan Wakely 50712db568 libstdc++: Fix printing of std::atomic<shared_ptr<T>> for versioned namespace
libstdc++-v3/ChangeLog:

	* python/libstdcxx/v6/printers.py (SharedPointerPrinter): Strip
	versioned namespace from the template argument too.

(cherry picked from commit 634b0089f6)
2022-05-27 18:32:52 +01:00
Jonathan Wakely 7be1dd924d libstdc++: Add constexpr to std::counted_iterator post-increment (LWG 3643)
libstdc++-v3/ChangeLog:

	* include/bits/stl_iterator.h (counted_iterator::operator++(int)):
	Add 'constexpr' as per LWG 3643.
	* testsuite/24_iterators/counted_iterator/lwg3643.cc: New test.

(cherry picked from commit 47b20d027a)
2022-05-27 18:32:52 +01:00
Jonathan Wakely 5647e401bb libstdc++: Implement LWG 3683 for pmr::polymorphic_allocator
This issue has recently been moved to Tentatively Ready, and seems
uncontroversial. This allows equality comparison with types that are
convertible to pmr::polymorphic_allocator, which fail deduction for the
existing equality operator.

libstdc++-v3/ChangeLog:

	* include/std/memory_resource (polymorphic_allocator): Add
	non-template equality operator, as proposed for LWG 3683.
	* testsuite/20_util/polymorphic_allocator/lwg3683.cc: New test.

(cherry picked from commit f13f9c99db)
2022-05-27 18:32:52 +01:00
Jonathan Wakely 871aa11366 libstdc++: Reduce <random> test iterations for simulators
Some of these tests take several minutes on a simulator like cris-elf,
so we can conditionally run fewer iterations. The testDiscreteDist
helper already supports custom sizes so we just need to make use of that
when { target simulator } matches.

The relevant code is sufficiently tested on other targets, so we're not
losing anything by only running a small number of iterators for sims.

libstdc++-v3/ChangeLog:

	* testsuite/26_numerics/random/bernoulli_distribution/operators/values.cc:
	Run fewer iterations for simulator targets.
	* testsuite/26_numerics/random/binomial_distribution/operators/values.cc:
	Likewise.
	* testsuite/26_numerics/random/discrete_distribution/operators/values.cc:
	Likewise.
	* testsuite/26_numerics/random/geometric_distribution/operators/values.cc:
	Likewise.
	* testsuite/26_numerics/random/negative_binomial_distribution/operators/values.cc:
	Likewise.
	* testsuite/26_numerics/random/poisson_distribution/operators/values.cc:
	Likewise.
	* testsuite/26_numerics/random/uniform_int_distribution/operators/values.cc:
	Likewise.

(cherry picked from commit e3b8b4f781)
2022-05-27 18:32:51 +01:00
Jonathan Wakely bcb39ac643 libstdc++: Skip tests that fail for the versioned namespace
Most tests for the contents of header synopses need to be supressed for
the versioned namespace build, because redeclaring the entities in std
fails when they were originally declared in std::__8.

I added these tests recently without the suppression, so they fail.

libstdc++-v3/ChangeLog:

	* testsuite/20_util/expected/synopsis.cc: Skip for versioned
	namespace.
	* testsuite/27_io/headers/iosfwd/synopsis.cc: Likewise.

(cherry picked from commit 1815462a6e)
2022-05-27 18:32:51 +01:00
Jonathan Wakely 702ac6e761 libstdc++: Fix typo in doxygen @headerfile command
libstdc++-v3/ChangeLog:

	* include/bits/mofunc_impl.h: Fix doxygen command.

(cherry picked from commit 4163b0be81)
2022-05-27 18:32:51 +01:00
Jonathan Wakely d2b9fdedcd libstdc++: Add noexcept to std::launch operators
libstdc++-v3/ChangeLog:

	* include/std/future (launch): Make operators noexcept.

(cherry picked from commit 8659bcd6b7)
2022-05-27 18:32:51 +01:00