Commit Graph

13476 Commits

Author SHA1 Message Date
Jakub Jelinek a71b107013 libstdc++: Update {x86_64,i?86,aarch64,s390x,ppc{,64,64le}} baseline_symbols.txt
The following patch updates baseline_symbols.txt on arches where I have
latest libstdc++ builds (my ws + Fedora package builds).
I've manually excluded:
+FUNC:_ZNKSt17__gnu_cxx_ieee1287num_getIcSt19istreambuf_iteratorIcSt11char_traitsIcEEE14_M_extract_intB5cxx11IjEES4_S4_S4_RSt8ios_baseRSt12_Ios_IostateRT_@@GLIBCXX_IEEE128_3.4.29
+FUNC:_ZNKSt17__gnu_cxx_ieee1287num_getIcSt19istreambuf_iteratorIcSt11char_traitsIcEEE14_M_extract_intB5cxx11IlEES4_S4_S4_RSt8ios_baseRSt12_Ios_IostateRT_@@GLIBCXX_IEEE128_3.4.29
+FUNC:_ZNKSt17__gnu_cxx_ieee1287num_getIcSt19istreambuf_iteratorIcSt11char_traitsIcEEE14_M_extract_intB5cxx11ImEES4_S4_S4_RSt8ios_baseRSt12_Ios_IostateRT_@@GLIBCXX_IEEE128_3.4.29
+FUNC:_ZNKSt17__gnu_cxx_ieee1287num_getIcSt19istreambuf_iteratorIcSt11char_traitsIcEEE14_M_extract_intB5cxx11ItEES4_S4_S4_RSt8ios_baseRSt12_Ios_IostateRT_@@GLIBCXX_IEEE128_3.4.29
+FUNC:_ZNKSt17__gnu_cxx_ieee1287num_getIcSt19istreambuf_iteratorIcSt11char_traitsIcEEE14_M_extract_intB5cxx11IxEES4_S4_S4_RSt8ios_baseRSt12_Ios_IostateRT_@@GLIBCXX_IEEE128_3.4.29
+FUNC:_ZNKSt17__gnu_cxx_ieee1287num_getIcSt19istreambuf_iteratorIcSt11char_traitsIcEEE14_M_extract_intB5cxx11IyEES4_S4_S4_RSt8ios_baseRSt12_Ios_IostateRT_@@GLIBCXX_IEEE128_3.4.29
+FUNC:_ZNKSt17__gnu_cxx_ieee1287num_getIwSt19istreambuf_iteratorIwSt11char_traitsIwEEE14_M_extract_intB5cxx11IjEES4_S4_S4_RSt8ios_baseRSt12_Ios_IostateRT_@@GLIBCXX_IEEE128_3.4.29
+FUNC:_ZNKSt17__gnu_cxx_ieee1287num_getIwSt19istreambuf_iteratorIwSt11char_traitsIwEEE14_M_extract_intB5cxx11IlEES4_S4_S4_RSt8ios_baseRSt12_Ios_IostateRT_@@GLIBCXX_IEEE128_3.4.29
+FUNC:_ZNKSt17__gnu_cxx_ieee1287num_getIwSt19istreambuf_iteratorIwSt11char_traitsIwEEE14_M_extract_intB5cxx11ImEES4_S4_S4_RSt8ios_baseRSt12_Ios_IostateRT_@@GLIBCXX_IEEE128_3.4.29
+FUNC:_ZNKSt17__gnu_cxx_ieee1287num_getIwSt19istreambuf_iteratorIwSt11char_traitsIwEEE14_M_extract_intB5cxx11ItEES4_S4_S4_RSt8ios_baseRSt12_Ios_IostateRT_@@GLIBCXX_IEEE128_3.4.29
+FUNC:_ZNKSt17__gnu_cxx_ieee1287num_getIwSt19istreambuf_iteratorIwSt11char_traitsIwEEE14_M_extract_intB5cxx11IxEES4_S4_S4_RSt8ios_baseRSt12_Ios_IostateRT_@@GLIBCXX_IEEE128_3.4.29
+FUNC:_ZNKSt17__gnu_cxx_ieee1287num_getIwSt19istreambuf_iteratorIwSt11char_traitsIwEEE14_M_extract_intB5cxx11IyEES4_S4_S4_RSt8ios_baseRSt12_Ios_IostateRT_@@GLIBCXX_IEEE128_3.4.29
additions on ppc64le as those look unexpected.
Those symbols didn't show up in Fedora 11.3.1 build with recent glibc,
while other GLIBCXX_IEEE128_3.4.29 symbols are in 11.x already.

What this patch includes are only @@GLIBCXX_3.4.30 symbol additions, same
symbols on all files, except that powerpc64 adds also
_ZNSt17__gnu_cxx_ieee12816__convert_from_vERKP15__locale_structPciPKcz@@GLIBCXX_IEEE128_3.4.30
so everything included in the patch looks right to me.

2022-04-27  Jakub Jelinek  <jakub@redhat.com>

	* config/abi/post/x86_64-linux-gnu/baseline_symbols.txt: Update.
	* config/abi/post/x86_64-linux-gnu/32/baseline_symbols.txt: Update.
	* config/abi/post/i486-linux-gnu/baseline_symbols.txt: Update.
	* config/abi/post/aarch64-linux-gnu/baseline_symbols.txt: Update.
	* config/abi/post/s390x-linux-gnu/baseline_symbols.txt: Update.
	* config/abi/post/powerpc-linux-gnu/baseline_symbols.txt: Update.
	* config/abi/post/powerpc64-linux-gnu/baseline_symbols.txt: Update.
	* config/abi/post/powerpc64-linux-gnu/32/baseline_symbols.txt: Update.
2022-04-27 17:30:09 +02:00
Jonathan Wakely a849584587 libstdc++: Add pretty printer for std::atomic
For the atomic specializations for shared_ptr and weak_ptr we can reuse
the existing SharedPointerPrinter, with a small tweak.

libstdc++-v3/ChangeLog:

	* python/libstdcxx/v6/printers.py (SharedPointerPrinter): Add
	support for atomic<shared_ptr<T>> and atomic<weak_ptr<T>>.
	(StdAtomicPrinter): New printer.
	(build_libstdcxx_dictionary): Register new printer.
	* testsuite/libstdc++-prettyprinters/cxx11.cc: Test std::atomic.
	* testsuite/libstdc++-prettyprinters/cxx20.cc: Test atomic smart
	pointers.
2022-04-27 15:48:32 +01:00
GCC Administrator 01ad093b5f Daily bump. 2022-04-27 00:16:46 +00:00
Jonathan Wakely 41ccd683f0 libstdc++: Add std::atomic<shared_ptr>(nullptr_t) constructor (LWG 3661)
This DR was approved at the February 2022 plenary.

libstdc++-v3/ChangeLog:

	* include/bits/shared_ptr_atomic.h (atomic<shared_ptr>): Add
	constructor for constant initialization from nullptr_t.
	* testsuite/20_util/shared_ptr/atomic/atomic_shared_ptr.cc:
	Check for new constructor.
2022-04-26 13:22:18 +01:00
Jonathan Wakely e3c5e8360b libstdc++: Define std::hash<std::filesystem::path> (LWG 3657)
This DR was approved at the February 2022 plenary.

libstdc++-v3/ChangeLog:

	* include/bits/fs_path.h (hash<filesystem::path>): Define.
	* testsuite/27_io/filesystem/path/nonmember/hash_value.cc:
	Check std::hash specialization.
2022-04-26 13:22:18 +01:00
GCC Administrator 98de0da603 Daily bump. 2022-04-26 00:16:51 +00:00
Jonathan Wakely 2fbdcf5e58 libstdc++: Implement constexpr std::unique_ptr for C++23 (P2273R3)
libstdc++-v3/ChangeLog:

	* include/bits/ptr_traits.h (__cpp_lib_constexpr_memory): Define
	conditionally.
	* include/bits/unique_ptr.h (__cpp_lib_constexpr_memory):
	Define for C++23.
	(default_delete, default_delete<T[]>, __uniq_ptr_impl)
	(unique_ptr, unique_ptr<T[], D>): Add constexpr to all member
	functions.
	* include/std/version (__cpp_lib_constexpr_memory): Define new
	value for C++23.
	* testsuite/20_util/unique_ptr/assign/constexpr.cc: New test.
	* testsuite/20_util/unique_ptr/comparison/constexpr.cc: New test.
	* testsuite/20_util/unique_ptr/cons/constexpr_c++20.cc: New test.
	* testsuite/20_util/unique_ptr/creation/constexpr.cc: New test.
	* testsuite/20_util/unique_ptr/modifiers/constexpr.cc: New test.
	* testsuite/20_util/unique_ptr/specialized_algorithms/constexpr.cc:
	New test.
2022-04-25 16:16:33 +01:00
Jonathan Wakely a5cee0480c libstdc++: Add deduction guides for std::packaged_task [PR105375]
This change was LWG 3117.

The test is copied from 20_util/function/cons/deduction.cc

libstdc++-v3/ChangeLog:

	PR libstdc++/105375
	* include/std/future (packaged_task): Add deduction guides.
	* testsuite/30_threads/packaged_task/cons/deduction.cc: New test.
2022-04-25 16:16:33 +01:00
Philipp Fent 71999fde2a libstdc++: Add pretty printer for std::initializer_list
Re-using the std::span printer, this now shows the contents of the
initializer list instead of the pointer and length members.

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

libstdc++-v3/ChangeLog:

	* python/libstdcxx/v6/printers.py (StdSpanPrinter._iterator):
	Rename as iterator.
	(StdInitializerListPrinter): Define new printer.
	(build_libstdcxx_dictionary): Register new printer.
	* testsuite/libstdc++-prettyprinters/cxx11.cc: Check printer for
	initializer_list.
2022-04-25 13:32:04 +01:00
GCC Administrator ab54f6007c Daily bump. 2022-04-23 00:16:24 +00:00
Thomas W Rodgers 7c21556daf libstdc++: Make atomic notify_one and notify_all non-const
<recording this here for future reference>
PR102994 "atomics: std::atomic<ptr>::wait is not marked const" raises the
issue that the current libstdc++ implementation marks the notify members
const, the implementation strategy used by libstdc++, as well as libc++
and the Microsoft STL, do not require the atomic to be mutable (it is hard
to conceive of a desirable implementation approach that would require it).
The original paper proposing the wait/notify functionality for atomics
(p1185) also had these members marked const for the first three revisions,
but that was changed without explanation in r3 and subsequent revisions of
the paper.

After raising the issue to the authors of p1185 and the author of the
libc++ implementation, the consensus seems to be "meh, it's harmless" so
there seems little appetite for an LWG issue to revisit the subject.

This patch changes the libstdc++ implementation to be in agreement with
the standard by removing const from those notify_one/notify_all members.

libstdc++-v3/ChangeLog:

	PR libstdc++/102994
	* include/bits/atomic_base.h (atomic_flag::notify_one,
	notify_all): Remove const qualification.
	(__atomic_base::notify_one, notify_all): Likewise.
	* include/std/atomic (atomic<bool>::notify_one, notify_all):
	Likewise.
	(atomic::notify_one, notify_all): Likewise.
	(atomic<T*>::notify_one, notify_all): Likewise.
	(atomic_notify_one, atomic_notify_all): Likewise.
	* testsuite/29_atomics/atomic/wait_notify/102994.cc: Adjust test
	to account for change in notify_one/notify_all signature.
2022-04-22 15:53:41 -07:00
GCC Administrator c1a9cf6791 Daily bump. 2022-04-22 00:16:43 +00:00
Patrick Palka 93dd7f36f2 libstdc++: Avoid ASCII assumptions in floating_from_chars.cc
In starts_with_ci and in __floating_from_chars_hex's inf/nan handling,
we were assuming that the letters are contiguous and that 'A' + 32 == 'a'
which is true for ASCII but not for other character encodings.

This patch fixes starts_with_ci by using a constexpr lookup table that
maps uppercase letters to lowercase, and fixes __floating_from_chars_hex
by using __from_chars_alnum_to_val.

libstdc++-v3/ChangeLog:

	* include/std/charconv (__from_chars_alnum_to_val_table):
	Simplify initialization of __lower/__upper_letters.
	(__from_chars_alnum_to_val): Default the template parameter to
	false.
	* src/c++17/floating_from_chars.cc (starts_with_ci): Don't
	assume the uppercase and lowercase letters are contiguous.
	(__floating_from_chars_hex): Likewise.
