aboutsummaryrefslogtreecommitdiff
path: root/libstdc++-v3
AgeCommit message (Collapse)AuthorFilesLines
3 hoursDaily bump.HEADtrunkmasterGCC Administrator1-0/+64
10 hourslibstdc++: Fix __uninitialized_default for constexpr caseJonathan Wakely1-1/+7
We should not use the std::fill optimization for trivial types during constant evaluation, because we need to begin the lifetime of all objects, even trivially default constructible ones. This fixes a bug that Clang diagnosed: include/c++/16.0.0/bits/stl_algobase.h:925:11: note: assignment to object outside its lifetime is not allowed in a constant expression 925 | *__first = __val; | ~~~~~~~~~^~~~~~~ I initially just added the #ifdef __cpp_lib_is_constant_evaluated check, but that gave warnings with GCC because the function isn't constexpr until C++26. So then I tried checking __glibcxx_raw_memory_algorithms for the value indicating constexpr uninitialized_value_construct, but that macro depends on __cpp_constexpr >= 202406 and Clang 19 doesn't support constexpr placement new, so doesn't define it. So I decided to just change __uninitialized_default to use _GLIBCXX20_CONSTEXPR which is consistent with __uninitialized_default_n (which needs to be constexpr because it's used by std::vector). We don't currently need to use __uninitialized_default in constexpr contexts for C++20 code, but we might find uses for it, so now it would be possible. libstdc++-v3/ChangeLog: * include/bits/stl_uninitialized.h (__uninitialized_default): Do not use optimized implementation for constexpr case. Use _GLIBCXX20_CONSTEXPR instead of _GLIBCXX26_CONSTEXPR.
10 hourslibstdc++: Add more template keywords to <mdspan> for ClangJonathan Wakely1-2/+2
This fixes: include/c++/16.0.0/mdspan:1182:33: error: use 'template' keyword to treat 'mapping' as a dependent template name 1182 | const typename _OLayout::mapping<_OExtents>&> | ^ include/c++/16.0.0/mdspan:1185:31: error: use 'template' keyword to treat 'mapping' as a dependent template name 1185 | const typename _OLayout::mapping<_OExtents>&, mapping_type> | ^ libstdc++-v3/ChangeLog: * include/std/mdspan (mdspan): Add template keyword for dependent name.
10 hourslibstdc++: Do not use list-initialization in std::span members [PR120997]Jonathan Wakely2-7/+54
As the bug report shows, for span<const bool> the return statements of the form `return {data(), count};` will use the new C++26 constructor, span(initializer_list<element_type>). Although the conversions from data() to bool and count to bool are narrowing and should be ill-formed, in system headers the narrowing diagnostics are suppressed. In any case, even if the compiler diagnosed them as ill-formed, we still don't want the initializer_list constructor to be used. We want to use the span(element_type*, size_t) constructor instead. Replace the braced-init-list uses with S(data(), count) where S is the correct return type. We need to make similar changes in the C++26 working draft, which will be taken care of via an LWG issue. libstdc++-v3/ChangeLog: PR libstdc++/120997 * include/std/span (span::first, span::last, span::subspan): Do not use braced-init-list for return statements. * testsuite/23_containers/span/120997.cc: New test.
16 hourslibstdc++: Add smart ptr owner_equals and owner_hash [PR117403]Paul Keir14-0/+616
New structs and member functions added to C++26 by P1901R2. libstdc++-v3/ChangeLog: PR libstdc++/117403 * include/bits/shared_ptr.h (shared_ptr::owner_equal) (shared_ptr::owner_hash, weak_ptr::owner_equal) (weak_ptr::owner_hash): Define new member functions. * include/bits/shared_ptr_base.h (owner_equal, owner_hash): Define new structs. * include/bits/version.def (smart_ptr_owner_equality): Define. * include/bits/version.h: Regenerate. * include/std/memory: Added define for __glibcxx_want_smart_ptr_owner_equality. * testsuite/20_util/owner_equal/version.cc: New test. * testsuite/20_util/owner_equal/cmp.cc: New test. * testsuite/20_util/owner_equal/noexcept.cc: New test. * testsuite/20_util/owner_hash/cmp.cc: New test. * testsuite/20_util/owner_hash/noexcept.cc: New test. * testsuite/20_util/shared_ptr/observers/owner_equal.cc: New test. * testsuite/20_util/shared_ptr/observers/owner_hash.cc: New test. * testsuite/20_util/weak_ptr/observers/owner_equal.cc: New test. * testsuite/20_util/weak_ptr/observers/owner_hash.cc: New test. Signed-off-by: Paul Keir <paul.keir@uws.ac.uk>
16 hourslibstdc++: Added missing members to numeric_limits specializations for ↵Mateusz Zych2-0/+114
integer-class types [iterator.concept.winc]/11 says that std::numeric_limits should be specialized for integer-class types, with each member defined appropriately. libstdc++-v3/ChangeLog: * include/bits/max_size_type.h (numeric_limits<__max_size_type>): New members. (numeric_limits<__max_diff_type>): Likewise. * testsuite/std/ranges/iota/max_size_type.cc: New test cases. Signed-off-by: Mateusz Zych <mte.zych@gmail.com>
18 hourslibstdc++: Fix memory_resource.cc bootstrap failure for non-gthreads targetsJonathan Wakely2-27/+40
The new choose_block_size function added in r16-2112-gac2fb60a67d6d1 was defined inside an #ifdef _GLIBCXX_HAS_GTHREADS group, which means that it's not available for single-threaded targets, and so can't be used by unsynchronized_pool_resource. Move it before that preprocessor group so it's always defined. libstdc++-v3/ChangeLog: * src/c++17/memory_resource.cc: Adjust indentation of unnamed namespaces. (pool_sizes): Add comment. (choose_block_size): Move outside preprocessor group for gthreads targets. * testsuite/20_util/synchronized_pool_resource/118681.cc: Require gthreads.
26 hourslibstdc++: Update some baseline_symbols.txt (x32)H.J. Lu1-0/+11
* config/abi/post/x86_64-linux-gnu/x32/baseline_symbols.txt: Updated. Signed-off-by: H.J. Lu <hjl.tools@gmail.com>
27 hoursDaily bump.GCC Administrator1-0/+172
27 hourslibstdc++: Fix double free in new pool resource test [PR118681]Jonathan Wakely1-1/+1
This was supposed to free p1 and p2, not free p2 twice. libstdc++-v3/ChangeLog: PR libstdc++/118681 * testsuite/20_util/unsynchronized_pool_resource/118681.cc: Fix deallocate argument.
31 hourslibstdc++: Ensure pool resources meet alignment requirements [PR118681]Jonathan Wakely3-4/+85
For allocations with size > alignment and size % alignment != 0 we were sometimes returning pointers that did not meet the requested aligment. For example, allocate(24, 16) would select the pool for 24-byte objects and the second allocation from that pool (at offset 24 bytes into the pool) is only 8-byte aligned not 16-byte aligned. The pool resources need to round up the requested allocation size to a multiple of the alignment, so that the selected pool will always return allocations that meet the alignment requirement. libstdc++-v3/ChangeLog: PR libstdc++/118681 * src/c++17/memory_resource.cc (choose_block_size): New function. (synchronized_pool_resource::do_allocate): Use choose_block_size to determine appropriate block size. (synchronized_pool_resource::do_deallocate): Likewise (unsynchronized_pool_resource::do_allocate): Likewise. (unsynchronized_pool_resource::do_deallocate): Likewise * testsuite/20_util/synchronized_pool_resource/118681.cc: New test. * testsuite/20_util/unsynchronized_pool_resource/118681.cc: New test. Reviewed-by: Tomasz Kamiński <tkaminsk@redhat.com>
34 hourslibstdc++: Fix _GLIBCXX_DEBUG std::forward_list build regressionJonathan Wakely1-4/+4
Commit 2fd6f42c17a8040dbd3460ca34d93695dacf8575 broke _GLIBCXX_DEBUG std::forward_list implementation. libstdc++-v3/ChangeLog: * include/debug/forward_list (_Safe_forward_list<>::_M_swap): Adapt to _M_this() signature change.
36 hourslibstdc++: Do not expose set_brackets/set_separator for formatter with ↵Tomasz Kamiński2-2/+54
format_kind other than sequence [PR119861] The standard defines separate specializations of range-default-formatter, out of which only one for range_format::sequence provide the set_brackets and set_separator methods. We implemented it as one specialization and exposed this method for range_format other than string or debug_string, i.e. when range_formatter was used as underlying formatter. PR libstdc++/119861 libstdc++-v3/ChangeLog: * include/std/format (formatter<_Rg, _CharT>::set_separator) (formatter<_Rg, _CharT>::set_brackets): Constrain with (format_kind<_Rg> == range_format::sequence). * testsuite/std/format/ranges/pr119861_neg.cc: New test.
37 hourslibstdc++: Better CTAD for span and mdspan [PR120914].Luc Grosheintz5-7/+69
This implements P3029R1. In P3029R1, the CTAD for span is refined to permit deducing the extent of the span from an integral constant, e.g. span((T*) ptr, integral_constant<size_t, 5>{}); is deduced as span<T, 5>. Similarly, in auto exts = extents(integral_constant<int, 2>); auto md = mdspan((T*) ptr, integral_constant<int, 2>); exts and md have types extents<size_t, 2> and mdspan<double, extents<size_t, 2>>, respectively. PR libstdc++/120914 libstdc++-v3/ChangeLog: * include/std/span (span): Update CTAD to enable integral constants [P3029R1]. * include/std/mdspan (extents): ditto. (mdspan): ditto. * testsuite/23_containers/span/deduction.cc: Test deduction guide. * testsuite/23_containers/mdspan/extents/misc.cc: ditto. * testsuite/23_containers/mdspan/mdspan.cc: ditto. Reviewed-by: Jonathan Wakely <jwakely@redhat.com> Reviewed-by: Tomasz Kamiński <tkaminsk@redhat.com> Signed-off-by: Luc Grosheintz <luc.grosheintz@gmail.com>
38 hourslibstdc++: Silence a warning in a test for span.Luc Grosheintz1-0/+1
In a test of span, there's an unused variable myspan. This commit silences the warning. libstdc++-v3/ChangeLog: * testsuite/23_containers/span/contiguous_range_neg.cc: Silence warning about unused variable myspan. Reviewed-by: Jonathan Wakely <jwakely@redhat.com> Reviewed-by: Tomasz Kamiński <tkaminsk@redhat.com> Signed-off-by: Luc Grosheintz <luc.grosheintz@gmail.com>
38 hourslibstdc++: Set feature test macro for complete C++23 mdspan [PR107761].Luc Grosheintz3-3/+12
PR libstdc++/107761 libstdc++-v3/ChangeLog: * include/bits/version.def (mdspan): Set to 202207 and remove no_stdname. * include/bits/version.h: Regenerate. * testsuite/23_containers/mdspan/version.cc: Test presence of feature test macro. Reviewed-by: Tomasz Kamiński <tkaminsk@redhat.com> Signed-off-by: Luc Grosheintz <luc.grosheintz@gmail.com>
38 hourslibstdc++: Implement mdspan and tests [PR107761].Luc Grosheintz6-1/+1078
Implements the class mdspan as described in N4950, i.e. without P3029. It also adds tests for mdspan. This commit completes the implementation of P0009, i.e. the C++23 part <mdspan>. PR libstdc++/107761 libstdc++-v3/ChangeLog: * include/std/mdspan (mdspan): New class. * src/c++23/std.cc.in (mdspan): Add. * testsuite/23_containers/mdspan/class_mandate_neg.cc: New test. * testsuite/23_containers/mdspan/mdspan.cc: New test. * testsuite/23_containers/mdspan/layout_like.h: Add class LayoutLike which models a user-defined layout. Reviewed-by: Tomasz Kamiński <tkaminsk@redhat.com> Signed-off-by: Luc Grosheintz <luc.grosheintz@gmail.com>
40 hourslibstdc++: Implement __mdspan::__size.Luc Grosheintz1-4/+8
The current code uses __mdspan::__fwd_prod(__exts, __rank) to express computing the size of an extent. This commit adds an function __mdspan:: __size(__exts) to express the idea more directly. libstdc++-v3/ChangeLog: * include/std/mdspan (__mdspan::__size): New function. Reviewed-by: Tomasz Kamiński <tkaminsk@redhat.com> Signed-off-by: Luc Grosheintz <luc.grosheintz@gmail.com>
40 hourslibstdc++: Restructure mdspan tests to reuse IntLike.Luc Grosheintz2-26/+31
The class IntLike is used for testing extents with user-defined classes that convert to int. This commit places the class into a separate header file. This allows it to be reused across different parts of the mdspan related testsuite. libstdc++-v3/ChangeLog: * testsuite/23_containers/mdspan/extents/custom_integer.cc: Delete IntLike and include "int_like.h". * testsuite/23_containers/mdspan/extents/int_like.h: Add IntLike. Reviewed-by: Tomasz Kamiński <tkaminsk@redhat.com> Signed-off-by: Luc Grosheintz <luc.grosheintz@gmail.com>
40 hourslibstdc++: Check prerequisite of extents::extents.Luc Grosheintz3-0/+50
Previously the prerequisite of the extents ctors that static_extent(i) == dynamic_extent || extent(i) == other.extent(i). was not checked. This commit adds the __glibcxx_assert and test them. libstdc++-v3/ChangeLog: * include/std/mdspan (extents): Check prerequisite of the ctor that static_extent(i) == dynamic_extent || extent(i) == other.extent(i). * testsuite/23_containers/mdspan/extents/class_mandates_neg.cc: Test the implemented prerequisite. Reviewed-by: Tomasz Kamiński <tkaminsk@redhat.com> Signed-off-by: Luc Grosheintz <luc.grosheintz@gmail.com>
40 hourslibstdc++: Check prerequisites of layout_*::operator().Luc Grosheintz2-0/+35
Previously, the prerequisite that the arguments passed to operator() are a multi-dimensional index (of extents()) was not checked. Both mapping::operator() and mdspan::operator[] have the same prerequisite. Since, mdspan must check the prerequisite for user-defined layout mappings, the preference is to check in mdspan. Because out-of-bounds accesses are very common it's nevertheless useful to check the prerequisite in mapping::operator(). This is relevant for cases where the layout mappings are used without mdspan. This commit checks the prerequisites via _GLIBCXX_DEBUG_ASSERTs and adds the required tests. More discussion in the email chain starting at: https://gcc.gnu.org/pipermail/libstdc++/2025-July/062265.html libstdc++-v3/ChangeLog: * include/std/mdspan: Check prerequisites of layout_*::operator() with _GLIBCXX_DEBUG_ASSERTs. * testsuite/23_containers/mdspan/layouts/debug/out_of_bounds_neg.cc: Add tests for prerequisites. Reviewed-by: Tomasz Kamiński <tkaminsk@redhat.com> Signed-off-by: Luc Grosheintz <luc.grosheintz@gmail.com>
43 hourslibstdc++: Document that LWG 3881 is resolved, by using different apporach.Tomasz Kamiński1-2/+8
libstdc++-v3/ChangeLog: * include/std/queue (formatter<queue<_Tp, _Container>, _CharT>) (formatter<priority_queue<_Tp, _Container, _Compare>, _CharT>): Add _GLIBCXX_RESOLVE_LIB_DEFECTS comments.
46 hourslibstdc++: Make debug iterator pointer sequence const [PR116369]François Dumont23-206/+491
In revision a35dd276cbf6236e08bcf6e56e62c2be41cf6e3c the debug sequence have been made mutable to allow attach iterators to const containers. This change completes this fix by also declaring debug unordered container members mutable. Additionally the debug iterator sequence is now a pointer-to-const and so _Safe_sequence_base _M_attach and all other methods are const qualified. Not-const methods exported are preserved for abi backward compatibility. libstdc++-v3/ChangeLog: PR c++/116369 * config/abi/pre/gnu-versioned-namespace.ver: Use new const qualified symbols. * config/abi/pre/gnu.ver: Add new const qualified symbols. * include/debug/safe_base.h (_Safe_iterator_base::_M_sequence): Declare as pointer-to-const. (_Safe_iterator_base::_M_attach, _M_attach_single): New, take pointer-to-const _Safe_sequence_base. (_Safe_sequence_base::_M_detach_all, _M_detach_singular, _M_revalidate_singular) (_M_swap, _M_get_mutex): New, const qualified. (_Safe_sequence_base::_M_attach, _M_attach_single, _M_detach, _M_detach_single): const qualify. * include/debug/safe_container.h (_Safe_container<>::_M_cont): Add const qualifier. (_Safe_container<>::_M_swap_base): New. (_Safe_container(_Safe_container&&, const _Alloc&, std::false_type)): Adapt to use latter. (_Safe_container<>::operator=(_Safe_container&&)): Likewise. (_Safe_container<>::_M_swap): Likewise and take parameter as const reference. * include/debug/safe_unordered_base.h (_Safe_local_iterator_base::_M_safe_container): New. (_Safe_local_iterator_base::_Safe_local_iterator_base): Take _Safe_unordered_container_base as pointer-to-const. (_Safe_unordered_container_base::_M_attach, _M_attach_single): New, take container as _Safe_unordered_container_base pointer-to-const. (_Safe_unordered_container_base::_M_local_iterators, _M_const_local_iterators): Add mutable. (_Safe_unordered_container_base::_M_detach_all, _M_swap): New, const qualify. (_Safe_unordered_container_base::_M_attach_local, _M_attach_local_single) (_M_detach_local, _M_detach_local_single): Add const qualifier. * include/debug/safe_unordered_container.h (_Safe_unordered_container::_M_self()): New. * include/debug/safe_unordered_container.tcc (_Safe_unordered_container::_M_invalidate_if, _M_invalidated_local_if): Use latter. * include/debug/safe_iterator.h (_Safe_iterator<>::_M_attach, _M_attach_single): Take _Safe_sequence_base as pointer-to-const. (_Safe_iterator<>::_M_get_sequence): Add const_cast and comment about it. * include/debug/safe_local_iterator.h (_Safe_local_iterator<>): Replace usages of _M_sequence member by _M_safe_container(). (_Safe_local_iterator<>::_M_attach, _M_attach_single): Take _Safe_unordered_container_base as pointer-to-const. (_Safe_local_iterator<>::_M_get_sequence): Rename into... (_Safe_local_iterator<>::_M_get_ucontainer): ...this. Add necessary const_cast and comment to explain it. (_Safe_local_iterator<>::_M_is_begin, _M_is_end): Adapt. * include/debug/safe_local_iterator.tcc: Adapt. * include/debug/safe_sequence.h (_Safe_sequence<>::_M_invalidate_if, _M_transfer_from_if): Add const qualifier. * include/debug/safe_sequence.tcc: Adapt. * include/debug/deque (std::__debug::deque::erase): Adapt to use new const qualified methods. * include/debug/formatter.h: Adapt. * include/debug/forward_list (_Safe_forward_list::_M_this): Add const qualification and return pointer for consistency with 'this' keyword. (_Safe_forward_list::_M_swap_aux): Rename into... (_Safe_forward_list::_S_swap_aux): ...this and take sequence as const reference. (forward_list<>::resize): Adapt to use const methods. * include/debug/list (list<>::resize): Likewise. * src/c++11/debug.cc: Adapt to const qualification. * testsuite/util/testsuite_containers.h (forward_members_unordered::forward_members_unordered): Add check on local_iterator conversion to const_local_iterator. (forward_members::forward_members): Add check on iterator conversion to const_iterator. * testsuite/23_containers/unordered_map/const_container.cc: New test case. * testsuite/23_containers/unordered_multimap/const_container.cc: New test case. * testsuite/23_containers/unordered_multiset/const_container.cc: New test case. * testsuite/23_containers/unordered_set/const_container.cc: New test case. * testsuite/23_containers/vector/debug/mutex_association.cc: Adapt.
2 daysDaily bump.GCC Administrator1-0/+41
2 dayslibstdc++: Fix attribute order on __normal_iterator friends [PR120949]Jonathan Wakely1-14/+16
In r16-1911-g6596f5ab746533 I claimed to have reordered some attributes for compatibility with Clang, but it looks like I got the Clang restriction backwards and put them all in the wrong order. Clang trunk accepts either order (probably since the llvm/llvm-project#133107 fix) but released versions still require a particular order. There were also some cases where the attributes were after the friend keyword, which Clang trunk still rejects. libstdc++-v3/ChangeLog: PR libstdc++/120949 * include/bits/stl_iterator.h (__normal_iterator): Fix order of always_inline and nodiscard attributes for Clang compatibility.
2 dayslibstdc++: Make VERIFY a variadic macroJonathan Wakely2-10/+35
This defines the testsuite assertion macro VERIFY so that it allows un-parenthesized expressions containing commas. This matches how assert is defined in C++26, following the approval of P2264R7. The primary motivation is to allow expressions that the preprocessor splits into multiple arguments, e.g. VERIFY( vec == std::vector<int>{1,2,3,4} ); To achieve this, VERIFY is redefined as a variadic macro and then the arguments are grouped together again through the use of __VA_ARGS__. The implementation is complex due to the following points: - The arguments __VA_ARGS__ are contextually-converted to bool, so that scoped enums and types that are not contextually convertible to bool cannot be used with VERIFY. - bool(__VA_ARGS__) is used so that multiple arguments (i.e. those which are separated by top-level commas) are ill-formed. Nested commas are allowed, but likely mistakes such as VERIFY( cond, "some string" ) are ill-formed. - The bool(__VA_ARGS__) expression needs to be unevaluated, so that we don't evaluate __VA_ARGS__ more than once. The simplest way to do that would be just sizeof bool(__VA_ARGS__), without parentheses to avoid a vexing parse for VERIFY(bool(i)). However that wouldn't work for e.g. VERIFY( []{ return true; }() ), because lambda expressions are not allowed in unevaluated contexts until C++20. So we use another conditional expression with bool(__VA_ARGS__) as the unevaluated operand. libstdc++-v3/ChangeLog: * testsuite/util/testsuite_hooks.h (VERIFY): Define as variadic macro. * testsuite/ext/verify_neg.cc: New test. Reviewed-by: Tomasz Kamiński <tkaminsk@redhat.com>
2 dayslibstdc++: Use template keyword in __mapping_of alias templateJonathan Wakely1-1/+1
This is needed to fix an error with Clang 19: include/c++/16.0.0/mdspan:512:30: error: use 'template' keyword to treat 'mapping' as a dependent template name 512 | is_same_v<typename _Layout::mapping<typename _Mapping::extents_type>, | ^ libstdc++-v3/ChangeLog: * include/std/mdspan (__mapping_of): Add template keyword.
3 dayslibstdc++: Format chrono %a/%A/%b/%h/%B/%p using locale's time_put [PR117214]XU Kailiang3-15/+90
C++ formatting locale could have a custom time_put that performs differently from the C locale, so do not use __timepunct directly, instead all of above specifiers use _M_locale_fmt. For %a/%A/%b/%h/%B, the code handling the exception is now moved to the _M_check_ok function, that is invoked before handling of the conversion specifier. For time_points the values of months/weekday are computed, and thus are always ok(), this information is indicated by new _M_time_point member of the _ChronoSpec. The different behavior of j specifier for durations and time_points/calendar types, is now handled using only _ChronoParts, and _M_time_only in _ChronoSpec is no longer needed, thus it was removed. PR libstdc++/117214 libstdc++-v3/ChangeLog: * include/bits/chrono_io.h (_ChronoSpec::_M_time_only): Remove. (_ChronoSpec::_M_time_point): Define. (__formatter_chrono::_M_parse): Use __parts to determine interpretation of j. (__formatter_chrono::_M_check_ok): Define. (__formatter_chrono::_M_format_to): Invoke _M_check_ok. (__formatter_chrono::_M_a_A, __formatter_chrono::_M_b_B): Move exception throwing to _M_check_ok. (__formatter_chrono::_M_j): Use _M_needs to define interpretation. (__formatter_duration::_S_spec_for): Set _M_time_point. * testsuite/std/time/format/format.cc: Test for exception for !ok() months/weekday. * testsuite/std/time/format/pr117214_custom_timeput.cc: New test. Co-authored-by: Tomasz Kaminski <tkaminsk@redhat.com> Reviewed-by: Jonathan Wakely <jwakely@redhat.com> Signed-off-by: XU Kailiang <xu2k3l4@outlook.com> Signed-off-by: Tomasz Kaminski <tkaminsk@redhat.com>
3 dayslibstdc++: Format __float128 as _Float128 only when long double is not 128 ↵Tomasz Kamiński1-8/+3
IEEE [PR120976] For powerpc64 and sparc architectures that both have __float128 and 128bit long double, the __float128 is same type as long double/__ieee128 and already formattable. The remaining specialization makes __float128 formattable on x86_64 via _Float128, however __float128 is now not formattable on x86_32 (-m32) with -mlong-double-128, where __float128 is distinct type from long double that is 128bit IEEE. PR libstdc++/120976 libstdc++-v3/ChangeLog: * include/std/format (formatter<__float128, _Char_T): Define if _GLIBCXX_FORMAT_F128 == 2. Reviewed-by: Jonathan Wakely <jwakely@redhat.com> Signed-off-by: Tomasz Kamiński <tkaminsk@redhat.com>
3 daysDaily bump.GCC Administrator1-0/+14
3 dayslibstdc++: Implement ranges::shift_left/right from P2440R1Patrick Palka6-3/+340
The implementation is just a copy of std::shift_left/right with the following changes: - check bidirectional_iterator instead of iterator_category - cope with __last being a distinct sentinel type - for shift_left, return the subrange {__first, X} instead of X - for shift_right, return the subrange {X, ranges::next(__first, __last)} instead of X - use the ranges:: versions of move_backward, move and iter_swap - don't bother std::move'ing any iterators, it's unnecessary since all iterators are forward, it's visually noisy, and in earlier versions of this patch it introduced subtle use-after-move bugs In passing also use the __glibcxx_shift macro to guard the std::shift_left/right implementations. libstdc++-v3/ChangeLog: * include/bits/ranges_algo.h (shift_left, shift_right): Guard with __glibcxx_shift >= 201806L. (ranges::__shift_left_fn, ranges::shift_left): Define for C++23. (ranges::__shift_right_fn, ranges::shift_right): Likewise. * include/bits/version.def (shift): Update for C++23. * include/bits/version.h: Regenerate. * src/c++23/std.cc.in: Add ranges::shift_left/right. * testsuite/25_algorithms/shift_left/constrained.cc: New test, based off of 1.cc. * testsuite/25_algorithms/shift_right/constrained.cc: New test, based off of 1.cc. Reviewed-by: Jonathan Wakely <jwakely@redhat.com>
5 daysDaily bump.GCC Administrator1-0/+11
5 dayslibstdc++: Avoid -Wswitch warning from chrono formattersJonathan Wakely1-0/+2
Add a default case to the switch to suppress warnings about unhandled enumeration values. This is a consteval function, so if the default case is ever reached it will be an error not silent miscompilation. libstdc++-v3/ChangeLog: * include/bits/chrono_io.h (__formatter_duration::_S_spec_for): Add default case to switch and use __builtin_unreachable.
5 dayslibstdc++: Fix typo in __size_to_integer(__GLIBCXX_TYPE_INT_N_3)Jonathan Wakely1-2/+2
The overload taking a signed type was returning unsigned and the overload taking an unsigned type was returning signed. libstdc++-v3/ChangeLog: * include/bits/stl_algobase.h (__size_to_integer): Move misplaced unsigned keyword on __size_to_integer overloads for __GLIBCXX_TYPE_INT_N_3 integer type.
6 daysDaily bump.GCC Administrator1-0/+33
6 dayslibstdc++: fix bits/version.def typoNathan Myers2-2/+2
bits/version.def was missing a ';'. libstdc++-v3/Changelog: * include/bits/version.def: Fix typo. * include/bits/version.h: Rebuilt.
7 dayslibstdc++: Update LWG 4166 changes to concat_view::end() [PR120934]Patrick Palka2-2/+15
In r15-4555-gf191c830154565 we proactively implemented the initial proposed resolution for LWG 4166 which later turned out to be insufficient, since we must also require equality_comparable of the underlying iterators before concat_view could be a common range. This patch implements the updated P/R, requiring all underlying iterators to be forward (which implies equality_comparable) before making concat_view common, which fixes the testcase from this PR. PR libstdc++/120934 libstdc++-v3/ChangeLog: * include/std/ranges (concat_view::end): Refine condition for returning an iterator instead of default_sentinel as per the updated P/R for LWG 4166. * testsuite/std/ranges/concat/1.cc (test05): New test. Reviewed-by: Jonathan Wakely <jwakely@redhat.com>
7 dayslibstdc++: construct bitset from string_view (P2697) [PR119742]Nathan Myers7-31/+215
Add a bitset constructor from string_view, per P2697. Fix existing tests that would fail to detect incorrect exception behavior. Argument checks that result in exceptions guarded by "#if HOSTED" are made unguarded because the functions called to throw just call terminate() in free-standing builds. Improve readability in Doxygen comments. Generalize a private member argument-checking function to work with string and string_view without mentioning either, obviating need for guards. The version.h symbol is not "hosted" because string_view, though not specified to be available in free-standing builds, is defined there and the feature is useful there. libstdc++-v3/ChangeLog: PR libstdc++/119742 * include/bits/version.def: Add preprocessor symbol. * include/bits/version.h: Add preprocessor symbol. * include/std/bitset: Add constructor. * testsuite/20_util/bitset/cons/1.cc: Fix. * testsuite/20_util/bitset/cons/6282.cc: Fix. * testsuite/20_util/bitset/cons/string_view.cc: Test new ctor. * testsuite/20_util/bitset/cons/string_view_wide.cc: Test new ctor.
7 dayslibstdc++: Fix regression in std::uninitialized_fill for C++98 [PR120931]Jonathan Wakely2-1/+17
A typo in r15-4473-g3abe751ea86e34 made it ill-formed to use std::uninitialized_fill with iterators that aren't pointers (or pointers wrapped in our __normal_iterator) if the value type is a narrow character type. libstdc++-v3/ChangeLog: PR libstdc++/120931 * include/bits/stl_uninitialized.h (__uninitialized_fill<true>): Fix typo resulting in call to __do_uninit_copy instead of __do_uninit_fill. * testsuite/20_util/specialized_algorithms/uninitialized_fill/120931.cc: New test.
7 daysDaily bump.GCC Administrator1-0/+16
7 dayslibstdc++: Use hidden friends for __normal_iterator operatorsJonathan Wakely3-184/+175
As suggested by Jason, this makes all __normal_iterator operators into friends so they can be found by ADL and don't need to be separately exported in module std. The operator<=> comparing two iterators of the same type is removed entirely, instead of being made a hidden friend. That overload was added by r12-5882-g2c7fb16b5283cf to deal with unconstrained operator overloads found by ADL, as defined in the testsuite_greedy_ops.h header. We don't actually test that case as there's no unconstrained <=> in that header, and it doesn't seem reasonable for anybody to define such an operator<=> in C++20 when they should constrain their overloads properly (e.g. using a requires-clause). The homogeneous operator<=> overloads added for reverse_iterator and move_iterator could also be removed, but that's not part of this commit. I also had to reorder the __attribute__((always_inline)) and [[nodiscard]] attributes on the pre-c++20 operators, because Clang won't allow [[foo]] after __attribute__((bar)) on a friend function: <source>:4:36: error: an attribute list cannot appear here 4 | __attribute__((always_inline)) [[nodiscard]] friend bool | ^~~~~~~~~~~~~ libstdc++-v3/ChangeLog: * include/bits/stl_iterator.h (__normal_iterator): Make all non-member operators hidden friends, except ... (operator<=>(__normal_iterator<I,C>, __normal_iterator<I,C>)): Remove. * src/c++11/string-inst.cc: Remove explicit instantiations of operators that are no longer templates. * src/c++23/std.cc.in (__gnu_cxx): Do not export operators for __normal_iterator. Reviewed-by: Patrick Palka <ppalka@redhat.com>
8 dayslibstdc++: make range view ctors explicit (P2711) [PR119744]Nathan Myers1-16/+16
Make range view constructors explicit, per P2711. Technically, this is a breaking change, but it is unlikely to break any production code, as reliance on non-explicit construction is unidiomatic.. libstdc++-v3/ChangeLog PR libstdc++/119744 * include/std/ranges: View ctors become explicit.
8 daysDaily bump.GCC Administrator1-0/+21
8 dayslibstdc++: Use ranges::iter_move in ranges::remove_if [PR120789]Patrick Palka2-1/+37
PR libstdc++/120789 libstdc++-v3/ChangeLog: * include/bits/ranges_algo.h (__remove_if_fn::operator()): Use ranges::iter_move(iter) instead of std::move(*iter). * testsuite/25_algorithms/remove_if/120789.cc: New test. Reviewed-by: Tomasz Kamiński <tkaminsk@redhat.com> Reviewed-by: Jonathan Wakely <jwakely@redhat.com>
8 dayslibstdc++: Use ranges::iter_move in ranges::unique [PR120789]Patrick Palka2-1/+37
PR libstdc++/120789 libstdc++-v3/ChangeLog: * include/bits/ranges_algo.h (__unique_fn::operator()): Use ranges::iter_move(iter) instead of std::move(*iter). * testsuite/25_algorithms/unique/120789.cc: New test. Reviewed-by: Tomasz Kamiński <tkaminsk@redhat.com> Reviewed-by: Jonathan Wakely <jwakely@redhat.com>
9 dayslibstdc++: Implement default_accessor from mdspan.Luc Grosheintz4-1/+155
libstdc++-v3/ChangeLog: * include/std/mdspan (default_accessor): New class. * src/c++23/std.cc.in: Register default_accessor. * testsuite/23_containers/mdspan/accessors/default.cc: New test. * testsuite/23_containers/mdspan/accessors/default_neg.cc: New test. Signed-off-by: Luc Grosheintz <luc.grosheintz@gmail.com>
12 daysDaily bump.GCC Administrator1-0/+262
12 dayslibstdc++: Directly implement ranges::shuffle [PR100795]Patrick Palka2-3/+80
PR libstdc++/100795 libstdc++-v3/ChangeLog: * include/bits/ranges_algo.h (shuffle_fn::operator()): Reimplement directly, based on the stl_algo.h implementation. * testsuite/25_algorithms/shuffle/constrained.cc (test02): New test. Reviewed-by: Jonathan Wakely <jwakely@redhat.com>
12 dayslibstdc++: Directly implement ranges::sample [PR100795]Patrick Palka2-7/+89
PR libstdc++/100795 libstdc++-v3/ChangeLog: * include/bits/ranges_algo.h (__sample_fn::operator()): Reimplement the forward_iterator branch directly, based on the stl_algo.h implementation. Add explicit cast to _Out's difference_type in the !forward_iterator branch. * testsuite/25_algorithms/sample/constrained.cc (test02): New test. Reviewed-by: Jonathan Wakely <jwakely@redhat.com>
12 dayslibstdc++: Directly implement ranges::nth_element [PR100795]Patrick Palka2-5/+73
PR libstdc++/100795 libstdc++-v3/ChangeLog: * include/bits/ranges_algo.h (__detail::__introselect): New, based on the stl_algo.h implementation. (nth_element_fn::operator()): Reimplement in terms of the above. * testsuite/25_algorithms/nth_element/constrained.cc: Reviewed-by: Jonathan Wakely <jwakely@redhat.com>