Age | Commit message (Collapse) | Author | Files | Lines |
|
As in r16-3912-g412a1f78b53709, this fixes some other spots where we
wrongly use a deduced type and non-direct-initialization when trying
to initialize a value type from an iterator's reference type.
PR libstdc++/111861
libstdc++-v3/ChangeLog:
* include/bits/ranges_algo.h (ranges::unique_copy): When
initializing a value type object from *iter, use
direct-initialization and don't use a deduced type.
(ranges::push_heap): Use direct-initialization when initializing
a value type object from ranges::iter_move.
(ranges::max): As in ranges::unique_copy.
* include/bits/ranges_util.h (ranges::min): Likewise.
Reviewed-by: Jonathan Wakely <jwakely@redhat.com>
|
|
When running libstdc++ tests using an installed gcc (as opposed to an
in-tree gcc), we naturally use system stdlib headers instead of the
in-tree headers. But warnings from within system headers are suppressed
by default, so tests that check for such warnings spuriously fail in such
a setup. This patch makes us compile such tests with -Wsystem-headers so
that they consistently pass.
libstdc++-v3/ChangeLog:
* testsuite/20_util/bind/dangling_ref.cc: Compile with
-Wsystem-headers.
* testsuite/20_util/ratio/operations/ops_overflow_neg.cc: Likewise.
* testsuite/20_util/unique_ptr/lwg4148.cc: Likewise.
* testsuite/29_atomics/atomic/operators/pointer_partial_void.cc:
Likewise.
* testsuite/30_threads/packaged_task/cons/dangling_ref.cc:
Likewise.
Reviewed-by: Jonathan Wakely <jwakely@redhat.com>
|
|
|
|
The std::tuple_cat function has to determine a std::tuple return type
from zero or more tuple-like arguments. This uses the __make_tuple class
template to transform a tuple-like type into a std::tuple, and the
__combine_tuples class template to combine zero or more std::tuple types
into a single std::tuple type.
This change optimizes the __make_tuple class template to use an
_Index_tuple and pack expansion instead of recursive instantiation, and
optimizes __combine_tuples to use fewer levels of recursion.
For ranges::adjacent_view's __detail::__repeated_tuple helper we can
just use the __make_tuple class template directly, instead of doing
overload resolution on std::tuple_cat to get its return type.
libstdc++-v3/ChangeLog:
* include/std/ranges (__detail::__repeated_tuple): Use
__make_tuple helper alias directly, instead of doing overload
resolution on std::tuple_cat.
* include/std/tuple (__make_tuple_impl): Remove.
(__do_make_tuple): Replace recursion with _Index_tuple and pack
expansion.
(__make_tuple): Adjust to new __do_make_tuple definition.
(__combine_tuples<tuple<T1s...>, tuple<T2s...>, Rem...>): Replace
with a partial specialization for exactly two tuples and a
partial specialization for three or more tuples.
Reviewed-by: Patrick Palka <ppalka@redhat.com>
|
|
[PR121913]
The r16-3835-g7801236069a95c change to use ranges::iter_move should also
have used iter_value_t<_Iter> to ensure we get an object of the value
type, not a proxy reference.
libstdc++-v3/ChangeLog:
PR libstdc++/121913
* include/bits/ranges_algo.h (__rotate_fn::operator()): Use
auto_value_t<_Iter> instead of deduced type.
Reviewed-by: Patrick Palka <ppalka@redhat.com>
|
|
ranges::adjacent_view::_Iterator::value_type should have been changed by
r14-8710-g65b4cba9d6a9ff to always produce std::tuple, even for the
N == 2 views::pairwise specialization.
libstdc++-v3/ChangeLog:
PR libstdc++/121956
* include/std/ranges (adjacent_view::_Iterator::value_type):
Always define as std::tuple<T, N>, not std::pair<T, T>.
* testsuite/std/ranges/adaptors/adjacent/1.cc: Check value type
of views::pairwise.
Reviewed-by: Patrick Palka <ppalka@redhat.com>
|
|
The _GLIBCXX_MAKE_MOVE_ITERATOR macro is needed for code that needs to
compile as C++98, where it just produces the original iterator. In
std::uninitialized_move and std::uninitialized_move_n we can just call
std::make_move_iterator directly.
libstdc++-v3/ChangeLog:
* include/bits/stl_uninitialized.h (uninitialized_move)
(uninitialized_move_n): Replace _GLIBCXX_MAKE_MOVE_ITERATOR with
std::make_move_iterator.
Reviewed-by: Patrick Palka <ppalka@redhat.com>
|
|
libstdc++-v3/ChangeLog:
PR libstdc++/119820
* include/bits/ranges_algo.h (__shuffle_fn): Use
ranges::distance to get difference type value to add to
iterator.
* include/std/format (__formatter_str::_M_format_range):
Use ranges::next to increment iterator by a size_t value.
Reviewed-by: Patrick Palka <ppalka@redhat.com>
|
|
|
|
ranges::shuffle has a two-at-a-time PRNG optimization (copied from
std::shuffle) that considers the PRNG width vs the size of the range.
But in C++20 a random access sentinel isn't always sized so we can't
unconditionally do __last - __first to obtain the size in constant
time.
We could instead use ranges::distance, but that'd take linear time for a
non-sized sentinel which makes the optimization less clear of a win. So
this patch instead makes us only consider this optimization for sized
ranges.
PR libstdc++/121917
libstdc++-v3/ChangeLog:
* include/bits/ranges_algo.h (__shuffle_fn::operator()): Only
consider the two-at-a-time PRNG optimization if the range is
sized.
* testsuite/25_algorithms/shuffle/constrained.cc (test03): New
test.
Reviewed-by: Jonathan Wakely <jwakely@redhat.com>
|
|
|
|
Using std::move(*it) is incorrect for iterators that use proxy refs, we
should use ranges::iter_move(it) instead.
libstdc++-v3/ChangeLog:
PR libstdc++/121913
* include/bits/ranges_algo.h (__rotate_fn::operator()): Use
ranges::iter_move(it) instead of std::move(*it).
* testsuite/25_algorithms/rotate/121913.cc: New test.
Reviewed-by: Patrick Palka <ppalka@redhat.com>
|
|
[PR121890]
Whenever we use operator+ or similar operators on random access
iterators we need to be careful to use the iterator's difference_type
rather than some other integer type. It's not guaranteed that an
expression with an arbitrary integer type, such as `it + 1u`, has the
same effects as `it + iter_difference_t<It>(1)`.
Some of our algorithms need changes to cast values to the correct type,
or to use std::next or ranges::next instead of `it + n`. Several tests
also need fixes where the arithmetic occurs directly in the test.
The __gnu_test::random_access_iterator_wrapper class template is
adjusted to have deleted operators that make programs ill-formed if the
argument to relevant operators is not the difference_type. This will
make it easier to avoid regressing in future.
libstdc++-v3/ChangeLog:
PR libstdc++/121890
* include/bits/ranges_algo.h (ranges::rotate, ranges::shuffle)
(__insertion_sort, __unguarded_partition_pivot, __introselect):
Use ranges::next to advance iterators. Use local variables in
rotate to avoid duplicate expressions.
(ranges::push_heap, ranges::pop_heap, ranges::partial_sort)
(ranges::partial_sort_copy): Use ranges::prev.
(__final_insertion_sort): Use iter_difference_t<Iter>
for operand of operator+ on iterator.
* include/bits/ranges_base.h (ranges::advance): Use iterator's
difference_type for all iterator arithmetic.
* include/bits/stl_algo.h (__search_n_aux, __rotate)
(__insertion_sort, __unguarded_partition_pivot, __introselect)
(__final_insertion_sort, for_each_n, random_shuffle): Likewise.
Use local variables in __rotate to avoid duplicate expressions.
* include/bits/stl_algobase.h (__fill_n_a, __lc_rai::__newlast1):
Likewise.
* include/bits/stl_heap.h (push_heap): Likewise.
(__is_heap_until): Add static_assert.
(__is_heap): Convert distance to difference_type.
* include/std/functional (boyer_moore_searcher::operator()): Use
iterator's difference_type for iterator arithmetic.
* testsuite/util/testsuite_iterators.h
(random_access_iterator_wrapper): Add deleted overloads of
operators that should be called with difference_type.
* testsuite/24_iterators/range_operations/advance.cc: Use
ranges::next.
* testsuite/25_algorithms/heap/constrained.cc: Use ranges::next
and ranges::prev.
* testsuite/25_algorithms/nth_element/58800.cc: Use std::next.
* testsuite/25_algorithms/nth_element/constrained.cc: Use
ptrdiff_t for loop variable.
* testsuite/25_algorithms/nth_element/random_test.cc: Use
iterator's difference_type instead of int.
* testsuite/25_algorithms/partial_sort/check_compare_by_value.cc:
Use std::next.
* testsuite/25_algorithms/partial_sort/constrained.cc: Use
ptrdiff_t for loop variable.
* testsuite/25_algorithms/partial_sort/random_test.cc: Use
iterator's difference_type instead of int.
* testsuite/25_algorithms/partial_sort_copy/constrained.cc:
Use ptrdiff_t for loop variable.
* testsuite/25_algorithms/partial_sort_copy/random_test.cc:
Use iterator's difference_type instead of int.
* testsuite/std/ranges/adaptors/drop.cc: Use ranges::next.
* testsuite/25_algorithms/fill_n/diff_type.cc: New test.
* testsuite/25_algorithms/lexicographical_compare/diff_type.cc:
New test.
Reviewed-by: Patrick Palka <ppalka@redhat.com>
Reviewed-by: Tomasz Kamiński <tkaminsk@redhat.com>
|
|
Backport of upstream patch:
https://github.com/uxlfoundation/oneDPL/pull/1589
libstdc++-v3/ChangeLog:
PR libstdc++/117276
* include/pstl/parallel_backend_tbb.h (__func_task::finalize):
Make deallocation unconditional.
|
|
The r16-3435-gbbc0e70b610f19 change (for LWG 4294) needs to be applied
to the debug mode __gnu_debug::bitset as well as the normal one.
libstdc++-v3/ChangeLog:
PR libstdc++/121046
* include/debug/bitset (bitset(const CharT*, ...)): Add
constraints on CharT type.
|
|
My r16-3810-g6456da6bab8a2c changes broke bootstrap for targets that use
the mutex-based atomic helpers. This fixes it by casting away the
unnecessary volatile-qualification on the _Atomic_word* before passing
it to __exchange_and_add_single.
libstdc++-v3/ChangeLog:
* config/cpu/generic/atomicity_mutex/atomicity.h
(__exchange_and_add): Use const_cast to remove volatile.
|
|
|
|
This adds checks when incrementing the shared count and weak count and
will trap if they would be be incremented past its maximum. The maximum
value is the value at which incrementing it produces an invalid
use_count(). So that is either the maximum positive value of
_Atomic_word, or for targets where we now allow the counters to wrap
around to negative values, the "maximum" value is -1, because that is
the value at which one more increment overflows the usable range and
resets the counter to zero.
For the weak count the maximum is always -1 as we always allow that
count to use nagative values, so we only tap if it wraps all the way
back to zero.
libstdc++-v3/ChangeLog:
PR libstdc++/71945
* include/bits/shared_ptr_base.h (_Sp_counted_base::_S_chk):
Trap if a reference count cannot be incremented any higher.
(_Sp_counted_base::_M_add_ref_copy): Use _S_chk.
(_Sp_counted_base::_M_add_weak_ref): Likewise.
(_Sp_counted_base<_S_mutex>::_M_add_ref_lock_nothrow): Likewise.
(_Sp_counted_base<_S_atomic>::_M_add_ref_lock_nothrow): Likewise.
(_Sp_counted_base<_S_single>::_M_add_ref_copy): Use _S_chk.
Reviewed-by: Tomasz Kamiński <tkaminsk@redhat.com>
|
|
This change doubles the effective range of the std::shared_ptr and
std::weak_ptr reference counts for most 64-bit targets.
The counter type, _Atomic_word, is usually a signed 32-bit int (except
on Solaris v9 where it is a signed 64-bit long). The return type of
std::shared_ptr::use_count() is long. For targets where long is wider
than _Atomic_word (most 64-bit targets) we can treat the _Atomic_word
reference counts as unsigned and allow them to wrap around from their
most positive value to their most negative value without any problems.
The logic that operates on the counts only cares if they are zero or
non-zero, and never performs relational comparisons. The atomic
fetch_add operations on integers are required by the standard to behave
like unsigned types, so that overflow is well-defined:
"the result is as if the object value and parameters were converted to
their corresponding unsigned types, the computation performed on those
types, and the result converted back to the signed type."
So if we allow the counts to wrap around to negative values, all we need
to do is cast the value to make_unsigned_t<_Atomic_word> before
returning it as long from the use_count() function.
In practice even exceeding INT_MAX is extremely unlikely, as it would
require billions of shared_ptr or weak_ptr objects to have been
constructed and never destroyed. However, if that happens we now have
double the range before the count returns to zero and causes problems.
Some of the member functions for the _Sp_counted_base<_S_single>
specialization are adusted to use the __atomic_add_single and
__exchange_and_add_single helpers instead of plain ++ and -- operations.
This is done because those helpers use unsigned arithmetic, where the
plain increments and decrements would have undefined behaviour on
overflow.
libstdc++-v3/ChangeLog:
PR libstdc++/71945
* include/bits/shared_ptr_base.h
(_Sp_counted_base::_M_get_use_count): Cast _M_use_count to
unsigned before returning as long.
(_Sp_counted_base<_S_single>::_M_add_ref_copy): Use atomic
helper function to adjust ref count using unsigned arithmetic.
(_Sp_counted_base<_S_single>::_M_weak_release): Likewise.
(_Sp_counted_base<_S_single>::_M_get_use_count): Cast
_M_use_count to unsigned before returning as long.
(_Sp_counted_base<_S_single>::_M_add_ref_lock_nothrow): Use
_M_add_ref_copy to do increment using unsigned arithmetic.
(_Sp_counted_base<_S_single>::_M_release): Use atomic helper and
_M_weak_release to do decrements using unsigned arithmetic.
(_Sp_counted_base<_S_mutex>::_M_release): Add comment.
(_Sp_counted_base<_S_single>::_M_weak_add_ref): Remove
specialization.
Reviewed-by: Tomasz Kamiński <tkaminsk@redhat.com>
|
|
The standard requires that std::atomic<integral-type>::fetch_add does
not have undefined behaviour for signed overflow, instead it wraps like
unsigned integers. The compiler ensures this is true for the atomic
built-ins that std::atomic uses, but it's not currently true for the
__gnu_cxx::__exchange_and_add and __gnu_cxx::__atomic_add functions
defined in libstdc++, which operate on type _Atomic_word.
For the inline __exchange_and_add_single function (used when there's
only one thread in the process), we can copy the value to an unsigned
long and do the addition on that, then assign it back to the
_Atomic_word variable.
The __exchange_and_add in config/cpu/generic/atomicity_mutex/atomicity.h
locks a mutex and then performs exactly the same steps as
__exchange_and_add_single. Calling __exchange_and_add_single instead of
duplicating the code benefits from the fix just made to
__exchange_and_add_single.
For the remaining config/cpu/$arch/atomicity.h implementations, they
either use inline assembly which uses wrapping instructions (so no
changes needed), or we can fix them by compiling with -fwrapv.
After ths change, UBsan no longer gives an error for:
_Atomic_word i = INT_MAX;
__gnu_cxx::__exchange_and_add_dispatch(&i, 1);
/usr/include/c++/14/ext/atomicity.h:85:12: runtime error: signed integer overflow: 2147483647 + 1 cannot be represented in type 'int'
libstdc++-v3/ChangeLog:
PR libstdc++/121148
* config/cpu/generic/atomicity_mutex/atomicity.h
(__exchange_and_add): Call __exchange_and_add_single.
* include/ext/atomicity.h (__exchange_and_add_single): Use an
unsigned type for the addition.
* libsupc++/Makefile.am (atomicity.o): Compile with -fwrapv.
* libsupc++/Makefile.in: Regenerate.
Reviewed-by: Tomasz Kamiński <tkaminsk@redhat.com>
|
|
These _S_noexcept() functions are only used in noexcept-specifiers and
never need to be called at runtime. They can be immediate functions,
i.e. consteval.
libstdc++-v3/ChangeLog:
* include/bits/iterator_concepts.h (_IterMove::_S_noexcept)
(_IterSwap::_S_noexcept): Change constexpr to consteval.
* include/bits/ranges_base.h (_Begin::_S_noexcept)
(_End::_S_noexcept, _RBegin::_S_noexcept, _REnd::_S_noexcept)
(_Size::_S_noexcept, _Empty::_S_noexcept, _Data::_S_noexcept):
Likewise.
* include/std/concepts (_Swap::_S_noexcept): Likewise.
Reviewed-by: Tomasz Kamiński <tkaminsk@redhat.com>
|
|
Most of the basis operations for ranges such as ranges::begin and
ranges::next are trivial one-line function bodies, so can be made
always_inline to reduce the abstraction penalty for -O0 code.
Now that we no longer need to support the -fconcepts-ts grammar, we can
also move some [[nodiscard]] attributes to the more natural position
before the function declaration, instead of between the declarator-id
and the function parameters, e.g. we can use:
template<typename T> requires C<T> [[nodiscard]] auto operator()(T&&)
instead of:
template<typename T> requires C<T> auto operator() [[nodiscard]] (T&&)
The latter form was necessary because -fconcepts-ts used a different
grammar for the requires-clause, parsing 'C<T>[[x]]' as a subscripting
operator with an ill-formed argument '[x]'. In the C++20 grammar you
would need to use parentheses to use a subscript in a constraint, so
without parentheses it's parsed as an attribute.
libstdc++-v3/ChangeLog:
* include/bits/ranges_base.h (__detail::__to_unsigned_like)
(__access::__possible_const_range, __access::__as_const)
(__distance_fn::operator(), __next_fn::operator())
(__prev_fn::operator()): Add always_inline attribute.
(_Begin::operator(), _End::operator(), _RBegin::operator())
(_REnd::operator(), _Size::operator(), _SSize::operator())
(_Empty::operator(), _Data::operator(), _SSize::operator()):
Likewise. Move nodiscard attribute to start of declaration.
Reviewed-by: Tomasz Kamiński <tkaminsk@redhat.com>
|
|
Converting a weak_ptr<Derived> to a weak_ptr<Base> requires calling
lock() on the source object in the general case.
Although the source weak_ptr<Derived> does contain a raw pointer to
Derived, we can't just get it and (up)cast it to Base, as that will
dereference the pointer in case Base is a virtual base class of Derived.
We don't know if the managed object is still alive, and therefore if
this operation is safe to do; we therefore temporarily lock() the source
weak_ptr, do the cast using the resulting shared_ptr, and then discard
this shared_ptr. Simply checking the strong counter isn't sufficient,
because if multiple threads are involved then we'd have a race / TOCTOU
problem; the object may get destroyed after we check the strong counter
and before we cast the pointer.
However lock() is not necessary if we know that Base is *not* a virtual
base class of Derived; in this case we can avoid the relatively
expensive call to lock() and just cast the pointer. This commit uses
the newly added builtin to detect this case and optimize std::weak_ptr's
converting constructors and assignment operations.
Apart from non-virtual bases, there's also another couple of interesting
cases where we can also avoid locking. Specifically:
1) converting a weak_ptr<T[N]> to a weak_ptr<T cv[]>;
2) converting a weak_ptr<T*> to a weak_ptr<T const * const> or similar.
Since this logic is going to be used by multiple places, I've
centralized it in a new static helper.
libstdc++-v3/ChangeLog:
* include/bits/shared_ptr_base.h (__weak_ptr): Avoid calling
lock() when converting or assigning a weak_ptr<Derived> to
a weak_ptr<Base> in case Base is not a virtual base of Derived.
This logic is centralized in _S_safe_upcast, called by the
various converting constructors/assignment operators.
(_S_safe_upcast): New helper function.
* testsuite/20_util/weak_ptr/cons/virtual_bases.cc: New test.
Reviewed-by: Jonathan Wakely <jwakely@redhat.com>
Reviewed-by: Tomasz Kamiński <tkaminsk@redhat.com>
Signed-off-by: Giuseppe D'Angelo <giuseppe.dangelo@kdab.com>
|
|
libstdc++-v3/ChangeLog:
* include/std/syncstream: Remove trailing whitespace.
|
|
libstdc++-v3/ChangeLog:
* testsuite/std/time/year_month_day/io.cc: Additional tests.
Reviewed-by: Jonathan Wakely <jwakely@redhat.com>
Signed-off-by: Tomasz Kamiński <tkaminsk@redhat.com>
|
|
|
|
libstdc++-v3/ChangeLog:
* include/bits/unique_ptr.h: Remove blank line.
|
|
C++17 has a 'Requires:' precondition that the two random access iterator
types have the same value type. In C++20 that is a 'Mandates:'
requirement which we must diagnose.
Although we could diagnose it in C++17, that might be a breaking change
for any users relying on it today. Also I am lazy and wanted to use
C++20's std::iter_value_t for the checks. So this only enforces the
requirement for C++20 and later.
libstdc++-v3/ChangeLog:
* include/std/functional (boyer_moore_searcher::operator()): Add
static_assert.
(boyer_moore_horspool_searcher::operator()): Likewise.
* testsuite/20_util/function_objects/121782.cc: New test.
|
|
In libstdc++ the prefix _S is used for static members only. In <mdspan>
there's several type aliases that also used the prefix _S. They now use
a single leading underscore follow by a capital letter instead.
libstdc++-v3/ChangeLog:
* include/std/mdspan (_ExtentsStorage::_Base): New name for
_S_base.
(_ExtentsStorage::_Storage): New name for _S_storage.
(extents::_Storage): New name for _S_storage.
(layout_stride::mapping::_Strides): New name for
_S_stries_t.
* testsuite/23_containers/mdspan/class_mandate_neg.cc: Update
test to the new error message.
Reviewed-by: Jonathan Wakely <jwakely@redhat.com>
Signed-off-by: Luc Grosheintz <luc.grosheintz@gmail.com>
|
|
The concept __integral_constant_like doesn't consider traits with a
boolean member `value` as an integer constant. This is done to reject
various completely unrelated traits like is_const, is_abstract, etc.
LWG4351 adjusts the check to strip references and cv qualifiers before
checking if `value` is bool. The immediate context is constant_wrapper
which defines:
template<...>
struct constant_wrapper
{
static constexpr const auto& value = ...;
};
Without LWG4351, std::cw<true> and std::cw<false> would both be
considered integer constants (by __integral_constant_like); but both
std::{true,false}_type are not considered integer constants. Hence,
LWG4351 removes inconsistent behaviour between std::integral_constant
and std::constant_wrapper.
libstdc++-v3/ChangeLog:
* include/std/span (__integral_constant_like): Use
remove_cvref_t before checking if _Tp::value is boolean.
* testsuite/23_containers/mdspan/extents/misc.cc: Update test.
* testsuite/23_containers/mdspan/mdspan.cc: Ditto.
* testsuite/23_containers/span/deduction.cc: Ditto.
Reviewed-by: Jonathan Wakely <jwakely@redhat.com>
Signed-off-by: Luc Grosheintz <luc.grosheintz@gmail.com>
|
|
When producing output, the libstdc++ format implementation only uses _Sink_iter
specializations. Since users cannot construct basic_format_context, this is the
only iterator type actually used. The __format_padded helper relies on this
property to efficiently pad sequences from tuples and ranges.
However, the standard's formattable concept requires a generic format function
in formatters that works with any iterator type. This is intended to
future-proof the implementation by allowing new format_context types. Previously,
libstdc++ used back_insert_iterator<basic_string<_CharT>> for this purpose.
Normally, concept checks only instantiate function signatures, but with
user-defined formatters and deduced return types, the function body and all
called functions are instantiated. This could trigger a static assertion error
in the range/tuple formatter that assumed the iterator was a _Sink_iter
(see included test).
This patch resolves the issue by replacing the _Iter_for_t alias with the
internal _Drop_iter. This iterator's sematnics is to drop elements, so
__format_padded can handle it by simply returning the input iterator, which
still produces the required behavior [1].
An alternative of using _Sink_iter was considered but rejected because it would
allow formatters to pass formattable requirements while only supporting
format_context and wformat_context, which seems counter to the design intent
(the std/format/formatter/concept.cc fails).
[1] The standard's wording defines format functions as producing an output
representation, but does not explicitly require a formatter to be invoked
for each element. This allows the use of _Drop_iter to pass the concept check
without generating any output.
PR libstdc++/121765
libstdc++-v3/ChangeLog:
* include/std/format (__format::_Drop_iter): Define.
(_Iter_for_t::type): Change alias to _Drop_iter.
(__format::__format_padded): Return __fc.out() for
_Drop_iter.
* testsuite/std/format/pr121765.cc: New test.
Reviewed-by: Jonathan Wakely <jwakely@redhat.com>
Signed-off-by: Tomasz Kamiński <tkaminsk@redhat.com>
|
|
I have double checked that implementation-defined behavior in the [compliance]
(whether the implementation is freestanding) and [stringbuf.const] (initialization
of sequence pointers) are indeed null, and there are no corresponding entires in
earlier standards.
libstdc++-v3/ChangeLog:
* doc/html/manual/status.html: Regenerate.
* doc/xml/manual/status_cxx2020.xml: Add more entires.
Reviewed-by: Jonathan Wakely <jwakely@redhat.com>
Signed-off-by: Tomasz Kamiński <tkaminsk@redhat.com>
|
|
Also introduce Implementation Specific Behavior section for C++20.
libstdc++-v3/ChangeLog:
* doc/html/index.html: Regenerated.
* doc/html/manual/index.html: Regenerated.
* doc/html/manual/intro.html: Regenerated.
* doc/html/manual/status.html: Regenatered.
* doc/xml/manual/status_cxx2020.xml: Add iso.2020.specific
section with atomic_ref documentation.
Reviewed-by: Jonathan Wakely <jwakely@redhat.com>
Signed-off-by: Tomasz Kamiński <tkaminsk@redhat.com>
|
|
|
|
Rename _S_type to __type as it's not a static member.
Also rename _Tp to _Xv because it's not a type.
libstdc++-v3/ChangeLog:
* include/std/type_traits (_CwFixedValue::_S_type): Rename to
__type.
(constant_wrapper): Rename template parameter in declaration to
match later definition.
|
|
This works around a dblatex bug, where dblatex emits invalid TeX, by
placing a raw "#" in a \href.
Fixes: f6ff531d907d ("libstdc++: Update link to "Tunables" in Glibc manual")
libstdc++-v3/ChangeLog:
* doc/xml/manual/using_exceptions.xml: Replace "Tunables" link
with one that does not have an anchor.
* doc/html/manual/using_exceptions.html: Regenerate.
|
|
|
|
This fixes:
FAIL: 17_intro/badnames.cc -std=gnu++26 (test for excess errors)
libstdc++-v3/ChangeLog:
* include/std/type_traits (constant_wrapper): Rename template
parameter to avoid BADNAME.
|
|
libstdc++-v3/ChangeLog:
PR libstdc++/120698
* doc/xml/manual/configure.xml: Do not claim that vtv is enabled
by default.
* doc/html/manual/configure.html: Regenerate.
|
|
This patch fixes Makefile.in to include mention of new syncbuf.lo.
libstdc++-v3/Changelog:
* src/c++20/Makefile.in: Mention syncbuf.lo.
|
|
This patch creates a global function __syncbuf_get_mutex, gated by
_GLIBCXX_HAS_GTHREADS, replacing a static instantiated member
_S_get_mutex used in syncbuf<> construction, and makes the global
symbol visible. A static local table of 16 mutexes is shared among
all specializations of syncbuf<>, chosen on construction by a hash
of the wrapped streambuf's address.
It detaches the implementation of _S_get_mutex from the C++20 ABI.
libstdc++-v3/ChangeLog:
* include/std/syncstream: (syncbuf<>::__mutex) Remove _S_get_mutex,
use extern function instead.
* src/c++20/syncbuf.cc: Define global __syncbuf_get_mutex.
* src/c++20/Makefile.am: Mention syncbuf.cc.
* src/c++20/Makefile.in: Regenerate.
* config/abi/pre/gnu.ver: Mention mangled __syncbuf_get_mutex.
|
|
During the tests mentioned in
https://gcc.gnu.org/pipermail/gcc-patches/2025-August/692482.html
(but dunno why I haven't noticed it back in August but only when testing
https://gcc.gnu.org/pipermail/gcc-patches/2025-September/694527.html )
I've noticed two ext header problems.
One is that #include <ext/pointer.h> got broken with the
r13-3037-g18f176d0b25591e28 change and since then is no longer
self-contained, as it includes iosfwd only if _GLIBCXX_HOSTED is defined
but doesn't actually include bits/c++config.h to make sure it is defined,
then includes a bunch of headers which do include bits/c++config.h and
finally uses in #if _GLIBCXX_HOSTED guarded code what is declared in iosfwd.
The other problem is that ext/cast.h is also not a self-contained header,
but that one has
/** @file ext/cast.h
* This is an internal header file, included by other library headers.
* Do not attempt to use it directly. @headername{ext/pointer.h}
*/
comment, so I think we just shouldn't include it in extc++.h and let
ext/pointer.h include it.
2025-09-08 Jakub Jelinek <jakub@redhat.com>
PR libstdc++/121827
* include/precompiled/extc++.h: Don't include ext/cast.h which is an
internal header.
* include/ext/pointer.h: Include bits/c++config.h before
#if _GLIBCXX_HOSTED.
|
|
libstdc++-v3:
* doc/xml/manual/using_exceptions.xml: Update link to "Tunables"
section in the Glibc manual.
* doc/html/manual/using_exceptions.html: Regenerate.
|
|
A usecase for P2781R9 is more ergonomic creation of span and mdspan with
mixed static and dynamic extents, e.g.:
span(ptr, cw<3>)
extents(cw<3>, 5, cw<7>)
mdspan(ptr, cw<3>, 5, cw<7>)
should be deduced as:
span<..., 3>
extents<..., 3, dyn, 7>
mdspan<..., extents<..., 3, dyn, 7>>
The change required is to strip cv-qualifiers and references from
`_Tp::value`, because of:
template<_CwFixedValue _X, typename>
struct constant_wrapper : _CwOperators
{
static constexpr const auto& value = _X._M_data;
libstdc++-v3/ChangeLog:
* include/std/span (__integral_constant_like): Allow the member
`value` of a constant wrapping type to be a const reference of
an integer.
* testsuite/23_containers/mdspan/extents/misc.cc: Add test for
cw and constant_wrapper.
* testsuite/23_containers/mdspan/mdspan.cc: Ditto.
* testsuite/23_containers/span/deduction.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>
|
|
This is a partial implementation of P2781R9. It adds std::cw and
std::constant_wrapper, but doesn't modify __integral_constant_like for
span/mdspan.
libstdc++-v3/ChangeLog:
* include/bits/version.def (constant_wrapper): Add.
* include/bits/version.h: Regenerate.
* include/std/type_traits (_CwFixedValue): New class.
(_IndexSequence): New struct.
(_BuildIndexSequence): New struct.
(_ConstExprParam): New concept.
(_CwOperators): New struct.
(constant_wrapper): New struct.
(cw): New global constant.
* src/c++23/std.cc.in (constant_wrapper): Add.
(cw): Add.
* testsuite/20_util/constant_wrapper/adl.cc: New test.
* testsuite/20_util/constant_wrapper/ex.cc: New test.
* testsuite/20_util/constant_wrapper/generic.cc: New test.
* testsuite/20_util/constant_wrapper/instantiate.cc: New test.
* testsuite/20_util/constant_wrapper/op_comma_neg.cc: New test.
* testsuite/20_util/constant_wrapper/version.cc: New test.
Reviewed-by: Jonathan Wakely <jwakely@redhat.com>
Co-authored-by: Tomasz Kamiński <tkaminsk@redhat.com>
Signed-off-by: Luc Grosheintz <luc.grosheintz@gmail.com>
Signed-off-by: Tomasz Kamiński <tkaminsk@redhat.com>
|
|
|
|
Since this helper (added in r16-3576-g7f7f1878eedd80) is used in the
noexcept-spec of iter_move and iter_swap, it in turn needs an accurate
noexcept-spec.
PR libstdc++/121804
libstdc++-v3/ChangeLog:
* include/std/ranges (join_view::_Iterator::_M_get_inner):
Mark noexcept.
* testsuite/std/ranges/adaptors/join.cc (test16): New test.
Reviewed-by: Tomasz Kamiński <tkaminsk@redhat.com>
Reviewed-by: Jonathan Wakely <jwakely@redhat.com>
|
|
This also covers bad_function_call::what from C++11.
libstdc++-v3/ChangeLog:
* doc/html/manual/status.html: Regenerate.
* doc/xml/manual/status_cxx2011.xml: Add entry for bad_function_call.
* doc/xml/manual/status_cxx2017.xml: Add entries for bad_any_cast
and nullptr_t output. Update entry for sf.cmath. Fix stable name for
mem.res.
Reviewed-by: Jonathan Wakely <jwakely@redhat.com>
Signed-off-by: Tomasz Kamiński <tkaminsk@redhat.com>
|
|
libstdc++-v3/ChangeLog:
* doc/html/manual/status.html: Regenerate the file.
* doc/xml/manual/status_cxx2017.xml: Addd more entires.
Reviewed-by: Jonathan Wakely <jwakely@redhat.com>
Signed-off-by: Tomasz Kamiński <tkaminsk@redhat.com>
|
|
|