2022-04-21 12:11:01 -04:00
Patrick Palka 1e6c0e69af libstdc++: Work around modules ICE in <charconv> [PR105297]
This makes the initializer for __table in __from_chars_alnum_to_val
dependent in an artificial way, which works around the reported modules
testsuite ICE by preventing the compiler from evaluating the initializer
parse time.

Compared to the alternative workaround of using a non-local class type
for __table, this workaround has the advantage of slightly speeding up
compilation of <charconv>, since now the table won't get built (via
constexpr evaluation) until the integer std::from_chars overload is
instantiated.

	PR c++/105297
	PR c++/105322

libstdc++-v3/ChangeLog:

	* include/std/charconv (__from_chars_alnum_to_val): Make
	initializer for __table dependent in an artificial way.
2022-04-21 08:34:59 -04:00
Jonathan Wakely cf37107522 libstdc++: Remove bogus assertion in std::from_chars [PR105324]
I'm not sure what I was thinking when I added this assertion, maybe it
was supposed to be alignment == 1 (which is what the pmr::string actually
uses). The simplest fix is to just remove the assertion.

The assertion is no longer enabled by default on trunk, but it's still
there for the --enablke-libstdcxx-debug build, and is still wrong. The
fix is needed on the gcc-11 branch.

libstdc++-v3/ChangeLog:

	PR libstdc++/105324
	* src/c++17/floating_from_chars.cc (buffer_resource::do_allocate):
	Remove assertion.
	* testsuite/20_util/from_chars/pr105324.cc: New test.
2022-04-21 11:31:51 +01:00
GCC Administrator 29a25a6038 Daily bump. 2022-04-21 00:16:32 +00:00
Jonathan Wakely 67ded3a1f5 libstdc++: Fix macro checked by test
The macro being tested here is wrong, but just happens to have the same
value as the one supposed to be tests.

libstdc++-v3/ChangeLog:

	* testsuite/21_strings/basic_string_view/operations/copy/char/constexpr.cc:
	Check correct feature test macro.
2022-04-20 13:54:57 +01:00
Jonathan Wakely c644b7df11 libstdc++: Use LTLIBICONV when linking libstdc++.so [PR93602]
This fixes missing libiconv symbols when libstdc++ is built on a system
that has libiconv installed. If the libiconv headers are found then
libstdc++ depends on libiconv_open etc instead of libc's iconv_open. But
without this fix libstdc++ is not linked to the libiconv library that
provides the definitions of those symbols.

As discussed in PR 93602 this changed means that libstdc++.so.6 might
have an rpath pointing to the location of the libiconv.so library. If
that is not desired, then GCC must be configured to link to a static
libiconv.a instead, using either --with-libiconv-type=static or an
in-tree build of libiconv.

libstdc++-v3/ChangeLog:

	PR libstdc++/93602
	* doc/xml/manual/prerequisites.xml: Document libiconv
	workarounds.
	* doc/html/manual/setup.html: Regenerate.
	* src/Makefile.am (CXXLINK): Add $(LTLIBICONV).
	* src/Makefile.in: Regenerate.
2022-04-20 13:54:57 +01:00
GCC Administrator d1d571873c Daily bump. 2022-04-20 00:16:26 +00:00
Patrick Palka cd3964ebd3 libstdc++: Stop defining _GLIBCXX_ASSERTIONS in floating_to_chars.cc
Assertions were originally enabled in the compiled-in floating-point
std::to_chars implementation to help shake out any bugs, but they
apparently impose a significant performance penalty, most notably for
the hex formatting which is around 25% slower with assertions enabled.
This seems too high a cost for unconditionally enabling them.

The newly added calls to __builtin_unreachable work around the compiler
no longer knowing that the set of valid values of 'fmt' is limited (which
was previously upheld by an assert).

libstdc++-v3/ChangeLog:

	* src/c++17/floating_to_chars.cc (_GLIBCXX_ASSERTIONS): Don't
	define.
	(__floating_to_chars_shortest): Add __builtin_unreachable calls to
	squelch false-positive -Wmaybe-uninitialized and -Wreturn-type
	warnings.
	(__floating_to_chars_precision): Likewise.
2022-04-19 10:20:04 -04:00
Philipp Fent fdb3f82fb3 libstdc++: Add pretty printer for std::span
This improves the debug output for C++20 spans.

Before:
{static extent = 18446744073709551615, _M_ptr = 0x7fffffffb9a8, _M_extent = {_M_extent_value = 2}}
Now with StdSpanPrinter:
std::span of length 2 = {1, 2}

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

libstdc++-v3/ChangeLog:

	* python/libstdcxx/v6/printers.py (StdSpanPrinter): Define.
	* testsuite/libstdc++-prettyprinters/cxx20.cc: Test it.
2022-04-19 14:18:33 +01:00
Jonathan Wakely a2a7da1a05 libstdc++: Fix syntax error in libbacktrace configuration
Using == instead of = causes a configuration error with dash as the
shell:

checking whether to build libbacktrace support... /home/devel/building/work/src/gcc-12-20220417/libstdc++-v3/configure: 77471: test: auto: unexpected operator
/home/devel/building/work/src/gcc-12-20220417/libstdc++-v3/configure: 77474: test: auto: unexpected operator
auto

This means we fail to change the value from "auto" to "no" and so this
test passes:
GLIBCXX_CONDITIONAL(ENABLE_BACKTRACE, [test "$enable_libstdcxx_backtrace" != no])

This leads to the libbacktrace directory being included in the build
without being configured properly, and bootstrap fails.

libstdc++-v3/ChangeLog:

	* acinclude.m4 (GLIBCXX_ENABLE_BACKTRACE): Fix shell operators.
	* configure: Regenerate.
2022-04-19 11:58:30 +01:00
GCC Administrator 3f7c81ef14 Daily bump. 2022-04-19 00:16:28 +00:00
Patrick Palka d210653f39 libstdc++: Micro-optimize __from_chars_pow2_base
In the first iteration of __from_chars_pow2_base's main loop, we need
to remember the value of the leading significant digit for sake of the
overflow check at the end (for base > 2).

This patch manually unrolls this first iteration so as to not encumber
the entire loop with logic that only the first iteration needs.  This
seems to significantly improve performance:

Base  Before  After (seconds, lower is better)
   2    9.36   9.37
   8    3.66   2.93
  16    2.93   1.91
  32    2.39   2.24

libstdc++-v3/ChangeLog:

	* include/std/charconv (__from_chars_pow2_base): Manually
	unroll the first iteration of the main loop and simplify
	accordingly.
2022-04-18 17:22:55 -04:00
GCC Administrator 587953f093 Daily bump. 2022-04-16 00:16:31 +00:00
Patrick Palka 7e76cef873 libstdc++: Avoid double-deref of __first in ranges::minmax [PR104858]
PR libstdc++/104858

libstdc++-v3/ChangeLog:

	* include/bits/ranges_algo.h (__minmax_fn): Avoid dereferencing
	__first twice at the start.
	* testsuite/25_algorithms/minmax/constrained.cc (test06): New test.
2022-04-15 14:41:14 -04:00
Patrick Palka a54137c880 libstdc++: Optimize integer std::from_chars
This applies the following optimizations to the integer std::from_chars
implementation:

  1. Use a lookup table for converting an alphanumeric digit to its
     base-36 value instead of using a range test (for 0-9) and switch
     (for a-z and A-Z).  The table is constructed using a C++14
     constexpr function which doesn't assume a particular character
     encoding or __CHAR_BIT__ value.  This new conversion function
     __from_chars_alnum_to_val is templated on whether we care
     only about the decimal digits, in which case we can perform the
     conversion with a single subtraction since the digit characters
     are guaranteed to be contiguous (unlike the letters).
  2. Generalize __from_chars_binary to handle all power-of-two bases.
     This function (now named __from_chars_pow2_base) is also templated
     on whether we care only about the decimal digits for the benefit of
     faster digit conversion for base 2, 4 and 8.
  3. In __from_chars_digit, use
       static_cast<unsigned char>(__c - '0') < __base
     instead of
       '0' <= __c && __c <= ('0' + (__base - 1)).
     as the digit recognition test (exhaustively verified that the two
     tests are equivalent).
  4. In __from_chars_alnum, use a nested loop to consume the rest of the
     digits in the overflow case (mirroring __from_chars_digit) so that
     the main loop doesn't have to maintain the overflow flag __valid.

At this point, __from_chars_digit is nearly identical to
__from_chars_alnum, so this patch merges the two functions by removing
the former and templatizing the latter according to whether we care only
about the decimal digits.  Finally,

  5. In __from_chars_alnum, maintain a lower bound on the number of
     unused bits in the result and use it to omit the overflow check
     when it's safe to do so.

In passing, this patch replaces the non-portable function ascii_to_hexit
used by __floating_from_chars_hex with the new conversion function.

Some runtime measurements for a simple 15-line benchmark that roundtrips
printing/parsing 200 million integers via std::to/from_chars (average of
5 runs):

  Base  Before  After (seconds, lower is better)
     2    9.37   9.37
     3   15.79  12.13
     8    4.15   3.67
    10    4.90   3.86
    11    6.84   5.03
    16    4.14   2.93
    32    3.85   2.39
    36    5.22   3.26

libstdc++-v3/ChangeLog:

	* include/std/charconv (__from_chars_alnum_to_val_table): Define.
	(__from_chars_alnum_to_val): Define.
	(__from_chars_binary): Rename to ...
	(__from_chars_pow2_base): ... this.  Generalize to handle any
	power-of-two base using __from_chars_alnum_to_val.
	(__from_chars_digit): Optimize digit recognition to a single
	test instead of two tests.  Use [[__unlikely___]] attribute.
	(__from_chars_alpha_to_num): Remove.
	(__from_chars_alnum): Use __from_chars_alnum_to_val.  Use a
	nested loop for the overflow case.  Maintain a lower bound
	on the number of available bits in the result and use it to
	omit the overflow check.
	(from_chars): Adjust appropriately.
	* src/c++17/floating_from_chars.cc (ascii_to_hexit): Remove.
	(__floating_from_chars_hex): Use __from_chars_alnum_to_val
	to recognize a hex digit instead.
2022-04-15 09:34:09 -04:00
GCC Administrator 031bd52e48 Daily bump. 2022-04-15 00:16:48 +00:00
Palmer Dabbelt 3fc22eedb0 libstdc++: Default to mutex-based atomics on RISC-V
The RISC-V port requires libatomic to be linked in order to resolve
various atomic functions, which results in builds that have
"--with-libstdcxx-lock-policy=auto" defaulting to mutex-based locks.
Changing this to direct atomics breaks the ABI, this forces the auto
detection mutex-based atomics on RISC-V in order to avoid a silent ABI
break for users.

See Bug 84568 for more discussion.  In the long run there may be a way
to get the higher-performance atomics without an ABI flag day, but
that's going to be a much more complicated operation.  We don't even
have support for the inline atomics yet, but given that some folks have
been discussing hacks to make these libatomic routines appear implicitly
it seems prudent to just turn off the automatic detection for RISC-V.

libstdc++-v3/ChangeLog:

	* acinclude.m4 (GLIBCXX_ENABLE_LOCK_POLICY): Force auto to mutex
	for RISC-V.
	* configure: Regenerate.
2022-04-14 17:31:15 +01:00
Jonathan Wakely 832fcbbc73 libstdc++: Fix incorrect IS number in doc comment
libstdc++-v3/ChangeLog:

	* doc/xml/manual/intro.xml: Fix comment.
2022-04-14 17:31:15 +01:00
Jonathan Wakely 41a72a744a libstdc++: Add new headers to <bits/stdc++.h> PCH
libstdc++-v3/ChangeLog:

	* include/precompiled/stdc++.h: Include <stacktrace> and
	<stdatomic.h> for C++23.
2022-04-14 11:02:43 +01:00
Jonathan Wakely d2f8208e9a libstdc++: Fix missing and incorrect feature test macros [PR105269]
libstdc++-v3/ChangeLog:

	PR libstdc++/105269
	* include/bits/stl_vector.h (__cpp_lib_constexpr_vector):
	Define.
	* include/c_compatibility/stdatomic.h (__cpp_lib_stdatomic_h):
	Define.
	* include/std/optional (__cpp_lib_optional): Define new value
	for C++23.
	(__cpp_lib_monadic_optional): Remove.
	* include/std/version (__cpp_lib_constexpr_vector): Define.
	(__cpp_lib_stdatomic_h): Define.
	(__cpp_lib_optional): Define new value for C++23.
	(__cpp_lib_monadic_optional): Remove.
	* testsuite/20_util/optional/monadic/and_then.cc: Adjust.
	* testsuite/20_util/optional/requirements.cc: Adjust for C++23.
	* testsuite/20_util/optional/version.cc: Likewise.
	* testsuite/23_containers/vector/cons/constexpr.cc: Check
	feature test macro.
	* testsuite/29_atomics/headers/stdatomic.h/c_compat.cc:
	Likewise.
	* testsuite/20_util/optional/monadic/version.cc: Removed.
	* testsuite/23_containers/vector/requirements/version.cc: New test.
	* testsuite/29_atomics/headers/stdatomic.h/version.cc: New test.
