Merge fixes from Trunk.

[SVN r62832]
This commit is contained in:
John Maddock
2010-06-12 08:33:32 +00:00
parent 730be18188
commit e3da9260e1
3 changed files with 49 additions and 10 deletions

View File

@ -366,58 +366,87 @@ INT#_C macros if they're not already defined (John Maddock).
******************************************************/ ******************************************************/
#if !defined(BOOST__STDC_CONSTANT_MACROS_DEFINED) && !defined(INT8_C) #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
#include <limits.h> #include <limits.h>
# define BOOST__STDC_CONSTANT_MACROS_DEFINED # define BOOST__STDC_CONSTANT_MACROS_DEFINED
# if defined(BOOST_HAS_MS_INT64) # if defined(BOOST_HAS_MS_INT64)
// //
// Borland/Intel/Microsoft compilers have width specific suffixes: // Borland/Intel/Microsoft compilers have width specific suffixes:
// //
#ifndef INT8_C
# define INT8_C(value) value##i8 # define INT8_C(value) value##i8
#endif
#ifndef INT16_C
# define INT16_C(value) value##i16 # define INT16_C(value) value##i16
#endif
#ifndef INT32_C
# define INT32_C(value) value##i32 # define INT32_C(value) value##i32
#endif
#ifndef INT64_C
# define INT64_C(value) value##i64 # define INT64_C(value) value##i64
#endif
# ifdef __BORLANDC__ # ifdef __BORLANDC__
// Borland bug: appending ui8 makes the type a signed char // Borland bug: appending ui8 makes the type a signed char
# define UINT8_C(value) static_cast<unsigned char>(value##u) # define UINT8_C(value) static_cast<unsigned char>(value##u)
# else # else
# define UINT8_C(value) value##ui8 # define UINT8_C(value) value##ui8
# endif # endif
#ifndef UINT16_C
# define UINT16_C(value) value##ui16 # define UINT16_C(value) value##ui16
#endif
#ifndef UINT32_C
# define UINT32_C(value) value##ui32 # define UINT32_C(value) value##ui32
#endif
#ifndef UINT64_C
# define UINT64_C(value) value##ui64 # define UINT64_C(value) value##ui64
#endif
#ifndef INTMAX_C
# define INTMAX_C(value) value##i64 # define INTMAX_C(value) value##i64
# define UINTMAX_C(value) value##ui64 # define UINTMAX_C(value) value##ui64
#endif
# else # else
// do it the old fashioned way: // do it the old fashioned way:
// 8-bit types ------------------------------------------------------------// // 8-bit types ------------------------------------------------------------//
# if UCHAR_MAX == 0xff # if (UCHAR_MAX == 0xff) && !defined(INT8_C)
# define INT8_C(value) static_cast<boost::int8_t>(value) # define INT8_C(value) static_cast<boost::int8_t>(value)
# define UINT8_C(value) static_cast<boost::uint8_t>(value##u) # define UINT8_C(value) static_cast<boost::uint8_t>(value##u)
# endif # endif
// 16-bit types -----------------------------------------------------------// // 16-bit types -----------------------------------------------------------//
# if USHRT_MAX == 0xffff # if (USHRT_MAX == 0xffff) && !defined(INT16_C)
# define INT16_C(value) static_cast<boost::int16_t>(value) # define INT16_C(value) static_cast<boost::int16_t>(value)
# define UINT16_C(value) static_cast<boost::uint16_t>(value##u) # define UINT16_C(value) static_cast<boost::uint16_t>(value##u)
# endif # endif
// 32-bit types -----------------------------------------------------------// // 32-bit types -----------------------------------------------------------//
#ifndef INT32_C
# if UINT_MAX == 0xffffffff # if (UINT_MAX == 0xffffffff)
# define INT32_C(value) value # define INT32_C(value) value
# define UINT32_C(value) value##u # define UINT32_C(value) value##u
# elif ULONG_MAX == 0xffffffff # elif ULONG_MAX == 0xffffffff
# define INT32_C(value) value##L # define INT32_C(value) value##L
# define UINT32_C(value) value##uL # define UINT32_C(value) value##uL
# endif # endif
#endif
// 64-bit types + intmax_t and uintmax_t ----------------------------------// // 64-bit types + intmax_t and uintmax_t ----------------------------------//
#ifndef INT64_C
# if defined(BOOST_HAS_LONG_LONG) && \ # if defined(BOOST_HAS_LONG_LONG) && \
(defined(ULLONG_MAX) || defined(ULONG_LONG_MAX) || defined(ULONGLONG_MAX) || defined(_LLONG_MAX)) (defined(ULLONG_MAX) || defined(ULONG_LONG_MAX) || defined(ULONGLONG_MAX) || defined(_LLONG_MAX))
@ -462,7 +491,7 @@ INT#_C macros if they're not already defined (John Maddock).
# define INTMAX_C(value) INT64_C(value) # define INTMAX_C(value) INT64_C(value)
# define UINTMAX_C(value) UINT64_C(value) # define UINTMAX_C(value) UINT64_C(value)
# endif # endif
#endif
# endif // Borland/Microsoft specific width suffixes # endif // Borland/Microsoft specific width suffixes
#endif // INT#_C macros. #endif // INT#_C macros.

