From 002c331fdbe314bfe435dc08955ba3c0c3710770 Mon Sep 17 00:00:00 2001 From: John Maddock Date: Thu, 17 Apr 2003 11:20:13 +0000 Subject: [PATCH] warning suppression for gcc [SVN r18273] --- include/boost/type_traits/is_enum.hpp | 19 ++++++++++++++----- include/boost/type_traits/is_union.hpp | 12 ++++++++++++ 2 files changed, 26 insertions(+), 5 deletions(-) diff --git a/include/boost/type_traits/is_enum.hpp b/include/boost/type_traits/is_enum.hpp index 9392625..6997eb6 100644 --- a/include/boost/type_traits/is_enum.hpp +++ b/include/boost/type_traits/is_enum.hpp @@ -15,6 +15,9 @@ #include "boost/type_traits/is_arithmetic.hpp" #include "boost/type_traits/is_reference.hpp" #include "boost/type_traits/is_convertible.hpp" +#ifdef __GNUC__ +#include +#endif #include "boost/type_traits/config.hpp" #ifdef BOOST_TT_HAS_CONFORMING_IS_CLASS_IMPLEMENTATION @@ -68,9 +71,19 @@ template struct is_enum_impl // We MUST do this on conforming compilers in order to // correctly deduce that noncopyable types are not enums (dwa // 2002/04/15)... + // strictly speaking is_convertible should work with non-copyable + // types rendering this fix unnecessary - unfortunately this is not + // the case for all compilers yet (JM 2003/04/16)... , ::boost::is_class::value >::value)); -#else +#elif defined __GNUC__ + BOOST_STATIC_CONSTANT(bool, selector = + (::boost::type_traits::ice_or< + ::boost::is_arithmetic::value + , ::boost::is_reference::value + , ::boost::is_function::value + >::value)); +#else BOOST_STATIC_CONSTANT(bool, selector = (::boost::type_traits::ice_or< ::boost::is_arithmetic::value @@ -91,10 +104,6 @@ template struct is_enum_impl BOOST_STATIC_CONSTANT(bool, value = helper::value); }; -// Specializations suppress some nasty warnings with GCC -BOOST_TT_AUX_BOOL_TRAIT_IMPL_SPEC1(is_enum,float,false) -BOOST_TT_AUX_BOOL_TRAIT_IMPL_SPEC1(is_enum,double,false) -BOOST_TT_AUX_BOOL_TRAIT_IMPL_SPEC1(is_enum,long double,false) // these help on compilers with no partial specialization support: BOOST_TT_AUX_BOOL_TRAIT_IMPL_SPEC1(is_enum,void,false) #ifndef BOOST_NO_CV_VOID_SPECIALIZATIONS diff --git a/include/boost/type_traits/is_union.hpp b/include/boost/type_traits/is_union.hpp index 5a2c3f9..99f2dcf 100644 --- a/include/boost/type_traits/is_union.hpp +++ b/include/boost/type_traits/is_union.hpp @@ -21,11 +21,23 @@ namespace boost { namespace detail { +#ifndef __GNUC__ template struct is_union_impl { typedef typename remove_cv::type cvt; BOOST_STATIC_CONSTANT(bool, value = BOOST_IS_UNION(cvt)); }; +#else +// +// using remove_cv here generates a whole load of needless +// warnings with gcc, since it doesn't do any good with gcc +// in any case (at least at present), just remove it: +// +template struct is_union_impl +{ + BOOST_STATIC_CONSTANT(bool, value = BOOST_IS_UNION(cvt)); +}; +#endif } // namespace detail BOOST_TT_AUX_BOOL_TRAIT_DEF1(is_union,T,::boost::detail::is_union_impl::value)