Boost logo

Boost-Commit :

Subject: [Boost-commit] svn:boost r84805 - in trunk/boost: . atomic
From: andrey.semashev_at_[hidden]
Date: 2013-06-16 11:02:27


Author: andysem
Date: 2013-06-16 11:02:27 EDT (Sun, 16 Jun 2013)
New Revision: 84805
URL: http://svn.boost.org/trac/boost/changeset/84805

Log:
Extracted intptr_t and uintptr_t types to cstdint.hpp. Refs #7823.

Text files modified:
   trunk/boost/atomic/atomic.hpp | 18 ---
   trunk/boost/cstdint.hpp | 216 +++++++++++++++++++++++----------------
   2 files changed, 126 insertions(+), 108 deletions(-)

Modified: trunk/boost/atomic/atomic.hpp
==============================================================================
--- trunk/boost/atomic/atomic.hpp Sun Jun 16 10:01:04 2013 (r84804)
+++ trunk/boost/atomic/atomic.hpp 2013-06-16 11:02:27 EDT (Sun, 16 Jun 2013) (r84805)
@@ -196,25 +196,9 @@
 typedef atomic<std::size_t> atomic_size_t;
 typedef atomic<std::ptrdiff_t> atomic_ptrdiff_t;
 
-// PGI seems to not support intptr_t/uintptr_t properly. BOOST_HAS_STDINT_H is not defined for this compiler by Boost.Config.
-#if !defined(__PGIC__)
-
-#if (defined(BOOST_WINDOWS) && !defined(_WIN32_WCE)) \
- || (defined(_XOPEN_UNIX) && (_XOPEN_UNIX+0 > 0) && !defined(__UCLIBC__)) \
- || defined(__CYGWIN__) \
- || defined(macintosh) || defined(__APPLE__) || defined(__APPLE_CC__) \
- || defined(__FreeBSD__) || defined(__NetBSD__) || defined(__OpenBSD__) || defined(__DragonFly__)
+#if defined(BOOST_HAS_INTPTR_T)
 typedef atomic<intptr_t> atomic_intptr_t;
 typedef atomic<uintptr_t> atomic_uintptr_t;
-#elif defined(__GNUC__) || defined(__clang__)
-#if defined(__INTPTR_TYPE__)
-typedef atomic< __INTPTR_TYPE__ > atomic_intptr_t;
-#endif
-#if defined(__UINTPTR_TYPE__)
-typedef atomic< __UINTPTR_TYPE__ > atomic_uintptr_t;
-#endif
-#endif
-
 #endif
 
 #ifndef BOOST_ATOMIC_FLAG_LOCK_FREE

Modified: trunk/boost/cstdint.hpp
==============================================================================
--- trunk/boost/cstdint.hpp Sun Jun 16 10:01:04 2013 (r84804)
+++ trunk/boost/cstdint.hpp 2013-06-16 11:02:27 EDT (Sun, 16 Jun 2013) (r84805)
@@ -1,8 +1,8 @@
 // boost cstdint.hpp header file ------------------------------------------//
 
-// (C) Copyright Beman Dawes 1999.
-// (C) Copyright Jens Mauer 2001
-// (C) Copyright John Maddock 2001
+// (C) Copyright Beman Dawes 1999.
+// (C) Copyright Jens Mauer 2001
+// (C) Copyright John Maddock 2001
 // Distributed under the Boost
 // Software License, Version 1.0. (See accompanying file
 // LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt)
@@ -24,9 +24,9 @@
 #define BOOST_CSTDINT_HPP
 
 //
-// Since we always define the INT#_C macros as per C++0x,
+// Since we always define the INT#_C macros as per C++0x,
 // define __STDC_CONSTANT_MACROS so that <stdint.h> does the right
-// thing if possible, and so that the user knows that the macros
+// thing if possible, and so that the user knows that the macros
 // are actually defined as per C99.
 //
 #ifndef __STDC_CONSTANT_MACROS
@@ -50,7 +50,7 @@
 # ifdef __STDC_32_MODE__
       // this is triggered with GCC, because it defines __cplusplus < 199707L
 # define BOOST_NO_INT64_T
-# endif
+# endif
 # elif defined(__FreeBSD__) || defined(__IBMCPP__) || defined(_AIX)
 # include <inttypes.h>
 # else
