From ed8c404ca6fae957e581d40d9ca3f5d358cdfce3 Mon Sep 17 00:00:00 2001 From: Daniel James Date: Tue, 10 Nov 2009 08:15:55 +0000 Subject: [PATCH] Stricter warnings for unordered and hash. There are still warnings in hash_complex_test. [SVN r57537] --- hash/test/Jamfile.v2 | 18 +++++++++++++----- hash/test/hash_no_ext_fail_test.cpp | 3 +++ include/boost/functional/hash/hash.hpp | 13 +++++++++++++ 3 files changed, 29 insertions(+), 5 deletions(-) diff --git a/hash/test/Jamfile.v2 b/hash/test/Jamfile.v2 index ea19365..e261cff 100644 --- a/hash/test/Jamfile.v2 +++ b/hash/test/Jamfile.v2 @@ -7,9 +7,16 @@ import testing ; project hash-tests : requirements + all + intel:on + intel:-strict-ansi + gcc:"-pedantic -Wstrict-aliasing -fstrict-aliasing -Wextra -Wsign-promo -Wunused-parameter" + darwin:"-pedantic -Wstrict-aliasing -fstrict-aliasing -Wextra -Wsign-promo -Wunused-parameter" gcc:_GLIBCXX_DEBUG - gcc:-Wsign-promo - #gcc:-Wextra + darwin:_GLIBCXX_DEBUG + msvc:on + gcc:on + darwin:on ; test-suite functional/hash @@ -33,13 +40,14 @@ test-suite functional/hash [ run hash_deque_test.cpp ] [ run hash_set_test.cpp ] [ run hash_map_test.cpp ] - [ run hash_complex_test.cpp ] + [ run hash_complex_test.cpp : : : off ] [ run link_test.cpp link_test_2.cpp ] [ run link_ext_test.cpp link_no_ext_test.cpp ] [ run extensions_hpp_test.cpp ] [ run container_fwd_test.cpp ] - [ compile-fail hash_no_ext_fail_test.cpp ] - [ compile-fail namespace_fail_test.cpp ] + # Don't want compile-fail tests to fail because of warnings. + [ compile-fail hash_no_ext_fail_test.cpp : : : off ] + [ compile-fail namespace_fail_test.cpp : : : off ] [ run hash_no_ext_macro_1.cpp ] [ run hash_no_ext_macro_2.cpp ] ; diff --git a/hash/test/hash_no_ext_fail_test.cpp b/hash/test/hash_no_ext_fail_test.cpp index ef7ae96..a29f8d5 100644 --- a/hash/test/hash_no_ext_fail_test.cpp +++ b/hash/test/hash_no_ext_fail_test.cpp @@ -12,8 +12,11 @@ #include #include +template void ignore(T const&) {} + int main() { HASH_NAMESPACE::hash< int[10] > hasher; + ignore(hasher); return 0; } diff --git a/include/boost/functional/hash/hash.hpp b/include/boost/functional/hash/hash.hpp index 6784f3e..ce1ce94 100644 --- a/include/boost/functional/hash/hash.hpp +++ b/include/boost/functional/hash/hash.hpp @@ -197,6 +197,15 @@ namespace boost return x + (x >> 3); } +#if defined(BOOST_MSVC) +#pragma warning(push) +#if BOOST_MSVC == 1400 +#pragma warning(disable:4267) // 'argument' : conversion from 'size_t' to 'unsigned int', + // possible loss of data + // A misguided attempt to detect 64-bit incompatability. +#endif +#endif + #if BOOST_WORKAROUND(BOOST_MSVC, < 1300) template inline void hash_combine(std::size_t& seed, T& v) @@ -209,6 +218,10 @@ namespace boost seed ^= hasher(v) + 0x9e3779b9 + (seed<<6) + (seed>>2); } +#if defined(BOOST_MSVC) +#pragma warning(pop) +#endif + template inline std::size_t hash_range(It first, It last) {