|
Boost-Commit : |
Subject: [Boost-commit] svn:boost r65188 - trunk/libs/type_traits/test
From: john_at_[hidden]
Date: 2010-09-02 05:32:48
Author: johnmaddock
Date: 2010-09-02 05:32:35 EDT (Thu, 02 Sep 2010)
New Revision: 65188
URL: http://svn.boost.org/trac/boost/changeset/65188
Log:
Set warnings as errors in type_traits library, where possible.
Text files modified:
trunk/libs/type_traits/test/Jamfile.v2 | 13 +++++
trunk/libs/type_traits/test/aligned_storage_empy_test.cpp | 2
trunk/libs/type_traits/test/aligned_storage_test.cpp | 6 ++
trunk/libs/type_traits/test/decay_test.cpp | 7 ++
trunk/libs/type_traits/test/has_operator_new_test.cpp | 7 ++
trunk/libs/type_traits/test/is_abstract_test.cpp | 96 ++++++++++++++++++++--------------------
trunk/libs/type_traits/test/is_convertible_test.cpp | 4
trunk/libs/type_traits/test/promote_enum_msvc_bug_test.cpp | 5 ++
trunk/libs/type_traits/test/promote_enum_test.cpp | 5 ++
trunk/libs/type_traits/test/test.hpp | 30 +++++++++---
10 files changed, 114 insertions(+), 61 deletions(-)
Modified: trunk/libs/type_traits/test/Jamfile.v2
==============================================================================
--- trunk/libs/type_traits/test/Jamfile.v2 (original)
+++ trunk/libs/type_traits/test/Jamfile.v2 2010-09-02 05:32:35 EDT (Thu, 02 Sep 2010)
@@ -8,7 +8,18 @@
# 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 ;
Modified: trunk/libs/type_traits/test/aligned_storage_empy_test.cpp
==============================================================================
--- trunk/libs/type_traits/test/aligned_storage_empy_test.cpp (original)
+++ trunk/libs/type_traits/test/aligned_storage_empy_test.cpp 2010-09-02 05:32:35 EDT (Thu, 02 Sep 2010)
@@ -102,7 +102,7 @@
do_check<__int64>();
#endif
#ifdef BOOST_HAS_LONG_LONG
-do_check<long long>();
+do_check<boost::long_long_type>();
#endif
do_check<int(*)(int)>();
Modified: trunk/libs/type_traits/test/aligned_storage_test.cpp
==============================================================================
--- trunk/libs/type_traits/test/aligned_storage_test.cpp (original)
+++ trunk/libs/type_traits/test/aligned_storage_test.cpp 2010-09-02 05:32:35 EDT (Thu, 02 Sep 2010)
@@ -27,6 +27,10 @@
{
}
+#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 @@
#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);
Modified: trunk/libs/type_traits/test/decay_test.cpp
==============================================================================
--- trunk/libs/type_traits/test/decay_test.cpp (original)
+++ trunk/libs/type_traits/test/decay_test.cpp 2010-09-02 05:32:35 EDT (Thu, 02 Sep 2010)
@@ -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
{
Modified: trunk/libs/type_traits/test/has_operator_new_test.cpp
==============================================================================
--- trunk/libs/type_traits/test/has_operator_new_test.cpp (original)
+++ trunk/libs/type_traits/test/has_operator_new_test.cpp 2010-09-02 05:32:35 EDT (Thu, 02 Sep 2010)
@@ -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);
};
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 2010-09-02 05:32:35 EDT (Thu, 02 Sep 2010)
@@ -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)
Modified: trunk/libs/type_traits/test/is_convertible_test.cpp
==============================================================================
--- trunk/libs/type_traits/test/is_convertible_test.cpp (original)
+++ trunk/libs/type_traits/test/is_convertible_test.cpp 2010-09-02 05:32:35 EDT (Thu, 02 Sep 2010)
@@ -19,8 +19,8 @@
};
struct base2 { };
-struct middle2 : virtual base2 { };
-struct derived2 : middle2 { };
+struct middle2 : public virtual base2 { };
+struct derived2 : public middle2 { };
TT_TEST_BEGIN(is_convertible)
Modified: trunk/libs/type_traits/test/promote_enum_msvc_bug_test.cpp
==============================================================================
--- trunk/libs/type_traits/test/promote_enum_msvc_bug_test.cpp (original)
+++ trunk/libs/type_traits/test/promote_enum_msvc_bug_test.cpp 2010-09-02 05:32:35 EDT (Thu, 02 Sep 2010)
@@ -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 };
Modified: trunk/libs/type_traits/test/promote_enum_test.cpp
==============================================================================
--- trunk/libs/type_traits/test/promote_enum_test.cpp (original)
+++ trunk/libs/type_traits/test/promote_enum_test.cpp 2010-09-02 05:32:35 EDT (Thu, 02 Sep 2010)
@@ -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 };
Modified: trunk/libs/type_traits/test/test.hpp
==============================================================================
--- trunk/libs/type_traits/test/test.hpp (original)
+++ trunk/libs/type_traits/test/test.hpp 2010-09-02 05:32:35 EDT (Thu, 02 Sep 2010)
@@ -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 @@
virtual ~VB(){};
};
-struct VD : VB
+struct VD : public VB
{
~VD(){};
};
@@ -356,21 +367,21 @@
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 @@
wrap& operator=(const wrap&);
};
+#ifdef BOOST_INTEL
+#pragma warning(pop)
+#endif
#endif
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