Boost logo

Boost-Commit :

Subject: [Boost-commit] svn:boost r57489 - in trunk: boost/type_traits libs/type_traits/test
From: john_at_[hidden]
Date: 2009-11-08 11:49:41


Author: johnmaddock
Date: 2009-11-08 11:49:40 EST (Sun, 08 Nov 2009)
New Revision: 57489
URL: http://svn.boost.org/trac/boost/changeset/57489

Log:
Fix msvc and gcc warnings in the type_traits library.
Build should now be clean with cl /W4 or gcc -Wall -Wextra -pedantic for all except one test - there appears to be no way to use initialized aligned_storage with gcc without it producing a warning :-(
Text files modified:
   trunk/boost/type_traits/is_signed.hpp | 10 +++++++++-
   trunk/boost/type_traits/is_unsigned.hpp | 11 +++++++++--
   trunk/libs/type_traits/test/is_abstract_test.cpp | 4 ++++
   trunk/libs/type_traits/test/test.hpp | 4 ++++
   4 files changed, 26 insertions(+), 3 deletions(-)

Modified: trunk/boost/type_traits/is_signed.hpp
==============================================================================
--- trunk/boost/type_traits/is_signed.hpp (original)
+++ trunk/boost/type_traits/is_signed.hpp 2009-11-08 11:49:40 EST (Sun, 08 Nov 2009)
@@ -27,10 +27,18 @@
 #if !(defined(__EDG_VERSION__) && __EDG_VERSION__ <= 238)
 
 template <class T>
+struct is_signed_values
+{
+ typedef typename remove_cv<T>::type no_cv_t;
+ BOOST_STATIC_CONSTANT(no_cv_t, minus_one = (static_cast<no_cv_t>(-1)));
+ BOOST_STATIC_CONSTANT(no_cv_t, zero = (static_cast<no_cv_t>(0)));
+};
+
+template <class T>
 struct is_signed_helper
 {
    typedef typename remove_cv<T>::type no_cv_t;
- BOOST_STATIC_CONSTANT(bool, value = (!(static_cast<no_cv_t>(-1) > 0)));
+ BOOST_STATIC_CONSTANT(bool, value = (!(::boost::detail::is_signed_values<T>::minus_one > boost::detail::is_signed_values<T>::zero)));
 };
 
 template <bool integral_type>

Modified: trunk/boost/type_traits/is_unsigned.hpp
==============================================================================
--- trunk/boost/type_traits/is_unsigned.hpp (original)
+++ trunk/boost/type_traits/is_unsigned.hpp 2009-11-08 11:49:40 EST (Sun, 08 Nov 2009)
@@ -27,10 +27,17 @@
 #if !(defined(__EDG_VERSION__) && __EDG_VERSION__ <= 238)
 
 template <class T>
-struct is_ununsigned_helper
+struct is_unsigned_values
 {
    typedef typename remove_cv<T>::type no_cv_t;
- BOOST_STATIC_CONSTANT(bool, value = (static_cast<no_cv_t>(-1) > 0));
+ BOOST_STATIC_CONSTANT(no_cv_t, minus_one = (static_cast<no_cv_t>(-1)));
+ BOOST_STATIC_CONSTANT(no_cv_t, zero = (static_cast<no_cv_t>(0)));
+};
+
+template <class T>
+struct is_ununsigned_helper
+{
+ BOOST_STATIC_CONSTANT(bool, value = (::boost::detail::is_unsigned_values<T>::minus_one > ::boost::detail::is_unsigned_values<T>::zero));
 };
 
 template <bool integral_type>

Modified: trunk/libs/type_traits/test/is_abstract_test.cpp
==============================================================================
--- trunk/libs/type_traits/test/is_abstract_test.cpp (original)
+++ trunk/libs/type_traits/test/is_abstract_test.cpp 2009-11-08 11:49:40 EST (Sun, 08 Nov 2009)
@@ -13,6 +13,10 @@
 # include <boost/type_traits/is_abstract.hpp>
 #endif
 
+#ifdef BOOST_MSVC
+#pragma warning(disable: 4505)
+#endif
+
 
 struct TestA {};
 struct TestB { virtual void foo(void) = 0; };

Modified: trunk/libs/type_traits/test/test.hpp
==============================================================================
--- trunk/libs/type_traits/test/test.hpp (original)
+++ trunk/libs/type_traits/test/test.hpp 2009-11-08 11:49:40 EST (Sun, 08 Nov 2009)
@@ -407,6 +407,10 @@
 {
    T t;
    int j;
+protected:
+ wrap();
+ wrap(const wrap&);
+ wrap& operator=(const wrap&);
 };
 
 


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