* [PATCH] libstdc++: A few more minor <ranges> cleanups
@ 2022-08-31 19:27 Patrick Palka
2022-08-31 20:09 ` Jonathan Wakely
0 siblings, 1 reply; 2+ messages in thread
From: Patrick Palka @ 2022-08-31 19:27 UTC (permalink / raw)
To: gcc-patches; +Cc: libstdc++, Patrick Palka
Tested on x86_64-pc-linux-gnu, does this look OK for trunk?
libstdc++-v3/ChangeLog:
* include/bits/ranges_base.h (__advance_fn::operator()): Add
parentheses in assert condition to avoid -Wparentheses warning.
* include/std/ranges: (take_view::take_view): Uglify 'base'.
(take_while_view::take_while_view): Likewise.
(elements_view::elements_view): Likewise.
(views::_Zip::operator()): Adjust position of [[nodiscard]] for
compatibility with -fconcepts-ts.
(zip_transform_view::_Sentinel): Uglify 'OtherConst'.
(views::_ZipTransform::operator()): Adjust position of
[[nodiscard]] for compatibilty with -fconcepts-ts.
---
libstdc++-v3/include/bits/ranges_base.h | 2 +-
libstdc++-v3/include/std/ranges | 40 ++++++++++++-------------
2 files changed, 20 insertions(+), 22 deletions(-)
diff --git a/libstdc++-v3/include/bits/ranges_base.h b/libstdc++-v3/include/bits/ranges_base.h
index 38db33fd2ce..866d7c56cbc 100644
--- a/libstdc++-v3/include/bits/ranges_base.h
+++ b/libstdc++-v3/include/bits/ranges_base.h
@@ -778,7 +778,7 @@ namespace ranges
else if (__n != 0) [[likely]]
{
// n and bound must not lead in opposite directions:
- __glibcxx_assert(__n < 0 == __diff < 0);
+ __glibcxx_assert((__n < 0) == (__diff < 0));
(*this)(__it, __n);
return 0;
diff --git a/libstdc++-v3/include/std/ranges b/libstdc++-v3/include/std/ranges
index 2352aad76fc..39822b71b94 100644
--- a/libstdc++-v3/include/std/ranges
+++ b/libstdc++-v3/include/std/ranges
@@ -2121,8 +2121,8 @@ namespace views::__adaptor
take_view() requires default_initializable<_Vp> = default;
constexpr
- take_view(_Vp base, range_difference_t<_Vp> __count)
- : _M_base(std::move(base)), _M_count(std::move(__count))
+ take_view(_Vp __base, range_difference_t<_Vp> __count)
+ : _M_base(std::move(__base)), _M_count(std::move(__count))
{ }
constexpr _Vp
@@ -2355,8 +2355,8 @@ namespace views::__adaptor
= default;
constexpr
- take_while_view(_Vp base, _Pred __pred)
- : _M_base(std::move(base)), _M_pred(std::move(__pred))
+ take_while_view(_Vp __base, _Pred __pred)
+ : _M_base(std::move(__base)), _M_pred(std::move(__pred))
{ }
constexpr _Vp
@@ -3982,8 +3982,8 @@ namespace views::__adaptor
elements_view() requires default_initializable<_Vp> = default;
constexpr explicit
- elements_view(_Vp base)
- : _M_base(std::move(base))
+ elements_view(_Vp __base)
+ : _M_base(std::move(__base))
{ }
constexpr _Vp
@@ -4753,9 +4753,8 @@ namespace views::__adaptor
{
template<typename... _Ts>
requires (sizeof...(_Ts) == 0 || __detail::__can_zip_view<_Ts...>)
- [[nodiscard]]
constexpr auto
- operator()(_Ts&&... __ts) const
+ operator() [[nodiscard]] (_Ts&&... __ts) const
{
if constexpr (sizeof...(_Ts) == 0)
return views::empty<tuple<>>;
@@ -5036,22 +5035,22 @@ namespace views::__adaptor
: _M_inner(std::move(__i._M_inner))
{ }
- template<bool OtherConst>
- requires sentinel_for<__zentinel<_Const>, __ziperator<OtherConst>>
+ template<bool _OtherConst>
+ requires sentinel_for<__zentinel<_Const>, __ziperator<_OtherConst>>
friend constexpr bool
- operator==(const _Iterator<OtherConst>& __x, const _Sentinel& __y)
+ operator==(const _Iterator<_OtherConst>& __x, const _Sentinel& __y)
{ return __x._M_inner == __y._M_inner; }
- template<bool OtherConst>
- requires sized_sentinel_for<__zentinel<_Const>, __ziperator<OtherConst>>
- friend constexpr range_difference_t<__detail::__maybe_const_t<OtherConst, _InnerView>>
- operator-(const _Iterator<OtherConst>& __x, const _Sentinel& __y)
+ template<bool _OtherConst>
+ requires sized_sentinel_for<__zentinel<_Const>, __ziperator<_OtherConst>>
+ friend constexpr range_difference_t<__detail::__maybe_const_t<_OtherConst, _InnerView>>
+ operator-(const _Iterator<_OtherConst>& __x, const _Sentinel& __y)
{ return __x._M_inner - __y._M_inner; }
- template<bool OtherConst>
- requires sized_sentinel_for<__zentinel<_Const>, __ziperator<OtherConst>>
- friend constexpr range_difference_t<__detail::__maybe_const_t<OtherConst, _InnerView>>
- operator-(const _Sentinel& __x, const _Iterator<OtherConst>& __y)
+ template<bool _OtherConst>
+ requires sized_sentinel_for<__zentinel<_Const>, __ziperator<_OtherConst>>
+ friend constexpr range_difference_t<__detail::__maybe_const_t<_OtherConst, _InnerView>>
+ operator-(const _Sentinel& __x, const _Iterator<_OtherConst>& __y)
{ return __x._M_inner - __y._M_inner; }
};
@@ -5068,9 +5067,8 @@ namespace views::__adaptor
{
template<typename _Fp, typename... _Ts>
requires (sizeof...(_Ts) == 0) || __detail::__can_zip_transform_view<_Fp, _Ts...>
- [[nodiscard]]
constexpr auto
- operator()(_Fp&& __f, _Ts&&... __ts) const
+ operator() [[nodiscard]] (_Fp&& __f, _Ts&&... __ts) const
{
if constexpr (sizeof...(_Ts) == 0)
return views::empty<decay_t<invoke_result_t<_Fp>>>;
--
2.37.2.490.g6c8e4ee870
^ permalink raw reply [flat|nested] 2+ messages in thread
* Re: [PATCH] libstdc++: A few more minor <ranges> cleanups
2022-08-31 19:27 [PATCH] libstdc++: A few more minor <ranges> cleanups Patrick Palka
@ 2022-08-31 20:09 ` Jonathan Wakely
0 siblings, 0 replies; 2+ messages in thread
From: Jonathan Wakely @ 2022-08-31 20:09 UTC (permalink / raw)
To: Patrick Palka; +Cc: gcc-patches, libstdc++
On Wed, 31 Aug 2022 at 20:27, Patrick Palka via Libstdc++
<libstdc++@gcc.gnu.org> wrote:
>
> Tested on x86_64-pc-linux-gnu, does this look OK for trunk?
OK, thanks.
^ permalink raw reply [flat|nested] 2+ messages in thread
end of thread, other threads:[~2022-08-31 20:09 UTC | newest]
Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2022-08-31 19:27 [PATCH] libstdc++: A few more minor <ranges> cleanups Patrick Palka
2022-08-31 20:09 ` Jonathan Wakely
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).