aboutsummaryrefslogtreecommitdiff
path: root/libstdc++-v3
AgeCommit message (Collapse)AuthorFilesLines
2022-05-07Daily bump.GCC Administrator1-0/+55
2022-05-06libstdc++: Simplify std::normal_distribution equality operatorJonathan Wakely3-10/+22
libstdc++-v3/ChangeLog: * include/bits/random.tcc (operator==): Only check normal_distribution::_M_saved_available once. * testsuite/26_numerics/random/normal_distribution/operators/equal.cc: Check equality after state changes. * testsuite/26_numerics/random/pr60037-neg.cc: Adjust dg-error lineno.
2022-05-06libstdc++: Fix deserialization for std::normal_distribution [PR105502]Jonathan Wakely2-2/+36
This fixes a regression in std::normal_distribution deserialization that caused the object to be left unchanged if the __state_avail value read from the stream was false. libstdc++-v3/ChangeLog: PR libstdc++/105502 * include/bits/random.tcc (operator>>(basic_istream<C,T>&, normal_distribution<R>&)): Update state when __state_avail is false. * testsuite/26_numerics/random/normal_distribution/operators/serialize.cc: Check that deserialized object equals serialized one.
2022-05-06libstdc++: ppc: conditionalize vsx-only simd intrinsicsAlexandre Oliva1-3/+10
libstdc++'s bits/simd.h section for PowerPC, guarded by __ALTIVEC__, defines various intrinsic vector types that are only available with __VSX__: 64-bit long double, double, (un)signed long long, and 64-bit (un)signed long. experimental/simd/standard_abi_usable{,_2}.cc tests error out reporting the unmet requirements when the target cpu doesn't enable VSX. Make the reported instrinsic types conditional on __VSX__ so that <experimental/simd> can be used on PowerPC variants that do not support VSX. for libstdc++-v3/ChangeLog * include/experimental/bits/simd.h [__ALTIVEC__]: Require VSX for double, long long, and 64-bit long intrinsic types. [__ALTIVEC__] (__intrinsic_type): Mention 128-bit in preexisting long double diagnostic, adjust no-VSX double diagnostic to cover 64-bit long double as well.
2022-05-06libstdc++: Fix test that fails on Solaris [PR104731]Jonathan Wakely1-13/+22
On Solaris the dirent::d_name member is a single char, causing this test to fail with warnings about buffer overflow. Change the test to use a union with additional space for writing a string to the d_name member. libstdc++-v3/ChangeLog: PR libstdc++/104731 * testsuite/27_io/filesystem/iterators/error_reporting.cc: Use a trailing char array as storage for dirent::d_name.
2022-05-06libstdc++: Do not include <cxxabi.h> in <stacktrace>Jonathan Wakely1-1/+7
This avoids polluting the global namespace with the "abi" namespace alias. libstdc++-v3/ChangeLog: * include/std/stacktrace: Do not include <cxxabi.h>. (__cxa_demangle): Declare.
2022-05-06libstdc++: Do not use #include inside push visibility scope [PR99871]Jonathan Wakely7-37/+7
libstdc++-v3/ChangeLog: PR libstdc++/99871 * include/bits/specfun.h: Use visibility attribute on namespace, instead of pragma push/pop. * libsupc++/compare: Likewise. * libsupc++/exception: Likewise. * libsupc++/exception.h: Likewise. * libsupc++/exception_ptr.h: Likewise. * libsupc++/initializer_list: Likewise. * libsupc++/nested_exception.h: Likewise.
2022-05-06libstdc++: Update documentation about copyright and GPL notices in testsJonathan Wakely2-4/+12
There is no need to require FSF copyright for tests that are just "self-evident" ways to check the API and behaviour of the library. This is consistent with tests for the compiler, which do not have copyright and licence notices either. libstdc++-v3/ChangeLog: * doc/xml/manual/test.xml: Remove requirement for copyright and GPL notice in tests. * doc/html/manual/test.html: Regenerate.
2022-05-06Daily bump.GCC Administrator1-0/+71
2022-05-05libstdc++: Fixes for tests that fail with -fno-rttiJonathan Wakely55-63/+284
This disables a use of dynamic_cast that is not valid for -fno-rtti and adjusts some tests so they don't FAIL with -fno-rtti. Some tests are skipped completely, and others just make use of typeid conditional on the __cpp_rtti macro. A couple of tests were using typeid to verify typedefs denote the right type, which can be done at compile-time using templates instead. libstdc++-v3/ChangeLog: * include/experimental/memory_resource [!__cpp_rtti] (__resource_adaptor_imp::do_is_equal): Do not use dynamic_cast when RTTI is disabled. * testsuite/17_intro/freestanding.cc: Require RTTI. * testsuite/18_support/exception/38732.cc: Likewise. * testsuite/18_support/exception_ptr/rethrow_exception.cc: Likewise. * testsuite/18_support/nested_exception/68139.cc: Likewise. * testsuite/18_support/nested_exception/rethrow_if_nested.cc: Likewise. * testsuite/18_support/type_info/103240.cc: Likewise. * testsuite/18_support/type_info/fundamental.cc: Likewise. * testsuite/18_support/type_info/hash_code.cc: Likewise. * testsuite/20_util/any/assign/emplace.cc: Likewise. * testsuite/20_util/any/cons/in_place.cc: Likewise. * testsuite/20_util/any/misc/any_cast.cc: Likewise. * testsuite/20_util/any/observers/type.cc: Likewise. * testsuite/20_util/function/1.cc: Likewise. * testsuite/20_util/function/2.cc: Likewise. * testsuite/20_util/function/3.cc: Likewise. * testsuite/20_util/function/4.cc: Likewise. * testsuite/20_util/function/5.cc: Likewise. * testsuite/20_util/function/6.cc: Likewise. * testsuite/20_util/function/7.cc: Likewise. * testsuite/20_util/function/8.cc: Likewise. * testsuite/20_util/polymorphic_allocator/resource.cc: Likewise. * testsuite/20_util/shared_ptr/casts/1.cc: Likewise. * testsuite/20_util/shared_ptr/casts/rval.cc: Likewise. * testsuite/20_util/shared_ptr/cons/unique_ptr_deleter_ref_2.cc: Likewise. * testsuite/20_util/shared_ptr/misc/get_deleter.cc: Likewise. * testsuite/20_util/typeindex/comparison_operators.cc: Likewise. * testsuite/20_util/typeindex/comparison_operators_c++20.cc: Likewise. * testsuite/20_util/typeindex/hash.cc: Likewise. * testsuite/20_util/typeindex/hash_code.cc: Likewise. * testsuite/20_util/typeindex/name.cc: Likewise. * testsuite/22_locale/ctype/is/string/89728_neg.cc: Likewise. * testsuite/22_locale/global_templates/standard_facet_hierarchies.cc: Likewise. * testsuite/22_locale/global_templates/user_facet_hierarchies.cc: Likewise. * testsuite/22_locale/locale/13630.cc: Check type without using RTTI. * testsuite/23_containers/array/requirements/non_default_constructible.cc: Require RTTI. * testsuite/27_io/basic_ostream/emit/1.cc: Likewise. * testsuite/27_io/fpos/14320-1.cc: Check type without using RTTI. * testsuite/27_io/fpos/mbstate_t/12065.cc: Require RTTI. * testsuite/27_io/ios_base/failure/dual_abi.cc: Likewise. * testsuite/experimental/any/misc/any_cast.cc: Likewise. * testsuite/experimental/any/observers/type.cc: Likewise. * testsuite/experimental/memory_resource/resource_adaptor.cc: Likewise. * testsuite/lib/libstdc++.exp (check_effective_target_rtti): Define new proc. * testsuite/tr1/3_function_objects/function/1.cc: Likewise. * testsuite/tr1/3_function_objects/function/2.cc: Likewise. * testsuite/tr1/3_function_objects/function/3.cc: Likewise. * testsuite/tr1/3_function_objects/function/4.cc: Likewise. * testsuite/tr1/3_function_objects/function/5.cc: Likewise. * testsuite/tr1/3_function_objects/function/6.cc: Likewise. * testsuite/tr1/3_function_objects/function/7.cc: Likewise. * testsuite/tr1/3_function_objects/function/8.cc: Likewise. * testsuite/tr2/bases/value.cc: Likewise. * testsuite/tr2/direct_bases/value.cc: Likewise. * testsuite/util/exception/safety.h [!__cpp_rtti]: Don't print types without RTTI.
2022-05-05Daily bump.GCC Administrator1-0/+22
2022-05-04libstdc++: Add always_inline to the simplest std::array accessors [PR104719]Jonathan Wakely1-4/+4
libstdc++-v3/ChangeLog: PR libstdc++/104719 * include/std/array (array::size(), array::max_size()) (array::empty(), array::data()): Add always_inline attribute.
2022-05-04libstdc++: Simplify std::array accessors [PR104719]Jonathan Wakely2-48/+38
This removes the __array_traits::_S_ref and __array_traits::_S_ptr accessors, which only exist to make the special case of std::array<T, 0> syntactically well-formed. By changing the empty type used as the std::array<T, 0>::_M_elems data member to support operator[] and conversion to a pointer, we can write code using the natural syntax. The indirection through _S_ref and _S_ptr is removed for the common case, and a function call is only used for the special case of zero-size arrays. The invalid member access for zero-sized arrays is changed to use __builtin_trap() instead of a null dereference. This guarantees a runtime error if it ever gets called, instead of undefined behaviour that is likely to get optimized out as unreachable. libstdc++-v3/ChangeLog: PR libstdc++/104719 * include/std/array (__array_traits::_S_ref): Remove. (__array_traits::_S_ptr): Remove. (__array_traits<T, 0>::_Type): Define operator[] and operator T* to provide an array-like API. (array::_AT_Type): Remove public typeef. (array::operator[], array::at, array::front, array::back): Use index operator to access _M_elems instead of _S_ref. (array::data): Use implicit conversion from _M_elems to pointer. (swap(array&, array&)): Use __enable_if_t helper. (get<I>): Use index operator to access _M_elems. * testsuite/23_containers/array/tuple_interface/get_neg.cc: Adjust dg-error line numbers.
2022-05-04Daily bump.GCC Administrator1-0/+6
2022-05-03[PR105324] libstdc++: testsuite: pr105324 requires FP from_charAlexandre Oliva1-0/+2
The floating-point overloads of from_char are only declared if _GLIBCXX_HAVE_USELOCALE is #defined as nonzero. That's exposed from charconv as __cpp_lib_to_chars >= 201611L, so guard the test body with that. for libstdc++-v3/ChangeLog PR c++/105324 * testsuite/20_util/from_chars/pr105324.cc: Guard test body with conditional for floating-point overloads of from_char.
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