public inbox for libstdc++-cvs@sourceware.org
help / color / mirror / Atom feed
From: Jonathan Wakely <redi@gcc.gnu.org>
To: gcc-cvs@gcc.gnu.org, libstdc++-cvs@gcc.gnu.org
Subject: [gcc r12-5976] libstdc++: Simplify typedefs by using __UINTPTR_TYPE__
Date: Tue, 14 Dec 2021 21:47:30 +0000 (GMT)	[thread overview]
Message-ID: <20211214214730.A10E63858427@sourceware.org> (raw)

https://gcc.gnu.org/g:fda28722703d7ab8903ce5f616e3efed1bbdbc25

commit r12-5976-gfda28722703d7ab8903ce5f616e3efed1bbdbc25
Author: Jonathan Wakely <jwakely@redhat.com>
Date:   Tue Dec 14 14:21:18 2021 +0000

    libstdc++: Simplify typedefs by using __UINTPTR_TYPE__
    
    libstdc++-v3/ChangeLog:
    
            * include/ext/pointer.h (_Relative_pointer_impl::_UIntPtrType):
            Rename to uintptr_t and define as __UINTPTR_TYPE__.

Diff:
---
 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<uintptr_t>(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<uintptr_t>(__arg) 
+                    - reinterpret_cast<uintptr_t>(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<uintptr_t>(this->get())
+		< reinterpret_cast<uintptr_t>(__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<uintptr_t>(this->get())
+		== reinterpret_cast<uintptr_t>(__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<const _Tp*>
-	      (reinterpret_cast<_UIntPtrType>(this) + _M_diff);
+	      (reinterpret_cast<uintptr_t>(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<uintptr_t>(__arg) 
+                    - reinterpret_cast<uintptr_t>(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<uintptr_t>(this->get())
+		< reinterpret_cast<uintptr_t>(__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<uintptr_t>(this->get())
+		== reinterpret_cast<uintptr_t>(__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<typename _Up>
         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)); }


                 reply	other threads:[~2021-12-14 21:47 UTC|newest]

Thread overview: [no followups] expand[flat|nested]  mbox.gz  Atom feed

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20211214214730.A10E63858427@sourceware.org \
    --to=redi@gcc.gnu.org \
    --cc=gcc-cvs@gcc.gnu.org \
    --cc=libstdc++-cvs@gcc.gnu.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
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).