From 6d7e2976d3b66d3792cedc411add9de5f80ffd98 Mon Sep 17 00:00:00 2001 From: Daniel James Date: Tue, 4 Jan 2011 23:06:53 +0000 Subject: [PATCH] Merge hash from trunk. - Avoid `-Wconversion` warnings. [SVN r67664] --- hash/doc/Jamfile.v2 | 3 +++ hash/doc/changes.qbk | 4 ++++ hash/test/Jamfile.v2 | 8 ++++---- hash/test/hash_complex_test.cpp | 2 +- hash/test/hash_number_test.cpp | 3 ++- .../boost/functional/hash/detail/hash_float_generic.hpp | 4 ++-- include/boost/functional/hash/hash.hpp | 4 ++-- 7 files changed, 18 insertions(+), 10 deletions(-) diff --git a/hash/doc/Jamfile.v2 b/hash/doc/Jamfile.v2 index c21c881..62e2798 100644 --- a/hash/doc/Jamfile.v2 +++ b/hash/doc/Jamfile.v2 @@ -3,6 +3,9 @@ # 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) +using boostbook ; +using quickbook ; + xml hash : hash.qbk ; boostbook standalone : hash : boost.root=../../../../.. diff --git a/hash/doc/changes.qbk b/hash/doc/changes.qbk index eec4876..eb6572f 100644 --- a/hash/doc/changes.qbk +++ b/hash/doc/changes.qbk @@ -119,4 +119,8 @@ it's opt-in for now. This, or something like it, will become the default in a future version. +[h2 Boost 1.46.0] + +* Avoid warning due with gcc's `-Wconversion` flag. + [endsect] diff --git a/hash/test/Jamfile.v2 b/hash/test/Jamfile.v2 index 1b35eed..8985875 100644 --- a/hash/test/Jamfile.v2 +++ b/hash/test/Jamfile.v2 @@ -11,8 +11,8 @@ project hash-tests 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:"-pedantic -Wstrict-aliasing -fstrict-aliasing -Wextra -Wsign-promo -Wunused-parameter -Wconversion" + darwin:"-pedantic -Wstrict-aliasing -fstrict-aliasing -Wextra -Wsign-promo -Wunused-parameter -Wconversion" msvc:on #gcc:on #darwin:on @@ -25,8 +25,8 @@ test-suite functional/hash [ run hash_number_test.cpp ] [ run hash_pointer_test.cpp ] [ run hash_function_pointer_test.cpp ] - [ run hash_float_test.cpp : : : always_show_run_output ] - [ run hash_long_double_test.cpp : : : always_show_run_output ] + [ run hash_float_test.cpp ] + [ run hash_long_double_test.cpp ] [ run hash_string_test.cpp ] [ run hash_range_test.cpp ] [ run hash_custom_test.cpp ] diff --git a/hash/test/hash_complex_test.cpp b/hash/test/hash_complex_test.cpp index a2a2dc2..67e2aff 100644 --- a/hash/test/hash_complex_test.cpp +++ b/hash/test/hash_complex_test.cpp @@ -69,7 +69,7 @@ void complex_float_tests(Float*) generic_complex_tests(complex(0.5,0)); generic_complex_tests(complex(25,0)); generic_complex_tests(complex(25,0)); - generic_complex_tests(complex(-67.5324535,56.23578678)); + generic_complex_tests(complex(static_cast(-67.5324535),static_cast(56.23578678))); } template diff --git a/hash/test/hash_number_test.cpp b/hash/test/hash_number_test.cpp index 91b9b92..b989d22 100644 --- a/hash/test/hash_number_test.cpp +++ b/hash/test/hash_number_test.cpp @@ -113,7 +113,8 @@ void poor_quality_tests(T*) if(T(1) != T(2)) BOOST_TEST(x1(T(1)) != x2(T(2))); if((limits::max)() != (limits::max)() - 1) - BOOST_TEST(x1((limits::max)()) != x2((limits::max)() - 1)); + BOOST_TEST(x1(static_cast((limits::max)())) + != x2(static_cast((limits::max)() - 1))); } void bool_test() diff --git a/include/boost/functional/hash/detail/hash_float_generic.hpp b/include/boost/functional/hash/detail/hash_float_generic.hpp index fdbf53f..1278c2f 100644 --- a/include/boost/functional/hash/detail/hash_float_generic.hpp +++ b/include/boost/functional/hash/detail/hash_float_generic.hpp @@ -53,7 +53,7 @@ namespace boost v = ldexp(v, limits::digits); std::size_t seed = static_cast(v); - v -= seed; + v -= static_cast(seed); // ceiling(digits(T) * log2(radix(T))/ digits(size_t)) - 1; std::size_t const length @@ -66,7 +66,7 @@ namespace boost { v = ldexp(v, limits::digits); std::size_t part = static_cast(v); - v -= part; + v -= static_cast(part); hash_float_combine(seed, part); } diff --git a/include/boost/functional/hash/hash.hpp b/include/boost/functional/hash/hash.hpp index 0eedf7f..389804c 100644 --- a/include/boost/functional/hash/hash.hpp +++ b/include/boost/functional/hash/hash.hpp @@ -210,8 +210,8 @@ namespace boost #endif { #if defined(__VMS) && __INITIAL_POINTER_SIZE == 64 - // for some reason ptrdiff_t on OpenVMS compiler with - // 64 bit is not 64 bit !!! + // for some reason ptrdiff_t on OpenVMS compiler with + // 64 bit is not 64 bit !!! std::size_t x = static_cast( reinterpret_cast(v)); #else