2022-04-14 11:02:37 +01:00
GCC Administrator 504dae1d37 Daily bump. 2022-04-13 00:16:34 +00:00
Jonathan Wakely 3c742621ed libstdc++: Prefer to use mmap instead of malloc in libbacktrace
As reported in PR libbacktrace/105240, libbacktrace leaks memory when
using malloc for allocations. I originally thought it would be simpler
to just use malloc unconditionally (because it's supported on all
targets) but the leaks make that problematic.

This adds libbacktrace's detection for mmap to the libstdc++
configury, so that we use mmap.c and mmapio.c when possible. This avoids
the leaks seen previously, at least on linux.

libstdc++-v3/ChangeLog:

	* acinclude.m4 (GLIBCXX_ENABLE_BACKTRACE): Check for mmap.
	* config.h.in: Regenerate.
	* configure: Regenerate.
2022-04-12 22:38:31 +01:00
Jonathan Wakely b2c007b87d libstdc++: shrink-to-fit in std::basic_stacktrace::current(skip, max)
If a large stacktrace is reduced to a max depth that is less than half
the capacity it will now be reallocated to remove the unused capacity.

libstdc++-v3/ChangeLog:

	* include/std/stacktrace (basic_stacktrace::current): Reallocate
	a smaller container if the unused capacity is larger than the
	used size.
2022-04-12 22:38:31 +01:00
Jonathan Wakely 7cf8875995 libstdc++: Use allocator to construct std::stacktrace_entry objects
Because std::basic_stacktrace<A> is an allocator-aware container its
elements should be initialized using allocator_traits<A>::construct and
destroyed using allocator_traits<A>::destroy.

This adds new _M_clone and _M_assign helper functions to construct
elements correctly and uses those functions instead of calling
std::uninitialized_copy_n.

The _Impl::_M_destroy function needs to be passed an allocator to
destroy the elements correctly, so is replaced by _M_resize which can
also be used to trim the container to a smaller size.

Because destroying and creating std::stacktrace_entry objects is cheap,
the copy/move assignment operators can just destroy all existing
elements and use _Impl._M_clone or _Impl._M_assign to create new ones.

libstdc++-v3/ChangeLog:

	* include/std/stacktrace (basic_stacktrace): Use _Impl::_M_clone
	or _Impl::_M_assign to initialize elements in allocated storage.
	(basic_stacktrace::_M_clear()): Use _Impl::_M_resize instead of
	_Impl::_M_destroy.
	(basic_stacktrace::_Impl::_M_destroy()): Replace with ...
	(basic_stacktrace::_Impl::_M_resize(size_type, allocator&)): New
	function.
	(basic_stacktrace::_Impl::_M_push_back): Use _M_xclone. Construct
	new element using allocator.
	(basic_stacktrace::_Impl::_M_clone): New function.
	(basic_stacktrace::_Impl::_M_xclone): New function.
	(basic_stacktrace::_Impl::_M_assign): New function.
2022-04-12 22:38:31 +01:00
Jonathan Wakely e48933f00d libstdc++: Use nothrow new in std::stacktrace
We can avoid the overhead of handling a bad_alloc exception from
std::allocator<std::stacktrace_entry>::allocate by just calling the
nothrow operator new instead.

libstdc++-v3/ChangeLog:

	* include/std/stacktrace (basic_stacktrace::_Impl::_M_allocate):
	Use nothrow new instead of try block for std::allocator.
	(basic_stacktrace::_Impl::_M_deallocate): Use delete for
	std::allocator.
2022-04-12 22:38:31 +01:00
Jonathan Wakely 2ce0f5185b libstdc++: Reduce memory usage in std::stacktrace::current
This adds an alternative callback for use in the overload of
basic_stacktrace::current that takes a max_depth parameter. The new
callback will not allow the container to grow past the initial capacity,
which is set to the specified maximum depth.  This avoids allocating
memory for hundreds of frames only to discard them again because of a
small maximum depth limit.

For larger maximum depths the normal callback is used, with a smaller
initial capacity that can grow as needed. The container will be resized
to the given max depth after the entire backtrace has been produced
(relying on the fact that std::stacktrace_entry objects are trivially
destructible to elide their destruction).

Currently the value for "larger" limits is 128, so a max depth <= 128
will allocate capacity for exactly that many frames. A larger max depth
(or an unspecified max depth) will use an initial capacity of 64 frames
and grow as needed. Since each frame is only a uintptr_t value it might
be reasonable to increase the first value so that memory usage can be
capped for larger maximum depths.

This change also delays the creation of the libbacktrace state until we
actually need it, so that the state is not created if allocation fails.

libstdc++-v3/ChangeLog:

	* include/std/stacktrace (basic_stacktrace::current): Replace
	calls to _M_reserve and _S_curr_cb with call to _M_prepare.
	Check return value of backtrace_simple when max depth given.
	(basic_stacktrace::_M_reserve): Remove.
	(basic_stacktrace::_S_curr_cb): Remove.
	(basic_stacktrace::_M_prepare(size_type)): New function to
	reserve initial capacity and return callback.
	(basic_stacktrace::_Impl::_M_allocate): Remove check for 0 < n
	and remove redundant zeroing of _M_frames and _M_capacity.
	(basic_stacktrace::_Impl::_M_push_back): Add [[unlikely]]
	attribute. Assign _Impl instead of swapping.
	* testsuite/19_diagnostics/stacktrace/current.cc: New test.
2022-04-12 22:38:31 +01:00
GCC Administrator da066c4269 Daily bump. 2022-04-12 00:16:37 +00:00
Jonathan Wakely b1124648ff libstdc++: Fix incorrect branch prediction hint in std::stacktrace
libstdc++-v3/ChangeLog:

	* include/std/stacktrace (basic_stacktrace::_Impl::_M_allocate):
	Change [[unlikely]] attribute to [[likely]].
2022-04-11 22:10:00 +01:00
Jonathan Wakely 73da9ec556 libstdc++: Fix std::basic_stacktrace special members [PR105031]
The PR points out that there is a non-constant condition used for an
if-constexpr statement, but there are several other problems with the
copy, move and swap members of std::basic_stacktrace.

libstdc++-v3/ChangeLog:

	PR libstdc++/105031
	* include/std/stacktrace (basic_stacktrace::basic_stacktrace):
	Fix allocator usage in constructors.
	(basic_stacktrace::operator=(const basic_stacktrace&)): Do not
	try to reallocate using const allocator.
	(basic_stacktrace::operator=(basic_stacktrace&&)): Fix
	if-constexpr with non-constant condition. Do not allocate new
	storage if allocator propagates. Do not set _M_size if
	allocation fails.
	(basic_stacktrace::swap(basic_stacktrace&)): Fix typo. Add
	assertion that non-propagating allocators are equal.
	* testsuite/19_diagnostics/stacktrace/stacktrace.cc: New test.
2022-04-11 17:59:50 +01:00
Jonathan Wakely bdb9639ee9 libstdc++: Improve behaviour of std::stacktrace::current
This prevents inlining the current() function to guarantee that it is
present in the stacktrace, then tells libbacktrace to skip that frame.

To avoid overflow in the int argument to __glibcxx_backtrace_simple, we
need to check if the skip parameter exceeds INT_MAX (which is possible
for 16-bit targets where short and int have the same width). We also
need to limit the size of the returned value to the max_depth parameter,
which was missing previously.

This also fixes basic_stacktrace::max_size() to not exceed the maximum
size supported by the allocator, which might be smaller than the maximum
value of size_type.

libstdc++-v3/ChangeLog:

	* include/std/stacktrace (basic_stacktrace::current): Duplicate
	implementation into each overload. Add noinline attribute and
	skip current frame.
	(basic_stacktrace::max_size()): Call _Impl::_S_max_size.
	(basic_stacktrace::_S_curr_cb()): New function defining lambda.
	(basic_stacktrace::_Impl::_S_max_size): New function defining
	maximum size in terms of allocator and size_type.
	(basic_stacktrace::_Impl::_M_allocate): Check against
	max_size().
	* testsuite/19_diagnostics/stacktrace/entry.cc: Call function
	for non-constexpr checks. Check line number is correct.
2022-04-11 17:59:08 +01:00
Jonathan Wakely c62b0f731b libstdc++: Move stacktrace tests to 19_diagnostics directory
This matches where the feature is defined in the current draft.

libstdc++-v3/ChangeLog:

	* testsuite/20_util/stacktrace/entry.cc: Moved to...
	* testsuite/19_diagnostics/stacktrace/entry.cc: ...here.
	* testsuite/20_util/stacktrace/synopsis.cc: Moved to...
	* testsuite/19_diagnostics/stacktrace/synopsis.cc: ...here.
	* testsuite/20_util/stacktrace/version.cc: Moved to...
	* testsuite/19_diagnostics/stacktrace/version.cc: ...here.
2022-04-11 15:53:22 +01:00
Jonathan Wakely 0df39b0803 libstdc++: Move Filesystem TS path definitions out of class body
This fixes some errors with clang caused by instantiating vector<_Cmpt>
before the _Cmpt type is complete.

libstdc++-v3/ChangeLog:

	* include/experimental/bits/fs_path.h (path): Define special
	members after path::_Cmpt is complete.
2022-04-11 15:53:22 +01:00
GCC Administrator 405eda0d34 Daily bump. 2022-04-09 00:16:56 +00:00
Jonathan Wakely 7b4495d3c4 libstdc++: Fix constraints on std::expected<void, E> constructor [PR105153]
libstdc++-v3/ChangeLog:

	PR libstdc++/105153
	* include/std/expected
	(expected<void,E>::expected(expected<U,G>&&)): Fix constraints.
	* testsuite/20_util/expected/cons.cc: Check constructor.
2022-04-08 18:30:07 +01:00
Jonathan Wakely 0dfaf56252 libstdc++: Fix std::expected<void, E>::swap(expected&) [PR105154]
libstdc++-v3/ChangeLog:

	PR libstdc++/105154
	* include/std/expected (expected<void, E>::swap): Set
	_M_has_value to false for objects that previously had a value.
	* testsuite/20_util/expected/swap.cc: Fix test to check void
	specialization.
2022-04-08 18:30:06 +01:00
Jonathan Wakely 29e355d0d6 libstdc++: Fix std::bad_expected_access constructor [PR105146]
libstdc++-v3/ChangeLog:

	PR libstdc++/105146
	* include/std/expected (bad_expected_access): Move constructor
	parameter.
	* testsuite/20_util/expected/bad.cc: New test.
2022-04-08 18:30:06 +01:00
GCC Administrator df00d10320 Daily bump. 2022-04-08 00:16:21 +00:00
Hans-Peter Nilsson 2dda1094a7 libstdc++-v3 expected: Correct minimal-size test in requirements.cc
Without this, for a target where alignment and structure-sizes are by
default byte-aligned, such as cris-elf, you'll see, in libstdc++.log:

/X/gcc/libstdc++-v3/testsuite/20_util/expected/requirements.cc:127: error: static assertion failed
/X/gcc/libstdc++-v3/testsuite/20_util/expected/requirements.cc:127: note: the comparison reduces to '(5 == 2)'
compiler exited with status 1
FAIL: 20_util/expected/requirements.cc (test for excess errors)
Excess errors:
/X/gcc/libstdc++-v3/testsuite/20_util/expected/requirements.cc:127: error: static assertion failed

The intent of that line is to check that the object is not larger than
necessary.

libstdc++-v3/:
	* testsuite/20_util/expected/requirements.cc: Correct minimal-size
	test.
2022-04-07 04:19:21 +02:00
GCC Administrator 8af4270d3f Daily bump. 2022-04-04 08:00:40 +00:00
Jakub Jelinek 2a82301d40 libstdc++: Tweak source_location for clang trunk [PR105128]
Apparently clang trunk implemented __builtin_source_location(), but the
using __builtin_ret_type = decltype(__builtin_source_location());
which has been added for it isn't enough, they also need the
std::source_location::__impl class to be defined (but incomplete seems
to be good enough) before the builtin is used.

