Commit Graph

13172 Commits

Author SHA1 Message Date
Thomas Rodgers 07a971b28c Strengthen memory order for atomic<T>::wait/notify
This matches the memory order in libc++.

libstdc++-v3/ChangeLog:
	* include/bits/atomic_wait.h: Change memory order from
	Acquire/Release with relaxed loads to SeqCst+Release for
	accesses to the waiter's count.
2022-02-01 09:04:10 -08:00
GCC Administrator 1bb5266257 Daily bump. 2022-02-01 00:16:29 +00:00
Martin Liska c99a6eb015 Add mold detection for libs.
libatomic/ChangeLog:

	* acinclude.m4: Detect *_ld_is_mold and use it.
	* configure: Regenerate.

libgomp/ChangeLog:

	* acinclude.m4: Detect *_ld_is_mold and use it.
	* configure: Regenerate.

libitm/ChangeLog:

	* acinclude.m4: Detect *_ld_is_mold and use it.
	* configure: Regenerate.

libstdc++-v3/ChangeLog:

	* acinclude.m4: Detect *_ld_is_mold and use it.
	* configure: Regenerate.
2022-01-31 09:46:44 +01:00
GCC Administrator c67ffc256d Daily bump. 2022-01-31 00:16:28 +00:00
Hans-Peter Nilsson baf98320ac libstdc++ testsuite: Don't run lwg3464.cc tests on simulators
These tests have always been failing for my autotester running a
cris-elf simulator; when unrestrained they take about 20 minutes each,
compared to the (doubled) timeout of 720 seconds, of a total 2h40min
for the whole of the libstdc++-v3 testsuite.  The tests cover counter
overflow and are already disabled for LP64 targets.

	* testsuite/27_io/basic_istream/get/char/lwg3464.cc: Don't run on
	simulator targets.
	* testsuite/27_io/basic_istream/get/wchar_t/lwg3464.cc: Likewise.
2022-01-30 17:51:02 +01:00
GCC Administrator 99f17e996f Daily bump. 2022-01-28 00:16:32 +00:00
Jonathan Wakely eae41b4d2c libstdc++: Prevent -Wstringop-overread warning in std::deque [PR100516]
The compiler warns about the loop in deque::_M_range_initialize because
it doesn't know that the number of nodes has already been correctly
sized to match the size of the input. Use __builtin_unreachable to tell
it that the loop will never be entered if the number of elements is
smaller than a single node.

libstdc++-v3/ChangeLog:

	PR libstdc++/100516
	* include/bits/deque.tcc (_M_range_initialize<ForwardIterator>):
	Add __builtin_unreachable to loop.
	* testsuite/23_containers/deque/100516.cc: New test.
2022-01-27 23:31:03 +00:00
Jonathan Wakely f21f22d1ba libstdc++: Avoid overflow in ranges::advance(i, n, bound)
When (bound - i) or n is the most negative value of its type, the
negative of the value will overflow. Instead of abs(n) >= abs(bound - i)
use n >= (bound - i) when positive and n <= (bound - i) when negative.
The function has a precondition that they must have the same sign, so
this works correctly. The precondition check can be moved into the else
branch, and simplified.

The standard requires calling ranges::advance(i, bound) even if i==bound
is already true, which is technically observable, but that's pointless.
We can just return n in that case. Similarly, for i!=bound but n==0 we
are supposed to call ranges::advance(i, n), but that's pointless. An LWG
issue to allow omitting the pointless calls is expected to be filed.

libstdc++-v3/ChangeLog:

	* include/bits/ranges_base.h (ranges::advance): Avoid signed
	overflow. Do nothing if already equal to desired result.
	* testsuite/24_iterators/range_operations/advance_overflow.cc:
	New test.
2022-01-27 22:24:29 +00:00
Martin Liska 14f339894d libstdc++: fix typo in acinclude.m4.
PR libstdc++/104259

libstdc++-v3/ChangeLog:

	* acinclude.m4: Fix typo.
	* configure: Regenerate.
