diff --git a/test/container/Jamfile.v2 b/test/container/Jamfile.v2 index b5f89567..7d050bd7 100644 --- a/test/container/Jamfile.v2 +++ b/test/container/Jamfile.v2 @@ -9,6 +9,7 @@ project unordered-test/container : requirements intel-linux:"-strict_ansi -cxxlib-icc" gcc:-Wsign-promo + msvc:/W4 ; test-suite container-tests diff --git a/test/container/compile_tests.hpp b/test/container/compile_tests.hpp index 0c1175a8..521f1d4e 100644 --- a/test/container/compile_tests.hpp +++ b/test/container/compile_tests.hpp @@ -3,7 +3,17 @@ // 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) +#if defined(BOOST_MSVC) +#pragma warning(push) +#pragma warning(disable:4100) // unreferenced formal parameter +#endif + #include + +#if defined(BOOST_MSVC) +#pragma warning(pop) +#endif + #include #include #include diff --git a/test/helpers/allocator.hpp b/test/helpers/allocator.hpp index 5e489e7e..0c15f0d9 100644 --- a/test/helpers/allocator.hpp +++ b/test/helpers/allocator.hpp @@ -10,6 +10,11 @@ #include #include +#if defined(BOOST_MSVC) +#pragma warning(push) +#pragma warning(disable:4100) // unreferenced formal parameter +#endif + namespace test { template @@ -26,8 +31,8 @@ namespace test template struct rebind { typedef malloc_allocator other; }; malloc_allocator() {} - template malloc_allocator(malloc_allocator const& x) {} - malloc_allocator(malloc_allocator const& x) {} + template malloc_allocator(malloc_allocator const&) {} + malloc_allocator(malloc_allocator const&) {} pointer address(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); } - 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 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 diff --git a/test/helpers/generators.hpp b/test/helpers/generators.hpp index d6c875b0..792b240e 100644 --- a/test/helpers/generators.hpp +++ b/test/helpers/generators.hpp @@ -59,7 +59,7 @@ namespace test inline signed char generate(signed char const*) { using namespace std; - return rand(); + return static_cast(rand()); } inline std::string generate(std::string const*) diff --git a/test/helpers/invariants.hpp b/test/helpers/invariants.hpp index a4eca0b0..db64c132 100644 --- a/test/helpers/invariants.hpp +++ b/test/helpers/invariants.hpp @@ -15,6 +15,11 @@ #include "./helpers.hpp" #include "./allocator.hpp" +#if defined(BOOST_MSVC) +#pragma warning(push) +#pragma warning(disable:4127) // conditional expression is constant +#endif + namespace test { template @@ -92,5 +97,9 @@ namespace test } } +#if defined(BOOST_MSVC) +#pragma warning(pop) +#endif + #endif diff --git a/test/objects/minimal.hpp b/test/objects/minimal.hpp index 31d26d5d..3fd48da0 100644 --- a/test/objects/minimal.hpp +++ b/test/objects/minimal.hpp @@ -8,6 +8,11 @@ #include +#if defined(BOOST_MSVC) +#pragma warning(push) +#pragma warning(disable:4100) // unreferenced formal parameter +#endif + namespace test { namespace minimal @@ -226,4 +231,8 @@ namespace minimal } } +#if defined(BOOST_MSVC) +#pragma warning(pop) +#endif + #endif diff --git a/test/unordered/Jamfile.v2 b/test/unordered/Jamfile.v2 index 64cd63d1..c3dce0b3 100644 --- a/test/unordered/Jamfile.v2 +++ b/test/unordered/Jamfile.v2 @@ -9,6 +9,7 @@ project unordered-test/unordered : requirements intel-linux:"-strict_ansi -cxxlib-icc" gcc:-Wsign-promo + msvc:/W4 ; test-suite unordered-tests diff --git a/test/unordered/compile_tests.cpp b/test/unordered/compile_tests.cpp index aae63f55..9573b2de 100644 --- a/test/unordered/compile_tests.cpp +++ b/test/unordered/compile_tests.cpp @@ -6,7 +6,17 @@ #include #include +#if defined(BOOST_MSVC) +#pragma warning(push) +#pragma warning(disable:4100) // unreferenced formal parameter +#endif + #include + +#if defined(BOOST_MSVC) +#pragma warning(pop) +#endif + #include #include #include "../helpers/check_return_type.hpp" diff --git a/test/unordered/load_factor_tests.cpp b/test/unordered/load_factor_tests.cpp index cbb99c3b..97687892 100644 --- a/test/unordered/load_factor_tests.cpp +++ b/test/unordered/load_factor_tests.cpp @@ -9,6 +9,11 @@ #include #include "../helpers/random_values.hpp" +#if defined(BOOST_MSVC) +#pragma warning(push) +#pragma warning(disable:4127) // conditional expression is constant +#endif + template void load_factor_tests(X* = 0) { @@ -70,3 +75,8 @@ int main() return boost::report_errors(); } + +#if defined(BOOST_MSVC) +#pragma warning(pop) +#pragma warning(disable:4127) // conditional expression is constant +#endif diff --git a/test/unordered/unnecessary_copy_tests.cpp b/test/unordered/unnecessary_copy_tests.cpp index 19255ba2..0968d8d4 100644 --- a/test/unordered/unnecessary_copy_tests.cpp +++ b/test/unordered/unnecessary_copy_tests.cpp @@ -11,7 +11,7 @@ struct count_copies { static int count; count_copies() { ++count; } - count_copies(count_copies const& x) { ++count; } + count_copies(count_copies const&) { ++count; } private: count_copies& operator=(count_copies const&); }; @@ -20,7 +20,7 @@ private: namespace boost { #endif -std::size_t hash_value(count_copies const& x) { +std::size_t hash_value(count_copies const&) { return 0; } @@ -28,7 +28,7 @@ std::size_t hash_value(count_copies const& x) { } #endif -bool operator==(count_copies const& x, count_copies const& y) { +bool operator==(count_copies const&, count_copies const&) { return true; }