Run most of the unordered container tests (not the exception tests) on warning

level 4 on Visual C++.


[SVN r38648]
This commit is contained in:
Daniel James
2007-08-14 09:55:30 +00:00
parent 3ebd8bc9f2
commit 36f4508019
10 changed files with 67 additions and 7 deletions

View File

@@ -9,6 +9,7 @@ project unordered-test/container
: requirements : requirements
<toolset>intel-linux:"<cxxflags>-strict_ansi -cxxlib-icc" <toolset>intel-linux:"<cxxflags>-strict_ansi -cxxlib-icc"
<toolset>gcc:<cxxflags>-Wsign-promo <toolset>gcc:<cxxflags>-Wsign-promo
<toolset>msvc:<cxxflags>/W4
; ;
test-suite container-tests test-suite container-tests

View File

@@ -3,7 +3,17 @@
// Distributed under the Boost Software License, Version 1.0. (See accompanying // Distributed under the Boost Software License, Version 1.0. (See accompanying
// file LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt) // file LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt)
#if defined(BOOST_MSVC)
#pragma warning(push)
#pragma warning(disable:4100) // unreferenced formal parameter
#endif
#include <boost/concept_check.hpp> #include <boost/concept_check.hpp>
#if defined(BOOST_MSVC)
#pragma warning(pop)
#endif
#include <boost/mpl/assert.hpp> #include <boost/mpl/assert.hpp>
#include <boost/mpl/bool.hpp> #include <boost/mpl/bool.hpp>
#include <boost/type_traits/is_same.hpp> #include <boost/type_traits/is_same.hpp>

View File

@@ -10,6 +10,11 @@
#include <cstdlib> #include <cstdlib>
#include <boost/limits.hpp> #include <boost/limits.hpp>
#if defined(BOOST_MSVC)
#pragma warning(push)
#pragma warning(disable:4100) // unreferenced formal parameter
#endif
namespace test namespace test
{ {
template <class T> template <class T>
@@ -26,8 +31,8 @@ namespace test
template <class U> struct rebind { typedef malloc_allocator<U> other; }; template <class U> struct rebind { typedef malloc_allocator<U> other; };
malloc_allocator() {} malloc_allocator() {}
template <class Y> malloc_allocator(malloc_allocator<Y> const& x) {} template <class Y> malloc_allocator(malloc_allocator<Y> const&) {}
malloc_allocator(malloc_allocator const& x) {} malloc_allocator(malloc_allocator const&) {}
pointer address(reference r) { return &r; } pointer address(reference r) { return &r; }
const_pointer address(const_reference r) { return &r; } const_pointer address(const_reference r) { return &r; }
@@ -37,7 +42,7 @@ namespace test
} }
pointer allocate(size_type n, const_pointer u) { return allocate(n); } pointer allocate(size_type n, const_pointer u) { return allocate(n); }
void deallocate(pointer p, size_type n) { free(p); } void deallocate(pointer p, size_type) { free(p); }
void construct(pointer p, T const& t) { new(p) T(t); } void construct(pointer p, T const& t) { new(p) T(t); }
void destroy(pointer p) { p->~T(); } void destroy(pointer p) { p->~T(); }
@@ -59,4 +64,9 @@ namespace test
}; };
} }
#if defined(BOOST_MSVC)
#pragma warning(pop)
#pragma warning(disable:4100) // unreferenced formal parameter
#endif
#endif #endif

View File

@@ -59,7 +59,7 @@ namespace test
inline signed char generate(signed char const*) inline signed char generate(signed char const*)
{ {
using namespace std; using namespace std;
return rand(); return static_cast<signed char>(rand());
} }
inline std::string generate(std::string const*) inline std::string generate(std::string const*)

View File

@@ -15,6 +15,11 @@
#include "./helpers.hpp" #include "./helpers.hpp"
#include "./allocator.hpp" #include "./allocator.hpp"
#if defined(BOOST_MSVC)
#pragma warning(push)
#pragma warning(disable:4127) // conditional expression is constant
#endif
namespace test namespace test
{ {
template <class X> template <class X>
@@ -92,5 +97,9 @@ namespace test
} }
} }
#if defined(BOOST_MSVC)
#pragma warning(pop)
#endif
#endif #endif

View File

@@ -8,6 +8,11 @@
#include <cstddef> #include <cstddef>
#if defined(BOOST_MSVC)
#pragma warning(push)
#pragma warning(disable:4100) // unreferenced formal parameter
#endif
namespace test namespace test
{ {
namespace minimal namespace minimal
@@ -226,4 +231,8 @@ namespace minimal
} }
} }
#if defined(BOOST_MSVC)
#pragma warning(pop)
#endif
#endif #endif

View File

@@ -9,6 +9,7 @@ project unordered-test/unordered
: requirements : requirements
<toolset>intel-linux:"<cxxflags>-strict_ansi -cxxlib-icc" <toolset>intel-linux:"<cxxflags>-strict_ansi -cxxlib-icc"
<toolset>gcc:<cxxflags>-Wsign-promo <toolset>gcc:<cxxflags>-Wsign-promo
<toolset>msvc:<cxxflags>/W4
; ;
test-suite unordered-tests test-suite unordered-tests

View File

@@ -6,7 +6,17 @@
#include <boost/unordered_set.hpp> #include <boost/unordered_set.hpp>
#include <boost/unordered_map.hpp> #include <boost/unordered_map.hpp>
#if defined(BOOST_MSVC)
#pragma warning(push)
#pragma warning(disable:4100) // unreferenced formal parameter
#endif
#include <boost/concept_check.hpp> #include <boost/concept_check.hpp>
#if defined(BOOST_MSVC)
#pragma warning(pop)
#endif
#include <boost/mpl/assert.hpp> #include <boost/mpl/assert.hpp>
#include <boost/iterator/iterator_traits.hpp> #include <boost/iterator/iterator_traits.hpp>
#include "../helpers/check_return_type.hpp" #include "../helpers/check_return_type.hpp"

View File

@@ -9,6 +9,11 @@
#include <boost/limits.hpp> #include <boost/limits.hpp>
#include "../helpers/random_values.hpp" #include "../helpers/random_values.hpp"
#if defined(BOOST_MSVC)
#pragma warning(push)
#pragma warning(disable:4127) // conditional expression is constant
#endif
template <class X> template <class X>
void load_factor_tests(X* = 0) void load_factor_tests(X* = 0)
{ {
@@ -70,3 +75,8 @@ int main()
return boost::report_errors(); return boost::report_errors();
} }
#if defined(BOOST_MSVC)
#pragma warning(pop)
#pragma warning(disable:4127) // conditional expression is constant
#endif

View File

@@ -11,7 +11,7 @@ struct count_copies
{ {
static int count; static int count;
count_copies() { ++count; } count_copies() { ++count; }
count_copies(count_copies const& x) { ++count; } count_copies(count_copies const&) { ++count; }
private: private:
count_copies& operator=(count_copies const&); count_copies& operator=(count_copies const&);
}; };
@@ -20,7 +20,7 @@ private:
namespace boost { namespace boost {
#endif #endif
std::size_t hash_value(count_copies const& x) { std::size_t hash_value(count_copies const&) {
return 0; return 0;
} }
@@ -28,7 +28,7 @@ std::size_t hash_value(count_copies const& x) {
} }
#endif #endif
bool operator==(count_copies const& x, count_copies const& y) { bool operator==(count_copies const&, count_copies const&) {
return true; return true;
} }