2022-01-27 15:34:06 +01:00
GCC Administrator e0b8716f53 Daily bump. 2022-01-26 00:16:38 +00:00
Jonathan Wakely 5c1f274e3e libstdc++: Avoid some more warnings [PR104019]
With -fno-exceptions we get a -Wmisleading-indentation warning for:

  if (cond)
    __try {}
    __catch (...) {}

This is because the __catch(...) expands to if (false), but is indented
as though it is controlled by the preceding 'if'. Surround it in braces.

The new make_shared<T[]> code triggers a bogus warning due to PR 61596,
which can be disabled with a pragma.

libstdc++-v3/ChangeLog:

	PR libstdc++/104019
	* include/bits/istream.tcc (basic_istream::sentry): Add braces
	around try-block.
	* include/bits/shared_ptr_base.h (_Sp_counted_array_base::_M_init):
	Add pragmas to disable bogus warnings from PR 61596.
2022-01-25 21:05:16 +00:00
Jonathan Wakely e20486d508 libstdc++: Define _GNU_SOURCE for secure_getenv on Cygwin [PR104217]
For GNU/Linux G++ defines _GNU_SOURCE automatically, but not for Cygwin.
This means secure_getenv is not declared by Cygwin's <stdlib.h>, even
though autoconf detected it is present in the library. Define it in the
source files that want to use secure_getenv.

libstdc++-v3/ChangeLog:

	PR libstdc++/104217
	* src/c++17/fs_ops.cc (_GNU_SOURCE): Define.
	* src/filesystem/dir.cc (_GNU_SOURCE): Define.
	* src/filesystem/ops.cc (_GNU_SOURCE): Define.
2022-01-25 21:05:16 +00:00
Jonathan Wakely c8bd4dc821 libstdc++: Avoid symlink race in filesystem::remove_all [PR104161]
This adds a new internal flag to the filesystem::directory_iterator
constructor that makes it fail if the path is a symlink that resolves to
a directory. This prevents filesystem::remove_all from following a
symlink to a directory, rather than deleting the symlink itself.

We can also use that new flag in recursive_directory_iterator to ensure
that we don't follow symlinks if the follow_directory_symlink option is
not set.

This also moves an error check in filesystem::remove_all after the while
loop, so that errors from the directory_iterator constructor are
reproted, instead of continuing to the filesystem::remove call below.

libstdc++-v3/ChangeLog:

	PR libstdc++/104161
	* acinclude.m4 (GLIBCXX_CHECK_FILESYSTEM_DEPS): Check for
	fdopendir.
	* config.h.in: Regenerate.
	* configure: Regenerate.
	* src/c++17/fs_dir.cc (_Dir): Add nofollow flag to constructor
	and pass it to base class constructor.
	(directory_iterator): Pass nofollow flag to _Dir constructor.
	(fs::recursive_directory_iterator::increment): Likewise.
	* src/c++17/fs_ops.cc (do_remove_all): Use nofollow option for
	directory_iterator constructor. Move error check outside loop.
	* src/filesystem/dir-common.h (_Dir_base): Add nofollow flag to
	constructor and when it's set use ::open with O_NOFOLLOW and
	O_DIRECTORY.
	* src/filesystem/dir.cc (_Dir): Add nofollow flag to constructor
	and pass it to base class constructor.
	(directory_iterator): Pass nofollow flag to _Dir constructor.
	(fs::recursive_directory_iterator::increment): Likewise.
	* src/filesystem/ops.cc (remove_all): Use nofollow option for
	directory_iterator constructor. Move error check outside loop.
2022-01-25 21:05:15 +00:00
GCC Administrator 0c940703f0 Daily bump. 2022-01-24 00:16:28 +00:00
Jonathan Wakely 51631875a2 libstdc++: Fix std::spanstream move assignment [PR104032]
libstdc++-v3/ChangeLog:

	PR libstdc++/104032
	* include/std/spanstream (basic_spanbuf(basic_spanbuf&&)): Use
	mem-initializer for _M_buf.
	(basic_spanbuf::Operator=(basic_spanbuf&&)): Fix ill-formed
	member access.
	* testsuite/27_io/spanstream/2.cc: New test.
