Boost logo

Boost-Commit :

Subject: [Boost-commit] svn:boost r57839 - in trunk/libs/functional/hash: examples test
From: daniel_james_at_[hidden]
Date: 2009-11-21 14:40:55


Author: danieljames
Date: 2009-11-21 14:40:54 EST (Sat, 21 Nov 2009)
New Revision: 57839
URL: http://svn.boost.org/trac/boost/changeset/57839

Log:
Fix some hash /W4 warnings. Fixes #3648
Text files modified:
   trunk/libs/functional/hash/examples/books.cpp | 1 +
   trunk/libs/functional/hash/test/hash_complex_test.cpp | 14 ++++++--------
   2 files changed, 7 insertions(+), 8 deletions(-)

Modified: trunk/libs/functional/hash/examples/books.cpp
==============================================================================
--- trunk/libs/functional/hash/examples/books.cpp (original)
+++ trunk/libs/functional/hash/examples/books.cpp 2009-11-21 14:40:54 EST (Sat, 21 Nov 2009)
@@ -20,6 +20,7 @@
 
     boost::hash<library::book> book_hasher;
     std::size_t knife_hash_value = book_hasher(knife);
+ (void)knife_hash_value; // suppress unused variable warning
 
     // If std::unordered_set was available:
     //

Modified: trunk/libs/functional/hash/test/hash_complex_test.cpp
==============================================================================
--- trunk/libs/functional/hash/test/hash_complex_test.cpp (original)
+++ trunk/libs/functional/hash/test/hash_complex_test.cpp 2009-11-21 14:40:54 EST (Sat, 21 Nov 2009)
@@ -19,19 +19,17 @@
 
 #include <boost/detail/lightweight_test.hpp>
 
-#include <complex>
-#include <sstream>
-#include <boost/limits.hpp>
-
 #if defined(BOOST_MSVC)
-#pragma warning(push)
 #pragma warning(disable:4244) // conversion from 'unsigned long' to 'unsigned short', possible loss of data
+#pragma warning(disable:4245) // conversion from 'int' to 'const unsigned short', signed/unsigned mismatch
+#pragma warning(disable:4305) // truncation from 'double' to 'const std::complex<float>::_Ty'
+#pragma warning(disable:4309) // truncation of constant value
 #pragma warning(disable:4512) // assignment operator could not be generated
 #endif
 
-#if defined(BOOST_MSVC)
-#pragma warning(pop)
-#endif
+#include <complex>
+#include <sstream>
+#include <boost/limits.hpp>
 
 template <class T>
 void generic_complex_tests(std::complex<T> v)


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