Boost logo

Boost-Commit :

Subject: [Boost-commit] svn:boost r64471 - in sandbox/SOC/2010/bit_masks: . boost/bitfield boost/integer boost/integer/detail/bft lib/integer/test
From: bbartmanboost_at_[hidden]
Date: 2010-07-30 12:45:25


Author: bbartman
Date: 2010-07-30 12:45:24 EDT (Fri, 30 Jul 2010)
New Revision: 64471
URL: http://svn.boost.org/trac/boost/changeset/64471

Log:
working on suppressing or fixing all of the MSVC waringings.
Text files modified:
   sandbox/SOC/2010/bit_masks/boost/bitfield/bitfield_orignal.hpp | 25 +++++++++++++++++++------
   sandbox/SOC/2010/bit_masks/boost/integer/bits_mask.hpp | 10 +++++++++-
   sandbox/SOC/2010/bit_masks/boost/integer/detail/bft/policy_creation_detail.hpp | 8 ++++++++
   sandbox/SOC/2010/bit_masks/boost/integer/high_bits_mask.hpp | 4 ++--
   sandbox/SOC/2010/bit_masks/lib/integer/test/bit_mask_test.cpp | 8 ++++++++
   sandbox/SOC/2010/bit_masks/notes.txt | 30 +++++++++++++++---------------
   6 files changed, 61 insertions(+), 24 deletions(-)

Modified: sandbox/SOC/2010/bit_masks/boost/bitfield/bitfield_orignal.hpp
==============================================================================
--- sandbox/SOC/2010/bit_masks/boost/bitfield/bitfield_orignal.hpp (original)
+++ sandbox/SOC/2010/bit_masks/boost/bitfield/bitfield_orignal.hpp 2010-07-30 12:45:24 EDT (Fri, 30 Jul 2010)
@@ -18,8 +18,6 @@
 
 #include <cassert>
 #include <limits>
-// #include <netinet/in.h>
-
 namespace boost { namespace integer {
     
 
@@ -77,9 +75,9 @@
         struct bitfield_complete_signed<true, value_type, storage_type, WIDTH, SIGN_MASK> {
             static value_type convert(storage_type val) {
                 if( (val>>(WIDTH-1))!=0) {
- return (val | SIGN_MASK);
+ return value_type(val | SIGN_MASK);
                 } else {
- return val;
+ return value_type(val);
                 }
             }
         };
@@ -87,9 +85,17 @@
         template <typename value_type, typename storage_type, unsigned int WIDTH, unsigned int SIGN_MASK>
         struct bitfield_complete_signed<false, value_type, storage_type, WIDTH, SIGN_MASK> {
             static value_type convert(storage_type val) {
- return val;
+ return value_type(val);
+ }
+ };
+#ifdef BOOST_MSVC
+ template <typename value_type, typename storage_type, unsigned int WIDTH, unsigned int SIGN_MASK>
+ struct bitfield_complete_signed<false, value_type, bool, WIDTH, SIGN_MASK> {
+ static value_type convert(storage_type val) {
+ return value_type(val) > 0;
             }
         };
+#endif
     }}
     
     //------------------------------------------------------------------------------
@@ -170,6 +176,10 @@
 
         static value_type storage_to_value(storage_type field) {
             storage_type val = (field & FIELD_MASK) >> LASTD;
+#ifdef BOOST_MSVC
+#pragma warning(push)
+#pragma warning(disable:4309)
+#endif
             return detail::policy::bitfield_complete_signed<
                 std::numeric_limits<value_type>::is_signed,
                 value_type,
@@ -177,6 +187,9 @@
                 WIDTH,
                 SIGN_MASK
>::convert(val);
+#ifdef BOOST_MSVC
+#pragma warning(pop)
+#endif
         }
 
         //! private because a reference is nedeed
@@ -193,7 +206,7 @@
         static const std::size_t WIDTH = LAST - FIRST + 1; //!< Width in bits of the bitfield
         static const storage_type VAL_MASK = (STORAGE_TYPE(1) << WIDTH) - 1; //!< Mask applied against assigned values
         static const storage_type FIELD_MASK = (STORAGE_TYPE(VAL_MASK) << LASTD); //!< Mask of the field's bit positions
- static const storage_type SIGN_MASK = ~VAL_MASK; //!< Sign mask applied against assigned values
+ static const storage_type SIGN_MASK = storage_type(~VAL_MASK); //!< Sign mask applied against assigned values
 
 
         //! explicit constructor from a reference

