Set warnings as errors in type_traits library, where possible.

[SVN r65188]
This commit is contained in:
John Maddock
2010-09-02 09:32:35 +00:00
parent f8e246218e
commit d06a16e0e9
10 changed files with 114 additions and 61 deletions

View File

@ -8,7 +8,18 @@ import testing ;
# type_traits in V1 seem to have two modes: standalone, triggered
# by a command line option, and a regular. For now, just imitate
# regular
# regular
project : requirements
# default to all warnings on:
<warnings>all
# set warnings as errors for those compilers we know we get warning free:
<toolset>gcc:<cxxflags>-Wextra
<toolset>gcc:<warnings-as-errors>on
<toolset>intel:<warnings-as-errors>on
<toolset>sun:<warnings-as-errors>on
<toolset>msvc:<warnings-as-errors>on
;
rule all-tests {
local result ;

View File

@ -102,7 +102,7 @@ do_check<long double>();
do_check<__int64>();
#endif
#ifdef BOOST_HAS_LONG_LONG
do_check<long long>();
do_check<boost::long_long_type>();
#endif
do_check<int(*)(int)>();

View File

@ -27,6 +27,10 @@ inline void no_unused_warning(const volatile T&)
{
}
#if defined(__GNUC__) && (__GNUC__ >= 4) && !defined(BOOST_INTEL)
#pragma GCC diagnostic ignored "-Wmissing-braces"
#endif
template <class T>
void do_check(const T&)
{
@ -55,7 +59,7 @@ void do_check(const T&)
#ifndef TEST_STD
// Non-Tr1 behaviour:
typedef typename tt::aligned_storage<T::value,-1L>::type t3;
typedef typename tt::aligned_storage<T::value, ~static_cast<std::size_t>(0UL)>::type t3;
t3 as3 = { 0, };
must_be_pod<t3> pod3;
no_unused_warning(as3);

View File

@ -16,6 +16,13 @@
#include <string>
#include <utility>
#ifdef BOOST_INTEL
// remark #383: value copied to temporary, reference to temporary used
// std::pair<std::string, int> p2 = boost::make_pair( "foo", 1 );
// ^
#pragma warning(disable:383)
#endif
namespace boost
{

View File

@ -7,6 +7,13 @@
#include "check_integral_constant.hpp"
#include <boost/type_traits/has_new_operator.hpp>
#ifdef BOOST_INTEL
// remark #1720: function "class_with_new_op::operator new" has no corresponding member operator delete (to be called if an exception is thrown during initialization of an allocated object)
// void * operator new(std::size_t);
// ^
#pragma warning(disable:1720)
#endif
struct class_with_new_op {
void * operator new(std::size_t);
};

View File

@ -21,71 +21,71 @@
struct TestA {};
struct TestB { virtual void foo(void) = 0; };
struct TestC { private: virtual void foo(void) = 0; };
struct TestD : TestA {};
struct TestE : TestB {};
struct TestF : TestC {};
struct TestG : TestB { virtual void foo(void) {} };
struct TestH : TestC { private: virtual void foo(void) {} };
struct TestI : TestB, TestC {};
struct TestJ : TestI { virtual void foo(void) {} };
struct TestK : TestB { virtual void foo(void); virtual void foo2(void) = 0; };
struct TestL : TestK { virtual void foo2(void) {} };
struct TestM : virtual TestB {};
struct TestN : virtual TestC {};
struct TestO : TestM, TestN {};
struct TestP : TestO { virtual void foo(void) {} };
struct TestQ : TestB { virtual void foo(void) = 0; };
struct TestR : TestC { private: virtual void foo(void) = 0; };
struct TestD : public TestA {};
struct TestE : public TestB {};
struct TestF : public TestC {};
struct TestG : public TestB { virtual void foo(void) {} };
struct TestH : public TestC { private: virtual void foo(void) {} };
struct TestI : public TestB, public TestC {};
struct TestJ : public TestI { virtual void foo(void) {} };
struct TestK : public TestB { virtual void foo(void); virtual void foo2(void) = 0; };
struct TestL : public TestK { virtual void foo2(void) {} };
struct TestM : public virtual TestB {};
struct TestN : public virtual TestC {};
struct TestO : public TestM, public TestN {};
struct TestP : public TestO { virtual void foo(void) {} };
struct TestQ : public TestB { virtual void foo(void) = 0; };
struct TestR : public TestC { private: virtual void foo(void) = 0; };
struct TestS { virtual void foo(void) {} };
struct TestT { virtual ~TestT(void) {} virtual void foo(void) {} };
struct TestU : TestT { virtual void foo(void) = 0; };
struct TestV : TestT { virtual void foo(void) {} };
struct TestU : public TestT { virtual void foo(void) = 0; };
struct TestV : public TestT { virtual void foo(void) {} };
struct TestW { virtual void foo1(void) = 0; virtual void foo2(void) = 0; };
struct TestX : TestW { virtual void foo1(void) {} virtual void foo2(void) {} };
struct TestX : public TestW { virtual void foo1(void) {} virtual void foo2(void) {} };
struct TestY { virtual ~TestY(void) = 0; };
struct TestZ { virtual ~TestZ(void) = 0; }; TestZ::~TestZ(void) {}
struct TestAA : TestZ { virtual ~TestAA(void) = 0; }; TestAA::~TestAA(void) {}
struct TestAB : TestAA { virtual ~TestAB(void) {} };
struct TestAA : public TestZ { virtual ~TestAA(void) = 0; }; TestAA::~TestAA(void) {}
struct TestAB : public TestAA { virtual ~TestAB(void) {} };
struct TestAC { virtual void foo(void) = 0; }; void TestAC::foo(void) {}
struct TestAD : TestAC {};
struct TestAE : TestAD { virtual void foo() {} };
struct TestAF : TestAD { virtual void foo(); }; void TestAF::foo(void) {}
struct TestAG : virtual TestA {};
struct TestAD : public TestAC {};
struct TestAE : public TestAD { virtual void foo() {} };
struct TestAF : public TestAD { virtual void foo(); }; void TestAF::foo(void) {}
struct TestAG : public virtual TestA {};
// template test types:
template <class T> struct TTestA {};
template <class T> struct TTestB { virtual void foo(void) = 0; };
template <class T> struct TTestC { private: virtual void foo(void) = 0; };
template <class T> struct TTestD : TTestA<T> {};
template <class T> struct TTestE : TTestB<T> {};
template <class T> struct TTestF : TTestC<T> {};
template <class T> struct TTestG : TTestB<T> { virtual void foo(void) {} };
template <class T> struct TTestH : TTestC<T> { private: virtual void foo(void) {} };
template <class T> struct TTestI : TTestB<T>, TTestC<T> {};
template <class T> struct TTestJ : TTestI<T> { virtual void foo(void) {} };
template <class T> struct TTestK : TTestB<T> { virtual void foo(void); virtual void foo2(void) = 0; };
template <class T> struct TTestL : TTestK<T> { virtual void foo2(void) {} };
template <class T> struct TTestM : virtual TTestB<T> {};
template <class T> struct TTestN : virtual TTestC<T> {};
template <class T> struct TTestO : TTestM<T>, TTestN<T> {};
template <class T> struct TTestP : TTestO<T> { virtual void foo(void) {} };
template <class T> struct TTestQ : TTestB<T> { virtual void foo(void) = 0; };
template <class T> struct TTestR : TTestC<T> { private: virtual void foo(void) = 0; };
template <class T> struct TTestD : public TTestA<T> {};
template <class T> struct TTestE : public TTestB<T> {};
template <class T> struct TTestF : public TTestC<T> {};
template <class T> struct TTestG : public TTestB<T> { virtual void foo(void) {} };
template <class T> struct TTestH : public TTestC<T> { private: virtual void foo(void) {} };
template <class T> struct TTestI : public TTestB<T>, public TTestC<T> {};
template <class T> struct TTestJ : public TTestI<T> { virtual void foo(void) {} };
template <class T> struct TTestK : public TTestB<T> { virtual void foo(void); virtual void foo2(void) = 0; };
template <class T> struct TTestL : public TTestK<T> { virtual void foo2(void) {} };
template <class T> struct TTestM : public virtual TTestB<T> {};
template <class T> struct TTestN : public virtual TTestC<T> {};
template <class T> struct TTestO : public TTestM<T>, public TTestN<T> {};
template <class T> struct TTestP : public TTestO<T> { virtual void foo(void) {} };
template <class T> struct TTestQ : public TTestB<T> { virtual void foo(void) = 0; };
template <class T> struct TTestR : public TTestC<T> { private: virtual void foo(void) = 0; };
template <class T> struct TTestS { virtual void foo(void) {} };
template <class T> struct TTestT { virtual ~TTestT(void) {} virtual void foo(void) {} };
template <class T> struct TTestU : TTestT<T> { virtual void foo(void) = 0; };
template <class T> struct TTestV : TTestT<T> { virtual void foo(void) {} };
template <class T> struct TTestU : public TTestT<T> { virtual void foo(void) = 0; };
template <class T> struct TTestV : public TTestT<T> { virtual void foo(void) {} };
template <class T> struct TTestW { virtual void foo1(void) = 0; virtual void foo2(void) = 0; };
template <class T> struct TTestX : TTestW<T> { virtual void foo1(void) {} virtual void foo2(void) {} };
template <class T> struct TTestX : public TTestW<T> { virtual void foo1(void) {} virtual void foo2(void) {} };
template <class T> struct TTestY { virtual ~TTestY(void) = 0; };
template <class T> struct TTestZ { virtual ~TTestZ(void) = 0; }; template <class T> TTestZ<T>::~TTestZ(void) {}
template <class T> struct TTestAA : TTestZ<T> { virtual ~TTestAA(void) = 0; }; template <class T> TTestAA<T>::~TTestAA(void) {}
template <class T> struct TTestAB : TTestAA<T> { virtual ~TTestAB(void) {} };
template <class T> struct TTestAA : public TTestZ<T> { virtual ~TTestAA(void) = 0; }; template <class T> TTestAA<T>::~TTestAA(void) {}
template <class T> struct TTestAB : public TTestAA<T> { virtual ~TTestAB(void) {} };
template <class T> struct TTestAC { virtual void foo(void) = 0; }; template <class T> void TTestAC<T>::foo(void) {}
template <class T> struct TTestAD : TTestAC<T> {};
template <class T> struct TTestAE : TTestAD<T> { virtual void foo() {} };
template <class T> struct TTestAF : TTestAD<T> { virtual void foo(); }; template <class T> void TTestAF<T>::foo(void) {}
template <class T> struct TTestAG : virtual TTestA<T> {};
template <class T> struct TTestAD : public TTestAC<T> {};
template <class T> struct TTestAE : public TTestAD<T> { virtual void foo() {} };
template <class T> struct TTestAF : public TTestAD<T> { virtual void foo(); }; template <class T> void TTestAF<T>::foo(void) {}
template <class T> struct TTestAG : public virtual TTestA<T> {};
TT_TEST_BEGIN(is_abstract)

View File

@ -19,8 +19,8 @@ struct convertible_from
};
struct base2 { };
struct middle2 : virtual base2 { };
struct derived2 : middle2 { };
struct middle2 : public virtual base2 { };
struct derived2 : public middle2 { };
TT_TEST_BEGIN(is_convertible)

View File

@ -17,6 +17,11 @@
#include "promote_util.hpp"
#ifdef BOOST_INTEL
// remark #1418: external function definition with no prior declaration
#pragma warning(disable:1418)
#endif
enum UIntEnum { UIntEnum_max = UINT_MAX };

5
test/promote_enum_test.cpp Executable file → Normal file
View File

@ -31,6 +31,11 @@
#include "promote_util.hpp"
#include <boost/detail/workaround.hpp>
#ifdef BOOST_INTEL
// remark #1418: external function definition with no prior declaration
#pragma warning(disable:1418)
#endif
enum IntEnum1 { IntEnum1_min = -5 , IntEnum1_max = 5 };
enum IntEnum2 { IntEnum2_min = SHRT_MIN, IntEnum2_max = SHRT_MAX };
enum IntEnum3 { IntEnum3_min = INT_MIN , IntEnum3_max = INT_MAX };

View File

@ -23,6 +23,17 @@
// We have to turn off warnings that occur within the test suite:
#pragma warning(disable:4127)
#endif
#ifdef BOOST_INTEL
// remark #1418: external function definition with no prior declaration
// remark #981: operands are evaluated in unspecified order
#pragma warning(disable:1418 981)
#endif
#ifdef BOOST_INTEL
// turn off warnings from this header:
#pragma warning(push)
#pragma warning(disable:444)
#endif
//
// basic configuration:
@ -289,7 +300,7 @@ struct VB
virtual ~VB(){};
};
struct VD : VB
struct VD : public VB
{
~VD(){};
};
@ -356,21 +367,21 @@ struct polymorphic_base
virtual void method();
};
struct polymorphic_derived1 : polymorphic_base
struct polymorphic_derived1 : public polymorphic_base
{
};
struct polymorphic_derived2 : polymorphic_base
struct polymorphic_derived2 : public polymorphic_base
{
virtual void method();
};
struct virtual_inherit1 : virtual Base { };
struct virtual_inherit2 : virtual_inherit1 { };
struct virtual_inherit1 : public virtual Base { };
struct virtual_inherit2 : public virtual_inherit1 { };
struct virtual_inherit3 : private virtual Base {};
struct virtual_inherit4 : virtual boost::noncopyable {};
struct virtual_inherit5 : virtual int_convertible {};
struct virtual_inherit6 : virtual Base { virtual ~virtual_inherit6()throw(); };
struct virtual_inherit4 : public virtual boost::noncopyable {};
struct virtual_inherit5 : public virtual int_convertible {};
struct virtual_inherit6 : public virtual Base { virtual ~virtual_inherit6()throw(); };
typedef void foo0_t();
typedef void foo1_t(int);
@ -413,6 +424,9 @@ protected:
wrap& operator=(const wrap&);
};
#ifdef BOOST_INTEL
#pragma warning(pop)
#endif
#endif