Boost logo

Boost-Commit :

Subject: [Boost-commit] svn:boost r58056 - in trunk: boost libs/integer/test
From: john_at_[hidden]
Date: 2009-11-30 08:50:06


Author: johnmaddock
Date: 2009-11-30 08:50:05 EST (Mon, 30 Nov 2009)
New Revision: 58056
URL: http://svn.boost.org/trac/boost/changeset/58056

Log:
Get the tests warning free again with GCC.
Finally get everything working with the Borland compiler.
Fix a few typos: use of long rather than unsigned long, use of long long rather than long_long_type etc.
Text files modified:
   trunk/boost/integer.hpp | 17 ++++++++++++++---
   trunk/boost/integer_fwd.hpp | 2 +-
   trunk/libs/integer/test/cstdint_test.cpp | 6 ++++++
   trunk/libs/integer/test/integer_test.cpp | 4 ++--
   4 files changed, 23 insertions(+), 6 deletions(-)

Modified: trunk/boost/integer.hpp
==============================================================================
--- trunk/boost/integer.hpp (original)
+++ trunk/boost/integer.hpp 2009-11-30 08:50:05 EST (Mon, 30 Nov 2009)
@@ -94,8 +94,8 @@
     (defined(ULONG_LONG_MAX) && (ULONG_LONG_MAX != ULONG_MAX)) ||\
     (defined(ULONGLONG_MAX) && (ULONGLONG_MAX != ULONG_MAX)) ||\
     (defined(_ULLONG_MAX) && (_ULLONG_MAX != ULONG_MAX)))
- template <> struct exact_signed_base_helper<sizeof(long long)* CHAR_BIT> { typedef long long exact; };
- template <> struct exact_unsigned_base_helper<sizeof(unsigned long long)* CHAR_BIT> { typedef unsigned long long exact; };
+ template <> struct exact_signed_base_helper<sizeof(boost::long_long_type)* CHAR_BIT> { typedef boost::long_long_type exact; };
+ template <> struct exact_unsigned_base_helper<sizeof(boost::ulong_long_type)* CHAR_BIT> { typedef boost::ulong_long_type exact; };
 #endif
 
 
@@ -194,10 +194,20 @@
 #if !defined(BOOST_NO_INTEGRAL_INT64_T) && defined(BOOST_HAS_LONG_LONG)
   template< boost::ulong_long_type MaxValue > // minimum value to require support
 #else
- template< long MaxValue > // minimum value to require support
+ template< unsigned long MaxValue > // minimum value to require support
 #endif
   struct uint_value_t
   {
+#if (defined(__BORLANDC__) || defined(__CODEGEAR__)) && defined(BOOST_NO_INTEGRAL_INT64_T)
+ // It's really not clear why this workaround should be needed... shrug I guess! JM
+ BOOST_STATIC_CONSTANT(unsigned, which =
+ 6 +
+ (MaxValue <= ::boost::integer_traits<unsigned long>::const_max) +
+ (MaxValue <= ::boost::integer_traits<unsigned int>::const_max) +
+ (MaxValue <= ::boost::integer_traits<unsigned short>::const_max) +
+ (MaxValue <= ::boost::integer_traits<unsigned char>::const_max));
+ typedef typename detail::int_least_helper< ::boost::uint_value_t<MaxValue>::which>::least least;
+#else
       typedef typename detail::int_least_helper
         <
           5 +
@@ -211,6 +221,7 @@
           (MaxValue <= ::boost::integer_traits<unsigned short>::const_max) +
           (MaxValue <= ::boost::integer_traits<unsigned char>::const_max)
>::least least;
+#endif
       typedef typename int_fast_t<least>::type fast;
   };
 

Modified: trunk/boost/integer_fwd.hpp
==============================================================================
--- trunk/boost/integer_fwd.hpp (original)
+++ trunk/boost/integer_fwd.hpp 2009-11-30 08:50:05 EST (Mon, 30 Nov 2009)
@@ -114,7 +114,7 @@
 #if !defined(BOOST_NO_INTEGRAL_INT64_T) && defined(BOOST_HAS_LONG_LONG)
   template< boost::ulong_long_type MaxValue > // maximum value to require support
 #else
- template< long MaxValue > // maximum value to require support
+ template< unsigned long MaxValue > // maximum value to require support
 #endif
     struct uint_value_t;
 

Modified: trunk/libs/integer/test/cstdint_test.cpp
==============================================================================
--- trunk/libs/integer/test/cstdint_test.cpp (original)
+++ trunk/libs/integer/test/cstdint_test.cpp 2009-11-30 08:50:05 EST (Mon, 30 Nov 2009)
@@ -12,6 +12,12 @@
 // 12 Nov 00 Adapted to merged <boost/cstdint.hpp>
 // 23 Sep 00 Added INTXX_C constant macro support + int64_t support (John Maddock).
 // 28 Jun 00 Initial version
+
+#if defined(__GNUC__) && (__GNUC__ > 4) || ((__GNUC__ == 4) && (__GNUC_MINOR__ >= 4))
+// We can't suppress this warning on the command line as not all GCC versions support -Wno-type-limits :
+#pragma GCC diagnostic ignored "-Wtype-limits"
+#endif
+
 #define __STDC_CONSTANT_MACROS
 #include <iostream>
 #include <boost/cstdint.hpp>

Modified: trunk/libs/integer/test/integer_test.cpp
==============================================================================
--- trunk/libs/integer/test/integer_test.cpp (original)
+++ trunk/libs/integer/test/integer_test.cpp 2009-11-30 08:50:05 EST (Mon, 30 Nov 2009)
@@ -165,8 +165,8 @@
    // Nothing to do here!!
 }
 
-template <class Traits, class Expected, class Value>
-void test_min_max_type(Value val)
+template <class Traits, class Expected>
+void test_min_max_type(Expected val)
 {
    typedef typename Traits::least least_type;
    typedef typename Traits::fast fast_type;


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