|
Boost-Commit : |
Subject: [Boost-commit] svn:boost r58032 - in branches/release: boost/functional/hash libs/functional/hash libs/functional/hash/examples libs/functional/hash/test
From: daniel_james_at_[hidden]
Date: 2009-11-29 11:14:12
Author: danieljames
Date: 2009-11-29 11:14:10 EST (Sun, 29 Nov 2009)
New Revision: 58032
URL: http://svn.boost.org/trac/boost/changeset/58032
Log:
Merge hash warning fixes from trunk.
Properties modified:
branches/release/boost/functional/hash/ (props changed)
branches/release/libs/functional/hash/ (props changed)
Text files modified:
branches/release/boost/functional/hash/hash.hpp | 13 +++++++++++++
branches/release/libs/functional/hash/examples/books.cpp | 1 +
branches/release/libs/functional/hash/test/Jamfile.v2 | 11 +++++++++--
branches/release/libs/functional/hash/test/config.hpp | 6 ++++++
branches/release/libs/functional/hash/test/container_fwd_test.cpp | 2 ++
branches/release/libs/functional/hash/test/extensions_hpp_test.cpp | 2 ++
branches/release/libs/functional/hash/test/hash_complex_test.cpp | 25 +++++++++++++++----------
branches/release/libs/functional/hash/test/hash_custom_test.cpp | 1 +
branches/release/libs/functional/hash/test/hash_float_test.hpp | 4 ++++
branches/release/libs/functional/hash/test/hash_friend_test.cpp | 2 ++
branches/release/libs/functional/hash/test/hash_fwd_test_1.cpp | 2 ++
branches/release/libs/functional/hash/test/hash_fwd_test_2.cpp | 2 ++
branches/release/libs/functional/hash/test/hash_global_namespace_test.cpp | 2 ++
branches/release/libs/functional/hash/test/hash_no_ext_fail_test.cpp | 17 +++++++++++++----
branches/release/libs/functional/hash/test/hash_no_ext_macro_1.cpp | 20 ++++++++++++--------
branches/release/libs/functional/hash/test/hash_no_ext_macro_2.cpp | 19 ++++++++++++-------
branches/release/libs/functional/hash/test/link_ext_test.cpp | 2 ++
branches/release/libs/functional/hash/test/link_no_ext_test.cpp | 2 ++
branches/release/libs/functional/hash/test/link_test.cpp | 2 ++
branches/release/libs/functional/hash/test/link_test_2.cpp | 2 ++
branches/release/libs/functional/hash/test/namespace_fail_test.cpp | 2 ++
21 files changed, 108 insertions(+), 31 deletions(-)
Modified: branches/release/boost/functional/hash/hash.hpp
==============================================================================
--- branches/release/boost/functional/hash/hash.hpp (original)
+++ branches/release/boost/functional/hash/hash.hpp 2009-11-29 11:14:10 EST (Sun, 29 Nov 2009)
@@ -197,6 +197,15 @@
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 <class T>
inline void hash_combine(std::size_t& seed, T& v)
@@ -209,6 +218,10 @@
seed ^= hasher(v) + 0x9e3779b9 + (seed<<6) + (seed>>2);
}
+#if defined(BOOST_MSVC)
+#pragma warning(pop)
+#endif
+
template <class It>
inline std::size_t hash_range(It first, It last)
{
Modified: branches/release/libs/functional/hash/examples/books.cpp
==============================================================================
--- branches/release/libs/functional/hash/examples/books.cpp (original)
+++ branches/release/libs/functional/hash/examples/books.cpp 2009-11-29 11:14:10 EST (Sun, 29 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: branches/release/libs/functional/hash/test/Jamfile.v2
==============================================================================
--- branches/release/libs/functional/hash/test/Jamfile.v2 (original)
+++ branches/release/libs/functional/hash/test/Jamfile.v2 2009-11-29 11:14:10 EST (Sun, 29 Nov 2009)
@@ -7,9 +7,16 @@
project hash-tests
: requirements
+ <warnings>all
+ <toolset>intel:<warnings>on
+ <toolset>intel:<cxxflags>-strict-ansi
+ <toolset>gcc:<cxxflags>"-pedantic -Wstrict-aliasing -fstrict-aliasing -Wextra -Wsign-promo -Wunused-parameter"
+ <toolset>darwin:<cxxflags>"-pedantic -Wstrict-aliasing -fstrict-aliasing -Wextra -Wsign-promo -Wunused-parameter"
<toolset>gcc:<define>_GLIBCXX_DEBUG
- <toolset>gcc:<cxxflags>-Wsign-promo
- #<toolset>gcc:<cxxflags>-Wextra
+ <toolset>darwin:<define>_GLIBCXX_DEBUG
+ <toolset>msvc:<warnings-as-errors>on
+ <toolset>gcc:<warnings-as-errors>on
+ <toolset>darwin:<warnings-as-errors>on
;
test-suite functional/hash
Modified: branches/release/libs/functional/hash/test/config.hpp
==============================================================================
--- branches/release/libs/functional/hash/test/config.hpp (original)
+++ branches/release/libs/functional/hash/test/config.hpp 2009-11-29 11:14:10 EST (Sun, 29 Nov 2009)
@@ -12,3 +12,9 @@
# define TEST_EXTENSIONS
# endif
#endif
+
+#if defined(_WIN32_WCE)
+// The standard windows mobile headers trigger this warning so I disable it
+// before doing anything else.
+#pragma warning(disable:4201) // nonstandard extension used : nameless struct/union
+#endif
Modified: branches/release/libs/functional/hash/test/container_fwd_test.cpp
==============================================================================
--- branches/release/libs/functional/hash/test/container_fwd_test.cpp (original)
+++ branches/release/libs/functional/hash/test/container_fwd_test.cpp 2009-11-29 11:14:10 EST (Sun, 29 Nov 2009)
@@ -3,6 +3,8 @@
// 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)
+#include "./config.hpp"
+
#include <boost/functional/detail/container_fwd.hpp>
#if BOOST_WORKAROUND(__GNUC__, < 3) && !defined(__SGI_STL_PORT) && !defined(_STLPORT_VERSION)
Modified: branches/release/libs/functional/hash/test/extensions_hpp_test.cpp
==============================================================================
--- branches/release/libs/functional/hash/test/extensions_hpp_test.cpp (original)
+++ branches/release/libs/functional/hash/test/extensions_hpp_test.cpp 2009-11-29 11:14:10 EST (Sun, 29 Nov 2009)
@@ -8,6 +8,8 @@
// It probably should be in boost/functional/hash/detail, but since it isn't it
// should work.
+#include "./config.hpp"
+
#include <boost/functional/hash/extensions.hpp>
int main() {
Modified: branches/release/libs/functional/hash/test/hash_complex_test.cpp
==============================================================================
--- branches/release/libs/functional/hash/test/hash_complex_test.cpp (original)
+++ branches/release/libs/functional/hash/test/hash_complex_test.cpp 2009-11-29 11:14:10 EST (Sun, 29 Nov 2009)
@@ -19,20 +19,21 @@
#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
+#if BOOST_MSVC < 1400
+#pragma warning(disable:4267) // conversion from 'size_t' to 'unsigned int', possible loss of data
#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)
{
@@ -80,13 +81,17 @@
int main()
{
+ // I've comments out the short and unsigned short tests
+ // as they cause warnings and don't really test
+ // anything that the other tests already deal with.
+
complex_float_tests((float*) 0);
complex_float_tests((double*) 0);
complex_float_tests((long double*) 0);
- complex_integral_tests((short*) 0);
+ //complex_integral_tests((short*) 0);
complex_integral_tests((int*) 0);
complex_integral_tests((long*) 0);
- complex_integral_tests((unsigned short*) 0);
+ //complex_integral_tests((unsigned short*) 0);
complex_integral_tests((unsigned int*) 0);
complex_integral_tests((unsigned long*) 0);
Modified: branches/release/libs/functional/hash/test/hash_custom_test.cpp
==============================================================================
--- branches/release/libs/functional/hash/test/hash_custom_test.cpp (original)
+++ branches/release/libs/functional/hash/test/hash_custom_test.cpp 2009-11-29 11:14:10 EST (Sun, 29 Nov 2009)
@@ -3,6 +3,7 @@
// 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)
+#include "./config.hpp"
#include <boost/config.hpp>
#include <cstddef>
Modified: branches/release/libs/functional/hash/test/hash_float_test.hpp
==============================================================================
--- branches/release/libs/functional/hash/test/hash_float_test.hpp (original)
+++ branches/release/libs/functional/hash/test/hash_float_test.hpp 2009-11-29 11:14:10 EST (Sun, 29 Nov 2009)
@@ -23,6 +23,10 @@
#if defined(BOOST_MSVC)
#pragma warning(push)
#pragma warning(disable:4127) // conditional expression is constant
+#pragma warning(disable:4723) // conditional expression is constant
+#if BOOST_MSVC < 1400
+#pragma warning(disable:4267) // conversion from 'size_t' to 'unsigned int', possible loss of data
+#endif
#endif
char const* float_type(float*) { return "float"; }
Modified: branches/release/libs/functional/hash/test/hash_friend_test.cpp
==============================================================================
--- branches/release/libs/functional/hash/test/hash_friend_test.cpp (original)
+++ branches/release/libs/functional/hash/test/hash_friend_test.cpp 2009-11-29 11:14:10 EST (Sun, 29 Nov 2009)
@@ -3,6 +3,8 @@
// 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)
+#include "./config.hpp"
+
#include <boost/config.hpp>
#include <cstddef>
Modified: branches/release/libs/functional/hash/test/hash_fwd_test_1.cpp
==============================================================================
--- branches/release/libs/functional/hash/test/hash_fwd_test_1.cpp (original)
+++ branches/release/libs/functional/hash/test/hash_fwd_test_1.cpp 2009-11-29 11:14:10 EST (Sun, 29 Nov 2009)
@@ -5,6 +5,8 @@
// This checks that template code implemented using hash_fwd will work.
+#include "./config.hpp"
+
#include "./hash_fwd_test.hpp"
#include <boost/detail/lightweight_test.hpp>
Modified: branches/release/libs/functional/hash/test/hash_fwd_test_2.cpp
==============================================================================
--- branches/release/libs/functional/hash/test/hash_fwd_test_2.cpp (original)
+++ branches/release/libs/functional/hash/test/hash_fwd_test_2.cpp 2009-11-29 11:14:10 EST (Sun, 29 Nov 2009)
@@ -6,6 +6,8 @@
// This test just makes sure a header which uses hash_fwd can compile without
// the main hash headers.
+#include "./config.hpp"
+
#if !defined(TEST_EXTENSIONS) || defined(TEST_STD_INCLUDES)
int main() {}
Modified: branches/release/libs/functional/hash/test/hash_global_namespace_test.cpp
==============================================================================
--- branches/release/libs/functional/hash/test/hash_global_namespace_test.cpp (original)
+++ branches/release/libs/functional/hash/test/hash_global_namespace_test.cpp 2009-11-29 11:14:10 EST (Sun, 29 Nov 2009)
@@ -6,6 +6,8 @@
// This test demonstrates an ADL bug in Borland 5.5 where ADL isn't performed
// in the global namespace.
+#include "./config.hpp"
+
#include <boost/config.hpp>
#include <cstddef>
Modified: branches/release/libs/functional/hash/test/hash_no_ext_fail_test.cpp
==============================================================================
--- branches/release/libs/functional/hash/test/hash_no_ext_fail_test.cpp (original)
+++ branches/release/libs/functional/hash/test/hash_no_ext_fail_test.cpp 2009-11-29 11:14:10 EST (Sun, 29 Nov 2009)
@@ -3,17 +3,26 @@
// 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)
-#define HASH_NAMESPACE boost
+#include "./config.hpp"
// Simple test to make sure BOOST_HASH_NO_EXTENSIONS does disable extensions
// (or at least one of them).
-#define BOOST_HASH_NO_EXTENSIONS
+#if !defined(BOOST_HASH_NO_EXTENSIONS)
+# define BOOST_HASH_NO_EXTENSIONS
+#endif
-#include <boost/functional/hash.hpp>
-#include <boost/functional/hash.hpp>
+#ifdef TEST_STD_INCLUDES
+# include <functional>
+#else
+# include <boost/functional/hash.hpp>
+#endif
+
+template <class T> void ignore(T const&) {}
int main()
{
HASH_NAMESPACE::hash< int[10] > hasher;
+ ignore(hasher);
+
return 0;
}
Modified: branches/release/libs/functional/hash/test/hash_no_ext_macro_1.cpp
==============================================================================
--- branches/release/libs/functional/hash/test/hash_no_ext_macro_1.cpp (original)
+++ branches/release/libs/functional/hash/test/hash_no_ext_macro_1.cpp 2009-11-29 11:14:10 EST (Sun, 29 Nov 2009)
@@ -3,24 +3,27 @@
// 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)
-#define HASH_NAMESPACE boost
+#include "./config.hpp"
+
+#if defined(TEST_EXTENSIONS)
// Include header without BOOST_HASH_NO_EXTENSIONS defined
-#if defined(BOOST_HASH_NO_EXTENSIONS)
-#undef BOOST_HASH_NO_EXTENSIONS
-#endif
-#include <boost/functional/hash.hpp>
+# if defined(BOOST_HASH_NO_EXTENSIONS)
+# undef BOOST_HASH_NO_EXTENSIONS
+# endif
+# include <boost/functional/hash.hpp>
// Include header with BOOST_HASH_NO_EXTENSIONS defined
-#define BOOST_HASH_NO_EXTENSIONS
-#include <boost/functional/hash.hpp>
+# define BOOST_HASH_NO_EXTENSIONS
+# include <boost/functional/hash.hpp>
+#endif
#include <boost/detail/lightweight_test.hpp>
#include <deque>
-#include <cassert>
int main()
{
+#if defined(TEST_EXTENSIONS)
std::deque<int> x;
x.push_back(1);
@@ -28,6 +31,7 @@
HASH_NAMESPACE::hash<std::deque<int> > hasher;
BOOST_TEST(hasher(x) == HASH_NAMESPACE::hash_value(x));
+#endif
return boost::report_errors();
}
Modified: branches/release/libs/functional/hash/test/hash_no_ext_macro_2.cpp
==============================================================================
--- branches/release/libs/functional/hash/test/hash_no_ext_macro_2.cpp (original)
+++ branches/release/libs/functional/hash/test/hash_no_ext_macro_2.cpp 2009-11-29 11:14:10 EST (Sun, 29 Nov 2009)
@@ -3,23 +3,27 @@
// 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)
-#define HASH_NAMESPACE boost
+#include "./config.hpp"
+
+#if defined(TEST_EXTENSIONS)
// Include header with BOOST_HASH_NO_EXTENSIONS defined
-#if !defined(BOOST_HASH_NO_EXTENSIONS)
-#define BOOST_HASH_NO_EXTENSIONS
-#endif
-#include <boost/functional/hash.hpp>
+# if !defined(BOOST_HASH_NO_EXTENSIONS)
+# define BOOST_HASH_NO_EXTENSIONS
+# endif
+# include <boost/functional/hash.hpp>
// Include header without BOOST_HASH_NO_EXTENSIONS defined
-#undef BOOST_HASH_NO_EXTENSIONS
-#include <boost/functional/hash.hpp>
+# undef BOOST_HASH_NO_EXTENSIONS
+# include <boost/functional/hash.hpp>
+#endif
#include <boost/detail/lightweight_test.hpp>
#include <map>
int main()
{
+#if defined(TEST_EXTENSIONS)
std::map<int, int> x;
x.insert(std::map<int, int>::value_type(53, -42));
@@ -27,6 +31,7 @@
HASH_NAMESPACE::hash<std::map<int, int> > hasher;
BOOST_TEST(hasher(x) == HASH_NAMESPACE::hash_value(x));
+#endif
return boost::report_errors();
}
Modified: branches/release/libs/functional/hash/test/link_ext_test.cpp
==============================================================================
--- branches/release/libs/functional/hash/test/link_ext_test.cpp (original)
+++ branches/release/libs/functional/hash/test/link_ext_test.cpp 2009-11-29 11:14:10 EST (Sun, 29 Nov 2009)
@@ -3,6 +3,8 @@
// 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)
+#include "./config.hpp"
+
#define HASH_NAMESPACE boost
#include <boost/functional/hash.hpp>
#include <boost/detail/lightweight_test.hpp>
Modified: branches/release/libs/functional/hash/test/link_no_ext_test.cpp
==============================================================================
--- branches/release/libs/functional/hash/test/link_no_ext_test.cpp (original)
+++ branches/release/libs/functional/hash/test/link_no_ext_test.cpp 2009-11-29 11:14:10 EST (Sun, 29 Nov 2009)
@@ -3,6 +3,8 @@
// 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)
+#include "./config.hpp"
+
#define HASH_NAMESPACE boost
#define BOOST_HASH_NO_EXTENSIONS
#include <boost/functional/hash.hpp>
Modified: branches/release/libs/functional/hash/test/link_test.cpp
==============================================================================
--- branches/release/libs/functional/hash/test/link_test.cpp (original)
+++ branches/release/libs/functional/hash/test/link_test.cpp 2009-11-29 11:14:10 EST (Sun, 29 Nov 2009)
@@ -3,6 +3,8 @@
// 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)
+#include "./config.hpp"
+
#include <boost/functional/hash.hpp>
extern int f();
Modified: branches/release/libs/functional/hash/test/link_test_2.cpp
==============================================================================
--- branches/release/libs/functional/hash/test/link_test_2.cpp (original)
+++ branches/release/libs/functional/hash/test/link_test_2.cpp 2009-11-29 11:14:10 EST (Sun, 29 Nov 2009)
@@ -3,6 +3,8 @@
// 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)
+#include "./config.hpp"
+
#include <boost/functional/hash.hpp>
int f() { return 0; }
Modified: branches/release/libs/functional/hash/test/namespace_fail_test.cpp
==============================================================================
--- branches/release/libs/functional/hash/test/namespace_fail_test.cpp (original)
+++ branches/release/libs/functional/hash/test/namespace_fail_test.cpp 2009-11-29 11:14:10 EST (Sun, 29 Nov 2009)
@@ -6,6 +6,8 @@
// Check that I haven't inadvertantly pulled namespace std into the global
// namespace.
+#include "./config.hpp"
+
#include <list>
#include <boost/functional/hash.hpp>
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