Modified: sandbox/SOC/2010/bit_masks/boost/integer/bits_mask.hpp
==============================================================================
--- sandbox/SOC/2010/bit_masks/boost/integer/bits_mask.hpp (original)
+++ sandbox/SOC/2010/bit_masks/boost/integer/bits_mask.hpp 2010-07-30 12:45:24 EDT (Fri, 30 Jul 2010)
@@ -6,6 +6,7 @@
 
 #ifndef BOOST_BITS_MASK_HPP
 #define BOOST_BITS_MASK_HPP
+#include <boost/config.hpp>
 #include <boost/integer/high_bits_mask.hpp>
 #include <boost/integer/low_bits_mask.hpp>
 #include <boost/static_assert.hpp>
@@ -29,6 +30,11 @@
  * NOTE: This is documented but not enforeced.
  *
  */
+#ifdef BOOST_MSVC
+#pragma warning(push)
+#pragma warning( disable : 4293 )
+#pragma warning( disable : 4307 )
+#endif
 template <typename T, unsigned int Offset, unsigned int Width = 1 >
 struct bits_mask
     :integral_mask<T, (low_bits_mask<T,Width>::value << Offset) >
@@ -46,7 +52,9 @@
     BOOST_STATIC_CONSTANT(unsigned int, width = Width);
 
 };
-
+#ifdef BOOST_MSVC
+#pragma warning(pop)
+#endif
 } // namespace boost
 
 

Modified: sandbox/SOC/2010/bit_masks/boost/integer/detail/bft/policy_creation_detail.hpp
==============================================================================
--- sandbox/SOC/2010/bit_masks/boost/integer/detail/bft/policy_creation_detail.hpp (original)
+++ sandbox/SOC/2010/bit_masks/boost/integer/detail/bft/policy_creation_detail.hpp 2010-07-30 12:45:24 EDT (Fri, 30 Jul 2010)
@@ -69,6 +69,10 @@
     typedef StorageType storage_type;
 
     typedef Mask get_from_ptr_mask;
+#ifdef BOOST_MSVC
+#pragma warning(push)
+#pragma warning(disable:4309)
+#endif
     typedef typename mpl::shift_right<
         integral_constant<
             storage_type,
@@ -77,6 +81,10 @@
         mpl::size_t<Shift>
>::type get_mask;
 
+#ifdef BOOST_MSVC
+#pragma warning(pop)
+#endif
+
     typedef integral_constant<
         storage_type,
         ~get_mask::value

Modified: sandbox/SOC/2010/bit_masks/boost/integer/high_bits_mask.hpp
==============================================================================
--- sandbox/SOC/2010/bit_masks/boost/integer/high_bits_mask.hpp (original)
+++ sandbox/SOC/2010/bit_masks/boost/integer/high_bits_mask.hpp 2010-07-30 12:45:24 EDT (Fri, 30 Jul 2010)
@@ -27,13 +27,13 @@
     template<typename T, unsigned int Width>
     struct evaluate_for_msvc_08 {
         typedef typename make_unsigned<T>::type unsigned_type;
- BOOST_STATIC_CONSTANT(unsigned_type, val = (~( unsigned_type(0)))
+ BOOST_STATIC_CONSTANT(unsigned_type, val = unsigned_type((~( unsigned_type(0)))
               &
             (~(mpl::shift_right<
                 mpl::size_t<static_cast<unsigned int>(~(T(0)))>,
                 mpl::size_t<Width>
>::type::value))
- );
+ ));
         typedef integral_constant<T, val> type;
     };
     // long long specialization

Modified: sandbox/SOC/2010/bit_masks/lib/integer/test/bit_mask_test.cpp
==============================================================================
--- sandbox/SOC/2010/bit_masks/lib/integer/test/bit_mask_test.cpp (original)
+++ sandbox/SOC/2010/bit_masks/lib/integer/test/bit_mask_test.cpp 2010-07-30 12:45:24 EDT (Fri, 30 Jul 2010)
@@ -8,6 +8,10 @@
 
 template <typename T>
 void test_function() {
+#ifdef BOOST_MSVC
+#pragma warning(push)
+#pragma warning(disable : 4127)
+#endif
     // making sure that the value type is transfered correctly.
     BOOST_ASSERT((is_same< typename bits_mask<T, 3>::value_type, T >::value));
 
@@ -23,11 +27,15 @@
     BOOST_ASSERT(( boost::bits_mask<T,3,2>::value == 24 ));
     BOOST_ASSERT(( boost::bits_mask<T,2,3>::value == 28 ));
 
+
     // assert that type returns the correct typedef.
     BOOST_ASSERT(( is_same<
                     typename bits_mask<T, 3>::type,
                     bits_mask<T, 3> >::value
               ));
+#ifdef BOOST_MSVC
+#pragma warning(pop)
+#endif
 }
 
 