View File

@ -57,6 +57,8 @@ namespace boost
// no specializations for 0 and 5: requests for a type > long are in error // no specializations for 0 and 5: requests for a type > long are in error
#ifdef BOOST_HAS_LONG_LONG #ifdef BOOST_HAS_LONG_LONG
template<> struct int_least_helper<1> { typedef boost::long_long_type least; }; template<> struct int_least_helper<1> { typedef boost::long_long_type least; };
#elif defined(BOOST_HAS_MS_INT64)
template<> struct int_least_helper<1> { typedef __int64 least; };
#endif #endif
template<> struct int_least_helper<2> { typedef long least; }; template<> struct int_least_helper<2> { typedef long least; };
template<> struct int_least_helper<3> { typedef int least; }; template<> struct int_least_helper<3> { typedef int least; };
@ -64,6 +66,8 @@ namespace boost
template<> struct int_least_helper<5> { typedef signed char least; }; template<> struct int_least_helper<5> { typedef signed char least; };
#ifdef BOOST_HAS_LONG_LONG #ifdef BOOST_HAS_LONG_LONG
template<> struct int_least_helper<6> { typedef boost::ulong_long_type least; }; template<> struct int_least_helper<6> { typedef boost::ulong_long_type least; };
#elif defined(BOOST_HAS_MS_INT64)
template<> struct int_least_helper<6> { typedef unsigned __int64 least; };
#endif #endif
template<> struct int_least_helper<7> { typedef unsigned long least; }; template<> struct int_least_helper<7> { typedef unsigned long least; };
template<> struct int_least_helper<8> { typedef unsigned int least; }; template<> struct int_least_helper<8> { typedef unsigned int least; };

View File

@ -77,12 +77,18 @@ template < >
template < > template < >
class integer_traits< unsigned long >; class integer_traits< unsigned long >;
#if !defined(BOOST_NO_INTEGRAL_INT64_T) && !defined(BOOST_NO_INT64_T) && (defined(BOOST_HAS_LONG_LONG) || defined(BOOST_HAS_MS_INT64)) #if !defined(BOOST_NO_INTEGRAL_INT64_T) && !defined(BOOST_NO_INT64_T) && defined(BOOST_HAS_LONG_LONG)
template < > template < >
class integer_traits< ::boost::long_long_type>; class integer_traits< ::boost::long_long_type>;
template < > template < >
class integer_traits< ::boost::ulong_long_type >; class integer_traits< ::boost::ulong_long_type >;
#elif !defined(BOOST_NO_INTEGRAL_INT64_T) && !defined(BOOST_NO_INT64_T) && defined(BOOST_HAS_MS_INT64)
template < >
class integer_traits<__int64>;
template < >
class integer_traits<unsigned __int64>;
#endif #endif