From c8d4c6ccd15006aad02e848776abdec1dce6901f Mon Sep 17 00:00:00 2001 From: John Maddock Date: Sun, 8 Nov 2009 16:49:40 +0000 Subject: [PATCH] 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 :-( [SVN r57489] --- include/boost/type_traits/is_signed.hpp | 10 +++++++++- include/boost/type_traits/is_unsigned.hpp | 11 +++++++++-- test/is_abstract_test.cpp | 4 ++++ test/test.hpp | 4 ++++ 4 files changed, 26 insertions(+), 3 deletions(-) mode change 100755 => 100644 test/is_abstract_test.cpp diff --git a/include/boost/type_traits/is_signed.hpp b/include/boost/type_traits/is_signed.hpp index e06b47c..bf7bbfd 100644 --- a/include/boost/type_traits/is_signed.hpp +++ b/include/boost/type_traits/is_signed.hpp @@ -26,11 +26,19 @@ namespace detail{ #if !(defined(__EDG_VERSION__) && __EDG_VERSION__ <= 238) +template +struct is_signed_values +{ + typedef typename remove_cv::type no_cv_t; + BOOST_STATIC_CONSTANT(no_cv_t, minus_one = (static_cast(-1))); + BOOST_STATIC_CONSTANT(no_cv_t, zero = (static_cast(0))); +}; + template struct is_signed_helper { typedef typename remove_cv::type no_cv_t; - BOOST_STATIC_CONSTANT(bool, value = (!(static_cast(-1) > 0))); + BOOST_STATIC_CONSTANT(bool, value = (!(::boost::detail::is_signed_values::minus_one > boost::detail::is_signed_values::zero))); }; template diff --git a/include/boost/type_traits/is_unsigned.hpp b/include/boost/type_traits/is_unsigned.hpp index 4866486..98baf4e 100644 --- a/include/boost/type_traits/is_unsigned.hpp +++ b/include/boost/type_traits/is_unsigned.hpp @@ -27,10 +27,17 @@ namespace detail{ #if !(defined(__EDG_VERSION__) && __EDG_VERSION__ <= 238) template -struct is_ununsigned_helper +struct is_unsigned_values { typedef typename remove_cv::type no_cv_t; - BOOST_STATIC_CONSTANT(bool, value = (static_cast(-1) > 0)); + BOOST_STATIC_CONSTANT(no_cv_t, minus_one = (static_cast(-1))); + BOOST_STATIC_CONSTANT(no_cv_t, zero = (static_cast(0))); +}; + +template +struct is_ununsigned_helper +{ + BOOST_STATIC_CONSTANT(bool, value = (::boost::detail::is_unsigned_values::minus_one > ::boost::detail::is_unsigned_values::zero)); }; template diff --git a/test/is_abstract_test.cpp b/test/is_abstract_test.cpp old mode 100755 new mode 100644 index 2d2079a..3f63aee --- a/test/is_abstract_test.cpp +++ b/test/is_abstract_test.cpp @@ -13,6 +13,10 @@ # include #endif +#ifdef BOOST_MSVC +#pragma warning(disable: 4505) +#endif + struct TestA {}; struct TestB { virtual void foo(void) = 0; }; diff --git a/test/test.hpp b/test/test.hpp index 47c3333..f31452b 100644 --- a/test/test.hpp +++ b/test/test.hpp @@ -407,6 +407,10 @@ struct wrap { T t; int j; +protected: + wrap(); + wrap(const wrap&); + wrap& operator=(const wrap&); };