From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from us-smtp-delivery-124.mimecast.com (us-smtp-delivery-124.mimecast.com [170.10.133.124]) by sourceware.org (Postfix) with ESMTPS id 74D0F385800F for ; Wed, 31 Aug 2022 19:27:14 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.4.1 sourceware.org 74D0F385800F Authentication-Results: sourceware.org; dmarc=pass (p=none dis=none) header.from=redhat.com Authentication-Results: sourceware.org; spf=pass smtp.mailfrom=redhat.com DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1661974034; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding; bh=LU1N6OYMKxxpXLss60Mh7VuIUKXliPCnEYpQGHqOdcs=; b=ZSgtExMBLB8IRHgm80YrxzEIEhssHOxyWpQCxrlH+MRWulFMVXkI0I9y6hyhkDj+PVCBsm OIhAxq/DqZPWFkZ4LmmGrpH/xtKxC/pB3g+u1KekCN4cMtxHqvQaLSfqVXqZ+2irHURIN7 VAev2sOjoOpO2V7qHWNIgG6K63IV6m0= Received: from mail-qk1-f198.google.com (mail-qk1-f198.google.com [209.85.222.198]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.3, cipher=TLS_AES_128_GCM_SHA256) id us-mta-632-orFUoryAMX-aAW9LJigoGQ-1; Wed, 31 Aug 2022 15:27:12 -0400 X-MC-Unique: orFUoryAMX-aAW9LJigoGQ-1 Received: by mail-qk1-f198.google.com with SMTP id bs43-20020a05620a472b00b006bb56276c94so12555110qkb.10 for ; Wed, 31 Aug 2022 12:27:12 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=content-transfer-encoding:mime-version:message-id:date:subject:cc :to:from:x-gm-message-state:from:to:cc:subject:date; bh=LU1N6OYMKxxpXLss60Mh7VuIUKXliPCnEYpQGHqOdcs=; b=N1QWehNAvTBpCORkTEscHFBZ9OTBWbZT9OvZ7B+02g1gTFs8e5WNP5ccFNKapyf+Ut yYZPH32pq3O62B/v34GvJ45gBa1PdGijwb7dsqlnijVNHkpYIR4XlV5swpL6DHpXTpRr lfyvzmP+cUGL0h+5bx/ZKZAeHnjYeWvILnVsihbIRVzPXvXmdvtms4WyLD5use89xrOZ tX3FNhKUG3MuIQOuKgtRWc49qJ7GPOxXKr9hQnHVHYY8Pm0pQerrNiKQYphG9zmxPakt 9Xj9nZyajdWnikgPE5abmrP+CMGaSEnxuGAfejVs5U/J1qjFGdz6exLTZ5238r3KdDu+ XoJw== X-Gm-Message-State: ACgBeo0nLHBLxWHXEG4aKTzp7+3lKd3Fced/uMqmZqcA/H7dnbPOzivn U6c77BkyHbNg68czg+4q/WV0Rt42KeCK6tSElVzzZGfKw/2JVs02YiFSv9yQoBGY6W3MwHsJ3Le 509ejUReuGm9CYHo= X-Received: by 2002:a37:e102:0:b0:6bf:5ac1:37a6 with SMTP id c2-20020a37e102000000b006bf5ac137a6mr2393555qkm.120.1661974031554; Wed, 31 Aug 2022 12:27:11 -0700 (PDT) X-Google-Smtp-Source: AA6agR7URl/S4EtByGJMJn8UnS4YKdAGH1fSj1n1+og1eN49Ya+J6sWy3tIz1IfNFF8dI4sFf/2Lug== X-Received: by 2002:a37:e102:0:b0:6bf:5ac1:37a6 with SMTP id c2-20020a37e102000000b006bf5ac137a6mr2393547qkm.120.1661974031306; Wed, 31 Aug 2022 12:27:11 -0700 (PDT) Received: from localhost.localdomain (ool-457670bb.dyn.optonline.net. [69.118.112.187]) by smtp.gmail.com with ESMTPSA id bm2-20020a05620a198200b006b5f06186aesm10775956qkb.65.2022.08.31.12.27.09 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 31 Aug 2022 12:27:10 -0700 (PDT) From: Patrick Palka To: gcc-patches@gcc.gnu.org Cc: libstdc++@gcc.gnu.org, Patrick Palka Subject: [PATCH] libstdc++: A few more minor cleanups Date: Wed, 31 Aug 2022 15:27:08 -0400 Message-Id: <20220831192708.171764-1-ppalka@redhat.com> X-Mailer: git-send-email 2.37.2.490.g6c8e4ee870 MIME-Version: 1.0 X-Mimecast-Spam-Score: 0 X-Mimecast-Originator: redhat.com Content-Transfer-Encoding: 8bit Content-Type: text/plain; charset="US-ASCII"; x-default=true X-Spam-Status: No, score=-14.0 required=5.0 tests=BAYES_00,DKIMWL_WL_HIGH,DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,GIT_PATCH_0,RCVD_IN_DNSWL_NONE,SPF_HELO_NONE,SPF_NONE,TXREP,T_SCC_BODY_TEXT_LINE autolearn=unavailable autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on server2.sourceware.org List-Id: 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 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>; @@ -5036,22 +5035,22 @@ namespace views::__adaptor : _M_inner(std::move(__i._M_inner)) { } - template - requires sentinel_for<__zentinel<_Const>, __ziperator> + template + requires sentinel_for<__zentinel<_Const>, __ziperator<_OtherConst>> friend constexpr bool - operator==(const _Iterator& __x, const _Sentinel& __y) + operator==(const _Iterator<_OtherConst>& __x, const _Sentinel& __y) { return __x._M_inner == __y._M_inner; } - template - requires sized_sentinel_for<__zentinel<_Const>, __ziperator> - friend constexpr range_difference_t<__detail::__maybe_const_t> - operator-(const _Iterator& __x, const _Sentinel& __y) + template + 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 - requires sized_sentinel_for<__zentinel<_Const>, __ziperator> - friend constexpr range_difference_t<__detail::__maybe_const_t> - operator-(const _Sentinel& __x, const _Iterator& __y) + template + 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 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>>; -- 2.37.2.490.g6c8e4ee870