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.129.124]) by sourceware.org (Postfix) with ESMTPS id 349B83858031 for ; Tue, 14 Dec 2021 21:47:53 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.4.1 sourceware.org 349B83858031 Received: from mimecast-mx01.redhat.com (mimecast-mx01.redhat.com [209.132.183.4]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id us-mta-459-Kz75zQ7nOTO1LvRacVY1Ug-1; Tue, 14 Dec 2021 16:47:49 -0500 X-MC-Unique: Kz75zQ7nOTO1LvRacVY1Ug-1 Received: from smtp.corp.redhat.com (int-mx05.intmail.prod.int.phx2.redhat.com [10.5.11.15]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mimecast-mx01.redhat.com (Postfix) with ESMTPS id 6CF5981CCB6; Tue, 14 Dec 2021 21:47:48 +0000 (UTC) Received: from localhost (unknown [10.33.36.71]) by smtp.corp.redhat.com (Postfix) with ESMTP id 1C5F354532; Tue, 14 Dec 2021 21:47:47 +0000 (UTC) From: Jonathan Wakely To: libstdc++@gcc.gnu.org, gcc-patches@gcc.gnu.org Subject: [committed] libstdc++: Simplify typedefs by using __UINTPTR_TYPE__ Date: Tue, 14 Dec 2021 21:47:47 +0000 Message-Id: <20211214214747.2133070-1-jwakely@redhat.com> MIME-Version: 1.0 X-Scanned-By: MIMEDefang 2.79 on 10.5.11.15 X-Mimecast-Spam-Score: 0 X-Mimecast-Originator: redhat.com Content-Transfer-Encoding: 8bit Content-Type: text/plain; charset="US-ASCII" 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_LOW, RCVD_IN_MSPIKE_H3, RCVD_IN_MSPIKE_WL, SPF_HELO_NONE, SPF_NONE, TXREP autolearn=unavailable autolearn_force=no version=3.4.4 X-Spam-Checker-Version: SpamAssassin 3.4.4 (2020-01-24) 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: Tue, 14 Dec 2021 21:47:55 -0000 Tested powerpc64le-linux, pushed to trunk. libstdc++-v3/ChangeLog: * include/ext/pointer.h (_Relative_pointer_impl::_UIntPtrType): Rename to uintptr_t and define as __UINTPTR_TYPE__. --- libstdc++-v3/include/ext/pointer.h | 50 ++++++++++++------------------ 1 file changed, 19 insertions(+), 31 deletions(-) diff --git a/libstdc++-v3/include/ext/pointer.h b/libstdc++-v3/include/ext/pointer.h index 6bed55f642d..5bf638a0c28 100644 --- a/libstdc++-v3/include/ext/pointer.h +++ b/libstdc++-v3/include/ext/pointer.h @@ -120,7 +120,7 @@ _GLIBCXX_BEGIN_NAMESPACE_VERSION if (_M_diff == 1) return 0; else - return reinterpret_cast<_Tp*>(reinterpret_cast<_UIntPtrType>(this) + return reinterpret_cast<_Tp*>(reinterpret_cast(this) + _M_diff); } @@ -130,30 +130,24 @@ _GLIBCXX_BEGIN_NAMESPACE_VERSION if (!__arg) _M_diff = 1; else - _M_diff = reinterpret_cast<_UIntPtrType>(__arg) - - reinterpret_cast<_UIntPtrType>(this); + _M_diff = reinterpret_cast(__arg) + - reinterpret_cast(this); } // Comparison of pointers inline bool operator<(const _Relative_pointer_impl& __rarg) const - { return (reinterpret_cast<_UIntPtrType>(this->get()) - < reinterpret_cast<_UIntPtrType>(__rarg.get())); } + { return (reinterpret_cast(this->get()) + < reinterpret_cast(__rarg.get())); } inline bool operator==(const _Relative_pointer_impl& __rarg) const - { return (reinterpret_cast<_UIntPtrType>(this->get()) - == reinterpret_cast<_UIntPtrType>(__rarg.get())); } + { return (reinterpret_cast(this->get()) + == reinterpret_cast(__rarg.get())); } private: -#ifdef _GLIBCXX_USE_LONG_LONG - typedef __gnu_cxx::__conditional_type< - (sizeof(unsigned long) >= sizeof(void*)), - unsigned long, unsigned long long>::__type _UIntPtrType; -#else - typedef unsigned long _UIntPtrType; -#endif - _UIntPtrType _M_diff; + typedef __UINTPTR_TYPE__ uintptr_t; + uintptr_t _M_diff; }; /** @@ -173,7 +167,7 @@ _GLIBCXX_BEGIN_NAMESPACE_VERSION return 0; else return reinterpret_cast - (reinterpret_cast<_UIntPtrType>(this) + _M_diff); + (reinterpret_cast(this) + _M_diff); } void @@ -182,30 +176,24 @@ _GLIBCXX_BEGIN_NAMESPACE_VERSION if (!__arg) _M_diff = 1; else - _M_diff = reinterpret_cast<_UIntPtrType>(__arg) - - reinterpret_cast<_UIntPtrType>(this); + _M_diff = reinterpret_cast(__arg) + - reinterpret_cast(this); } // Comparison of pointers inline bool operator<(const _Relative_pointer_impl& __rarg) const - { return (reinterpret_cast<_UIntPtrType>(this->get()) - < reinterpret_cast<_UIntPtrType>(__rarg.get())); } + { return (reinterpret_cast(this->get()) + < reinterpret_cast(__rarg.get())); } inline bool operator==(const _Relative_pointer_impl& __rarg) const - { return (reinterpret_cast<_UIntPtrType>(this->get()) - == reinterpret_cast<_UIntPtrType>(__rarg.get())); } + { return (reinterpret_cast(this->get()) + == reinterpret_cast(__rarg.get())); } private: -#ifdef _GLIBCXX_USE_LONG_LONG - typedef __gnu_cxx::__conditional_type< - (sizeof(unsigned long) >= sizeof(void*)), - unsigned long, unsigned long long>::__type _UIntPtrType; -#else - typedef unsigned long _UIntPtrType; -#endif - _UIntPtrType _M_diff; + typedef __UINTPTR_TYPE__ uintptr_t; + uintptr_t _M_diff; }; /** @@ -597,7 +585,7 @@ _GLIBCXX_BEGIN_NAMESPACE_VERSION template using rebind = typename __gnu_cxx::_Pointer_adapter< - typename pointer_traits<_Storage_policy>::template rebind<_Up>>; + typename pointer_traits<_Storage_policy>::template rebind<_Up>>; static pointer pointer_to(typename pointer::reference __r) noexcept { return pointer(std::addressof(__r)); } -- 2.31.1