aboutsummaryrefslogtreecommitdiff
path: root/libstdc++-v3
AgeCommit message (Collapse)AuthorFilesLines
2022-05-03Daily bump.GCC Administrator1-0/+15
2022-05-02libstdc++: Don't use std::tolower in <charconv> [PR103911]Patrick Palka1-6/+5
As with std::isdigit in r12-6281-gc83ecfbe74a5cf, we shouldn't be using std::tolower in <charconv> either. PR libstdc++/103911 libstdc++-v3/ChangeLog: * src/c++17/floating_from_chars.cc (find_end_of_float): Accept two delimeters for the exponent part in the form of a possibly NULL string of length two. Don't use std::tolower. (pattern): Adjust calls to find_end_of_float accordingly.
2022-05-02libstdc++: case-sensitivity in hexfloat std::from_chars [PR105441]Patrick Palka2-1/+2
The hexfloat parser for binary32/64 added in r12-6645-gcc3bf3404e4b1c overlooked that the exponent part can also begin with an uppercase 'P'. PR libstdc++/105441 libstdc++-v3/ChangeLog: * src/c++17/floating_from_chars.cc (__floating_from_chars_hex): Also accept 'P' as the start of the exponent. * testsuite/20_util/from_chars/7.cc: Add corresponding testcase.
2022-04-30Daily bump.GCC Administrator1-0/+18
2022-04-29libstdc++: Add missing exports for ppc64le --with-long-double-format=ibm ↵Jonathan Wakely2-0/+48
[PR105417] The --with-long-double-abi=ibm build is missing some exports that are present in the --with-long-double-abi=ieee build. Those symbols never should have been exported at all, but now that they have been, they should be exported consistently by both ibm and ieee. This simply defines them as aliases for equivalent symbols that are already present. The abi-tag on num_get::_M_extract_int isn't really needed, because it only uses a std::string as a local variable, not in the return type or function parameters, so it's safe to define the _M_extract_int[abi:cxx11] symbols as aliases for the corresponding function without the abi-tag. This causes some new symbols to be added to the GLIBCXX_3.4.29 version for the ibm long double build mode, but there is no advantage to adding them to 3.4.30 for that build. That would just create more inconsistencies. libstdc++-v3/ChangeLog: PR libstdc++/105417 * config/abi/post/powerpc64-linux-gnu/baseline_symbols.txt: Regenerate. * src/c++11/compatibility-ldbl-alt128.cc [_GLIBCXX_USE_DUAL_ABI]: Define __gnu_ieee128::num_get<C>::_M_extract_int[abi:cxx11]<I> symbols as aliases for corresponding symbols without abi-tag.
2022-04-29libstdc++: Update Solaris baselines for GCC 12.1Rainer Orth4-0/+48
The following patch updates the Solaris baselines for GCC 12.1. Tested on i386-pc-solaris2.11 and sparc-sun-solaris2.11 (Solaris 11.3 and 11.4 in each case). The only (expected) difference between the 11.3 and 11.4 versions is --- baseline_symbols.txt.s113s 2022-04-28 10:37:11.464068450 +0000 +++ baseline_symbols.txt.s114s 2022-04-27 16:54:31.995636805 +0000 @@ -4070,3 +4070,3 @@ -FUNC:_ZSt10from_charsPKcS0_RdSt12chars_format@@GLIBCXX_3.4.30 -FUNC:_ZSt10from_charsPKcS0_ReSt12chars_format@@GLIBCXX_3.4.30 -FUNC:_ZSt10from_charsPKcS0_RfSt12chars_format@@GLIBCXX_3.4.30 +FUNC:_ZSt10from_charsPKcS0_RdSt12chars_format@@GLIBCXX_3.4.29 +FUNC:_ZSt10from_charsPKcS0_ReSt12chars_format@@GLIBCXX_3.4.29 +FUNC:_ZSt10from_charsPKcS0_RfSt12chars_format@@GLIBCXX_3.4.29 which is handled by the fix for PR libstdc++/103407. I'm using the 11.4 version here. 2022-04-27 Rainer Orth <ro@CeBiTec.Uni-Bielefeld.DE> libstdc++-v3: * config/abi/post/i386-solaris/baseline_symbols.txt: Regenerate. * config/abi/post/i386-solaris/amd64/baseline_symbols.txt: Likewise. * config/abi/post/sparc-solaris/baseline_symbols.txt: Likewise. * config/abi/post/sparc-solaris/sparcv9/baseline_symbols.txt: Likewise.
2022-04-29Daily bump.GCC Administrator1-0/+16
2022-04-28libstdc++: Fix error reporting in filesystem::copy [PR99290]Jonathan Wakely4-4/+70
The recursive calls to filesystem::copy should stop if any of them reports an error. libstdc++-v3/ChangeLog: PR libstdc++/99290 * src/c++17/fs_ops.cc (fs::copy): Pass error_code to directory_iterator constructor, and check on each iteration. * src/filesystem/ops.cc (fs::copy): Likewise. * testsuite/27_io/filesystem/operations/copy.cc: Check for errors during recursion. * testsuite/experimental/filesystem/operations/copy.cc: Likewise.
2022-04-28libstdc++: Remove redundant line in versioned namespace linker scriptFrançois Dumont1-1/+0
This doesn't match anything. libstdc++-v3/ChangeLog: * config/abi/pre/gnu-versioned-namespace.ver: Remove std::random_device::* pattern.
2022-04-28Daily bump.GCC Administrator1-0/+21
2022-04-27libstdc++: Update {x86_64,i?86,aarch64,s390x,ppc{,64,64le}} baseline_symbols.txtJakub Jelinek8-8/+90
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-27libstdc++: Add pretty printer for std::atomicJonathan Wakely3-3/+69
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-27Daily bump.GCC Administrator1-0/+13
2022-04-26libstdc++: Add std::atomic<shared_ptr>(nullptr_t) constructor (LWG 3661)Jonathan Wakely2-0/+6
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-26libstdc++: Define std::hash<std::filesystem::path> (LWG 3657)Jonathan Wakely2-0/+20
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-26Daily bump.GCC Administrator1-0/+34
2022-04-25libstdc++: Implement constexpr std::unique_ptr for C++23 (P2273R3)Jonathan Wakely9-21/+466
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-25libstdc++: Add deduction guides for std::packaged_task [PR105375]Jonathan Wakely2-0/+96
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-25libstdc++: Add pretty printer for std::initializer_listPhilipp Fent2-2/+28
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-23Daily bump.GCC Administrator1-0/+14
2022-04-22libstdc++: Make atomic notify_one and notify_all non-constThomas W Rodgers3-14/+14
<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-22Daily bump.GCC Administrator1-0/+24
2022-04-21libstdc++: Avoid ASCII assumptions in floating_from_chars.ccPatrick Palka2-17/+28
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-21libstdc++: Work around modules ICE in <charconv> [PR105297]Patrick Palka1-1/+3
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-21libstdc++: Remove bogus assertion in std::from_chars [PR105324]Jonathan Wakely2-1/+14
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-21Daily bump.GCC Administrator1-0/+14
2022-04-20libstdc++: Fix macro checked by testJonathan Wakely1-1/+1
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-20libstdc++: Use LTLIBICONV when linking libstdc++.so [PR93602]Jonathan Wakely4-2/+89
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-20Daily bump.GCC Administrator1-0/+19
2022-04-19libstdc++: Stop defining _GLIBCXX_ASSERTIONS in floating_to_chars.ccPatrick Palka1-3/+6
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-19libstdc++: Add pretty printer for std::spanPhilipp Fent2-0/+49
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-19libstdc++: Fix syntax error in libbacktrace configurationJonathan Wakely2-6/+6
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-19Daily bump.GCC Administrator1-0/+6
2022-04-18libstdc++: Micro-optimize __from_chars_pow2_basePatrick Palka1-8/+20
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-16Daily bump.GCC Administrator1-0/+26
2022-04-15libstdc++: Avoid double-deref of __first in ranges::minmax [PR104858]Patrick Palka2-1/+31
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-15libstdc++: Optimize integer std::from_charsPatrick Palka2-163/+102
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-15Daily bump.GCC Administrator1-0/+40
2022-04-14libstdc++: Default to mutex-based atomics on RISC-VPalmer Dabbelt2-2/+8
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-14libstdc++: Fix incorrect IS number in doc commentJonathan Wakely1-1/+1
libstdc++-v3/ChangeLog: * doc/xml/manual/intro.xml: Fix comment.
2022-04-14libstdc++: Add new headers to <bits/stdc++.h> PCHJonathan Wakely1-0/+4
libstdc++-v3/ChangeLog: * include/precompiled/stdc++.h: Include <stacktrace> and <stdatomic.h> for C++23.
2022-04-14libstdc++: Fix missing and incorrect feature test macros [PR105269]Jonathan Wakely12-23/+54
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-13Daily bump.GCC Administrator1-0/+49
2022-04-12libstdc++: Prefer to use mmap instead of malloc in libbacktraceJonathan Wakely3-14/+83
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-12libstdc++: shrink-to-fit in std::basic_stacktrace::current(skip, max)Jonathan Wakely1-1/+14
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-12libstdc++: Use allocator to construct std::stacktrace_entry objectsJonathan Wakely1-45/+47
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-12libstdc++: Use nothrow new in std::stacktraceJonathan Wakely1-7/+35
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-12libstdc++: Reduce memory usage in std::stacktrace::currentJonathan Wakely2-48/+148
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-12Daily bump.GCC Administrator1-0/+48
2022-04-11libstdc++: Fix incorrect branch prediction hint in std::stacktraceJonathan Wakely1-1/+1
libstdc++-v3/ChangeLog: * include/std/stacktrace (basic_stacktrace::_Impl::_M_allocate): Change [[unlikely]] attribute to [[likely]].