The following has been tested on godbolt with clang trunk (old version
fails with
error: 'std::source_location::__impl' was not found; it must be defined before '__builtin_source_location' is called
and some follow-up errors), getting back to just void * instead of
__builtin_ret_type and commenting out using doesn't work either and
just struct __impl; before using __builtin_ret_type doesn't work too.

2022-04-02  Jakub Jelinek  <jakub@redhat.com>

	PR libstdc++/105128
	* include/std/source_location (std::source_location::__impl): Move
	definition before using __builtin_ret_type.
2022-04-02 12:49:38 +02:00
Jonathan Wakely babaabbcc8 libstdc++: Implement std::unreachable() for C++23 (P0627R6)
This defines std::unreachable as an assertion for debug mode, a trap
when _GLIBCXX_ASSERTIONS is defined, and __builtin_unreachable()
otherwise.

The reason for only using __builtin_trap() in the second case is to
avoid the overhead of setting up a call to __glibcxx_assert_fail that
should never happen.

UBsan can detect if __builtin_unreachable() is executed, so if a feature
test macro for that sanitizer is added, we could change just use
__builtin_unreachable() when the sanitizer is enabled.

While thinking about what the debug assertion failure should print, I
noticed that the __glibcxx_assert_fail function doesn't check for null
pointers. This adds a check so we don't try to print them if null.

libstdc++-v3/ChangeLog:

	* include/std/utility (unreachable): Define for C++23.
	* include/std/version (__cpp_lib_unreachable): Define.
	* src/c++11/debug.cc (__glibcxx_assert_fail): Check for valid
	arguments. Handle only the function being given.
	* testsuite/20_util/unreachable/1.cc: New test.
	* testsuite/20_util/unreachable/version.cc: New test.
2022-04-01 13:17:18 +01:00
Jonathan Wakely 944da70a5d libstdc++: Fix mismatched noexcept-specifiers in Filesystem TS
The copy_file fix should have been part of r12-7063-gda72e0fd20f87b.

The path::begin() fix should have been part of r12-3930-gf2b7f56a15d9cb.
Thanks to Timm Bäder for reporting this one.

libstdc++-v3/ChangeLog:

	* include/experimental/bits/fs_fwd.h (copy_file): Remove
	incorrect noexcept from declaration.
	* include/experimental/bits/fs_path.h (path::begin, path::end):
	Add noexcept to declarations, to match definitions.
2022-04-01 13:17:18 +01:00
Timm Bäder 1e9c026848 libstdc++: Fix filenames in Doxygen @file comments
Reviewed-by: Jonathan Wakely <jwakely@redhat.com>

libstdc++-v3/ChangeLog:

	* include/bits/fs_ops.h: Fix filename in Doxygen comment.
	* include/experimental/bits/fs_ops.h: Likewise.
2022-04-01 11:34:43 +01:00
GCC Administrator 57ad4462de Daily bump. 2022-04-01 00:16:41 +00:00
Jonathan Wakely 7f016919fc libstdc++: Add comment about memalign requirements
The memalign man page on Solaris and QNX lists an additional requirement
for the alignment value that is not present in all implementation of
that non-standard function. For both those targets we should actually be
using posix_memalign anyway, so it doesn't matter. This just adds a
comment making note of that fact.

libstdc++-v3/ChangeLog:

	* libsupc++/new_opa.cc (aligned_alloc): Add comment.
2022-03-31 16:18:00 +01:00
GCC Administrator 9f774626c0 Daily bump. 2022-03-30 00:16:49 +00:00
Jonathan Wakely 95768878c7 testsuite: Disable tests for C++23 that depend on std::unexpected
These tests depend on unexpected handlers, which are no longer declared
for C++23 mode. Adjust the target specifier so they don't run.

gcc/testsuite/ChangeLog:

	* g++.dg/cpp0x/noexcept06.C: Disable for C++23.

libstdc++-v3/ChangeLog:

	* testsuite/18_support/exception/38732.cc: Disable for C++23.
	* testsuite/18_support/headers/exception/synopsis.cc: Likewise.
	* testsuite/18_support/unexpected_handler.cc: Likewise.
2022-03-29 20:30:43 +01:00
Jonathan Wakely 8bbeffc102 libstdc++: Workaround for missing 'using enum' in Clang 12
Once we no longer care about older compilers without this feature, we
can drop these static data members, so the names don't have to be
visible at class scope.

libstdc++-v3/ChangeLog:

	* libsupc++/compare (_Strong_order) [!__cpp_using_enum]: Add
	static data members for _Fp_fmt enumerators.
2022-03-29 10:06:33 +01:00
Jonathan Wakely 7255d29c57 libstdc++: Fix incorrect preprocessor conditions in <version>
The conditions that guard the feature test macros in <version> should
match the main definitions of the macros in other headers.

This doesn't matter for GCC, because it supports all the conditions
being tested here, but it does matter for non-GCC compilers without the
relevant C++20 features.

libstdc++-v3/ChangeLog:

	* include/std/version (__cpp_lib_variant): Fix conditions to
	match <variant>.
	(__cpp_lib_expected): Fix condition to match <expected>.
2022-03-29 10:06:33 +01:00
GCC Administrator aab0127dae Daily bump. 2022-03-29 00:17:13 +00:00
Jonathan Wakely 567eb37c76 libstdc++: Fix typos in comments in tests
libstdc++-v3/ChangeLog:

	* testsuite/20_util/optional/monadic/and_then.cc: Fix typo.
	* testsuite/20_util/optional/monadic/transform.cc: Likewise.
	* testsuite/22_locale/codecvt/always_noconv/char/1.cc: Likewise.
	* testsuite/22_locale/codecvt/encoding/char/1.cc: Likewise.
	* testsuite/22_locale/codecvt/in/char/1.cc: Likewise.
	* testsuite/22_locale/codecvt/max_length/char/1.cc: Likewise.
	* testsuite/22_locale/codecvt/out/char/1.cc: Likewise.
	* testsuite/22_locale/codecvt/unshift/char/1.cc: Likewise.
2022-03-28 12:20:42 +01:00
GCC Administrator 2c1c55d701 Daily bump. 2022-03-28 00:16:40 +00:00
Jonathan Wakely b78e0ce28b libstdc++: Define std::expected for C++23 (P0323R12)
Because this adds a new class template called std::unexpected, we have
to stop declaring the std::unexpected() function (which was deprecated
in C++11 and removed in C++17).

libstdc++-v3/ChangeLog:

	* doc/doxygen/user.cfg.in: Add new header.
	* include/Makefile.am: Likewise.
	* include/Makefile.in: Regenerate.
	* include/precompiled/stdc++.h: Add new header.
	* include/std/version (__cpp_lib_expected): Define.
	* libsupc++/exception [__cplusplus > 202002] (unexpected)
	(unexpected_handler, set_unexpected): Do not declare for C++23.
	* include/std/expected: New file.
	* testsuite/20_util/expected/assign.cc: New test.
	* testsuite/20_util/expected/cons.cc: New test.
	* testsuite/20_util/expected/illformed_neg.cc: New test.
	* testsuite/20_util/expected/observers.cc: New test.
	* testsuite/20_util/expected/requirements.cc: New test.
	* testsuite/20_util/expected/swap.cc: New test.
	* testsuite/20_util/expected/synopsis.cc: New test.
	* testsuite/20_util/expected/unexpected.cc: New test.
	* testsuite/20_util/expected/version.cc: New test.
2022-03-27 18:50:31 +01:00
GCC Administrator 31e989a278 Daily bump. 2022-03-26 10:22:39 +00:00
Jonathan Wakely 674ec67905 libstdc++: Add more doxygen comments in <bit>
libstdc++-v3/ChangeLog:

	* include/std/bit (bit_cast, byteswap, endian): Add doxygen
	comments.
2022-03-25 20:21:48 +00:00
GCC Administrator d1ca63a1b7 Daily bump. 2022-03-24 00:16:44 +00:00
Jonathan Wakely 4894d69a1f libstdc++: Add missing constraints to std::bit_cast [PR105027]
Our std::bit_cast was relying on the compiler to check for errors inside
__builtin_bit_cast, instead of checking them as constraints. That means
std::bit_cast was not SFINAE-friendly.

This fix uses a requires-clause, so for old versions of Clang without
concepts support the function will still be unconstrained. At some point
in future we can remove the #ifdef __cpp_concepts check and rely on all
compilers having full concepts support in C++20 mode.

libstdc++-v3/ChangeLog:

	PR libstdc++/105027
	* include/std/bit (bit_cast): Add constraints.
	* testsuite/26_numerics/bit/bit.cast/105027.cc: New test.
2022-03-23 12:17:16 +00:00
Jonathan Wakely bd81327b03 libstdc++: Fix feature test macros in <version> for freestanding
Some C++17 and C++20 feature test macros are only defined in <version>
for hosted builds, even though the features are supported for
freestanding.

All C++23 feature test macros are defined in <version> for freestanding,
but most of the features are only supported for hosted.

libstdc++-v3/ChangeLog:

	* include/std/version [!_GLIBCXX_HOSTED]
	(__cpp_lib_hardware_interference_size): Define for freestanding.
	(__cpp_lib_bit_cast): Likewise.
	(__cpp_lib_is_layout_compatible): Likewise.
	(__cpp_lib_is_pointer_interconvertible): Likewise.
	(__cpp_lib_adaptor_iterator_pair_constructor): Do not define for
	freestanding.
	(__cpp_lib_invoke_r): Likewise.
	(__cpp_lib_ios_noreplace): Likewise.
	(__cpp_lib_monadic_optional): Likewise.
	(__cpp_lib_move_only_function): Likewise.
	(__cpp_lib_spanstream): Likewise.
	(__cpp_lib_stacktrace): Likewise.
	(__cpp_lib_string_contains): Likewise.
	(__cpp_lib_string_resize_and_overwrite): Likewise.
	(__cpp_lib_to_underlying): Likewise.
2022-03-23 10:03:03 +00:00
Jonathan Wakely 5bf59b0048 libstdc++: Disable atomic wait for freestanding [PR105021]
We use either condition variables or futexes to implement atomic waits,
so we can't do it in freestanding. This is non-conforming, so should be
revisited later, probably by making freestanding atomic waiting
operations spin without ever blocking.

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

libstdc++-v3/ChangeLog:

	PR libstdc++/105021
	* include/bits/atomic_base.h [!_GLIBCXX_HOSTED]: Do not include
	<bits/atomic_wait.h> for freestanding.
2022-03-23 10:03:03 +00:00
GCC Administrator a2287813b1 Daily bump. 2022-03-23 00:16:45 +00:00
Hans-Peter Nilsson 5d2233f403 libstdc++-v3 testsuite: Call fesetround(FE_DOWNWARD) only if defined
Without this, for a typical soft-float target such as cris-elf, after
commit r12-7676-g5a4e208022e704 you'll see, in libstdc++.log:
...
FAIL: 20_util/from_chars/6.cc (test for excess errors)
Excess errors:
/home/hp/tmp/auto0321/gcc/libstdc++-v3/testsuite/20_util/from_chars/6.cc:33: error: 'FE_DOWNWARD' was not declared in this scope

UNRESOLVED: 20_util/from_chars/6.cc compilation failed to produce executable
...

It appears to be a side-effect of that commit changing the
way __cpp_lib_to_chars is defined.  (On the bright side,
./7.cc now passes since that commit.)

TFM, specifically fenv(3), says that "Each of the macros
FE_DIVBYZERO, FE_INEXACT, FE_INVALID, FE_OVERFLOW,
FE_UNDERFLOW is defined when the implementation supports
handling of the corresponding exception".

A git-grep shows that this was the only place using a FE_ macro
unconditionally.

libstdc++-v3:
	* testsuite/20_util/from_chars/6.cc (test01) [FE_DOWNWARD]:
	Conditionalize call to fesetround.
2022-03-22 22:53:02 +01:00
GCC Administrator d156bb8702 Daily bump. 2022-03-22 00:16:44 +00:00
Jakub Jelinek e63ac860af libstdc++: Work around clang misdesign in time_get<>::get [PR104990]
Apparently clang has a -fgnuc-version= option which allows it to pretend
it is any GCC version the user likes.  It is already bad that it claims to
be GCC 4.2 compatible by default when it is not (various unimplemented
extensions at least), but this option is a horrible idea.