2022-01-23 22:48:33 +00:00
Jonathan Wakely 416b6fc748 libstdc++: Use fast_float for long double if it uses binary64 format
We can use the new from_chars implementation when long double and double
have the same representation.

libstdc++-v3/ChangeLog:

	* src/c++17/floating_from_chars.cc (USE_STRTOD_FOR_FROM_CHARS):
	Define macro for case where std::from_chars is implemented in
	terms of strtod, strtof or strtold.
	(buffer_resource, valid_fmt, find_end_of_float, pattern)
	(from_chars_impl, make_result, reserve_string): Do not define
	unless USE_STRTOD_FOR_FROM_CHARS is defined.
	(from_chars): Define when at least one of USE_LIB_FAST_FLOAT and
	USE_STRTOD_FOR_FROM_CHARS is defined, instead of
	_GLIBCXX_HAVE_USELOCALE. Use fast_float for long double when it
	is binary64.
2022-01-23 22:47:00 +00:00
Jonathan Wakely 084680db9a libstdc++: Restore support for unordered_map<const T, ...> [PR104174]
I broke this unintentionally in r12-4259.

libstdc++-v3/ChangeLog:

	PR libstdc++/104174
	* include/bits/hashtable_policy.h (_Map_base): Add partial
	specialization for maps with const key types.
	* testsuite/23_containers/unordered_map/104174.cc: New test.
2022-01-23 22:47:00 +00:00
Jonathan Wakely 2d8a9ad4a9 libstdc++: Fix aliasing violation in std::shared_ptr [PR104019]
The non-atomic store that sets both reference counts to zero uses a
type-punned pointer, which has undefined behaviour. We could use memset
to write 8 bytes, but we don't actually need it to be a single store
anyway. No other thread can observe the values, that's why it's safe to
use non-atomic stores in the first place. So we can just set each count
to zero.

With -fstore-merging (which is enabled by default at -O2) GCC produces
the same code for this as for memset or the type punned store. Clang
does that store merging even at -O1.

libstdc++-v3/ChangeLog:

	PR libstdc++/104019
	* include/bits/shared_ptr_base.h (_Sp_counted_base<>::_M_release):
	Set members to zero without type punning.
2022-01-23 22:47:00 +00:00
GCC Administrator 9dd443578f Daily bump. 2022-01-22 00:16:26 +00:00
Jonathan Wakely 45cae5b639 libstdc++: Fix typo in comment
libstdc++-v3/ChangeLog:

	* testsuite/20_util/shared_ptr/cons/array.cc: Fix comment.
2022-01-21 16:07:34 +00:00
Jonathan Wakely b8806796ec libstdc++: Ensure all feature test macros have type long [PR87193]
This defines all the __cpp_lib_xxx macros as type long, as required by
the standard. We had an inconsistent mix of int and long, sometimes even
for the same macro name.

The __cpp_lib_experimental_xxx macros are left as type int, because
that's what it says in the relevant TS specs.