@@ -100,40 +100,40 @@
 namespace boost
 {
 
- using ::int8_t;
- using ::int_least8_t;
- using ::int_fast8_t;
- using ::uint8_t;
- using ::uint_least8_t;
- using ::uint_fast8_t;
-
- using ::int16_t;
- using ::int_least16_t;
- using ::int_fast16_t;
- using ::uint16_t;
- using ::uint_least16_t;
- using ::uint_fast16_t;
-
- using ::int32_t;
- using ::int_least32_t;
- using ::int_fast32_t;
- using ::uint32_t;
- using ::uint_least32_t;
- using ::uint_fast32_t;
-
+ using ::int8_t;
+ using ::int_least8_t;
+ using ::int_fast8_t;
+ using ::uint8_t;
+ using ::uint_least8_t;
+ using ::uint_fast8_t;
+
+ using ::int16_t;
+ using ::int_least16_t;
+ using ::int_fast16_t;
+ using ::uint16_t;
+ using ::uint_least16_t;
+ using ::uint_fast16_t;
+
+ using ::int32_t;
+ using ::int_least32_t;
+ using ::int_fast32_t;
+ using ::uint32_t;
+ using ::uint_least32_t;
+ using ::uint_fast32_t;
+
 # ifndef BOOST_NO_INT64_T
 
- using ::int64_t;
- using ::int_least64_t;
- using ::int_fast64_t;
- using ::uint64_t;
- using ::uint_least64_t;
- using ::uint_fast64_t;
-
+ using ::int64_t;
+ using ::int_least64_t;
+ using ::int_fast64_t;
+ using ::uint64_t;
+ using ::uint_least64_t;
+ using ::uint_fast64_t;
+
 # endif
 
- using ::intmax_t;
- using ::uintmax_t;
+ using ::intmax_t;
+ using ::uintmax_t;
 
 } // namespace boost
 