Anyway, this patch adds a hack for it.

2022-03-21  Jakub Jelinek  <jakub@redhat.com>

	PR libstdc++/104990
	* include/bits/locale_facets_nonio.tcc (get): Don't check if do_get
	isn't overloaded if __clang__ is defined.
2022-03-21 11:02:04 +01:00
GCC Administrator 8ca61ad148 Daily bump. 2022-03-19 00:16:22 +00:00
Jonathan Wakely 7a42b1fa1a libstdc++: Simplify constraints for std::any construction [PR104242]
Partially revert r12-4190-g6da36b7d0e43b6f9281c65c19a025d4888a25b2d
because using __and_<..., is_copy_constructible<T>> when T is incomplete
results in an error about deriving from is_copy_constructible<T> when
that is incomplete. I don't know how to fix that, so this simply
restores the previous constraint which worked in this case (even though
I think it's technically undefined to use is_copy_constructible<T> with
incomplete T). This doesn't restore exactly what we had before, but uses
the is_copy_constructible_v and __is_in_place_type_v variable templates
instead of the ::value member.

libstdc++-v3/ChangeLog:

	PR libstdc++/104242
	* include/std/any (any(T&&)): Revert change to constraints.
	* testsuite/20_util/any/cons/104242.cc: New test.
2022-03-18 15:40:03 +00:00
Jonathan Wakely ac73c944ea libstdc++: Reduce header dependencies from PSTL headers [PR92546]
This avoids including the whole of <functional> in <algorithm>, as the
<pstl/glue_algorithm_defs.h> header only actually needs std::pair.