libstdc++-v3/ChangeLog:

	PR libstdc++/87193
	PR libstdc++/104019
	* include/bits/alloc_traits.h (__cpp_lib_allocator_traits_is_always_equal):
	Define as type long.
	* include/bits/allocator.h (__cpp_lib_incomplete_container_elements):
	Likewise.
	* include/bits/basic_string.h (__cpp_lib_string_udls): Likewise.
	* include/bits/chrono.h (__cpp_lib_chrono): Likewise.
	(__cpp_lib_chrono_udls): Likewise.
	* include/bits/move.h (__cpp_lib_addressof_constexpr): Likewise.
	* include/bits/node_handle.h (__cpp_lib_node_extract): Likewise.
	* include/bits/range_access.h (__cpp_lib_nonmember_container_access):
	Likewise.
	* include/bits/shared_ptr.h (__cpp_lib_enable_shared_from_this):
	Likewise.
	* include/bits/stl_algo.h (__cpp_lib_clamp): Likewise.
	(__cpp_lib_sample): Likewise.
	* include/bits/stl_algobase.h (__cpp_lib_robust_nonmodifying_seq_ops):
	Likewise.
	* include/bits/stl_function.h (__cpp_lib_transparent_operators):
	Likewise.
	* include/bits/stl_iterator.h (__cpp_lib_make_reverse_iterator):
	Likewise.
	* include/bits/stl_map.h (__cpp_lib_map_try_emplace):
	Likewise.
	* include/bits/stl_tree.h (__cpp_lib_generic_associative_lookup):
	Likewise.
	* include/bits/unique_ptr.h (__cpp_lib_make_unique):
	Likewise.
	* include/bits/unordered_map.h (__cpp_lib_unordered_map_try_emplace):
	Likewise.
	* include/c_global/cmath (__cpp_lib_hypot): Likewise.
	* include/c_global/cstddef (__cpp_lib_byte): Likewise.
	* include/std/atomic (__cpp_lib_atomic_is_always_lock_free):
	Likewise.
	* include/std/complex (__cpp_lib_complex_udls): Likewise.
	* include/std/filesystem (__cpp_lib_filesystem): Likewise.
	* include/std/functional (__cpp_lib_not_fn): Likewise.
	(__cpp_lib_boyer_moore_searcher): Likewise.
	* include/std/iomanip (__cpp_lib_quoted_string_io): Likewise.
	* include/std/mutex (__cpp_lib_scoped_lock): Likewise.
	* include/std/numeric (__cpp_lib_gcd_lcm): Likewise.
	(__cpp_lib_gcd, __cpp_lib_lcm): Likewise.
	* include/std/tuple (__cpp_lib_apply): Likewise.
	(__cpp_lib_make_from_tuple): Likewise.
	* include/std/type_traits (__cpp_lib_integral_constant_callable)
	(__cpp_lib_bool_constant, __cpp_lib_logical_traits)
	(__cpp_lib_is_null_pointer, __cpp_lib_transformation_trait_aliases)
	(__cpp_lib_result_of_sfinae, __cpp_lib_void_t)
	(__cpp_lib_is_swappable, __cpp_lib_is_invocable)
	(__cpp_lib_has_unique_object_representations)
	(__cpp_lib_is_aggregate): Likewise.
	* include/std/version: Likewise.
	* libsupc++/new (__cpp_lib_launder): Likewise.
2022-01-21 16:07:34 +00:00
Jonathan Wakely 2da1ef06ff libstdc++: Fix condition for __cpp_lib_shared_ptr_arrays
I changed the preprocessor condition from <= to < in r12-6574 which
meant the macro was not defined by <version> for C++17.

libstdc++-v3/ChangeLog:

	* include/std/version (__cpp_lib_shared_ptr_arrays): Fix
	condition for C++17 definition.
2022-01-21 16:07:33 +00:00
Jonathan Wakely 7d47aae7cd libstdc++: Fix constexpr constructor for atomic<shared_ptr<T>>
libstdc++-v3/ChangeLog:

	* include/bits/shared_ptr_atomic.h (_Sp_atomic::_Atomic_count):
	Add constexpr.
	(_Sp_atomic::_M_ptr): Add default member-initializer.
	* testsuite/20_util/shared_ptr/atomic/atomic_shared_ptr.cc:
	Check constant initialization.
	* testsuite/20_util/weak_ptr/atomic_weak_ptr.cc: Likewise.
2022-01-21 13:21:27 +00:00
GCC Administrator 5fa55d55ab Daily bump. 2022-01-21 00:16:28 +00:00
Jonathan Wakely 109f8af3d3 libstdc++: Use Clang attribute instead of __constinit
Clang doesn't support the __constinit extension that we use pre-C++20,
but it does have its own equivalent attribute that can be used instead.