@@ -143,35 +143,35 @@
 
 namespace boost {
 
- using ::int8_t;
- typedef int8_t int_least8_t;
- typedef int8_t int_fast8_t;
- using ::uint8_t;
- typedef uint8_t uint_least8_t;
- typedef uint8_t uint_fast8_t;
-
- using ::int16_t;
- typedef int16_t int_least16_t;
- typedef int16_t int_fast16_t;
- using ::uint16_t;
- typedef uint16_t uint_least16_t;
- typedef uint16_t uint_fast16_t;
-
- using ::int32_t;
- typedef int32_t int_least32_t;
- typedef int32_t int_fast32_t;
- using ::uint32_t;
- typedef uint32_t uint_least32_t;
- typedef uint32_t uint_fast32_t;
-
-# ifndef BOOST_NO_INT64_T
-
- using ::int64_t;
- typedef int64_t int_least64_t;
- typedef int64_t int_fast64_t;
- using ::uint64_t;
- typedef uint64_t uint_least64_t;
- typedef uint64_t uint_fast64_t;
+ using ::int8_t;
+ typedef int8_t int_least8_t;
+ typedef int8_t int_fast8_t;
+ using ::uint8_t;
+ typedef uint8_t uint_least8_t;
+ typedef uint8_t uint_fast8_t;
+
+ using ::int16_t;
+ typedef int16_t int_least16_t;
+ typedef int16_t int_fast16_t;
+ using ::uint16_t;
+ typedef uint16_t uint_least16_t;
+ typedef uint16_t uint_fast16_t;
+
+ using ::int32_t;
+ typedef int32_t int_least32_t;
+ typedef int32_t int_fast32_t;
+ using ::uint32_t;
+ typedef uint32_t uint_least32_t;
+ typedef uint32_t uint_fast32_t;
+
+# ifndef BOOST_NO_INT64_T
+
+ using ::int64_t;
+ typedef int64_t int_least64_t;
+ typedef int64_t int_fast64_t;
+ using ::uint64_t;
+ typedef uint64_t uint_least64_t;
+ typedef uint64_t uint_fast64_t;
 
   typedef int64_t intmax_t;
   typedef uint64_t uintmax_t;
@@ -235,15 +235,15 @@
      typedef unsigned short uint_least16_t;
      typedef unsigned short uint_fast16_t;
 # endif
-# elif (USHRT_MAX == 0xffffffff) && defined(__MTA__)
- // On MTA / XMT short is 32 bits unless the -short16 compiler flag is specified
- // MTA / XMT does support the following non-standard integer types
- typedef __short16 int16_t;
- typedef __short16 int_least16_t;
- typedef __short16 int_fast16_t;
- typedef unsigned __short16 uint16_t;
- typedef unsigned __short16 uint_least16_t;
- typedef unsigned __short16 uint_fast16_t;
+# elif (USHRT_MAX == 0xffffffff) && defined(__MTA__)
+ // On MTA / XMT short is 32 bits unless the -short16 compiler flag is specified
+ // MTA / XMT does support the following non-standard integer types
+ typedef __short16 int16_t;
+ typedef __short16 int_least16_t;
+ typedef __short16 int_fast16_t;
+ typedef unsigned __short16 uint16_t;
+ typedef unsigned __short16 uint_least16_t;
+ typedef unsigned __short16 uint_fast16_t;
 # elif (USHRT_MAX == 0xffffffff) && defined(CRAY)
      // no 16-bit types on Cray:
      typedef short int_least16_t;
@@ -277,14 +277,14 @@
      typedef unsigned long uint32_t;
      typedef unsigned long uint_least32_t;
      typedef unsigned long uint_fast32_t;
-# elif (UINT_MAX == 0xffffffffffffffff) && defined(__MTA__)
- // Integers are 64 bits on the MTA / XMT
- typedef __int32 int32_t;
- typedef __int32 int_least32_t;
- typedef __int32 int_fast32_t;
- typedef unsigned __int32 uint32_t;
- typedef unsigned __int32 uint_least32_t;
- typedef unsigned __int32 uint_fast32_t;
+# elif (UINT_MAX == 0xffffffffffffffff) && defined(__MTA__)
+ // Integers are 64 bits on the MTA / XMT
+ typedef __int32 int32_t;
+ typedef __int32 int_least32_t;
+ typedef __int32 int_fast32_t;
+ typedef unsigned __int32 uint32_t;
+ typedef unsigned __int32 uint_least32_t;
+ typedef unsigned __int32 uint_fast32_t;
 # else
 # error defaults not correct; you must hand modify boost/cstdint.hpp
 # endif
@@ -358,6 +358,40 @@
 
 #endif // BOOST_HAS_STDINT_H
 
+// intptr_t/uintptr_t are defined separately because they are optional and not universally available
+#if defined(BOOST_WINDOWS) && !defined(_WIN32_WCE) && !defined(BOOST_HAS_STDINT_H)
+// Older MSVC don't have stdint.h and have intptr_t/uintptr_t defined in stddef.h
+#include <stddef.h>
+#endif
+
+// PGI seems to not support intptr_t/uintptr_t properly. BOOST_HAS_STDINT_H is not defined for this compiler by Boost.Config.
+#if !defined(__PGIC__)
+
+#if (defined(BOOST_WINDOWS) && !defined(_WIN32_WCE)) \
+ || (defined(_XOPEN_UNIX) && (_XOPEN_UNIX+0 > 0) && !defined(__UCLIBC__)) \
+ || defined(__CYGWIN__) \
+ || defined(macintosh) || defined(__APPLE__) || defined(__APPLE_CC__) \
+ || defined(__FreeBSD__) || defined(__NetBSD__) || defined(__OpenBSD__) || defined(__DragonFly__)
+
+namespace boost {
+ using ::intptr_t;
+ using ::uintptr_t;
+}
+#define BOOST_HAS_INTPTR_T
+
+// Clang pretends to be GCC, so it'll match this condition
+#elif defined(__GNUC__) && defined(__INTPTR_TYPE__) && defined(__UINTPTR_TYPE__)
+
+namespace boost {
+ typedef __INTPTR_TYPE__ intptr_t;
+ typedef __UINTPTR_TYPE__ uintptr_t;
+}
+#define BOOST_HAS_INTPTR_T
+
+#endif
+
+#endif // !defined(__PGIC__)
+
 #endif // BOOST_CSTDINT_HPP
 
 
@@ -376,15 +410,15 @@
 #if !defined(BOOST__STDC_CONSTANT_MACROS_DEFINED) && \
    (!defined(INT8_C) || !defined(INT16_C) || !defined(INT32_C) || !defined(INT64_C))
 //
-// For the following code we get several warnings along the lines of:
-//
-// boost/cstdint.hpp:428:35: error: use of C99 long long integer constant
-//
-// So we declare this a system header to suppress these warnings.
-//
-#if defined(__GNUC__) && (__GNUC__ >= 4)
-#pragma GCC system_header
-#endif
+// For the following code we get several warnings along the lines of:
+//
+// boost/cstdint.hpp:428:35: error: use of C99 long long integer constant
+//
+// So we declare this a system header to suppress these warnings.
+//
+#if defined(__GNUC__) && (__GNUC__ >= 4)
+#pragma GCC system_header
+#endif
 
 #include <limits.h>
 # define BOOST__STDC_CONSTANT_MACROS_DEFINED


Boost-Commit list run by bdawes at acm.org, david.abrahams at rcn.com, gregod at cs.rpi.edu, cpdaniel at pacbell.net, john at johnmaddock.co.uk