This also avoids including <iterator> in <pstl/utils.h>, which only
needs <type_traits>, std::bad_alloc, and std::terminate (which can be
repalced with std::__terminate). This matters less, because
<pstl/utils.h> is only included by the <pstl/*_impl.h> headers and they
all use <iterator> anyway, and are only included by <execution>.

libstdc++-v3/ChangeLog:

	PR libstdc++/92546
	* include/pstl/glue_algorithm_defs.h: Replace <functional> with
	<bits/stl_pair.h>.
	* include/pstl/utils.h: Replace <iterator> with <type_traits>.
	(__pstl::__internal::__except_handler): Use std::__terminate
	instead of std::terminate.
	* src/c++17/fs_path.cc: Include <array>.
	* testsuite/25_algorithms/adjacent_find/constexpr.cc: Include
	<functional>.
	* testsuite/25_algorithms/binary_search/constexpr.cc: Likewise.
	* testsuite/25_algorithms/clamp/constrained.cc: Likewise.
	* testsuite/25_algorithms/equal/constrained.cc: Likewise.
	* testsuite/25_algorithms/for_each/constrained.cc: Likewise.
	* testsuite/25_algorithms/includes/constrained.cc: Likewise.
	* testsuite/25_algorithms/is_heap/constexpr.cc: Likewise.
	* testsuite/25_algorithms/is_heap_until/constexpr.cc: Likewise.
	* testsuite/25_algorithms/is_permutation/constrained.cc: Include
	<iterator>.
	* testsuite/25_algorithms/is_sorted/constexpr.cc: Include
	<functional>.
	* testsuite/25_algorithms/is_sorted_until/constexpr.cc:
	Likewise.
	* testsuite/25_algorithms/lexicographical_compare/constexpr.cc:
	Likewise.
	* testsuite/25_algorithms/lexicographical_compare/constrained.cc:
	Likewise.
	* testsuite/25_algorithms/lexicographical_compare_three_way/1.cc:
	Include <array>.
	* testsuite/25_algorithms/lower_bound/constexpr.cc: Include
	<functional>.
	* testsuite/25_algorithms/max/constrained.cc: Likewise.
	* testsuite/25_algorithms/max_element/constrained.cc: Likewise.
	* testsuite/25_algorithms/min/constrained.cc: Likewise.
	* testsuite/25_algorithms/min_element/constrained.cc: Likewise.
	* testsuite/25_algorithms/minmax_element/constrained.cc:
	Likewise.
	* testsuite/25_algorithms/mismatch/constexpr.cc: Likewise.
	* testsuite/25_algorithms/move/93872.cc: Likewise.
	* testsuite/25_algorithms/move_backward/93872.cc: Include
	<iterator>.
	* testsuite/25_algorithms/nth_element/constexpr.cc: Include
	<functional>.
	* testsuite/25_algorithms/partial_sort/constexpr.cc: Likewise.
	* testsuite/25_algorithms/partial_sort_copy/constexpr.cc:
	Likewise.
	* testsuite/25_algorithms/search/constexpr.cc: Likewise.
	* testsuite/25_algorithms/search_n/constrained.cc: Likewise.
	* testsuite/25_algorithms/set_difference/constexpr.cc: Likewise.
	* testsuite/25_algorithms/set_difference/constrained.cc:
	Likewise.
	* testsuite/25_algorithms/set_intersection/constexpr.cc:
	Likewise.
	* testsuite/25_algorithms/set_intersection/constrained.cc:
	Likewise.
	* testsuite/25_algorithms/set_symmetric_difference/constexpr.cc:
	Likewise.
	* testsuite/25_algorithms/set_union/constexpr.cc: Likewise.
	* testsuite/25_algorithms/set_union/constrained.cc: Likewise.
	* testsuite/25_algorithms/sort/constexpr.cc: Likewise.
	* testsuite/25_algorithms/sort_heap/constexpr.cc: Likewise.
	* testsuite/25_algorithms/transform/constrained.cc: Likewise.
	* testsuite/25_algorithms/unique/constexpr.cc: Likewise.
	* testsuite/25_algorithms/unique/constrained.cc: Likewise.
	* testsuite/25_algorithms/unique_copy/constexpr.cc: Likewise.
	* testsuite/25_algorithms/upper_bound/constexpr.cc: Likewise.
	* testsuite/std/ranges/adaptors/elements.cc: Include <vector>.
	* testsuite/std/ranges/adaptors/lazy_split.cc: Likewise.
	* testsuite/std/ranges/adaptors/split.cc: Likewise.
2022-03-18 10:16:36 +00:00
GCC Administrator e9ea30165b Daily bump. 2022-03-18 00:16:27 +00:00
Jonathan Wakely 00df7ee447 libstdc++: Avoid including <algorithm> in <filesystem> [PR92546]
This only affects Windows, but reduces the preprocessed size of
<filesystem> significantly.

libstdc++-v3/ChangeLog:

	PR libstdc++/92546
	* include/bits/fs_path.h (path::make_preferred): Use
	handwritten loop instead of std::replace.
2022-03-17 17:51:54 +00:00
Jonathan Wakely 38ce448963 libstdc++: Rewrite __moneypunct_cache::_M_cache [PR104966]
GCC thinks the following can lead to a buffer overflow when __ns.size()
equals zero:

	  const basic_string<_CharT>& __ns = __mp.negative_sign();
	  _M_negative_sign_size = __ns.size();
	  __negative_sign = new _CharT[_M_negative_sign_size];
	  __ns.copy(__negative_sign, _M_negative_sign_size);

This happens because operator new might be replaced with something that
writes to this->_M_negative_sign_size and so the basic_string::copy call
could use a non-zero size to write to a zero-length buffer.

The solution suggested by Richi is to cache the size in a local variable
so that the compiler knows it won't be changed between the allocation
and the copy.

This commit goes further and rewrites the whole function to use RAII and
delay all modifications of *this until after all allocations have
succeeded. The RAII helper type caches the size and copies the string
and owns the memory until told to release it.

libstdc++-v3/ChangeLog:

	PR middle-end/104966
	* include/bits/locale_facets_nonio.tcc
	(__moneypunct_cache::_M_cache): Replace try-catch with RAII and
	make all string copies before any stores to *this.
2022-03-17 17:51:53 +00:00
Jonathan Wakely 78ef40ecdc libstdc++: Fix comment in testsuite utility
libstdc++-v3/ChangeLog:

	* testsuite/util/testsuite_character.h: Fix comment.
2022-03-17 12:23:56 +00:00
GCC Administrator 9fc8f278eb Daily bump. 2022-03-17 00:17:00 +00:00
Jonathan Wakely 2f26b26721 libstdc++: Fix symbol versioning for Solaris 11.3 [PR103407]
The new std::from_chars implementation means that those symbols are now
defined on Solaris 11.3, which lacks uselocale. They were not present in
gcc-11, but the linker script gives them the GLIBCXX_3.4.29 symbol
version because that is the version where they appeared for systems with
uselocale.

This makes the version for those symbols depend on whether uselocale is
available or not, so that they get version GLIBCXX_3.4.30 on targets
where they weren't defined in gcc-11.

In order to avoid needing separate ABI baseline files for Solaris 11.3
and 11.4, the ABI checker program now treats the floating-point
std::from_chars overloads as undesignated if they are not found in the
baseline symbols file. This means they can be left out of the SOlaris
baseline without causing the check-abi target to fail.

libstdc++-v3/ChangeLog:

	PR libstdc++/103407
	* config/abi/pre/gnu.ver: Make version for std::from_chars
	depend on HAVE_USELOCALE macro.
	* testsuite/util/testsuite_abi.cc (compare_symbols): Treat
	std::from_chars for floating-point types as undesignated if
	not found in the baseline symbols file.
2022-03-16 21:16:53 +00:00
Jonathan Wakely 5a4e208022 libstdc++: Ensure that std::from_chars is declared when supported
This adjusts the declarations in <charconv> to match when the definition
is present. This solves the issue that std::from_chars is present on
Solaris 11.3 (using fast_float) but was not declared in the header
(because the declarations were guarded by _GLIBCXX_HAVE_USELOCALE).

Additionally, do not define __cpp_lib_to_chars unless both from_chars
and to_chars are supported (which is only true for IEEE float and
double). We might still provide from_chars (via strtold) but if to_chars
isn't provided, we shouldn't define the feature test macro.

Finally, this simplifies some of the preprocessor checks in the bodies
of std::from_chars in src/c++17/floating_from_chars.cc and hoists the
repeated code for the strtod version into a new function template.

N.B. the long double overload of std::from_chars will always be defined
if the float and double overloads are defined. We can always use one of
strtold or fast_float's binary64 routines (although the latter might
produce errors for some long double values if they are not representable
as binary64).

libstdc++-v3/ChangeLog:

	* include/std/charconv (__cpp_lib_to_chars): Only define when
	both from_chars and to_chars are supported for floating-point
	types.
	(from_chars, to_chars): Adjust preprocessor conditions guarding
	declarations.
	* include/std/version (__cpp_lib_to_chars): Adjust condition to
	match <charconv> definition.
	* src/c++17/floating_from_chars.cc (from_chars_strtod): New
	function template.
	(from_chars): Simplify preprocessor checks and use
	from_chars_strtod when appropriate.
2022-03-16 16:06:29 +00:00
GCC Administrator 510613e76c Daily bump. 2022-03-15 00:16:49 +00:00
Jonathan Wakely 8f7b7c1495 libstdc++: Fix reading UTF-8 characters for 16-bit targets [PR104875]
The current code in read_utf8_code_point assumes that integer promotion
will create a 32-bit int, but that's not true for 16-bit targets like
msp430 and avr. This changes the intermediate variables used for each
octet from unsigned char to char32_t, so that (c << N) works correctly
when N > 8.

libstdc++-v3/ChangeLog:

	PR libstdc++/104875
	* src/c++11/codecvt.cc (read_utf8_code_point): Use char32_t to
	hold octets that will be left-shifted.
2022-03-14 13:08:02 +00:00
GCC Administrator 5e28be8966 Daily bump. 2022-03-11 00:16:39 +00:00
Jonathan Wakely a8db9b9043 libstdc++: Do not use fast_float for 16-bit size_t [PR104870]
The preprocessor condition for using fast_float should match the one in
the header, and require at least 32-bit size_t.

libstdc++-v3/ChangeLog:

	PR libstdc++/104870
	* src/c++17/floating_from_chars.cc: Check __SIZE_WIDTH__ >= 32
	before using fast_float.
2022-03-10 23:45:03 +00:00
Detlef Vollmann b5417a0ba7 libstdc++: Move closing brace outside #endif [PR104866]
libstdc++-v3/ChangeLog:

	PR libstdc++/104866
	* include/bits/this_thread_sleep.h: Fix order of #endif and
	closing brace of namespace.
2022-03-10 21:04:01 +00:00
Jonathan Wakely 73f3b8a53e libstdc++: Fix std::strong_order to handle NaN on VAX
I mistakenly believed that VAX floats do not support NaN, but with GCC
__builtin_isnan(__builtin_nan("")) is true. That means my previous
change to <compare> is wrong, because it fails to handle NaN.

When std::numeric_limits<floating-point-type>::is_iec559 is false, as on
VAX, the standard only requires an ordering that is consistent with the
ordering observed by comparison operators. With this change the ordering
is -NaN < numbers < +NaN, and there is no support for different NaN bit
patterns (as I'm not even sure if GCC supports any for VAX).

libstdc++-v3/ChangeLog:

	* libsupc++/compare (_Strong_order::_S_fp_cmp) [__vax__]:
	Handle NaN.
2022-03-10 14:25:46 +00:00
Jonathan Wakely cfaa2fac42 libstdc++: Support VAX floats in std::strong_order
The VAX float and double format does not support NaN, so the
std::partial_ordering returned by <=> will never be 'unordered'. We can
just use the partial_ordering value as the strong_ordering.

libstdc++-v3/ChangeLog:

	* libsupc++/compare (_Strong_ordering::_S_fp_cmp) [__vax__]: Use
	<=> comparison.
2022-03-10 11:49:00 +00:00
GCC Administrator 8cc4f9cd82 Daily bump. 2022-03-10 00:16:28 +00:00
Patrick Palka 65857caee8 libstdc++: Avoid implicit narrowing from uint128_t [PR104859]
We need to be explicit about narrowing conversions from uint128_t since,
on targets that lack __int128, this type is defined as an integer-class
type that is only _explicitly_ convertible to the builtin integer types.
This issue was latent until r12-7563-ge32869a17b788b made the frontend
correctly reject explicit conversion functions during (dependent)
copy-initialization.

	PR libstdc++/104859

libstdc++-v3/ChangeLog:

	* src/c++17/floating_to_chars.cc (__floating_to_chars_hex):
	Be explicit when narrowing the shifted effective_mantissa,
	since it may have an integer-class type.
2022-03-09 18:48:52 -05:00
GCC Administrator 8d038a841a Daily bump. 2022-03-09 00:16:29 +00:00
Jonathan Wakely 7cce7b1c3d libstdc++: Remove incorrect copyright notice from header
This file has the SGI copyright notice, but contains no code from
the SGI STL. It was entirely written by me in 2019, originally as part
of the <memory> header. When I extracted it into a new header I
accidentally copied across the SGI copyright, but that only applies to
some much older parts of <memory>.

libstdc++-v3/ChangeLog:

	* include/bits/uses_allocator_args.h: Remove incorrect copyright
	notice.
2022-03-08 12:53:04 +00:00
GCC Administrator e6533e2ebe Daily bump. 2022-03-08 00:16:32 +00:00
Jonathan Wakely 4cb935cb69 libstdc++: Use visibility pragmas instead of attributes [PR104807]
The _GLIBCXX_PSEUDO_VISIBILITY macro isn't defined until after including
os_defines.h, so we can't use _GLIBCXX_VISIBILITY early in c++config.
Replace the uses of that macro with #pragma visibility push(default)
instead.

libstdc++-v3/ChangeLog:

	PR libstdc++/104807
	* include/bits/c++config (__terminate, __glibcxx_assert_fail):
	Replace _GLIBCXX_VISIBILITY on function with visibility pragma.
	(__is_constant_evaluated): Add visibility pragma.
2022-03-07 15:10:29 +00:00
Rasmus Villemoes 0f0b428961 libstdc++: vxworks: remove stray <iostream> include
There doesn't seem to be any reason for this TU to include
<iostream>, and it causes errors when the resulting libstdc++ is used
on our VxWorks 5.5 target - presumably because now libstdc++ itself
contains an instance of std::ios_base::Init. Which should be mostly
harmless, but apparently isn't, and from a QoI viewpoint should
probably be avoided anyway.

libstdc++-v3/ChangeLog:

	* config/locale/vxworks/ctype_members.cc: Remove <iostream>
	  include.
2022-03-07 08:44:46 +01:00
GCC Administrator 762181c5d6 Daily bump. 2022-03-06 00:16:16 +00:00
Jonathan Wakely d3a757af21 libstdc++: Ensure __glibcxx_assert_fail has default visibility
This ensures there's no linker error if libstdc++ headers are included
following a pragma that sets hidden visibility.

Similarly for std::__terminate, which is always-inline so shouldn't
matter, but it's not wrong to do this anyway.

libstdc++-v3/ChangeLog:

	* include/bits/c++config (__glibcxx_assert_fail): Add visibility
	attribute.
	(__terminate): Likewise.
2022-03-05 20:33:36 +00:00
GCC Administrator 8d96e14c1d Daily bump. 2022-03-05 00:16:31 +00:00
Jonathan Wakely 289f65d643 libstdc++: Fix -Wunused-local-typedefs warning in <compare>
libstdc++-v3/ChangeLog:

	* libsupc++/compare (strong_order::_S_fp_cmp): Move typedef
	inside #if condition.
2022-03-04 10:43:29 +00:00
GCC Administrator fc03ebdcea Daily bump. 2022-03-04 00:16:21 +00:00
Jonathan Wakely 5706a5db88 libstdc++: Use non-debug vector in constexpr test [PR104748]
The std::__debug::vector isn't usable in constant expressions, so this
test fails in debug mode. Until the debug vector is fixed we can just
make the test use the non-debug one.

libstdc++-v3/ChangeLog:

	PR libstdc++/104748
	* testsuite/std/ranges/adaptors/all.cc: Use non-debug vector for
	constexpr test.
2022-03-03 22:28:48 +00:00
Jonathan Wakely 64cdf49962 libstdc++: Fix test failure on AIX
This fixes a test failure due to a non-reserved name in an AIX system
header (included via <pthread.h>). That name clashes with one of the
names we check our own headers for, so skip checking that name on AIX.

libstdc++-v3/ChangeLog:

	* testsuite/17_intro/names.cc (func): Undef on AIX.
2022-03-03 22:25:44 +00:00
Jonathan Wakely 9805965e35 libstdc++: Implement std::strong_order for floating-point types [PR96526]
This removes a FIXME in <compare>, defining the total order for
floating-point types. I originally opened PR96526 to request a new
compiler built-in to implement this, but now that we have std::bit_cast
it can be done entirely in the library.

The implementation is based on the glibc definitions of totalorder,
totalorderf, totalorderl etc.

I think this works for all the types that satisfy std::floating_point
today, and should also work for the types expected to be added by P1467
except for std::bfloat16_t. It also supports some additional types that
don't currently satisfy std::floating_point, such as __float80, but we
probably do want that to satisfy the concept for non-strict modes.

libstdc++-v3/ChangeLog:

	PR libstdc++/96526
	* libsupc++/compare (strong_order): Add missing support for
	floating-point types.
	* testsuite/18_support/comparisons/algorithms/strong_order_floats.cc:
	New test.
2022-03-03 22:24:45 +00:00
GCC Administrator 12d4552e5e Daily bump. 2022-03-02 00:16:32 +00:00
Jonathan Wakely ad66b03b3c libstdc++: Fix -Wmaybe-uninitialized false positive [PR103984]
This fixes a false positive warning seen with LTO:

12/bits/regex_compiler.tcc:443:32: error: '__last_char._M_char' may be used uninitialized [-Werror=maybe-uninitialized]

Given that the std::regex code is not very efficient anyway, the
overhead of initializing this byte should be minimal.

libstdc++-v3/ChangeLog:

	PR middle-end/103984
	* include/bits/regex_compiler.h (_BracketMatcher::_M_char): Use
	default member initializer.
2022-03-01 15:25:39 +00:00
GCC Administrator 756a61851c Daily bump. 2022-02-25 00:16:20 +00:00
Jonathan Wakely 41cbcf53dc libstdc++: Fix cast in source_location::current() [PR104602]
This fixes a problem for Clang, which is going to return a non-void
pointer from __builtin_source_location(). The current definition of
std::source_location::current() converts that to void* and then has to
cast it back again in the body (which makes it invalid in a constant
expression). By using the actual type of the returned pointer, we avoid
the problematic cast for Clang.

libstdc++-v3/ChangeLog:

	PR libstdc++/104602
	* include/std/source_location (source_location::current): Use
	deduced type of __builtin_source_location().
2022-02-24 23:42:41 +00:00
GCC Administrator 2cfb33fc1e Daily bump. 2022-02-23 00:16:24 +00:00
Patrick Palka 5e1b17f038 libstdc++: Implement P2415R2 changes to viewable_range / views::all
This implements the wording changes in P2415R2 "What is a view?", which
is a DR for C++20.

libstdc++-v3/ChangeLog:

	* include/bits/ranges_base.h (__detail::__is_initializer_list):
	Define.
	(viewable_range): Adjust as per P2415R2.
	* include/bits/ranges_cmp.h (__cpp_lib_ranges): Adjust value.
	* include/std/ranges (owning_view): Define as per P2415R2.
	(enable_borrowed_range<owning_view>): Likewise.
	(views::__detail::__can_subrange): Replace with ...
	(views::__detail::__can_owning_view): ... this.
	(views::_All::_S_noexcept): Sync with operator().
	(views::_All::operator()): Use owning_view instead of subrange
	as per P2415R2.
	* include/std/version (__cpp_lib_ranges): Adjust value.
	* testsuite/std/ranges/adaptors/all.cc (test06): Adjust now that
	views::all uses owning_view instead of subrange.
	(test08): New test.
	* testsuite/std/ranges/adaptors/lazy_split.cc (test09): Adjust
	now that rvalue non-view non-borrowed ranges are viewable.
	* testsuite/std/ranges/adaptors/split.cc (test06): Likewise.
2022-02-22 09:37:58 -05:00
GCC Administrator 0bdb049877 Daily bump. 2022-02-18 00:16:39 +00:00
Jonathan Wakely 12a88e6e20 libstdc++: Deprecate non-standard std::vector<bool>::insert(pos) [PR104559]
The SGI STL and pre-1998 drafts of the C++ standard had a default
argument for vector<bool>::insert(iterator, const bool&) which was
remove by N1051. The default argument is still present in libstdc++ for
some reason. There are no tests verifying it as an extension, so I don't
think it has been kept intentionally.

This removes the default argument but adds an overload without the
second parameter, and adds the deprecated attribute to it. This allows
any code using it to keep working (for now) but with a warning.

libstdc++-v3/ChangeLog:

	PR libstdc++/104559
	* doc/xml/manual/evolution.xml: Document deprecation.
	* doc/html/manual/api.html: Regenerate.
	* include/bits/stl_bvector.h (insert(const_iterator, const bool&)):
	Remove default argument.
	(insert(const_iterator)): New overload with deprecated attribute.
	* testsuite/23_containers/vector/bool/modifiers/insert/104559.cc:
	New test.
2022-02-17 23:44:25 +00:00
Jonathan Wakely 36100e0e95 libstdc++: Make std::error_code printer more robust
This attempts to implement a partial workaround for the GDB bug
https://sourceware.org/bugzilla/show_bug.cgi?id=28856 which causes GDB
to crash when printing a frame with a std::error_code argument.

By recognising the known error categories defined in the library and
hardcoding their names we do not need to call cat->name() on the
category.  This has the additional benefit of also working when
debugging a core file rather than a running process. For those known
categories we can also cast the int value to the corresponding error
code enum (e.g. future_errc) so that we show an enumerator instead of
just an integer.

For program-defined categories we just use the name of the dynamic type
to identify the category, and print the value as an integer. Once the
GDB bug is fixed and the virtual name() function can be called safely,
that would be preferable. For now it's better to have an imperfect
printer that doesn't crash GDB.

This rewritten StdErrorCodePrinter needs gdb.Value.dynamic_type, so is
only registered if that is supported, which means GDB 7.7 and later.

libstdc++-v3/ChangeLog:

	* python/libstdcxx/v6/printers.py (StdErrorCodePrinter): Replace
	code that call cat->name() on std::error_category objects.
	Identify known categories by symbol name and use a hardcoded
	name. Print error code values as enumerators where appopriate.
	* testsuite/libstdc++-prettyprinters/cxx11.cc: Adjust expected
	name of custom category. Check io_errc and future_errc errors.
2022-02-17 22:22:14 +00:00
GCC Administrator 875e493bf5 Daily bump. 2022-02-16 00:16:26 +00:00
Jonathan Wakely 6cfb7ffb65 libstdc++: Add missing constexpr to uses-allocator construction utilities [PR104542]
libstdc++-v3/ChangeLog:

	PR libstdc++/104542
	* include/bits/uses_allocator_args.h (make_obj_using_allocator)
	(uninitialized_construct_using_allocator): Add constexpr.
	* testsuite/20_util/uses_allocator/make_obj.cc: Check constexpr.
	* testsuite/20_util/uses_allocator/uninitialized_construct.cc: New test.
2022-02-15 12:49:34 +00:00
GCC Administrator 1f8a09d2f3 Daily bump. 2022-02-15 00:16:41 +00:00
Jonathan Wakely 3d50dede07 libstdc++: Fix stream extraction of IEEE128 long double [PR100912]
The std::__convert_from_v helper that formats double and long double
values into a char buffer was not being duplicated for the two long
double ABIs. This resulted in an ODR violation inside the library, where
some callers needed it to use snprintf to format __ibm128 values and
other callers needed it to use __snprintfieee128 to format __ieee128
values. The linker discarded one of the definitions, leaving one set of
callers using the wrong code.

This puts __convert_from_v in the __gnu_cxx_ieee128 inline namespace
when long double is __ieee128, so that there are two different
definitions of the function.

The std::money_put::__do_put overload for __ibm128 values needs a
different fix, because that is defined when long double is __ieee128 and
so would call the one in the inline namespace. That can be fixed by just
inlining the code directly into the function and using an asm alias to
call the right version of snprintf for the __ibm128 format. The code to
do that can be simpler than __convert_from_v because if we're defining
the ALT128_COMPAT symbols we know that we have a recent glibc and so we
can assume that uselocale and snprintf are supported.

libstdc++-v3/ChangeLog:

	PR libstdc++/100912
	* config/locale/gnu/c_locale.h (__convert_from_v): Use inline
	namespace for IEEE128 long double mode.
	* config/os/gnu-linux/ldbl-ieee128-extra.ver: Add new symbol
	version and export __gnu_cxx_ieee128::__convert_from_v.
	* include/bits/locale_facets_nonio.tcc (money_put::__do_put):
	Make __ibm128 overload use snprintf directly
	* testsuite/util/testsuite_abi.cc: Add new symbol version.
	Remove stable IEEE128/LDBL versions.
2022-02-14 17:19:08 +00:00
Jonathan Wakely 164a761a9f libstdc++: Use __cpp_concepts instead of custom macro [PR103891]
With the new value of __cpp_concepts required by P2493, we can test
whether the compiler supports conditionally trivial special members.
This allows us to remove the workaround that disables fully-constexpr
std::variant for Clang. Now it should work for non-GCC compilers (such
as future releases of Clang) that support conditionally trivial
destructors and define the new value of __cpp_concepts.

libstdc++-v3/ChangeLog:

	PR libstdc++/103891
	* include/bits/c++config (_GLIBCXX_HAVE_COND_TRIVIAL_SPECIAL_MEMBERS):
	Remove.
	* include/std/variant: Check feature test macros instead.
	* include/std/version: Likewise.
2022-02-14 13:03:31 +00:00
Jonathan Wakely 220d85fdf0 libstdc++: Fix typo in pragma
libstdc++-v3/ChangeLog:

	* testsuite/20_util/unsynchronized_pool_resource/allocate.cc:
	Fix typo.
2022-02-14 12:46:04 +00:00
Jonathan Wakely 8134156502 libstdc++: Fix std::to_chars for IEEE128 long double
The preprocessor check for _GLIBCXX_USE_FLOAT128 is the wrong condition,
because when the compiler is built with --with-long-double-format=ieee
configure determines that __float128 is the same as long double, and so
should not be used. But we do want the std::to_chars overloads for
__float128 in that case, because the floating_to_chars.cc file is built
with -mabi=ibmlongdouble and so the __float128 overloads are actually
the 'long double' ones for -mabi=ieeelongdouble code.

This fixes missing definitions of the __float128 overloads of
std::to_chars for --with-long-double-format=ieee builds. Without this,
there are symbols present in the --with-long-double-abi=ibm build which
are missing from the --with-long-double-abi=ieee build.

libstdc++-v3/ChangeLog:

	* src/c++17/floating_to_chars.cc (FLOAT128_TO_CHARS): Depend on
	LONG_DOUBLE_ALT128_COMPAT instead of USE_FLOAT128.
2022-02-14 12:34:21 +00:00
GCC Administrator e8d68f0a45 Daily bump. 2022-02-12 00:16:23 +00:00
Jonathan Wakely 9a56779dbc libstdc++: Fix FAIL: 20_util/temporary_buffer.cc for C++14
The std::get_temporary_buffer function is deprecated since C++17, but
the test was expecting a warning for C++14 as well.

libstdc++-v3/ChangeLog:

	* testsuite/20_util/temporary_buffer.cc: Fix dg-warning target
	selector.
2022-02-11 21:42:22 +00:00
Jonathan Wakely b02247346e libstdc++: Fix test failures at -O0
libstdc++-v3/ChangeLog:

	* testsuite/20_util/monotonic_buffer_resource/allocate.cc:
	Ignore -Walloc-larger-than warning.
	* testsuite/20_util/unsynchronized_pool_resource/allocate.cc:
	Likewise.
	* testsuite/29_atomics/atomic/cons/user_pod.cc: Compile with -O1
	to avoid linker error for __atomic_is_lock_free.
2022-02-11 21:41:43 +00:00
GCC Administrator a645583d4d Daily bump. 2022-02-11 00:16:25 +00:00
Thomas Rodgers b25a7c05f1 libstdc++: Strengthen memory order for atomic<T>::wait/notify
This changes the memory order used in the spin wait code to match
that of libc++.

libstdc++-v3/ChangeLog:
	* include/bits/atomic_wait.h (__waiter_base::_S_do_spin,
	__waiter_base::_S_do_spin_v): Change memory order from relaxed
	to acquire.
2022-02-10 10:14:36 -08:00
Jonathan Wakely 3e539985cc libstdc++: Add atomic_fetch_xor to <stdatomic.h>
This function (and the explicit memory over version) are present in both
C++ <atomic> and C <stdatomic.h>, so should be in C++ <stdatomic.h> too.
There is a library issue incoming for this, but the resolution is
obvious.

libstdc++-v3/ChangeLog:

	* include/c_compatibility/stdatomic.h (atomic_fetch_xor): Add
	using-declaration.
	(atomic_fetch_xor_explicit): Likewise.
	* testsuite/29_atomics/headers/stdatomic.h/c_compat.cc: Check
	arithmetic and logical operations for atomic_int.
2022-02-10 13:01:10 +00:00
Jonathan Wakely 3d5f4f76e6 libstdc++: Fix directory iterator build for newlib
When building for newlib HAVE_OPENAT and HAVE_UNLINKAT are (sometimes?)
defined, but <fcntl.h> is only included when HAVE_DIRENT_H is defined.
Since directory iterators are completely useless without <dirent.h>,
just override the HAVE_OPENAT and HAVE_UNLINKAT detection when we don't
have <dirent.h>.

libstdc++-v3/ChangeLog:

	* src/filesystem/dir-common.h (_GLIBCXX_HAVE_DIRFD): Undefine
	when <dirent.h> is not available.
	(_GLIBCXX_HAVE_UNLINKAT):  Likewise.
2022-02-10 13:01:10 +00:00
GCC Administrator 3adf509fe6 Daily bump. 2022-02-10 00:16:27 +00:00
Thomas Rodgers 4cf3c33981 libstdc++: Fix deadlock in atomic wait [PR104442]
This issue was observed as a deadlock in
29_atomics/atomic/wait_notify/100334.cc on vxworks. When a wait is
"laundered" (e.g. type T* does not suffice as a waitable address for the
platform's native waiting primitive), the address waited is that of the
_M_ver member of __waiter_pool_base, so several threads may wait on the
same address for unrelated atomic<T> objects. As noted in the PR, the
implementation correctly exits the wait for the thread whose data
changed, but not for any other threads waiting on the same address.

As noted in the PR the __waiter::_M_do_wait_v member was correctly exiting
but the other waiters were not reloading the value of _M_ver before
re-entering the wait.

Moving the spin call inside the loop accomplishes this, and is
consistent with the predicate accepting version of __waiter::_M_do_wait.

libstdc++-v3/ChangeLog:

	PR libstdc++/104442
	* include/bits/atomic_wait.h (__waiter::_M_do_wait_v): Move spin
	 loop inside do loop so that threads failing the wait, reload
	 _M_ver.
2022-02-09 12:30:51 -08:00
GCC Administrator 2a2fda2d9b Daily bump. 2022-02-09 00:16:24 +00:00
Jonathan Wakely 1ef6085f09 libstdc++: Simplify resource management in directory iterators
This replaces the _Dir constructor that takes ownership of an existing
DIR* resource with one that takes a _Dir_base rvalue instead. This means
a raw DIR* is never passed around, but is always owned by a _Dir_base
object.

libstdc++-v3/ChangeLog:

	* src/c++17/fs_dir.cc (_Dir(DIR*, const path&)): Change first
	parameter to _Dir_base&&.
	* src/filesystem/dir-common.h (_Dir_base(DIR*)): Remove.
	* src/filesystem/dir.cc (_Dir(DIR*, const path&)): Change first
	parameter to _Dir_base&&.
2022-02-08 21:04:14 +00:00
Jonathan Wakely 8dbb60b8df libstdc++: Add comment to acinclude.m4
libstdc++-v3/ChangeLog:

	* acinclude.m4 (GLIBCXX_ENABLE_LOCK_POLICY): Add comment about
	checking for CAS on correct word size.
2022-02-08 14:15:38 +00:00
Jonathan Wakely 61b783995f libstdc++: Adjust Filesystem TS test for Windows
The Filesystem TS isn't really supported for Windows, but the FAIL for
this test is just because it doesn't match what happens on Windows.

libstdc++-v3/ChangeLog:

	* testsuite/experimental/filesystem/operations/create_directories.cc:
	Adjust expected results for Windows.
2022-02-08 13:31:09 +00:00
Jonathan Wakely 5750952bec libstdc++: Fix filesystem::remove_all for Windows [PR104161]
The recursive_directory_iterator::__erase member was failing for
Windows, because the entry._M_type value is always file_type::none
(because _Dir_base::advance doesn't populate it for Windows) and
top.unlink uses fs::remove which sets an error using the
system_category. That meant that ec.value() was a Windows error code and
not an errno value, so the comparisons to EPERM and EISDIR failed.
Instead of depending on a specific Windows error code for attempting to
remove a directory, just use directory_entry::refresh() to query the
type first. This doesn't avoid the TOCTTOU races with directory
symlinks, but we can't avoid them on Windows without openat and
unlinkat, and creating symlinks requires admin privs on Windows anyway.

This also fixes the fs::remove_all(const path&) overload, which was
supposed to use the same logic as the other overload, but I forgot to
change it before my previous commit.

libstdc++-v3/ChangeLog:

	PR libstdc++/104161
	* src/c++17/fs_dir.cc (fs::recursive_directory_iterator::__erase):
	[i_GLIBCXX_FILESYSTEM_IS_WINDOWS]: Refresh entry._M_type member,
	instead of checking for errno values indicating a directory.
	* src/c++17/fs_ops.cc (fs::remove_all(const path&)): Use similar
	logic to non-throwing overload.
	(fs::remove_all(const path&, error_code&)): Add comments.
	* src/filesystem/ops-common.h: Likewise.
2022-02-08 13:31:05 +00:00
GCC Administrator 3c1cbde16e Daily bump. 2022-02-05 00:16:31 +00:00
Jonathan Wakely 6e3419529d libstdc++: Fix std::filesystem build failure for Windows
The std::filesystem code needs to use posix::DIR not ::DIR, as that is
an alias for _WDIR on Windows.

libstdc++-v3/ChangeLog:

	* src/filesystem/dir-common.h (_Dir_base::openat): Change return
	type to use portable posix::DIR alias.
2022-02-04 23:56:29 +00:00
Jonathan Wakely 0d1aabb60e libstdc++: Allow Clang to use <stdatomic.h> before C++23
There is code that only expects to be compiled with clang++ and uses its
<stdatomic.h>, which works because Clang supports the _Atomic specifier
in C++. The addition  of <stdatomic.h> to libstdc++ broke this code, as
now it finds the C++ header instead, which is empty for any standard
mode before C++23.

This change allows that code to keep working as before, by forwarding to
clang's <stdatomic.h>.

libstdc++-v3/ChangeLog:

	* include/c_compatibility/stdatomic.h [__clang__]: Use
	#include_next <stdatomic.h>.
2022-02-04 19:51:26 +00:00
Jonathan Wakely da72e0fd20 libstdc++: Remove un-implementable noexcept from Filesystem TS operations
LWG 3014 removed these incorrect noexcept specifications from the C++17
std::filesystem operations. They are also incorrect on the experimental
TS versions and should be removed from them too.

libstdc++-v3/ChangeLog:

	* include/experimental/bits/fs_ops.h (fs::copy_file): Remove
	noexcept.
	(fs::create_directories): Likewise.
	(fs::remove_all): Likewise.
	* src/filesystem/ops.cc (fs::copy_file): Remove noexcept.
	(fs::create_directories): Likewise.
	(fs::remove_all): Likewise.
2022-02-04 19:51:26 +00:00
Jonathan Wakely ebf6175464 libstdc++: Fix filesystem::remove_all races [PR104161]
This fixes the remaining filesystem::remove_all race condition by using
POSIX openat to recurse into sub-directories and using POSIX unlinkat to
remove files. This avoids the remaining race where the directory being
removed is replaced with a symlink after the directory has been opened,
so that the filesystem::remove("subdir/file") resolves to "target/file"
instead, because "subdir" has been removed and replaced with a symlink.
The previous patch only fixed the case where the directory was replaced
with a symlink before we tried to open it, but it still used the full
(potentially compromised) path as an argument to filesystem::remove.

The first part of the fix is to use openat when recursing into a
sub-directory with recursive_directory_iterator. This means that opening
"dir/subdir" uses the file descriptor for "dir", and so is sure to open
"dir/subdir" and not "symlink/subdir". (The previous patch to use
O_NOFOLLOW already ensured we won't open "dir/symlink/" here.)

The second part of the fix is to use unlinkat for the remove_all
operation. Previously we used a directory_iterator to get the name of
each file in a directory and then used filesystem::remove(iter->path())
on that name. This meant that any checks (e.g. O_NOFOLLOW) done by the
iterator could be invalidated before the remove operation on that
pathname. The directory iterator contains an open DIR stream, which we
can use to obtain a file descriptor to pass to unlinkat. This ensures
that the file being deleted really is contained within the directory
we're iterating over, rather than using a pathname that could resolve to
some other file.

The filesystem::remove_all function previously used a (non-recursive)
filesystem::directory_iterator for each directory, and called itself
recursively for sub-directories. The new implementation uses a single
filesystem::recursive_directory_iterator object, and calls a new __erase
member function on that iterator. That new __erase member function does
the actual work of removing a file (or a directory after its contents
have been iterated over and removed) using unlinkat. That means we don't
need to expose the DIR stream or its file descriptor to the remove_all
function, it's still encapuslated by the iterator class.

It would be possible to add a __rewind member to directory iterators
too, to call rewinddir after each modification to the directory. That
would make it more likely for filesystem::remove_all to successfully
remove everything even if files are being written to the directory tree
while removing it. It's unclear if that is actually prefereable, or if
it's better to fail and report an error at the first opportunity.

The necessary APIs (openat, unlinkat, fdopendir, dirfd) are defined in
POSIX.1-2008, and in Glibc since 2.10. But if the target doesn't provide
them, the original code (with race conditions) is still used.

This also reduces the number of small memory allocations needed for
std::filesystem::remove_all, because we do not store the full path to
every directory entry that is iterated over. The new filename_only
option means we only store the filename in the directory entry, as that
is all we need in order to use openat or unlinkat.

Finally, rather than duplicating everything for the Filesystem TS, the
std::experimental::filesystem::remove_all implementation now just calls
std::filesystem::remove_all to do the work.

libstdc++-v3/ChangeLog:

	PR libstdc++/104161
	* acinclude.m4 (GLIBCXX_CHECK_FILESYSTEM_DEPS): Check for dirfd
	and unlinkat.
	* config.h.in: Regenerate.
	* configure: Regenerate.
	* include/bits/fs_dir.h (recursive_directory_iterator): Declare
	remove_all overloads as friends.
	(recursive_directory_iterator::__erase): Declare new member
	function.
	* include/bits/fs_fwd.h (remove, remove_all): Declare.
	* src/c++17/fs_dir.cc (_Dir): Add filename_only parameter to
	constructor. Pass file descriptor argument to base constructor.
	(_Dir::dir_and_pathname, _Dir::open_subdir, _Dir::do_unlink)
	(_Dir::unlink, _Dir::rmdir): Define new member functions.
	(directory_iterator): Pass filename_only argument to _Dir
	constructor.
	(recursive_directory_iterator::_Dir_stack): Adjust constructor
	parameters to take a _Dir rvalue instead of creating one.
	(_Dir_stack::orig): Add data member for storing original path.
	(_Dir_stack::report_error): Define new member function.
	(__directory_iterator_nofollow): Move here from dir-common.h and
	fix value to be a power of two.
	(__directory_iterator_filename_only): Define new constant.
	(recursive_directory_iterator): Construct _Dir object and move
	into _M_dirs stack. Pass skip_permission_denied argument to first
	advance call.
	(recursive_directory_iterator::increment): Use _Dir::open_subdir.
	(recursive_directory_iterator::__erase): Define new member
	function.
	* src/c++17/fs_ops.cc (ErrorReporter, do_remove_all): Remove.
	(fs::remove_all): Use new recursive_directory_iterator::__erase
	member function.
	* src/filesystem/dir-common.h (_Dir_base): Add int parameter to
	constructor and use openat to implement nofollow semantics.
	(_Dir_base::fdcwd, _Dir_base::set_close_on_exec, _Dir_base::openat):
	Define new member functions.
	(__directory_iterator_nofollow): Move to fs_dir.cc.
	* src/filesystem/dir.cc (_Dir): Pass file descriptor argument to
	base constructor.
	(_Dir::dir_and_pathname, _Dir::open_subdir): Define new member
	functions.
	(recursive_directory_iterator::_Dir_stack): Adjust constructor
	parameters to take a _Dir rvalue instead of creating one.
	(recursive_directory_iterator): Check for new nofollow option.
	Construct _Dir object and move into _M_dirs stack. Pass
	skip_permission_denied argument to first advance call.
	(recursive_directory_iterator::increment): Use _Dir::open_subdir.
	* src/filesystem/ops.cc (fs::remove_all): Use C++17 remove_all.
2022-02-04 19:51:26 +00:00
Jonathan Wakely 27ba40559c libstdc++: Add suggestion to std::uncaught_exception() warning
We should use the SUGGEST macro for std::uncaught_exception()
deprecation warnings.

libstdc++-v3/ChangeLog:

	* include/bits/allocator.h: Qualify std::allocator_traits in
	deprecated warnings.
	* libsupc++/exception (uncaught_exception): Add suggestion to
	deprecated warning.
2022-02-04 15:26:59 +00:00
GCC Administrator 88944e1314 Daily bump. 2022-02-03 00:16:22 +00:00
Jonathan Wakely 2905e1af94 libstdc++: Fix -Wunused-variable warning for -fno-exceptions build
If _GLIBCXX_THROW_OR_ABORT expands to just __builtin_abort() then the
bool variable used in the filesystem_error constructor is unused. Mark
it as maybe_unused to there's no warning for -fno-exceptions builds.

libstdc++-v3/ChangeLog:

	* src/c++17/fs_dir.cc (fs::recursive_directory_iterator::pop):
	Add [[maybe_unused]] attribute.
	* src/filesystem/dir.cc (fs::recursive_directory_iterator::pop):
	Likewise.
2022-02-02 17:55:16 +00:00
Jonathan Wakely c123096cf1 libstdc++: Fix invalid instantiations in tests
These tests instantiate std::multiset and std::set with a type that has
no operator< so they should use a custom comparison function.

libstdc++-v3/ChangeLog:

	* testsuite/23_containers/multiset/operators/cmp_c++20.cc: Use
	custom comparison function for multiset.
	* testsuite/23_containers/set/operators/cmp_c++20.cc: Use custom
	comparison function for set.
2022-02-02 17:08:54 +00:00
Jonathan Wakely b229c51860 libstdc++: Fix link failure in _OutputIteratorConcept
The C++98-style concept check for output iterators causes a link
failure on mingw-w64, because the __val() member function isn't defined.
Change it to use a function pointer instead. That pointer is never set
to anything meaningful, but it doesn't matter as the __constraints()
function only has to be instantiated, it's never called.

We could refactor all of these to use unevaluated contexts (e.g. sizeof
of __decltype) so that we only check the expressions are well-formed,
without any codegen at all. Any improvements to these are very low
priority though.

libstdc++-v3/ChangeLog:

	* include/bits/boost_concept_check.h (_OutputIteratorConcept):
	Change member function to data member of function pointer type.
2022-02-02 16:30:51 +00:00
Martin Sebor 756eabacfc Declare std::array members with attribute const [PR101831].
Resolves:
PR libstdc++/101831 - Spurious maybe-uninitialized warning on std::array::size

libstdc++-v3/ChangeLog:

	PR libstdc++/101831
	* include/std/array (begin): Declare const member function attribute
	const.
	(end, rbegin, rend, size, max_size, empty, data): Same.
	* testsuite/23_containers/array/capacity/empty.cc: Add test cases.
	* testsuite/23_containers/array/capacity/max_size.cc: Same.
	* testsuite/23_containers/array/capacity/size.cc: Same.
	* testsuite/23_containers/array/iterators/begin_end.cc: New test.
2022-02-01 17:21:49 -07:00
GCC Administrator ae7e4af964 Daily bump. 2022-02-02 00:17:16 +00:00
Jonathan Wakely d98668eb06 libstdc++: Do not use dirent::d_type unconditionally
These new tests should not use the d_type member unless it's actually
present on the OS.

libstdc++-v3/ChangeLog:

	* testsuite/27_io/filesystem/iterators/error_reporting.cc: Use
	autoconf macro to check whether d_type is present.
	* testsuite/experimental/filesystem/iterators/error_reporting.cc:
	Likewise.
2022-02-02 00:01:43 +00:00
Jonathan Wakely 2dc2f41728 libstdc++: Add more tests for filesystem directory iterators
The PR 97731 test was added to verify a fix to the Filesystem TS code,
but we should also have the same test to avoid similar regressions in
the C++17 std::filesystem code.

Also add tests for directory_options::follow_directory_symlink

libstdc++-v3/ChangeLog:

	* testsuite/27_io/filesystem/iterators/97731.cc: New test.
	* testsuite/27_io/filesystem/iterators/recursive_directory_iterator.cc:
	Check follow_directory_symlink option.
	* testsuite/experimental/filesystem/iterators/recursive_directory_iterator.cc:
	Likewise.
2022-02-01 21:56:35 +00:00
Jonathan Wakely ec09a5335f libstdc++: Reset filesystem::recursive_directory_iterator on error
The standard requires directory iterators to become equal to the end
iterator value if they report an error. Some members functions of
filesystem::recursive_directory_iterator fail to do that.

libstdc++-v3/ChangeLog:

	* src/c++17/fs_dir.cc (recursive_directory_iterator::increment):
	Reset state to past-the-end iterator on error.
	(fs::recursive_directory_iterator::pop(error_code&)): Likewise.
	(fs::recursive_directory_iterator::pop()): Check _M_dirs before
	it might get reset.
	* src/filesystem/dir.cc (recursive_directory_iterator): Likewise,
	for the TS implementation.
	* testsuite/27_io/filesystem/iterators/error_reporting.cc: New test.
	* testsuite/experimental/filesystem/iterators/error_reporting.cc: New test.
2022-02-01 21:56:16 +00:00
Jonathan Wakely 90263a4830 libstdc++: Fix doxygen comment for filesystem::perms operators
libstdc++-v3/ChangeLog:

	* include/bits/fs_fwd.h (filesystem::perms): Fix comment.
2022-02-01 21:53:15 +00:00
Jonathan Wakely 19b8946dbd libstdc++: Improve config output for --enable-cstdio [PR104301]
Currently we just print "checking for underlying I/O to use... stdio"
unconditionally, whether configured to use stdio_pure or stdio_posix. We
should make it clear that the user's configure option chose the right
thing.

libstdc++-v3/ChangeLog:

	PR libstdc++/104301
	* acinclude.m4 (GLIBCXX_ENABLE_CSTDIO): Print different messages
	for stdio_pure and stdio_posix options.
	* configure: Regenerate.
2022-02-01 21:53:14 +00:00
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