Modified: sandbox/SOC/2010/bit_masks/notes.txt
==============================================================================
--- sandbox/SOC/2010/bit_masks/notes.txt (original)
+++ sandbox/SOC/2010/bit_masks/notes.txt 2010-07-30 12:45:24 EDT (Fri, 30 Jul 2010)
@@ -57,13 +57,13 @@
 16) deduced_storage_type_long_long_test.cpp
 18) bitfield_tuple_test.hpp
 19) align_test.cpp
+17) custom_member_test.cpp
 
 9) make_bft_testing.cpp
     c) This may need additional test to make sure that the macros are correctly
         generating the code for the correct number of valid parameters.
 
-17) custom_member_test.cpp
- b) Implement test suite.
+
 
 
 
@@ -121,19 +121,19 @@
 --------------------------------------------------------------------------------
                                 MSVC warnings
 --------------------------------------------------------------------------------
-high_bit_mask_test.cpp(30) : warning C4127: conditional expression is constant
-bitfield_orignal.hpp(90) : warning C4244: 'return' : conversion from 'unsigned int' to 'unsigned char', possible loss of data
-bitfield_orignal.hpp(80) : warning C4244: 'return' : conversion from 'unsigned int' to 'char', possible loss of data
-bitfield_orignal.hpp(82) : warning C4244: 'return' : conversion from 'unsigned int' to 'char', possible loss of data
-bitfield_orignal.hpp(196) : warning C4245: 'initializing' : conversion from 'int' to 'const unsigned char', signed/unsigned mismatch
-bits_mask.hpp(34) : warning C4293: '<<' : shift count negative or too big, undefined behavior
-high_bits_mask.hpp(30) : warning C4305: 'initializing' : truncation from 'const boost::mpl::size_t<N>::value_type' to 'const unsigned char'
-integral_wrapper.hpp(72) : warning C4307: '+' : integral constant overflow
-integral_wrapper.hpp(73) : warning C4307: '-' : integral constant overflow
-bits_mask.hpp(37) : warning C4307: '+' : integral constant overflow
-policy_creation_detail.hpp(76) : warning C4309: 'specialization' : truncation of constant value
-bitfield_orignal.hpp(179) : warning C4309: 'specialization' : truncation of constant value
-bitfield_orignal.hpp(90) : warning C4800: 'unsigned char' : forcing value to bool 'true' or 'false' (performance warning)
+done - high_bit_mask_test.cpp(30) : warning C4127: conditional expression is constant
+Attempt - bitfield_orignal.hpp(90) : warning C4244: 'return' : conversion from 'unsigned int' to 'unsigned char', possible loss of data
+Attempt - bitfield_orignal.hpp(80) : warning C4244: 'return' : conversion from 'unsigned int' to 'char', possible loss of data
+Attempt - bitfield_orignal.hpp(82) : warning C4244: 'return' : conversion from 'unsigned int' to 'char', possible loss of data
+Attempt - bitfield_orignal.hpp(196) : warning C4245: 'initializing' : conversion from 'int' to 'const unsigned char', signed/unsigned mismatch
+Attempt - bits_mask.hpp(34) : warning C4293: '<<' : shift count negative or too big, undefined behavior
+Attempt - high_bits_mask.hpp(30) : warning C4305: 'initializing' : truncation from 'const boost::mpl::size_t<N>::value_type' to 'const unsigned char'
+can't fix :( - integral_wrapper.hpp(72) : warning C4307: '+' : integral constant overflow
+can't fix :( - integral_wrapper.hpp(73) : warning C4307: '-' : integral constant overflow
+Attempt - bits_mask.hpp(37) : warning C4307: '+' : integral constant overflow
+Attempt - policy_creation_detail.hpp(76) : warning C4309: 'specialization' : truncation of constant value
+Attempt - bitfield_orignal.hpp(179) : warning C4309: 'specialization' : truncation of constant value
+Attempt - bitfield_orignal.hpp(90) : warning C4800: 'unsigned char' : forcing value to bool 'true' or 'false' (performance warning)
 --------------------------------------------------------------------------------
 
 


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