This makes it a little easier to use Clang to build libstdc++ (which
isn't supported. but is sometimes attempted for esoteric targets).

libstdc++-v3/ChangeLog:

	* src/c++11/cxx11-ios_failure.cc (__constinit): Define as
	equivalent attribute for Clang.
	* src/c++11/future.cc (__constinit): Likewise.
	* src/c++11/system_error.cc (__constinit): Likewise.
	* src/c++17/memory_resource.cc (__constinit): Likewise.
2022-01-20 12:29:29 +00:00
Jonathan Wakely 5929f253fc libstdc++: Only add valid -L paths to testsuite linker options
The MacOS linker warns about -L arguments that don't exist, which causes
all tests to fail for the defauly configuration (because libbacktrace
isn't built).

libstdc++-v3/ChangeLog:

	* scripts/testsuite_flags.in: Only add src/filesystem/.libs and
	src/libbacktrace/.libs to LDFLAGS if those directories exist.
2022-01-20 12:29:29 +00:00
GCC Administrator fe1ad14165 Daily bump. 2022-01-20 00:16:54 +00:00
Jonathan Wakely fe3e978027 libstdc++: Remove -gdwarf-4 from flags for debug library
The default is -gdwarf-5 now, so this is hurting rather than improving
things.

libstdc++-v3/ChangeLog:

	* configure.ac (GLIBCXX_ENABLE_DEBUG_FLAGS): Remove -gdwarf-4
	from default flags.
	* configure: Regenerate.
2022-01-19 19:31:00 +00:00
Jonathan Wakely f5c50748f3 libstdc++: Include <stddef.h> for size_t and ptrdiff_t [PR104123]
libstdc++-v3/ChangeLog:

	PR libstdc++/104123
	* testsuite/29_atomics/headers/stdatomic.h/c_compat.cc: Include
	<stddef.h>.
2022-01-19 17:40:37 +00:00
Jonathan Wakely 6a26ad6736 libstdc++: Fix libbacktrace build files
This makes it possible to combine --enable-libstdcxx-debug with
--enable-libstdcxx-backtrace, by adding a rule to src/Makefile to copy
the backtrace-supported.h header into the src/debug/libbacktrace
directory.

Add libbacktrace path to testsuite flags so the tests can link without
having the library installed.

Also fix some warnings when running automake for the libbacktrace
makefile.

Use a per-library CPPFLAGS variable to fix:

src/libbacktrace/Makefile.am:38: warning: AM_CPPFLAGS multiply defined in condition TRUE ...
fragment.am:43: ... 'AM_CPPFLAGS' previously defined here
src/libbacktrace/Makefile.am:32:   'fragment.am' included from here

Create symlinks to the libbacktrace sources to fix:

src/libbacktrace/Makefile.am:55: warning: source file '../../../libbacktrace/atomic.c' is in a subdirectory,
src/libbacktrace/Makefile.am:55: but option 'subdir-objects' is disabled

libstdc++-v3/ChangeLog:

	* scripts/testsuite_flags.in: Add src/libbacktrace/.libs to
	linker search paths.
	* src/Makefile.am: Fix src/debug/libbacktrace build.
	* src/Makefile.in: Regenerate.
	* src/libbacktrace/Makefile.am: Use per-library CPPFLAGS
	variable. Use symlinks for the source files.
	* src/libbacktrace/Makefile.in: Regenerate.
2022-01-19 14:23:13 +00:00
Matthias Kretz 39f581028c libstdc++: Fix for non-constexpr math_errhandling
Use SFINAE magic to support: "It is unspecified whether math_errhandling
is a macro or an identifier with external linkage." [C Standard]

Signed-off-by: Matthias Kretz <m.kretz@gsi.de>

libstdc++-v3/ChangeLog:

	* include/experimental/bits/simd.h (__floating_point_flags): Do
	not rely on math_errhandling to expand to a constant expression.
2022-01-19 13:45:58 +01:00
Jonathan Wakely 9c186493a7 libstdc++: Update documentation for C++17 deprecations
libstdc++-v3/ChangeLog:

	* doc/xml/manual/evolution.xml: Document deprecations.
	* doc/xml/manual/status_cxx2017.xml: Update status.
	* doc/html/*: Regenerate.
2022-01-19 00:58:26 +00:00
Jonathan Wakely a68080a121 libstdc++: Fix deprecated attribute for std::get_temporary_buffer
This was deprecated in C++17, not C++14.

libstdc++-v3/ChangeLog:

	* include/bits/stl_tempbuf.h (get_temporary_buffer): Change
	_GLIBCXX14_DEPRECATED to _GLIBCXX17_DEPRECATED.
2022-01-19 00:58:25 +00:00
Jonathan Wakely 72ce3fd2c7 libstdc++: Remove unused std::pair helper function
This function is no longer used since r12-6691 and can be removed.

libstdc++-v3/ChangeLog:

	* include/bits/stl_pair.h (_PCC::_DeprConsPair): Remove unused
	function.
2022-01-19 00:58:25 +00:00
Jonathan Wakely c3861f7985 libstdc++: Fix std::atomic<std::shared_ptr<T>> for AIX [PR104101]
This fixes an on AIX.

The lock function currently just spins, which should be changed to use
back-off, and maybe then _M_val.wait(__current) when supported.

libstdc++-v3/ChangeLog:

	PR libstdc++/104101
	* include/bits/shared_ptr_atomic.h (_Sp_atomic::_Atomic_count::lock):
	Only use __thread_relax if __cpp_lib_atomic_wait is defined.
2022-01-19 00:58:21 +00:00
GCC Administrator 7a761ae658 Daily bump. 2022-01-19 00:16:32 +00:00
Jonathan Wakely fe3ed885cd libstdc++: Limit new basic_string(nullptr_t) constructor to C++23 [PR104099]
The new deleted constructors added by P2166R1 are a breaking change,
making previously valid code ill-formed in C++23. As a result, they
should only be defined for C++23 and not for C++11 and up.

libstdc++-v3/ChangeLog:

	PR libstdc++/104099
	* include/bits/basic_string.h (basic_string(nullptr_t)): Only
	define for C++23.
	(operator=(nullptr_t)): Likewise.
	* include/bits/cow_string.h: Likewise.
	* include/std/string_view (basic_string_view(nullptr_t)):
	Likewise.
	* testsuite/21_strings/basic_string/cons/char/nullptr.cc: Adjust
	expected error. Add examples that become ill-formed in C++23.
	* testsuite/21_strings/basic_string_view/cons/char/nonnull.cc:
	Adjust expected errors.
	* testsuite/21_strings/basic_string_view/cons/wchar_t/nonnull.cc:
	Likewise.
2022-01-18 20:41:46 +00:00
Jonathan Wakely e13e95bd27 libstdc++: Use __cpp_lib_concepts in std::reverse_iterator [PR104098]
We should not assume that std::iter_value_t etc. are defined
unconditionally for C++20 mode.

libstdc++-v3/ChangeLog:

	PR libstdc++/104098
	* include/bits/stl_iterator.h (reverse_iterator): Check
	__cpp_lib_concepts instead of __cplusplus.
2022-01-18 16:31:03 +00:00
Jonathan Wakely 302343d8dd libstdc++: Fix ambiguous std::pair constructors [PR101124]
The deprecated non-standard std::pair constructors that allow
constructing std::pair<move-only-type, pointer-type> from an rvalue and
a literal zero where not sufficiently constrained. They were viable when
constructing std::pair<copyable-type, pointer-type>, and that case
should work fine using the standard constructors.

Replace the constraints on the non-standard constructors so they are
only viable in cases that should actually be ill-formed according to the
standard.

Also rename __null_ptr_constant to __zero_as_null_pointer_constant so it
matches the name of the -Wzero-as-null-pointer-constant warning. Also
make the text of the deprecated warning describe the problem in more
detail.

libstdc++-v3/ChangeLog:

	PR libstdc++/101124
	* include/bits/stl_pair.h (pair): Adjust constraints on
	deprecated constructors accepting literal zero as null pointer
	constant. Improve wording of deprecated attribute.
	* testsuite/20_util/pair/cons/99957.cc: Check that deprecated
	constructors do not cause ambiguities for copyable types.
2022-01-18 16:31:03 +00:00
Jonathan Wakely 50bc6e463b libstdc++: Fix suggested alternative to std::ptr_fun
libstdc++-v3/ChangeLog:

	* include/bits/stl_function.h (ptr_fun): Fix suggestion for
	non-deprecated alternative.
2022-01-18 16:31:02 +00:00
Tom Honermann 0e4e4b37d9 libstdc++: Declare std::c8rtomb and std::mbrtoc8 if provided by the C library
This patch completes implementation of the C++20 proposal P0482R6 [1] by
adding declarations of std::c8rtomb() and std::mbrtoc8() in <cuchar> if
provided by the C library in <uchar.h>.

This patch addresses feedback provided in response to a previous patch
submission [2].

Autoconf changes determine if the C library declares c8rtomb and mbrtoc8
at global scope when uchar.h is included and compiled with either
-fchar8_t or -std=c++20. New _GLIBCXX_USE_UCHAR_C8RTOMB_MBRTOC8_FCHAR8_T
and _GLIBCXX_USE_UCHAR_C8RTOMB_MBRTOC8_CXX20 configuration macros
reflect the probe results. The <cuchar> header declares these functions
in the std namespace only if available and the _GLIBCXX_USE_CHAR8_T
configuration macro is defined (by default it is defined if the C++20
__cpp_char8_t feature test macro is defined)

Patches to glibc to implement c8rtomb and mbrtoc8 have been submitted [3].

New tests validate the presence of these declarations. The tests pass
trivially if the C library does not provide these functions. Otherwise
they ensure that the functions are declared when <cuchar> is included
and either -fchar8_t or -std=c++20 is enabled.

1]: WG21 P0482R6
      "char8_t: A type for UTF-8 characters and strings (Revision 6)"
      https://wg21.link/p0482r6

[2]: [PATCH] C++ P0482R6 char8_t: declare std::c8rtomb and std::mbrtoc8
if provided by the C library
      https://gcc.gnu.org/pipermail/libstdc++/2021-June/052685.html

[3]: "C++20 P0482R6 and C2X N2653"
      [Patch 0/3]:
https://sourceware.org/pipermail/libc-alpha/2022-January/135061.html
      [Patch 1/3]:
https://sourceware.org/pipermail/libc-alpha/2022-January/135062.html
      [Patch 2/3]:
https://sourceware.org/pipermail/libc-alpha/2022-January/135063.html
      [Patch 3/3]:
https://sourceware.org/pipermail/libc-alpha/2022-January/135064.html

libstdc++-v3/ChangeLog:

	* acinclude.m4: Define config macros if uchar.h provides
	c8rtomb() and mbrtoc8().
	* config.h.in: Regenerate.
	* configure: Regenerate.
	* include/c_compatibility/uchar.h (c8rtomb, mbrtoc8): Define.
	* include/c_global/cuchar (c8rtomb, mbrtoc8): Likewise.
	* include/c_std/cuchar (c8rtomb, mbrtoc8): Likewise.
	* testsuite/21_strings/headers/cuchar/functions_std_cxx20.cc:
	New test.
	* testsuite/21_strings/headers/cuchar/functions_std_fchar8_t.cc:
	New test.
2022-01-18 16:31:02 +00:00
Jonathan Wakely d7f2a09e98 libstdc++: Define <stdatomic.h> for C++23
This adds the C++23 <stdatomic.h> header, as proposed by P0943R6, for
compatibility with C code.

There are still some ABI differences between atomic_xxx in C and C++
std::atomic_xxx in C++, so this only provides source compatibility, not
binary compatibility.

libstdc++-v3/ChangeLog:

	* include/Makefile.am: Install new header.
	* include/Makefile.in: Regenerate.
	* include/c_compatibility/stdatomic.h: New file.
	* testsuite/29_atomics/headers/stdatomic.h/c_compat.cc: New test.
2022-01-18 16:31:02 +00:00
Jonathan Wakely 8f6b62e0f0 libstdc++: Use GCC's predefined macro for endianness [PR104080]
Instead of hardcoded preprocessor conditionals with explicit target
checks, just rely on the fact that __BYTE_ORDER__ is always defined by
GCC.

libstdc++-v3/ChangeLog:

	PR libstdc++/104080
	* src/c++17/fast_float/LOCAL_PATCHES: Update.
	* src/c++17/fast_float/fast_float.h (FASTFLOAT_IS_BIG_ENDIAN):
	Define in terms of __BYTE_ORDER__.
2022-01-18 10:03:16 +00:00
Jonathan Wakely 97b9236976 libstdc++: Fix deduction failure for std::min call [PR104080]
libstdc++-v3/ChangeLog:

	PR libstdc++/104080
	* src/c++17/fast_float/LOCAL_PATCHES: UPDATE.
	* src/c++17/fast_float/fast_float.h (round): Use explicit
	template argument list for std::min.
2022-01-18 09:53:30 +00:00
Jonathan Wakely ac358eef7a libstdc++: Update status tables in manual
libstdc++-v3/ChangeLog:

	* doc/xml/manual/status_cxx2017.xml: Update C++17 status.
	* doc/xml/manual/status_cxx2020.xml: Use 12.1 instead of 12 for
	upcoming release.
	* doc/html/manual/status.html: Regenerate.
2022-01-18 09:51:02 +00:00
Jonathan Wakely 5f3c0ee908 libstdc++: Improve comments describing --enable-fully-dynamic-string
libstdc++-v3/ChangeLog:

	* acinclude.m4 (GLIBCXX_ENABLE_FULLY_DYNAMIC_STRING): Improve
	comments.
	* configure: Regenerate.
2022-01-18 09:51:02 +00:00
GCC Administrator fc82978278 Daily bump. 2022-01-18 00:16:54 +00:00
Patrick Palka 490e23032b libstdc++: Use fast_float in std::from_chars for binary32/64
This makes our std::from_chars implementation use fast_float for decimal
parsing of binary32/64 numbers.  For other floating-point formats we
still use the fallback implementation that goes through the strtod family
of functions.

libstdc++-v3/ChangeLog:

	* src/c++17/floating_from_chars.cc: (USE_LIB_FAST_FLOAT):
	Conditionally define, and use it to conditionally include
	fast_float.
	(from_chars): Use fast_float for float and double when
	USE_LIB_FAST_FLOAT.
2022-01-17 14:33:12 -05:00
Patrick Palka 40b0d4472a libstdc++: Adjust fast_float's over/underflow behavior for conformance
This changes fast_float's handling of overflow/underflow to be
consistent with the standard: instead of returning errc{} and setting
value to +-0 or +-infinity, just return errc::result_out_of_range and
don't modify value, as per [charconv.from.chars]/1.

libstdc++-v3/ChangeLog:

	* src/c++17/fast_float/LOCAL_PATCHES: Update.
	* src/c++17/fast_float/fast_float.h (from_chars_advanced): In
	case of over/underflow, return errc::result_out_of_range and don't
	modify 'value'.
2022-01-17 14:32:30 -05:00
Patrick Palka f5c8b82512 libstdc++: Apply modifications to our local copy of fast_float
This performs the following modifications to our local copy of fast_float
in order to make it more readily usable in our std::from_chars
implementation:

  * Remove system #includes
  * Replace stray call to assert
  * Use the standard chars_format and from_chars_result types

libstdc++-v3/ChangeLog:

	* src/c++17/fast_float/LOCAL_PATCHES: Update.
	* src/c++17/fast_float/fast_float.h: Apply local modifications.
2022-01-17 14:32:27 -05:00