diff options
author | Jonathan Wakely <jwakely@redhat.com> | 2025-09-11 09:34:02 +0100 |
---|---|---|
committer | Jonathan Wakely <redi@gcc.gnu.org> | 2025-09-11 14:38:58 +0100 |
commit | f463e6bd8e84f12bde60f3e24e2d30da7fcda419 (patch) | |
tree | e5c822beb60128dc2e883f98021d82f88c8a836d /libjava | |
parent | 9eab6c6f223808ceeebb55b5453c75782224cd9e (diff) | |
download | gcc-f463e6bd8e84f12bde60f3e24e2d30da7fcda419.zip gcc-f463e6bd8e84f12bde60f3e24e2d30da7fcda419.tar.gz gcc-f463e6bd8e84f12bde60f3e24e2d30da7fcda419.tar.bz2 |
libstdc++: Add always_inline to ranges iterator ops and access functions
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>
Diffstat (limited to 'libjava')
0 files changed, 0 insertions, 0 deletions