From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from us-smtp-1.mimecast.com (us-smtp-2.mimecast.com [205.139.110.61]) by sourceware.org (Postfix) with ESMTP id EB0153857025 for ; Mon, 6 Jul 2020 21:07:37 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.3.2 sourceware.org EB0153857025 Received: from mimecast-mx01.redhat.com (mimecast-mx01.redhat.com [209.132.183.4]) (Using TLS) by relay.mimecast.com with ESMTP id us-mta-208-_fizyh4HOham9utV_TkP9g-1; Mon, 06 Jul 2020 17:07:35 -0400 X-MC-Unique: _fizyh4HOham9utV_TkP9g-1 Received: from smtp.corp.redhat.com (int-mx06.intmail.prod.int.phx2.redhat.com [10.5.11.16]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mimecast-mx01.redhat.com (Postfix) with ESMTPS id 6222CBFCC; Mon, 6 Jul 2020 21:07:34 +0000 (UTC) Received: from localhost (unknown [10.33.36.181]) by smtp.corp.redhat.com (Postfix) with ESMTP id DB4ED5C290; Mon, 6 Jul 2020 21:07:33 +0000 (UTC) Date: Mon, 6 Jul 2020 22:07:33 +0100 From: Jonathan Wakely To: libstdc++@gcc.gnu.org, gcc-patches@gcc.gnu.org Subject: [committed 3/3] libstdc++: Cleanup whitespace and type trait usage in Message-ID: <20200706210733.GE4137376@redhat.com> References: <20200706210551.GA750840@redhat.com> <20200706210646.GD4137376@redhat.com> MIME-Version: 1.0 In-Reply-To: <20200706210646.GD4137376@redhat.com> X-Clacks-Overhead: GNU Terry Pratchett X-Scanned-By: MIMEDefang 2.79 on 10.5.11.16 X-Mimecast-Spam-Score: 0 X-Mimecast-Originator: redhat.com Content-Type: multipart/mixed; boundary="//h4sZKAxcnndsN6" Content-Disposition: inline X-Spam-Status: No, score=-15.3 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, RCVD_IN_MSPIKE_H3, RCVD_IN_MSPIKE_WL, SPF_HELO_NONE, SPF_PASS, TXREP autolearn=ham autolearn_force=no version=3.4.2 X-Spam-Checker-Version: SpamAssassin 3.4.2 (2018-09-13) on server2.sourceware.org X-BeenThere: libstdc++@gcc.gnu.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: Libstdc++ mailing list List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 06 Jul 2020 21:07:39 -0000 --//h4sZKAxcnndsN6 Content-Type: text/plain; charset=us-ascii; format=flowed Content-Disposition: inline This makes the formatting in consistent and also removes redundant && tokens from template arguments for traits like is_constructible and is_convertible. libstdc++-v3/ChangeLog: * include/std/optional (_Optional_payload_base, _Optional_base) (optional, __optional_hash_call_base): Adjust whitespace and other formatting. Remove redundant && tokens on template arguments to type traits. Tested powerpc64le-linux, committed to trunk. --//h4sZKAxcnndsN6 Content-Type: text/x-patch; charset=us-ascii Content-Disposition: attachment; filename="patch.txt" commit 6e1c9715b3142bc09e313c0d4b196694ab7ae153 Author: Jonathan Wakely Date: Mon Jul 6 21:54:12 2020 +0100 libstdc++: Cleanup whitespace and type trait usage in This makes the formatting in consistent and also removes redundant && tokens from template arguments for traits like is_constructible and is_convertible. libstdc++-v3/ChangeLog: * include/std/optional (_Optional_payload_base, _Optional_base) (optional, __optional_hash_call_base): Adjust whitespace and other formatting. Remove redundant && tokens on template arguments to type traits. diff --git a/libstdc++-v3/include/std/optional b/libstdc++-v3/include/std/optional index 24821f81d0f..f9f42efe09c 100644 --- a/libstdc++-v3/include/std/optional +++ b/libstdc++-v3/include/std/optional @@ -163,9 +163,9 @@ _GLIBCXX_BEGIN_NAMESPACE_VERSION constexpr void _M_copy_assign(const _Optional_payload_base& __other) { - if (this->_M_engaged && __other._M_engaged) - this->_M_get() = __other._M_get(); - else + if (this->_M_engaged && __other._M_engaged) + this->_M_get() = __other._M_get(); + else { if (__other._M_engaged) this->_M_construct(__other._M_get()); @@ -211,7 +211,7 @@ _GLIBCXX_BEGIN_NAMESPACE_VERSION { } _Empty_byte _M_empty; - _Up _M_value; + _Up _M_value; }; template @@ -235,7 +235,7 @@ _GLIBCXX_BEGIN_NAMESPACE_VERSION ~_Storage() { } _Empty_byte _M_empty; - _Up _M_value; + _Up _M_value; }; _Storage<_Stored_type> _M_payload; @@ -243,14 +243,14 @@ _GLIBCXX_BEGIN_NAMESPACE_VERSION bool _M_engaged = false; template - void - _M_construct(_Args&&... __args) - noexcept(is_nothrow_constructible_v<_Stored_type, _Args...>) - { - ::new ((void *) std::__addressof(this->_M_payload)) - _Stored_type(std::forward<_Args>(__args)...); - this->_M_engaged = true; - } + void + _M_construct(_Args&&... __args) + noexcept(is_nothrow_constructible_v<_Stored_type, _Args...>) + { + ::new ((void *) std::__addressof(this->_M_payload)) + _Stored_type(std::forward<_Args>(__args)...); + this->_M_engaged = true; + } constexpr void _M_destroy() noexcept @@ -471,39 +471,41 @@ _GLIBCXX_BEGIN_NAMESPACE_VERSION bool = is_trivially_copy_constructible_v<_Tp>, bool = is_trivially_move_constructible_v<_Tp>> struct _Optional_base - : _Optional_base_impl<_Tp, _Optional_base<_Tp>> + : _Optional_base_impl<_Tp, _Optional_base<_Tp>> { // Constructors for disengaged optionals. constexpr _Optional_base() = default; // Constructors for engaged optionals. template, bool> = false> - constexpr explicit _Optional_base(in_place_t, _Args&&... __args) - : _M_payload(in_place, - std::forward<_Args>(__args)...) { } + enable_if_t, bool> = false> + constexpr explicit + _Optional_base(in_place_t, _Args&&... __args) + : _M_payload(in_place, std::forward<_Args>(__args)...) + { } template&, - _Args&&...>, bool> = false> - constexpr explicit _Optional_base(in_place_t, - initializer_list<_Up> __il, - _Args&&... __args) - : _M_payload(in_place, - __il, std::forward<_Args>(__args)...) - { } + _Args...>, bool> = false> + constexpr explicit + _Optional_base(in_place_t, + initializer_list<_Up> __il, + _Args&&... __args) + : _M_payload(in_place, __il, std::forward<_Args>(__args)...) + { } // Copy and move constructors. - constexpr _Optional_base(const _Optional_base& __other) - : _M_payload(__other._M_payload._M_engaged, - __other._M_payload) + constexpr + _Optional_base(const _Optional_base& __other) + : _M_payload(__other._M_payload._M_engaged, __other._M_payload) { } - constexpr _Optional_base(_Optional_base&& __other) + constexpr + _Optional_base(_Optional_base&& __other) noexcept(is_nothrow_move_constructible_v<_Tp>) - : _M_payload(__other._M_payload._M_engaged, - std::move(__other._M_payload)) + : _M_payload(__other._M_payload._M_engaged, + std::move(__other._M_payload)) { } // Assignment operators. @@ -515,33 +517,33 @@ _GLIBCXX_BEGIN_NAMESPACE_VERSION template struct _Optional_base<_Tp, false, true> - : _Optional_base_impl<_Tp, _Optional_base<_Tp>> + : _Optional_base_impl<_Tp, _Optional_base<_Tp>> { // Constructors for disengaged optionals. constexpr _Optional_base() = default; // Constructors for engaged optionals. template, bool> = false> - constexpr explicit _Optional_base(in_place_t, _Args&&... __args) - : _M_payload(in_place, - std::forward<_Args>(__args)...) { } + enable_if_t, bool> = false> + constexpr explicit + _Optional_base(in_place_t, _Args&&... __args) + : _M_payload(in_place, std::forward<_Args>(__args)...) + { } template&, - _Args&&...>, bool> = false> - constexpr explicit _Optional_base(in_place_t, - initializer_list<_Up> __il, - _Args&&... __args) - : _M_payload(in_place, - __il, std::forward<_Args>(__args)...) - { } + _Args...>, bool> = false> + constexpr explicit + _Optional_base(in_place_t, + initializer_list<_Up> __il, + _Args... __args) + : _M_payload(in_place, __il, std::forward<_Args>(__args)...) + { } // Copy and move constructors. constexpr _Optional_base(const _Optional_base& __other) - : _M_payload(__other._M_payload._M_engaged, - __other._M_payload) + : _M_payload(__other._M_payload._M_engaged, __other._M_payload) { } constexpr _Optional_base(_Optional_base&& __other) = default; @@ -555,36 +557,38 @@ _GLIBCXX_BEGIN_NAMESPACE_VERSION template struct _Optional_base<_Tp, true, false> - : _Optional_base_impl<_Tp, _Optional_base<_Tp>> + : _Optional_base_impl<_Tp, _Optional_base<_Tp>> { // Constructors for disengaged optionals. constexpr _Optional_base() = default; // Constructors for engaged optionals. template, bool> = false> - constexpr explicit _Optional_base(in_place_t, _Args&&... __args) - : _M_payload(in_place, - std::forward<_Args>(__args)...) { } + enable_if_t, bool> = false> + constexpr explicit + _Optional_base(in_place_t, _Args&&... __args) + : _M_payload(in_place, std::forward<_Args>(__args)...) + { } template&, - _Args&&...>, bool> = false> - constexpr explicit _Optional_base(in_place_t, - initializer_list<_Up> __il, - _Args&&... __args) - : _M_payload(in_place, - __il, std::forward<_Args>(__args)...) - { } + _Args...>, bool> = false> + constexpr explicit + _Optional_base(in_place_t, + initializer_list<_Up> __il, + _Args&&... __args) + : _M_payload(in_place, __il, std::forward<_Args>(__args)...) + { } // Copy and move constructors. constexpr _Optional_base(const _Optional_base& __other) = default; - constexpr _Optional_base(_Optional_base&& __other) + constexpr + _Optional_base(_Optional_base&& __other) noexcept(is_nothrow_move_constructible_v<_Tp>) - : _M_payload(__other._M_payload._M_engaged, - std::move(__other._M_payload)) + : _M_payload(__other._M_payload._M_engaged, + std::move(__other._M_payload)) { } // Assignment operators. @@ -596,28 +600,29 @@ _GLIBCXX_BEGIN_NAMESPACE_VERSION template struct _Optional_base<_Tp, true, true> - : _Optional_base_impl<_Tp, _Optional_base<_Tp>> + : _Optional_base_impl<_Tp, _Optional_base<_Tp>> { // Constructors for disengaged optionals. constexpr _Optional_base() = default; // Constructors for engaged optionals. template, bool> = false> - constexpr explicit _Optional_base(in_place_t, _Args&&... __args) - : _M_payload(in_place, - std::forward<_Args>(__args)...) { } + enable_if_t, bool> = false> + constexpr explicit + _Optional_base(in_place_t, _Args&&... __args) + : _M_payload(in_place, std::forward<_Args>(__args)...) + { } template&, - _Args&&...>, bool> = false> - constexpr explicit _Optional_base(in_place_t, - initializer_list<_Up> __il, - _Args&&... __args) - : _M_payload(in_place, - __il, std::forward<_Args>(__args)...) - { } + _Args...>, bool> = false> + constexpr explicit + _Optional_base(in_place_t, + initializer_list<_Up> __il, + _Args&&... __args) + : _M_payload(in_place, __il, std::forward<_Args>(__args)...) + { } // Copy and move constructors. constexpr _Optional_base(const _Optional_base& __other) = default; @@ -694,8 +699,8 @@ _GLIBCXX_BEGIN_NAMESPACE_VERSION // Converting constructors for engaged optionals. template, __not_tag<_Up>, - is_constructible<_Tp, _Up&&>, - is_convertible<_Up&&, _Tp>> = true> + is_constructible<_Tp, _Up>, + is_convertible<_Up, _Tp>> = true> constexpr optional(_Up&& __t) noexcept(is_nothrow_constructible_v<_Tp, _Up>) @@ -703,12 +708,12 @@ _GLIBCXX_BEGIN_NAMESPACE_VERSION template, __not_tag<_Up>, - is_constructible<_Tp, _Up&&>, - __not_>> = false> + is_constructible<_Tp, _Up>, + __not_>> = false> explicit constexpr optional(_Up&& __t) noexcept(is_nothrow_constructible_v<_Tp, _Up>) - : _Base(std::in_place, std::forward<_Up>(__t)) { } + : _Base(std::in_place, std::forward<_Up>(__t)) { } template>, @@ -736,11 +741,11 @@ _GLIBCXX_BEGIN_NAMESPACE_VERSION emplace(*__t); } - template >, - is_constructible<_Tp, _Up&&>, - is_convertible<_Up&&, _Tp>, - __not_<__converts_from_optional<_Tp, _Up>>> = true> + template>, + is_constructible<_Tp, _Up>, + is_convertible<_Up, _Tp>, + __not_<__converts_from_optional<_Tp, _Up>>> = true> constexpr optional(optional<_Up>&& __t) noexcept(is_nothrow_constructible_v<_Tp, _Up>) @@ -749,11 +754,11 @@ _GLIBCXX_BEGIN_NAMESPACE_VERSION emplace(std::move(*__t)); } - template >, - is_constructible<_Tp, _Up&&>, - __not_>, - __not_<__converts_from_optional<_Tp, _Up>>> = false> + template>, + is_constructible<_Tp, _Up>, + __not_>, + __not_<__converts_from_optional<_Tp, _Up>>> = false> explicit constexpr optional(optional<_Up>&& __t) noexcept(is_nothrow_constructible_v<_Tp, _Up>) @@ -763,7 +768,7 @@ _GLIBCXX_BEGIN_NAMESPACE_VERSION } template> = false> + _Requires> = false> explicit constexpr optional(in_place_t, _Args&&... __args) noexcept(is_nothrow_constructible_v<_Tp, _Args...>) @@ -772,7 +777,7 @@ _GLIBCXX_BEGIN_NAMESPACE_VERSION template&, - _Args&&...>> = false> + _Args...>> = false> explicit constexpr optional(in_place_t, initializer_list<_Up> __il, _Args&&... __args) noexcept(is_nothrow_constructible_v<_Tp, initializer_list<_Up>&, @@ -833,7 +838,7 @@ _GLIBCXX_BEGIN_NAMESPACE_VERSION } template - enable_if_t<__and_v<__not_>, + enable_if_t<__and_v<__not_>, is_constructible<_Tp, _Up>, is_assignable<_Tp&, _Up>, __not_<__converts_from_optional<_Tp, _Up>>, @@ -859,7 +864,7 @@ _GLIBCXX_BEGIN_NAMESPACE_VERSION } template - enable_if_t, _Tp&> + enable_if_t, _Tp&> emplace(_Args&&... __args) noexcept(is_nothrow_constructible_v<_Tp, _Args...>) { @@ -869,8 +874,8 @@ _GLIBCXX_BEGIN_NAMESPACE_VERSION } template - enable_if_t&, - _Args&&...>, _Tp&> + enable_if_t&, _Args...>, + _Tp&> emplace(initializer_list<_Up> __il, _Args&&... __args) noexcept(is_nothrow_constructible_v<_Tp, initializer_list<_Up>&, _Args...>) @@ -1246,17 +1251,17 @@ _GLIBCXX_BEGIN_NAMESPACE_VERSION // Hash. template, - bool = __poison_hash<_Up>::__enable_hash_call> + bool = __poison_hash<_Up>::__enable_hash_call> struct __optional_hash_call_base { size_t operator()(const optional<_Tp>& __t) const noexcept(noexcept(hash<_Up>{}(*__t))) { - // We pick an arbitrary hash for disengaged optionals which hopefully - // usual values of _Tp won't typically hash to. - constexpr size_t __magic_disengaged_hash = static_cast(-3333); - return __t ? hash<_Up>{}(*__t) : __magic_disengaged_hash; + // We pick an arbitrary hash for disengaged optionals which hopefully + // usual values of _Tp won't typically hash to. + constexpr size_t __magic_disengaged_hash = static_cast(-3333); + return __t ? hash<_Up>{}(*__t) : __magic_disengaged_hash; } }; --//h4sZKAxcnndsN6--