| Age | Commit message (Collapse) | Author | Files | Lines |
|
Some pre-r16-4328-g71e95e871d62e4 comments sneaked back in with some
recent commits.
libstdc++-v3/ChangeLog:
* include/bits/version.h: Regenerate.
|
|
The submdspan feature is complete and this commit sets the feature
testing macros accordingly. Also makes the feature testing macro
submdspan depend on constant_wrapper.
Also changes the value of the internal feature testing macro for padded
layouts to 202403.
libstdc++-v3/ChangeLog:
* include/bits/version.def (padded_layouts): Set to 202403.
(submdspan): Set to 202411 add dependency.
* include/bits/version.h: Regenerate.
Reviewed-by: Tomasz Kamiński <tkaminsk@redhat.com>
Signed-off-by: Luc Grosheintz <luc.grosheintz@gmail.com>
|
|
This implements the C++23 proposal P2404R3 "Move-only types for
equality_comparable_with, totally_ordered_with, and
three_way_comparable_with". As agreed with the maintainers of libc++ and
MSVC STL, we treat this as a DR for C++20. It allows reasonable code to
compile which wasn't originally allowed in C++20, and only affects some
obscure subsumption cases for valid C++20 code.
libstdc++-v3/ChangeLog:
PR libstdc++/122946
* include/bits/version.def (concepts): Set value to 202207.
* include/bits/version.h: Regenerate.
* include/std/concepts (__comparison_common_type_with_impl)
(__comparison_common_type_with): New helper concepts.
(equality_comparable_with): Use __comparison_common_type_with.
* libsupc++/compare (three_way_comparable_with): Likewise.
(__glibcxx_want_concepts): Define to get __cpp_lib_concepts
here.
* testsuite/std/concepts/concepts.compare/move_only.cc: New
test.
Reviewed-by: Tomasz Kamiński <tkaminsk@redhat.com>
|
|
We have __is_signed_integer and __is_unsigned_integer traits which
should have been updated by r16-2190-g4faa42ac0dee2c when making
__int128 an extended integer type (for PR libstdc++/96710). Currently
they check whether the type is a signed integer type or an unsigned
integer type, or a cv-qualified version of one of those. This doesn't
match the standard's definition, which does not include cv-qualified
types. This change ensures that signed __int128 and unsigned __int128
are included in those traits in strict -std modes, and it removes the
use of remove_cv_t so that they are not true for cv-qualified types.
This makes the traits match the meaning of "signed integer type" and
"unsigned integer type" in the standard ([basic.fundamental]).
We also have an __is_standard_integer trait, which is true if either
__is_signed_integer or __is_unsigned_integer is true, but that's also
not a match for the definition in the standard. The definitions of
"signed integer type" and "unsigned integer type" include both standard
and extended integer types, so only saying "standard" in the trait name
is misleading (even before this change, because in non-strict -std modes
the __GLIBCXX_TYPE_INT_N_0 .. __GLIBCXX_TYPE_INT_N_3 types were always
included in the trait, and they aren't standard integer types).
This change renames __is_standard_integer to the more accurate
__is_signed_or_unsigned_integer. Because the set of signed and
unsigned integer types is the same as the set of standard and extended
integer types, the trait could instead have been renamed to
__is_standard_or_extended_integer. I think it's clearer and more
self-explanatory to avoid "standard and extended" and name it for the
signed and unsigned integer types.
N.B. we don't want to call it just __is_integer_type because the integer
types includes cv-qualified types and also bool and the character types
char, wchar_t, char16_t etc.
The consequences of redefining and renaming these traits are small, and
only positive.
Apart from the uses in the __is_standard_integer trait, the only other
uses of __is_signed_integer and __is_unsigned_integer are in <format>
and those uses are unaffected by this change to add 128-bit integers to
the traits. In both uses the type argument is already cv-unqualified,
and there is already explicit handling for 128-bit integers where that
is required.
The existing uses of __is_standard_integer can simply be changed to use
the new name. This does change the behaviour of those uses of the trait,
because the __is_signed_or_unsigned_integer trait now includes
128-bit integers in strict modes. However, that is a desirable change
that fixes some bugs. Specifically, the [utility.intcmp] functions such
as std::cmp_less and the [numeric.sat.arith] functions such as
std::add_sat did not support 128-bit integers in strict modes. Since the
standard says they should be enabled for all signed and unsigned integer
types (or equivalently, for all standard and extended integer types),
those functions should all support __int128 and unsigned __int128. That
is fixed by this change. Additionally, the same changes in <charconv>,
<mdspan>, and <stdckdint.h> enable the use of 128-bit integers for those
APIs in strict modes.
Finally, this also make a drive-by fix to the enable_if constraints for
the integer overloads of std::from_chars. That used remove_cv_t and so
enabled the overload for lvalue arguments of type const char, which
won't work and should not be enabled.
libstdc++-v3/ChangeLog:
* include/bits/intcmp.h: Replace all uses of
__is_standard_integer with __is_signed_or_unsigned_integer.
* include/bits/max_size_type.h: Fix outdated comment.
* include/bits/sat_arith.h: Replace all uses of
__is_standard_integer with __is_signed_or_unsigned_integer.
* include/c_compatibility/stdckdint.h: Replace all uses of the
__cv_unqual_signed_or_unsigned_integer_type concept with
__is_signed_or_unsigned_integer.
(__cv_unqual_signed_or_unsigned_integer_type): Remove.
* include/ext/numeric_traits.h: Fix outdated comment.
* include/std/charconv (from_chars): Replace use of
__is_standard_integer with __is_signed_or_unsigned_integer.
Do not enable for cv-qualified char.
* include/std/mdspan: Likewise.
* include/std/type_traits (__is_unsigned_integer): Include
unsigned __int128 in type list.
(__is_signed_integer): Include signed __int128 in type list.
(__is_standard_integer): Rename to ...
(__is_signed_or_unsigned_integer): ... this.
* testsuite/23_containers/mdspan/extents/ctor_ints.cc: Test
with 128-bit integers.
* testsuite/23_containers/mdspan/submdspan/strided_slice.cc:
Likewise.
* testsuite/20_util/integer_comparisons/extended.cc: New test.
* testsuite/26_numerics/saturation/extended.cc: New test.
* testsuite/26_numerics/stdckdint/extended.cc: New test.
Reviewed-by: Patrick Palka <ppalka@redhat.com>
|
|
Since r16-2190-g4faa42ac0dee2c this header no longer mentions __int128
explicitly, because it's just handled like other integer types now. So
we don't need the diagnostic pragmas to disables pedwarns for referring
to __int128.
libstdc++-v3/ChangeLog:
* include/bits/iterator_concepts.h: Remove diagnostic pragmas.
|
|
This allows the [utility.intcmp] functions to be used without including
all of <utility>.
libstdc++-v3/ChangeLog:
* include/Makefile.am: Add new header.
* include/Makefile.in: Regenerate.
* include/std/latch: Include <bits/intcmp.h> instead of
<utility>.
* include/std/utility: Include <bits/intcmp.h>.
(cmp_equal, cmp_not_equal, cmp_less, cmp_greater)
(cmp_less_equal, cmp_greater_equal, in_range): Move to ...
* include/bits/intcmp.h: New file.
Reviewed-by: Tomasz Kamiński <tkaminsk@redhat.com>
|
|
libstdc++-v3/ChangeLog:
* include/bits/atomic_wait.h (__detail::__atomic_eq): Use
std::addressof instead of &.
* include/std/atomic (atomic::wait, atomic::notify_one)
(atomic::notify_all): Likewise.
Reviewed-by: Patrick Palka <ppalka@redhat.com>
|
|
PR libstdc++/120446
libstdc++-v3/ChangeLog:
* include/bits/refwrap.h (__detail::__is_ref_wrapper):
Define as per P2655R3 for C++20.
(__detail::__ref_wrap_common_reference_exists_with): Likewise.
(basic_common_reference): Define partial specializations using
the above as per P2655R3 for C++20.
* include/bits/version.def (common_reference_wrapper): New.
* include/bits/version.h: Regenerate.
* include/std/functional (__glibcxx_want_common_reference_wrapper):
Define.
* testsuite/20_util/reference_wrapper/p2655r3.cc: New test.
Co-authored-by: Tomasz Kamiński <tkaminsk@redhat.com>
Reviewed-by: Tomasz Kamiński <tkaminsk@redhat.com>
Reviewed-by: Jonathan Wakely <jwakely@redhat.com>
|
|
We implement this paper as a DR against C++20 (as do MSVC and libc++).
PR libstdc++/120446
libstdc++-v3/ChangeLog:
* include/bits/version.def (common_reference): New.
* include/bits/version.h: Regenerate.
* include/std/type_traits (__glibcxx_want_common_reference):
Define.
(__common_reference_impl<T1, T2, 1>): Add pointer convertibility
constraints as per P2655R3.
* testsuite/20_util/common_reference/p2655r3.cc: New test.
Reviewed-by: Tomasz Kamiński <tkaminsk@redhat.com>
Reviewed-by: Jonathan Wakely <jwakely@redhat.com>
|
|
PR libstdc++/111327
libstdc++-v3/ChangeLog:
* include/bits/binders.h (_Binder::operator())
[_GLIBCXX_EXPLICIT_THIS_PARAMETER]: Also use deducing this in
C++20 mode when possible.
* testsuite/20_util/function_objects/bind_front/111327.cc:
Expect error inside header even in C++20 mode.
Reviewed-by: Tomasz Kamiński <tkaminsk@redhat.com>
Reviewed-by: Jonathan Wakely <jwakely@redhat.com>
|
|
This FTM is like __cpp_explicit_this_parameter but is also defined
in earlier C++ modes if deducing this is supported as an extension
by the compiler. Currently only GCC supports this, Clang doesn't.
libstdc++-v3/ChangeLog:
* include/bits/c++config (_GLIBCXX_EXPLICIT_THIS_PARAMETER):
New.
Reviewed-by: Tomasz Kamiński <tkaminsk@redhat.com>
Reviewed-by: Jonathan Wakely <jwakely@redhat.com>
|
|
libstdc++-v3/ChangeLog:
* include/bits/basic_string.h: Add subview.
* include/bits/cow_string.h: Add subview.
* include/std/string: Add FTM.
* testsuite/21_strings/basic_string/operations/subview/char.cc: New test.
* testsuite/21_strings/basic_string/operations/subview/wchar_t.cc: New test.
|
|
libstdc++-v3/ChangeLog:
* include/bits/version.def: Add string_subview FTM.
* include/bits/version.h: Regenerate.
* include/std/string_view: Add subview.
* testsuite/21_strings/basic_string_view/operations/subview/char.cc: New test.
* testsuite/21_strings/basic_string_view/operations/subview/wchar_t.cc: New test.
|
|
Use the chrono::nanoseconds typedef instead of the equivalent
__wait_clock_t::duration typedef, and add a comment explaining why we
use a duration not a time_point.
libstdc++-v3/ChangeLog:
* include/bits/atomic_timed_wait.h (__wait_until_impl): Use
chrono::nanoseconds for parameter.
* src/c++20/atomic.cc (__wait_until_impl): Likewise.
|
|
LWG 3946 made const_iterator_t/sentinel_t agree with ranges::cbegin/cend
by defining the aliases in terms of the CPOs, but I defined it the other
way around in an incorrect way that made the aliases not consider
range-ness of const T via __possibly_const_range. This patch
reimplements the proposed resolution in a more obviously correct way,
mirroring the wording.
PR libstdc++/122842
libstdc++-v3/ChangeLog:
* include/bits/ranges_base.h (__access:_CBegin): Define in
terms of const_iterator directly, not const_iterator_t.
(__access::_CEnd): Likewise in terms of const_sentinel vs
const_sentinel_t.
(const_iterator_t): Move down definition and define in terms
of ranges::cbegin as per LWG 3946.
(const_sentinel_t): Likewise in terms of ranges::cend.
* testsuite/24_iterators/const_iterator/1.cc (test02): Correct
test for int[], std::array and std::vector. Also test
std::string.
Reviewed-by: Tomasz Kamiński <tkaminsk@redhat.com>
Reviewed-by: Jonathan Wakely <jwakely@redhat.com>
|
|
This will allow us to extend atomic waiting functions to support a
possible future 64-bit version of futex, as well as supporting
futex-like wait/wake primitives on other targets (e.g. macOS has
os_sync_wait_on_address and FreeBSD has _umtx_op).
Before this change, the decision of whether to do a proxy wait or to
wait on the atomic variable itself was made in the header at
compile-time, which makes it an ABI property that would not have been
possible to change later. That would have meant that
std::atomic<uint64_t> would always have to do a proxy wait even if Linux
gains support for 64-bit futex2(2) calls at some point in the future.
The disadvantage of proxy waits is that several distinct atomic objects
can share the same proxy state, leading to contention between threads
even when they are not waiting on the same atomic object, similar to
false sharing. It also result in spurious wake-ups because doing a
notify on an atomic object that uses a proxy wait will wake all waiters
sharing the proxy.
For types that are known to definitely not need a proxy wait (e.g. int
on Linux) the header can still choose a more efficient path at
compile-time. But for other types, the decision of whether to do a proxy
wait is deferred to runtime, inside the library internals. This will
make it possible for future versions of libstdc++.so to extend the set
of types which don't need to use proxy waits, without ABI changes.
The way the change works is to stop using the __proxy_wait flag that was
set by the inline code in the headers. Instead the __wait_args struct
has an extra pointer member which the library internals populate with
either the address of the atomic object or the _M_ver counter in the
proxy state. There is also a new _M_obj_size member which stores the
size of the atomic object, so that the library can decide whether a
proxy is needed. So for example if linux gains 64-bit futex support then
the library can decide not to use a proxy when _M_obj_size == 8.
Finally, the _M_old member of the __wait_args struct is changed to
uint64_t so that it has room to store 64-bit values, not just whatever
size the __platform_wait_t type is (which is a 32-bit int on Linux).
Similarly, the _M_val member of __wait_result_type changes to uint64_t
too.
libstdc++-v3/ChangeLog:
* config/abi/pre/gnu.ver: Adjust exports.
* include/bits/atomic_timed_wait.h (_GLIBCXX_HAVE_PLATFORM_TIMED_WAIT):
Do not define this macro.
(__atomic_wait_address_until_v, __atomic_wait_address_for_v):
Adjust assertions to check that __platform_wait_uses_type is
true.
* include/bits/atomic_wait.h (__waitable): New concept.
(__platform_wait_uses_type): Different separately for platforms
with and without platform wait.
(_GLIBCXX_HAVE_PLATFORM_WAIT): Do not define this macro.
(__wait_value_type): New typedef.
(__wait_result_type): Change _M_val to __wait_value_type.
(__wait_flags): Remove __proxy_wait enumerator. Reduce range
reserved for ABI version by the commented-out value.
(__wait_args_base::_M_old): Change type to __wait_args_base.
(__wait_args_base::_M_obj, __wait_args_base::_M_obj_size): New
data members.
(__wait_args::__wait_args): Set _M_obj and _M_obj_size on
construction.
(__wait_args::_M_setup_wait): Change void* parameter to deduced
type. Adjust bit_cast to work for types of different sizes.
(__wait_args::_M_load_proxy_wait_val): Remove function, replace
with ...
(__wait_args::_M_setup_proxy_wait): New function.
(__wait_args::_S_flags_for): Do not set __proxy_wait flag.
(__atomic_wait_address_v): Adjust assertion to check that
__platform_wait_uses_type is true.
* src/c++20/atomic.cc (_GLIBCXX_HAVE_PLATFORM_WAIT): Define here
instead of in header. Check _GLIBCXX_HAVE_PLATFORM_WAIT instead
of _GLIBCXX_HAVE_PLATFORM_TIMED_WAIT.
(__platform_wait, __platform_notify, __platform_wait_until): Add
unused parameter for _M_obj_size.
(__spin_impl): Adjust for 64-bit __wait_args_base::_M_old.
(use_proxy_wait): New function.
(__wait_args::_M_load_proxy_wait_val): Replace with ...
(__wait_args::_M_setup_proxy_wait): New function. Call
use_proxy_wait to decide at runtime whether to wait on the
pointer directly instead of using a proxy. If a proxy is needed,
set _M_obj and _M_obj_size to refer to its _M_ver member. Adjust
for change to type of _M_old.
(__wait_impl): Wait on _M_obj unconditionally. Pass _M_obj_size
to __platform_wait.
(__notify_impl): Call use_proxy_wait to decide whether to notify
on the address parameter or a proxy
(__spin_until_impl): Adjust for change to type of _M_val.
(__wait_until_impl): Wait on _M_obj unconditionally. Pass
_M_obj_size to __platform_wait_until.
Reviewed-by: Tomasz Kamiński <tkaminsk@redhat.com>
|
|
My recent (uncommitted) changes to support a 64-bit __platform_wait_t
for FreeBSD and Darwin revealed a problem in std::counting_semaphore.
When the default template argument is used and __platform_wait_t is a
64-bit type, the numeric_limits<__platform_wait_t>::max() value doesn't
fit in ptrdiff_t and so we get ptrdiff_t(-1), which fails a
static_assert in the class body.
The solution is to cap the value to PTRDIFF_MAX instead of allowing it
to go negative.
libstdc++-v3/ChangeLog:
* include/bits/semaphore_base.h (__platform_semaphore::_S_max):
Limit to PTRDIFF_MAX to avoid negative values.
* testsuite/30_threads/semaphore/least_max_value.cc: New test.
Reviewed-by: Tomasz Kamiński <tkaminsk@redhat.com>
|
|
The operator() for function objects introduced in C++20 (e.g., std::identity,
std::compare_three_way, std::ranges::equal) is now defined as static.
Although static operator() is a C++23 feature, it is supported in C++20 by
both GCC and clang (since their support was added in clang-16).
This change is not user-observable, as all affected operators are template
functions. Taking the address of such an operator requires casting to a pointer
to member function with a specific signature. The exact signature is unspecified
per C++20 [member.functions] p2 (e.g. due to potential parameters with default
arguments).
libstdc++-v3/ChangeLog:
* include/bits/ranges_cmp.h (std::identity::operator()):
(ranges::equal_to:operator(), ranges::not_equal_to:operator())
(ranges::greater::operator(), ranges::greater_equal::operator())
(ranges::less::operator(), ranges::less_equal::operator()):
Declare as static.
* libsupc++/compare (std::compare_three_way::operator()):
Declare as static.
Reviewed-by: Jonathan Wakely <jwakely@redhat.com>
Reviewed-by: Patrick Palka <ppalka@redhat.com>
Signed-off-by: Tomasz Kamiński <tkaminsk@redhat.com>
|
|
This patch implements P2592R3 Hashing support for std::chrono value classes.
To avoid the know issues with current hashing of integer types (see PR104945),
we use chrono::__int_hash function that hash the bytes of representation,
instead of hash<T>, as the later simply cast to value. Currently _Hash_impl
it used, but we should consider replacing it (see PR55815) before C++26 ABI
is made stable. The function is declared inside <chrono> header and chrono
namespace, to make sure that only chrono components would be affected by
such change. Finally, chrono::__int_hash is made variadic, to support
combining hashes of multiple integers.
To reduce the number of calls to hasher (defined out of line), the calendar
types are packed into single unsigned integer value. This is done by
chrono::__hash helper, that calls:
* chrono::__as_int to cast the value of single component, to unsigned integer
with size matching the one used by internal representation: unsigned short
for year/weekday_indexed, and unsigned char in all other cases,
* chrono::__pack_ints to pack integers (if more than one) into single integer
by performing bit shift operations,
* chrono::__int_hash to hash the value produced by above.
Hashing of duration, time_point, and zoned_time only hashes the value and
ignores any difference in the period, i.e. hashes of nanoseconds(2) and
seconds(2) are the same. This does not affect the usages inside unordered
containers, as the arguments are converted to key type first. To address
that period::num and period::den could be included in the hash, however
such approach will not make hashes of equal durations (2000ms, 2s) equal,
so they would remain unusable for precomputed hashes. In consequence,
including period in hash, would only increase runtime cost, withou any
clear benefits.
Futhermore, chrono::__int_hash is used when the duration representation
is integral type, and for other types (floating point due special handling
of +/-0.0 and user defined types) we delegate to hash specialization.
This is automatically picked up by time_point, that delegates to hasher
of duration. Similarly for leap_second that is specified to use integer
durations, we simply hash representations of date() and value(). Finally
zoned_time in addition to handling integer durations as described above,
we also use __int_hash for const time_zone* (if used), as hash<T*> have
similar problems as hash specialization for integers. This is limited
only to _TimeZonePtr being const time_zone* (default), as user can define
hash specializations for raw pointers to they zones.
As accessing the representation for duration requires calling count()
method that returns a copy of representation by value, the noexcept
specification of the hasher needs to take into consideration copy
constructor of duration. Similar reasoning applies for time_since_epoch
for time_points, and get_sys_time, get_time_zone for zoned_time.
For all this cases we use internal __is_nothrow_copy_hashable concept.
Finally support for zoned_time is provided only for CXX11 string ABI,
__cpp_lib_chrono feature test macro cannot be bumped if COW string are used.
To indicate presence of hasher for remaining types this patch also bumps
the internal __glibcxx_chrono_cxx20 macro, and uses it as guard to new
features.
PR libstdc++/110357
libstdc++-v3/ChangeLog:
* include/bits/version.def (chrono, chrono_cxx20): Bump values.
* include/bits/version.h: Regenerate.
* include/std/chrono (__is_nothrow_copy_hashable)
(chrono::__pack_ints, chrono::__as_int, chrono::__int_hash)
(chrono::__hash): Define.
(std::hash): Define partial specialization for duration, time_point,
and zoned_time, and full specializations for calendar types and
leap_second.
(std::__is_fast_hash): Define partial specializations for duration,
time_point, zoned_time.
* testsuite/std/time/hash.cc: New test.
Reviewed-by: Jonathan Wakely <jwakely@redhat.com>
Co-authored-by: Giuseppe D'Angelo <giuseppe.dangelo@kdab.com>
Signed-off-by: Tomasz Kamiński <tkaminsk@redhat.com>
Signed-off-by: Giuseppe D'Angelo <giuseppe.dangelo@kdab.com>
|
|
I don't know what changed, but I'm seeing some new failures:
FAIL: 23_containers/vector/capacity/114945.cc -std=gnu++11 (test for excess errors)
FAIL: 23_containers/vector/capacity/114945.cc -std=gnu++14 (test for excess errors)
FAIL: 23_containers/vector/capacity/114945.cc -std=gnu++17 (test for excess errors)
FAIL: 28_regex/basic_regex/85098.cc -std=gnu++11 (test for excess errors)
FAIL: 28_regex/basic_regex/85098.cc -std=gnu++14 (test for excess errors)
FAIL: 28_regex/basic_regex/85098.cc -std=gnu++17 (test for excess errors)
FAIL: 28_regex/simple_c++11.cc (test for excess errors)
libstdc++-v3/ChangeLog:
* include/bits/regex_automaton.tcc [_GLIBCXX_DEBUG]: Include
<ostream> so that _State_base::_M_print etc. can use it.
|
|
This improves the code generation slightly for std::string because of
aliasing. In many cases the length will be read again and the store of
the null character will cause the length to be re-read due to aliasing
requirements of the char type. So swapping around the stores will allow
the length not to have to be reloaded from memory and will allow
for more optimizations.
Bootstrapped and tested on x86_64-linux-gnu.
libstdc++-v3/ChangeLog:
* include/bits/basic_string.h (basic_string::M_set_length): Swap
around the order of traits_type::assign and _M_length so that
_M_length is at the end.
Signed-off-by: Andrew Pinski <andrew.pinski@oss.qualcomm.com>
|
|
reference_wrapper [PR121858]
To reduce instantiation count, function_ref(nontype<&S::x>, r) previously
reused the invoker from function_ref(nontype<&S::x>, &r). This assumed r was
always a reference to S or a derived class. However, this constructor is also
valid for lvalues (but not rvalues) of reference_wrapper specializations.
This patch fixes this by limiting above optimization only to situations,
when argument is not specialization of reference_wrapper. This is achieved
bu comparing __inv_unwrap<_Td>::type with _Td. We use __inv_unwrap because
unwrap_reference_t does not handle cv-qualified types.
PR libstdc++/121858
libstdc++-v3/ChangeLog:
* include/bits/funcref_impl.h
(function_ref::function_ref(nontype<__fn>, _Up&&)): Handle.
reference_wrapper.
* testsuite/20_util/function_ref/call.cc: Call and update
test05(). Add new test06() for reference_wrapper.
Reviewed-by: Jonathan Wakely <jwakely@redhat.com>
Signed-off-by: Tomasz Kamiński <tkaminsk@redhat.com>
|
|
libstdc++-v3/ChangeLog:
* include/bits/atomic_base.h: Tweak grammar of static assert
messages for unsupported atomic wait on volatile.
|
|
Previously, _Utf_view accepted any input_range, including reference-to-array
types like char(&)[2], and stored it as the _M_base member. In such cases,
_Utf_view was not assignable, failing the requirements of view concept.
This patch addresses the issue by adding the ranges::view constraint to the
second template parameter of _Utf_view, and for clarity renaming it from
_Range to _View. The constructor is also adjusted to accept its argument
by value (views must be O(1) move-constructible). This prevents implicitly
generated CTAD from deducing a reference type.
This makes _Utf_view consistent with both other standard views and the
wording from P2728R8: Unicode in the Library, Part 1: UTF Transcoding [1].
The explicit CTAD from viewable_range is not defined for _Utf_view because
it depends on views::all_t, views::ref_view, and views::owning_view,
which are declared in <ranges>. Consequently, users must explicitly cast
the argument to a view or specify it as a template parameter.
[1] https://www.open-std.org/jtc1/sc22/wg21/docs/papers/2025/p2728r8.html
libstdc++-v3/ChangeLog:
* include/bits/unicode.h (_Utf_view): Rename the template parameter
from _Range to _View and constrain it with ranges::view.
(_Utf_view::_Utf_view): Accept by value instead of rvalue reference.
* include/std/format (__format::__write_padded): Replace _Utf_view
over const char32_t(&)[1] with span<const char32_t, 1>.
* testsuite/ext/unicode/view.cc: Add checks if specialization
of _Utf_view satisfy view. Wrap arrays into std::span before
constructing _Utf_view.
Reviewed-by: Jonathan Wakely <jwakely@redhat.com>
Signed-off-by: Tomasz Kamiński <tkaminsk@redhat.com>
|
|
The std::is_assignable check should test for assignment to an lvalue,
not an rvalue.
libstdc++-v3/ChangeLog:
PR libstdc++/122661
* include/bits/forward_list.h (forward_list::assign(I, I)): Fix
value category in is_assignable check.
* testsuite/23_containers/forward_list/modifiers/122661.cc:
New test.
|
|
Since the implementation namespaces __detail and __exception_ptr aren't
exported from std, ADL can't find these functions there. Adding friend
declarations makes it work.
libstdc++-v3/ChangeLog:
* include/bits/quoted_string.h: Add ADL friends.
* libsupc++/exception_ptr.h: Add ADL friend.
|
|
In r15-3499 I added attributes to _Ios_Openmode to avoid -Wswitch false
positives; let's do the same for the other enums in ios_base.
It also seems to me that with these attributes, the tests don't need to
include the end/max/min cases.
libstdc++-v3/ChangeLog:
* include/bits/ios_base.h: Add attribs to _Ios_Fmtflags,
_Ios_Iostate, _ios_seekdir.
* testsuite/27_io/ios_base/types/fmtflags/case_label.cc: Remove
unneeded cases.
* testsuite/27_io/ios_base/types/iostate/case_label.cc: Likewise.
* testsuite/27_io/ios_base/types/openmode/case_label.cc: Likewise.
* testsuite/27_io/ios_base/types/seekdir/case_label.cc: Likewise.
|
|
The following patch attempts to implement the library side of the
C++23 P2674R1 paper. As mentioned in the paper, since CWG2605
the trait isn't really implementable purely on the library side.
The compiler side has been committed earlier, so this just uses
the new builtin trait on the library side.
2025-10-30 Jakub Jelinek <jakub@redhat.com>
* include/bits/version.def (is_implicit_lifetime): New.
* include/bits/version.h: Regenerate.
* include/std/type_traits (std::is_implicit_lifetime,
std::is_implicit_lifetime_v): New trait.
* src/c++23/std.cc.in (std::is_implicit_lifetime,
std::is_implicit_lifetime_v): Export.
* testsuite/20_util/is_implicit_lifetime/version.cc: New test.
* testsuite/20_util/is_implicit_lifetime/value.cc: New test.
|
|
In r16-4709-gc55c1de3a9adb2 I meant to use the result of the
static_cast<char> for the rest of the function following it, but I
accidentally used the original variable __ch. This causes
-Wunused-variable warnings for the __c initialized from the cast.
This fixes the rest of the function to use __c instead of __ch.
libstdc++-v3/ChangeLog:
* include/bits/regex.tcc (regex_traits::value): Use __c instead
of __ch.
|
|
We don't need to use an istringstream to convert a hex digit to its
numerical value. And if we don't use istringstream there, we don't need
to include <sstream> in <regex>.
libstdc++-v3/ChangeLog:
* include/bits/regex.tcc (regex_traits::value): Implement
without using istringstream.
* include/std/regex: Do not include <sstream>.
Reviewed-by: Tomasz Kamiński <tkaminsk@redhat.com>
|
|
This patch introduces the internal helper type _IotaArray to simplify
defining a pack of indices via a structured binding declaration:
constexpr auto [...__is] = _IotaArray<N>;
_IotaArray is a C-array for lowest overhead in terms of template
instantiations. Non-GCC compilers that do not implement
__integer_pack have a slightly higher overhead.
libstdc++-v3/ChangeLog:
* include/bits/utility.h (_IotaArray): Define.
* testsuite/ext/iotaarray.cc: New test.
Signed-off-by: Matthias Kretz <m.kretz@gsi.de>
|
|
Switch std::valarray<T> memory allocation to use std::__new_allocator<T>
to allocate and deallocate memory. This adds support for extended
alignment types without needing to duplicate all the logic from
__new_allocator::allocate and __new_allocator::dellocate.
std::__new_allocator is used instead of std::allocator because we want
to ensure that the memory is still allocated with operator new, so we
don't want to use any possible program-defined specialization of
std::allocator<T> which the user might have provided.
To make using an allocator possible, __valarray_release_memory needs to
become a function template so that it knows the type T. It also needs an
additional parameter specifying the size of the allocation.
This change doesn't cause an ABI change for types with fundamental
alignment, because __new_allocator still uses the same operator delete
function (or the sized version, which is ABI compatible) to free the
memory. So if memory for a valarray is allocated in one translation unit
and deallocated in another, and those TUs are compiled with different
versions of GCC, we still get memory from the same operator new and
release it with the same operator delete (or the compatibled sized
version). For types with extended alignment this does potentially cause
an ABI change on targets where the aligned version of operator delete
doesn't just call free(p), but support for extended alignment types was
previously just broken and had undefined behaviour.
libstdc++-v3/ChangeLog:
PR libstdc++/108951
* include/bits/valarray_array.h( __valarray_get_storage): Use
std::__new_allocator.
(__valarray_release_memory): Likewise.
* include/std/valarray: Pass _M_size to
__valarray_release_memory.
* testsuite/26_numerics/valarray/108951.cc: New test.
Reviewed-by: Tomasz Kamiński <tkaminsk@redhat.com>
|
|
As explained in PR libstdc++/122224 we do not make it ill-formed to call
std::prev with a non-Cpp17BidirectionalIterator. Instead we just use a
runtime assertion to check the std::advance precondition that the
distance is not negative.
This allows us to support std::prev on types which model the C++20
std::bidirectional_iterator concept but do not meet the
Cpp17BidirectionalIterator requirements, e.g. iota_view's iterators.
It also allows us to support std::prev(iter, -1) which is admittedly
weird, but there's no reason it shouldn't be equivalent to
std::next(iter), which is perfectly fine to use on non-bidirectional
iterators. In other words, "reverse decrementing" is valid for
non-bidirectional iterators.
However, the current implementation of std::advance for
non-bidirectional iterators uses a loop that does `while (n--) ++i;`
which assumes that n is not negative and so will eventually reach zero.
When the assertion for the precondition is not enabled, incrementing the
iterator while n is non-zero means that using std::prev(iter) or
std::next(iter, -1) on a non-bidirectional iterator will keep
incrementing the iterator until n reaches INT_MIN, overflows, and then
keeps decrementing until it eventually reaches zero. Incrementing most
iterators that many times will cause memory safety errors long before
the integer reaches zero and terminates the loop.
This commit changes the loop to use `while (n-- > 0)` which means that
the loop doesn't execute at all if a negative n is used. We still
consider such calls to be erroneous, but when the precondition isn't
checked by an assertion, the function now has no effects. The undefined
behaviour resulting from incrementing the iterator is prevented.
libstdc++-v3/ChangeLog:
PR libstdc++/122224
* include/bits/stl_iterator_base_funcs.h (prev): Compare
distance as n > 0 instead of n != 0.
* testsuite/24_iterators/range_operations/122224.cc: New test.
Reviewed-by: Tomasz Kamiński <tkaminsk@redhat.com>
|
|
This patch implements optional<T&> based on the P2988R12 paper, incorporating
corrections from LWG4300, LWG4304, and LWG3467. The resolution for LWG4015
is also extended to cover optional<T&>.
We introduce _M_fwd() helper, that is equivalent to operator*(), except that
it does not check non-empty precondition. It is used in to correctly propagate
the value during move construction from optional<T&>. This is necessary because
moving an optional<T&> must not move the contained object, which is the key
distinction between *std::move(opt) and std::move(*opt).
The implementation deviates from the standard by providing a separate std::swap
overload for std::optional<T&>, which simplifies preserving the resolution of
LWG2766.
This introduces a few changes to make_optional behavior (see included test):
* some previously valid uses of make_optional<T>({...}) (where T is not a
reference type) now become ill-formed (see optional/make_optional_neg.cc).
* make_optional<T&>(t) and make_optional<const T&>(ct), where decltype(t) is T&,
and decltype(ct) is const T& now produce optional<T&> and optional<const T&>
respectively, instead of optional<T>.
* a few other uses of make_optional<R> with reference type R are now ill-formed.
PR libstdc++/121748
libstdc++-v3/ChangeLog:
* include/bits/version.def: Bump value for optional,
* include/bits/version.h: Regenerate.
* include/std/optional (std::__is_valid_contained_type_for_optional):
Define.
(std::optional<T>): Use __is_valid_contained_type_for_optional.
(optional<T>(const optional<_Up>&), optional<T>(optional<_Up>&&))
(optional<T>::operator=(const optional<_Up>&))
(optional<T>::operator=(optional<_Up>&&)): Replacex._M_get() with
x._M_fwd(), and std::move(x._M_get()) with std::move(x)._M_fwd().
(optional<T>::and_then): Remove uncessary remove_cvref_t.
(optional<T>::_M_fwd): Define.
(std::optional<T&>): Define new partial specialization.
(std::swap(std::optional<T&>, std::optional<T&>)): Define.
(std::make_optional(_Tp&&)): Add non-type template parameter.
(std::make_optional): Use parenthesis to constructor optional.
(std::hash<optional<T>>): Add comment.
* testsuite/20_util/optional/make_optional-2.cc: Guarded not longer
working example.
* testsuite/20_util/optional/relops/constrained.cc: Expand test to
cover optionals of reference.
* testsuite/20_util/optional/requirements.cc: Ammend for
optional<T&>.
* testsuite/20_util/optional/requirements_neg.cc: Likewise.
* testsuite/20_util/optional/version.cc: Test new value of
__cpp_lib_optional.
* testsuite/20_util/optional/make_optional_neg.cc: New test.
* testsuite/20_util/optional/monadic/ref_neg.cc: New test.
* testsuite/20_util/optional/ref/access.cc: New test.
* testsuite/20_util/optional/ref/assign.cc: New test.
* testsuite/20_util/optional/ref/cons.cc: New test.
* testsuite/20_util/optional/ref/internal_traits.cc: New test.
* testsuite/20_util/optional/ref/make_optional/1.cc: New test.
* testsuite/20_util/optional/ref/make_optional/from_args_neg.cc:
New test.
* testsuite/20_util/optional/ref/make_optional/from_lvalue_neg.cc:
New test.
* testsuite/20_util/optional/ref/make_optional/from_rvalue_neg.cc:
New test.
* testsuite/20_util/optional/ref/monadic.cc: New test.
* testsuite/20_util/optional/ref/relops.cc: New test.
Reviewed-by: Jonathan Wakely <jwakely@redhat.com>
Co-authored-by: Tomasz Kamiński <tkaminsk@redhat.com>
|
|
This patch adds the views::indices function using iota.
libstdc++-v3/ChangeLog:
* include/bits/version.def: Add ranges_indices FTM.
* include/bits/version.h: Regenerate.
* include/std/ranges: Implement views::indices.
* testsuite/std/ranges/indices/1.cc: New test.
|
|
Implement resolution of LWG4425.
libstdc++-v3/ChangeLog:
* include/bits/funcwrap.h (__polyfunc::__deduce_funcref):
Adjust signature produced for member object pointers.
* testsuite/20_util/function_ref/deduction.cc: Update tests.
|
|
This implements the library parts of P1494 as amended by P3641. For GCC the
compiler itself treats stdio operations as equivalent to the observable
checkpoint and thus it does not appear to be necessary to add calls to those
functions (it will not alter the outcome).
This adds the facility for C++26, although there is no reason, in principle,
that it would not work back to C++11 at least.
PR c++/119060
libstdc++-v3/ChangeLog:
* include/bits/version.def: Add observable_checkpoint at present
allowed from C++26.
* include/bits/version.h: Regenerate.
* include/std/utility: Add std::observable_checkpoint().
* src/c++23/std.cc.in: Add obervable_checkpoint () to utility.
Signed-off-by: Iain Sandoe <iain@sandoe.co.uk>
|
|
libstdc++-v3/ChangeLog:
* include/bits/atomic_base.h
(__atomic_ref_base::_S_required_alignment): Renamed from...
(__atomic_ref_base::_S_required_aligment): Renamed.
|
|
[PR122293]
The preprocessor condition for defining the new __to_timeout_timespec
function templates did not match all the conditions under which it's
needed.
std::this_thread::sleep_for is defined #if ! defined _GLIBCXX_NO_SLEEP
but it relies on __to_timeout_timespec which was only being defined for
targets that use nanosleep, or clock_gettime, or use gthreads.
For a non-gthreads target that uses POSIX sleep to implement
std::this_thread::sleep_for, the build fails with:
include/bits/this_thread_sleep.h:71:40: error: '__to_timeout_timespec' is not a member of 'std::chrono' [-Wtemplate-body]
71 | struct timespec __ts = chrono::__to_timeout_timespec(__rtime);
| ^~~~~~~~~~~~~~~~~~~~~
Presumably the same would happen for mingw-w64 if configured with
--disable-threads (as that would be a non-gthreads target that doesn't
use nanosleep or clock_gettime).
libstdc++-v3/ChangeLog:
PR libstdc++/122293
* include/bits/chrono.h (__to_timeout_timespec): Fix
preprocessor condition to match the conditions under which
callers of this function are defined.
* include/bits/this_thread_sleep.h: Remove unused include.
|
|
When converting from a coarse duration with a very large value, the
existing code scales that up to chrono::seconds which overflows the
chrono::seconds::rep type. For example, sleep_for(chrono::hours::max())
tries to calculate LLONG_MAX * 3600, which overflows to -3600 and so the
sleep returns immediately.
The solution in this commit is inspired by this_thread::sleep_for in
libc++ which compares the duration argument to
chrono::duration<long double>(nanoseconds::max()) and limits the
duration to nanoseconds::max(). Because we split the duration into
seconds and nanoseconds, we can use seconds::max() as our upper limit.
We might need to limit further if seconds::max() doesn't fit in the
type used for sleeping, which is one of std::time_t, unsigned int, or
chrono::milliseconds.
To fix this everywhere that uses timeouts, new functions are introduced
for converting from a chrono::duration or chrono::time_point to a
timespec (or __gthread_time_t which is just a timespec on Linux). These
functions provide one central place where we can avoid overflow and also
handle negative timeouts (as these produce errors when passed to OS
functions that do not accept absolute times before the epoch). All
negative durations are converted to zero, and negative time_points are
converted to the epoch.
The new __to_timeout_gthread_time_t function in <bits/std_mutex.h>
requires adding <bits/chrono.h> to that header, but that only affects
<syncstream>. All other consumers of <bits/std_mutex.h> were already
including <bits/chrono.h> for timeouts (e.g. <shared_mutex> and
<condition_variable>).
libstdc++-v3/ChangeLog:
PR libstdc++/113327
PR libstdc++/116586
PR libstdc++/119258
PR libstdc++/58931
* include/bits/chrono.h (__to_timeout_timespec): New overloaded
function templates for converting chrono types to timespec.
* include/bits/std_mutex.h (__to_timeout_gthread_time_t): New
function template for converting time_point to __gthread_time_t.
* include/bits/this_thread_sleep.h (sleep_for): Use
__to_timeout_timespec.
(__sleep_for): Remove namespace-scope declaration.
* include/std/condition_variable: Likewise.
* include/std/mutex: Likewise.
* include/std/shared_mutex: Likewise.
* src/c++11/thread.cc (limit): New helper function.
(__sleep_for): Use limit to prevent overflow when converting
chrono::seconds to time_t, unsigned, or chrono::milliseconds.
* src/c++20/atomic.cc: Use __to_timeout_timespec and
__to_timeout_gthread_time_t for timeouts.
* testsuite/30_threads/this_thread/113327.cc: New test.
Reviewed-by: Mike Crowe <mac@mcrowe.com>
Reviewed-by: Tomasz Kamiński <tkaminsk@redhat.com>
|
|
This changes the associative and unordered containers to check
__glibcxx_node_extract, __glibcxx_generic_associative_lookup, and
__glibcxx_generic_unordered_lookup instead of just checking the value of
__cplusplus.
libstdc++-v3/ChangeLog:
* include/bits/hashtable.h: Check specific feature test macros
instead of checking thevalue of __cplusplus.
* include/bits/stl_map.h: Likewise.
* include/bits/stl_multimap.h: Likewise.
* include/bits/stl_multiset.h: Likewise.
* include/bits/stl_set.h: Likewise.
* include/bits/stl_tree.h: Likewise.
* include/bits/unordered_map.h: Likewise.
* include/bits/unordered_set.h: Likewise.
* include/debug/map.h: Likewise.
* include/debug/multimap.h: Likewise.
* include/debug/multiset.h: Likewise.
* include/debug/set.h: Likewise.
* include/debug/unordered_map: Likewise.
* include/debug/unordered_set: Likewise.
Reviewed-by: Tomasz Kamiński <tkaminsk@redhat.com>
|
|
changes [PR118757]
Previously, atomic<shared_ptr<T>>::wait (and the weak_ptr version) was
equivalent to waiting directly on _M_val, which corresponds to the pointer
to the control block (_M_pi). Consequently, wakeups were not triggered if
the stored pointer value was changed to a pointer that uses the same control
block but stores pointer to a different object. Such a pointer can be
constructed using an aliasing constructor.
To address this, wait now uses a generic proxy wait
std::__atomic_wait_address function, which supports waiting until any
predicate is satisfied. The provided predicate now compares both the control
block (_M_pi) and the stored pointer (_M_ptr). Comparing the latter requires
locking the pointer.
Since this function operates on raw pointers, the type of _M_val was changed
from __atomic_base<uintptr_t> to uintptr_t. Invocations of the corresponding
member functions are now replaced with direct use of __atomic builtins.
PR libstdc++/118757
libstdc++-v3/ChangeLog:
* include/bits/shared_ptr_atomic.h (_Atomic_count::_M_wait_unlock):
Add parameter capturing reference to _M_ptr. Reimplement in terms
of __atomic_wait_address.
(_Atomic_count::~_Atomic_count, _Atomic_count::lock)
(_Atomic_count::unlock, _Atomic_count::_M_swap_unlock): Replace
invocation of atomic member funcitons with __atomic builtins.
(_Atomic_count::notify_one, _Atomic_count::notify_all):
Use __atomic_notify_address.
(_Sp_atomic::element_type): Define.
(_Sp_atomic::_M_val): Change type to uintptr_t.
(_Sp_atomic::wait): Pass _M_ptr to _M_wait_unlock.
* python/libstdcxx/v6/printers.py:
* testsuite/20_util/shared_ptr/atomic/pr118757.cc: New test.
* testsuite/20_util/weak_ptr/pr118757.cc: New test.
Reviewed-by: Jonathan Wakely <jwakely@redhat.com>
Signed-off-by: Tomasz Kamiński <tkaminsk@redhat.com>
|
|
Before the r16-4349-g90dde804626f13 the required alignment of floating point,
and pointer specialization used __alignof__(_Vt) as required_alignment, and
mentioned commit changed them to alignof(_Vt). This values differs on i686
for double, as alignof(double) is 4, and __alignof__(double) is 8.
This patch restores the previous behavior.
PR libstdc++/122267
libstdc++-v3/ChangeLog:
* include/bits/atomic_base.h
(__atomic_ref_base<const _Tp>::_S_required_alignment):
Use __alignof__ instead of alignof.
Reviewed-by: Jonathan Wakely <jwakely@redhat.com>
|
|
libstdc++-v3/ChangeLog:
* include/bits/stl_iterator_base_funcs.h (advance): Fix comment.
|
|
This patch adds the address function to __atomic_ref_base.
libstdc++-v3/ChangeLog:
* include/bits/atomic_base.h: Implement address().
* include/bits/version.def: Bump version number.
* include/bits/version.h: Regenerate.
* testsuite/29_atomics/atomic_ref/address.cc: New test.
|
|
When iterating over a range of char16_t in reverse the _Utf_view was
incorrectly treating U+DC00 as a valid high surrogate that can precede
the low surrogate. But U+DC00 is a low surrogate, and so should not be
allowed before another low surrogate. The check should be u2 >= 0xDC00
rather than u2 > 0xDC00.
libstdc++-v3/ChangeLog:
* include/bits/unicode.h (_Utf_view::_M_read_reverse_utf16):
Fix check for high surrogate preceding low surrogate.
* testsuite/ext/unicode/view.cc: Check unpaired low surrogates.
Reviewed-by: Tomasz Kamiński <tkaminsk@redhat.com>
|
|
This should check for c <= 0x7f not x < 0x7f, because 0x7f is an ASCII
character (DEL).
libstdc++-v3/ChangeLog:
* include/bits/unicode.h (__is_single_code_unit): Fix check for
7-bit ASCII characters.
Reviewed-by: Tomasz Kamiński <tkaminsk@redhat.com>
|
|
GCC gives a -Wignored-attributes warning when a class template is
instantiated with a type that has an aligned(n) attribute. Specifically,
cris-elf uses 'typedef int __attribute_((__aligned(4))) _Atomic_word;'
and so compiling libstdc++ headers gives:
warning: ignoring attributes on template argument ‘int’ [-Wignored-attributes]
This commit reduces four occurrences of make_unsigned<_Atomic_word> into
two, one in bits/shared_ptr_base.h and one in ext/atomicity.h, and uses
diagnostic pragmas around the two remaining uses to avoid the warnings.
Because the unsigned type might have lost the alignment of _Atomic_word
that is needed for atomic ops (at least on cris-elf), the unsigned type
should only be used for plain non-atomic arithmetic. To prevent misuse,
it's defined as a private type in _Sp_counted_base, and is defined and
then undefined as a macro in ext/atomicity.h, so that it's not usable
after __exchange_and_add_single and __atomic_add_single have been
defined.
We also get a warning from instantiating __int_traits<_Atomic_word> in
shared_ptr_base.h which can be avoided by calculating the maximum signed
value from the maximum unsigned value.
libstdc++-v3/ChangeLog:
PR libstdc++/122172
* include/bits/shared_ptr_base.h (_Sp_counted_base): Define
_Unsigned_count_type for make_unsigned<_Atomic_word>.
Replace __int_traits<_Atomic_word> with equivalent expression.
* include/ext/atomicity.h (_GLIBCXX_UNSIGNED_ATOMIC_WORD):
Define macro for unsigned type to use for arithmetic.
(__exchange_and_add_single, __atomic_add_single): Use it.
Reviewed-by: Hans-Peter Nilsson <hp@axis.com>
|
|
[PR121790]
This patch addresses several issues related to the additional specializations
for enable_nonlocking_formatter_optimization fomr P3235R3 proposal:
* LWG4399 [1]: Apply remove_cvref_t to tuple and pair elements when checking if
the direct printing optimization is enabled.
* LWG4398 [2]: Disable the direct printing optimization for the standard library
container adaptors: queue, priority_queue, and stack.
* LWG4400 [3]: Enable the direct printing optimization only for durations that
use standard arithmetic types. Conditionally enable it for hh_mm_ss
and time_points based on their underlying Duration template argument.
[1] https://cplusplus.github.io/LWG/issue4399
[2] https://cplusplus.github.io/LWG/issue4398
[3] https://cplusplus.github.io/LWG/issue4400
PR libstdc++/121790
libstdc++-v3/ChangeLog:
* include/bits/chrono_io.h (enable_nonlocking_formatter_optimization):
Adjust specializations for duration, hh_mm_ss and time_points.
* include/std/format (enable_nonlocking_formatter_optimization):
Apply remove_cvref_t on pair and tuple elements.
* include/std/queue (enable_nonlocking_formatter_optimization):
Change specialization value to false.
* include/std/stack (enable_nonlocking_formatter_optimization):
Change specialization value to false.
* testsuite/std/format/ranges/adaptors.cc: Adjusted tests.
* testsuite/std/format/tuple.cc: Adjusted tests.
* testsuite/std/time/format/nonlocking.cc: Adjusted tests.
Reviewed-by: Jonathan Wakely <jwakely@redhat.com>
|
|
This patch implements additional enable_nonlocking_formatter_optimization
specializations listed in P3235R3.
PR libstdc++/121790
libstdc++-v3/ChangeLog:
* include/bits/chrono_io.h
(enable_nonlocking_formatter_optimization): Define specializations
for chrono types.
* include/bits/version.def (print): Bump.
* include/bits/version.h: Regenerate.
* include/std/format (enable_nonlocking_formatter_optimization):
Define specializations for pair, tuple and ranges.
* include/std/queue (enable_nonlocking_formatter_optimization):
Define specializations for queue and priority_queue.
* include/std/stack (enable_nonlocking_formatter_optimization):
Define specialization for stack.
* include/std/stacktrace (enable_nonlocking_formatter_optimization):
Define specialization for basic_stacktrace and stacktrace_entry.
* include/std/thread (enable_nonlocking_formatter_optimization):
Define specialization for thread::id.
* include/std/vector (enable_nonlocking_formatter_optimization):
Define specialization for vector<bool>::reference.
* testsuite/23_containers/vector/bool/format.cc: Test value of
enable_nonlocking_formatter_optimization.
* testsuite/30_threads/thread/id/output.cc: Likewise.
* testsuite/std/format/ranges/adaptors.cc: Likewise.
* testsuite/std/format/ranges/formatter.cc: Likewise.
* testsuite/std/format/tuple.cc: Likewise.
* testsuite/std/time/format/empty_spec.cc: Extract Rep class
to custom_rep.h.
* testsuite/std/time/format/custom_rep.h: Extracted from
empty_spec.cc.
* testsuite/std/time/format/nonlocking.cc: New test.
Reviewed-by: Jonathan Wakely <jwakely@redhat.com>
|