From c8c71d0ad19de265e7ad835c9c2f96c95e1e7617 Mon Sep 17 00:00:00 2001 From: Daniel James Date: Sun, 8 Apr 2012 15:29:15 +0000 Subject: [PATCH] Unordered/hash: Avoid a gcc warning. Refs #6771 [SVN r77832] --- include/boost/unordered/detail/table.hpp | 2 +- test/exception/assign_exception_tests.cpp | 2 -- test/exception/constructor_exception_tests.cpp | 2 -- test/exception/containers.hpp | 2 ++ test/exception/copy_exception_tests.cpp | 2 -- test/exception/erase_exception_tests.cpp | 2 -- test/exception/insert_exception_tests.cpp | 2 -- test/exception/rehash_exception_tests.cpp | 2 -- test/exception/swap_exception_tests.cpp | 2 -- test/helpers/postfix.hpp | 10 ++++++++++ test/unordered/Jamfile.v2 | 4 ++-- test/unordered/assign_tests.cpp | 2 +- test/unordered/at_tests.cpp | 3 ++- test/unordered/bucket_tests.cpp | 3 ++- test/unordered/compile_map.cpp | 2 +- test/unordered/compile_set.cpp | 2 +- test/unordered/constructor_tests.cpp | 3 ++- test/unordered/copy_tests.cpp | 3 ++- test/unordered/equality_deprecated.cpp | 3 ++- test/unordered/equality_tests.cpp | 3 ++- test/unordered/equivalent_keys_tests.cpp | 3 ++- test/unordered/erase_equiv_tests.cpp | 3 ++- test/unordered/erase_tests.cpp | 3 ++- test/unordered/find_tests.cpp | 3 ++- test/unordered/fwd_map_test.cpp | 2 +- test/unordered/fwd_set_test.cpp | 2 +- test/unordered/incomplete_test.cpp | 5 +++-- test/unordered/insert_stable_tests.cpp | 3 ++- test/unordered/insert_tests.cpp | 3 ++- test/unordered/link_test_1.cpp | 2 +- test/unordered/link_test_2.cpp | 2 +- test/unordered/load_factor_tests.cpp | 3 ++- test/unordered/move_tests.cpp | 3 ++- test/unordered/rehash_tests.cpp | 3 ++- test/unordered/simple_tests.cpp | 3 ++- test/unordered/swap_tests.cpp | 5 +++-- test/unordered/unnecessary_copy_tests.cpp | 6 ++++-- 37 files changed, 64 insertions(+), 46 deletions(-) create mode 100644 test/helpers/postfix.hpp diff --git a/include/boost/unordered/detail/table.hpp b/include/boost/unordered/detail/table.hpp index 217300cc..638f84bd 100644 --- a/include/boost/unordered/detail/table.hpp +++ b/include/boost/unordered/detail/table.hpp @@ -391,7 +391,7 @@ namespace boost { namespace unordered { namespace detail { std::size_t min_buckets_for_size(std::size_t size) const { - BOOST_ASSERT(this->mlf_ != 0); + BOOST_ASSERT(this->mlf_ >= minimum_max_load_factor); using namespace std; diff --git a/test/exception/assign_exception_tests.cpp b/test/exception/assign_exception_tests.cpp index 8e64efeb..bee732d4 100644 --- a/test/exception/assign_exception_tests.cpp +++ b/test/exception/assign_exception_tests.cpp @@ -3,8 +3,6 @@ // 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 "../helpers/prefix.hpp" - #include "./containers.hpp" #include "../helpers/random_values.hpp" #include "../helpers/invariants.hpp" diff --git a/test/exception/constructor_exception_tests.cpp b/test/exception/constructor_exception_tests.cpp index aa1e02a4..3a803651 100644 --- a/test/exception/constructor_exception_tests.cpp +++ b/test/exception/constructor_exception_tests.cpp @@ -3,8 +3,6 @@ // 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 "../helpers/prefix.hpp" - #include "./containers.hpp" #include "../helpers/random_values.hpp" #include "../helpers/input_iterator.hpp" diff --git a/test/exception/containers.hpp b/test/exception/containers.hpp index 23c9e495..b3a326b8 100644 --- a/test/exception/containers.hpp +++ b/test/exception/containers.hpp @@ -3,8 +3,10 @@ // 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 "../helpers/prefix.hpp" #include #include +#include "../helpers/postfix.hpp" #include "../objects/exception.hpp" typedef boost::unordered_set< diff --git a/test/exception/copy_exception_tests.cpp b/test/exception/copy_exception_tests.cpp index 0d0e2e14..019410ba 100644 --- a/test/exception/copy_exception_tests.cpp +++ b/test/exception/copy_exception_tests.cpp @@ -3,8 +3,6 @@ // 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 "../helpers/prefix.hpp" - #include "./containers.hpp" #include "../helpers/random_values.hpp" diff --git a/test/exception/erase_exception_tests.cpp b/test/exception/erase_exception_tests.cpp index f6eb5b42..5d40995a 100644 --- a/test/exception/erase_exception_tests.cpp +++ b/test/exception/erase_exception_tests.cpp @@ -3,8 +3,6 @@ // 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 "../helpers/prefix.hpp" - #include "./containers.hpp" #include "../helpers/random_values.hpp" #include "../helpers/invariants.hpp" diff --git a/test/exception/insert_exception_tests.cpp b/test/exception/insert_exception_tests.cpp index 84278c0e..fc962cec 100644 --- a/test/exception/insert_exception_tests.cpp +++ b/test/exception/insert_exception_tests.cpp @@ -3,8 +3,6 @@ // 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 "../helpers/prefix.hpp" - #include "./containers.hpp" #include #include "../helpers/random_values.hpp" diff --git a/test/exception/rehash_exception_tests.cpp b/test/exception/rehash_exception_tests.cpp index 2de210f5..2a987867 100644 --- a/test/exception/rehash_exception_tests.cpp +++ b/test/exception/rehash_exception_tests.cpp @@ -3,8 +3,6 @@ // 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 "../helpers/prefix.hpp" - #include "./containers.hpp" #include #include "../helpers/random_values.hpp" diff --git a/test/exception/swap_exception_tests.cpp b/test/exception/swap_exception_tests.cpp index 570a54fa..5fcab288 100644 --- a/test/exception/swap_exception_tests.cpp +++ b/test/exception/swap_exception_tests.cpp @@ -3,8 +3,6 @@ // 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 "../helpers/prefix.hpp" - #include "./containers.hpp" #include "../helpers/random_values.hpp" #include "../helpers/invariants.hpp" diff --git a/test/helpers/postfix.hpp b/test/helpers/postfix.hpp new file mode 100644 index 00000000..ca14ae71 --- /dev/null +++ b/test/helpers/postfix.hpp @@ -0,0 +1,10 @@ + +// Copyright 2012 Daniel James. +// 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 this after the boost headers, but before other test headers. + +#if defined(__GNUC__) +#pragma GCC diagnostic ignored "-Wfloat-equal" +#endif diff --git a/test/unordered/Jamfile.v2 b/test/unordered/Jamfile.v2 index 4a785224..15095a10 100644 --- a/test/unordered/Jamfile.v2 +++ b/test/unordered/Jamfile.v2 @@ -11,8 +11,8 @@ project unordered-test/unordered intel:on # Would be nice to define -Wundef, but I'm getting warnings from # Boost.Preprocessor on trunk. - gcc:"-pedantic -Wstrict-aliasing -fstrict-aliasing -Wextra -Wsign-promo -Wunused-parameter -Wconversion -Wno-long-long" - darwin:"-pedantic -Wstrict-aliasing -fstrict-aliasing -Wextra -Wsign-promo -Wunused-parameter -Wconversion" + gcc:"-pedantic -Wstrict-aliasing -fstrict-aliasing -Wextra -Wsign-promo -Wunused-parameter -Wconversion -Wno-long-long -Wfloat-equal" + darwin:"-pedantic -Wstrict-aliasing -fstrict-aliasing -Wextra -Wsign-promo -Wunused-parameter -Wconversion -Wfloat-equal" #gcc:_GLIBCXX_DEBUG #darwin:_GLIBCXX_DEBUG #msvc:on diff --git a/test/unordered/assign_tests.cpp b/test/unordered/assign_tests.cpp index 6c2dec60..5079f4d5 100644 --- a/test/unordered/assign_tests.cpp +++ b/test/unordered/assign_tests.cpp @@ -4,9 +4,9 @@ // file LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt) #include "../helpers/prefix.hpp" - #include #include +#include "../helpers/postfix.hpp" #include "../helpers/test.hpp" #include "../objects/test.hpp" #include "../objects/cxx11_allocator.hpp" diff --git a/test/unordered/at_tests.cpp b/test/unordered/at_tests.cpp index b67900f3..111f9c2f 100644 --- a/test/unordered/at_tests.cpp +++ b/test/unordered/at_tests.cpp @@ -4,8 +4,9 @@ // file LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt) #include "../helpers/prefix.hpp" - #include +#include "../helpers/postfix.hpp" + #include "../helpers/test.hpp" #include diff --git a/test/unordered/bucket_tests.cpp b/test/unordered/bucket_tests.cpp index 037e027e..c54d58d2 100644 --- a/test/unordered/bucket_tests.cpp +++ b/test/unordered/bucket_tests.cpp @@ -4,9 +4,10 @@ // file LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt) #include "../helpers/prefix.hpp" - #include #include +#include "../helpers/postfix.hpp" + #include "../helpers/test.hpp" #include #include "../objects/test.hpp" diff --git a/test/unordered/compile_map.cpp b/test/unordered/compile_map.cpp index 0d8a30b7..6cd3c503 100644 --- a/test/unordered/compile_map.cpp +++ b/test/unordered/compile_map.cpp @@ -7,8 +7,8 @@ // requirements. Makes sure everything compiles and is defined correctly. #include "../helpers/prefix.hpp" - #include +#include "../helpers/postfix.hpp" #include #include "../helpers/test.hpp" diff --git a/test/unordered/compile_set.cpp b/test/unordered/compile_set.cpp index 92e808d1..f023c797 100644 --- a/test/unordered/compile_set.cpp +++ b/test/unordered/compile_set.cpp @@ -7,8 +7,8 @@ // requirements. Makes sure everything compiles and is defined correctly. #include "../helpers/prefix.hpp" - #include +#include "../helpers/postfix.hpp" #include #include "../helpers/test.hpp" diff --git a/test/unordered/constructor_tests.cpp b/test/unordered/constructor_tests.cpp index 7df69d99..53149061 100644 --- a/test/unordered/constructor_tests.cpp +++ b/test/unordered/constructor_tests.cpp @@ -4,9 +4,10 @@ // file LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt) #include "../helpers/prefix.hpp" - #include #include +#include "../helpers/postfix.hpp" + #include "../helpers/test.hpp" #include "../objects/test.hpp" #include "../helpers/random_values.hpp" diff --git a/test/unordered/copy_tests.cpp b/test/unordered/copy_tests.cpp index 0200a48e..5bbdb901 100644 --- a/test/unordered/copy_tests.cpp +++ b/test/unordered/copy_tests.cpp @@ -4,9 +4,10 @@ // file LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt) #include "../helpers/prefix.hpp" - #include #include +#include "../helpers/postfix.hpp" + #include "../helpers/test.hpp" #include "../objects/test.hpp" #include "../objects/cxx11_allocator.hpp" diff --git a/test/unordered/equality_deprecated.cpp b/test/unordered/equality_deprecated.cpp index 826b11f4..af56bdea 100644 --- a/test/unordered/equality_deprecated.cpp +++ b/test/unordered/equality_deprecated.cpp @@ -6,9 +6,10 @@ #define BOOST_UNORDERED_DEPRECATED_EQUALITY #include "../helpers/prefix.hpp" - #include #include +#include "../helpers/postfix.hpp" + #include #include #include "../helpers/test.hpp" diff --git a/test/unordered/equality_tests.cpp b/test/unordered/equality_tests.cpp index bd12ba9e..317a40f4 100644 --- a/test/unordered/equality_tests.cpp +++ b/test/unordered/equality_tests.cpp @@ -4,9 +4,10 @@ // file LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt) #include "../helpers/prefix.hpp" - #include #include +#include "../helpers/postfix.hpp" + #include #include #include "../helpers/test.hpp" diff --git a/test/unordered/equivalent_keys_tests.cpp b/test/unordered/equivalent_keys_tests.cpp index 994bc668..2d459a4b 100644 --- a/test/unordered/equivalent_keys_tests.cpp +++ b/test/unordered/equivalent_keys_tests.cpp @@ -4,9 +4,10 @@ // file LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt) #include "../helpers/prefix.hpp" - #include #include +#include "../helpers/postfix.hpp" + #include "../helpers/test.hpp" #include #include diff --git a/test/unordered/erase_equiv_tests.cpp b/test/unordered/erase_equiv_tests.cpp index bb2e5b1b..6af1774e 100644 --- a/test/unordered/erase_equiv_tests.cpp +++ b/test/unordered/erase_equiv_tests.cpp @@ -7,8 +7,9 @@ // hairy with several tricky edge cases - so explicitly test each one. #include "../helpers/prefix.hpp" - #include +#include "../helpers/postfix.hpp" + #include "../helpers/test.hpp" #include "../helpers/list.hpp" #include diff --git a/test/unordered/erase_tests.cpp b/test/unordered/erase_tests.cpp index 6f434fb3..168e72a8 100644 --- a/test/unordered/erase_tests.cpp +++ b/test/unordered/erase_tests.cpp @@ -4,9 +4,10 @@ // file LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt) #include "../helpers/prefix.hpp" - #include #include +#include "../helpers/postfix.hpp" + #include "../helpers/test.hpp" #include #include "../objects/test.hpp" diff --git a/test/unordered/find_tests.cpp b/test/unordered/find_tests.cpp index 336f2a42..2766b938 100644 --- a/test/unordered/find_tests.cpp +++ b/test/unordered/find_tests.cpp @@ -4,9 +4,10 @@ // file LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt) #include "../helpers/prefix.hpp" - #include #include +#include "../helpers/postfix.hpp" + #include "../helpers/test.hpp" #include "../objects/test.hpp" #include "../helpers/random_values.hpp" diff --git a/test/unordered/fwd_map_test.cpp b/test/unordered/fwd_map_test.cpp index dc2267bf..5a943657 100644 --- a/test/unordered/fwd_map_test.cpp +++ b/test/unordered/fwd_map_test.cpp @@ -4,8 +4,8 @@ // file LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt) #include "../helpers/prefix.hpp" - #include +#include "../helpers/postfix.hpp" template void call_swap(boost::unordered_map& x, diff --git a/test/unordered/fwd_set_test.cpp b/test/unordered/fwd_set_test.cpp index 4fa66b90..62067f52 100644 --- a/test/unordered/fwd_set_test.cpp +++ b/test/unordered/fwd_set_test.cpp @@ -4,8 +4,8 @@ // file LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt) #include "../helpers/prefix.hpp" - #include +#include "../helpers/postfix.hpp" struct true_type { char x[100]; }; struct false_type { char x; }; diff --git a/test/unordered/incomplete_test.cpp b/test/unordered/incomplete_test.cpp index 5f355de2..035dfb6f 100644 --- a/test/unordered/incomplete_test.cpp +++ b/test/unordered/incomplete_test.cpp @@ -4,10 +4,11 @@ // file LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt) #include "../helpers/prefix.hpp" - -#include #include #include +#include "../helpers/postfix.hpp" + +#include namespace x { diff --git a/test/unordered/insert_stable_tests.cpp b/test/unordered/insert_stable_tests.cpp index 86304da8..f750e50f 100644 --- a/test/unordered/insert_stable_tests.cpp +++ b/test/unordered/insert_stable_tests.cpp @@ -4,9 +4,10 @@ // file LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt) #include "../helpers/prefix.hpp" - #include #include +#include "../helpers/postfix.hpp" + #include "../helpers/test.hpp" #include diff --git a/test/unordered/insert_tests.cpp b/test/unordered/insert_tests.cpp index 4b1cd80e..be8cdc30 100644 --- a/test/unordered/insert_tests.cpp +++ b/test/unordered/insert_tests.cpp @@ -4,9 +4,10 @@ // file LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt) #include "../helpers/prefix.hpp" - #include #include +#include "../helpers/postfix.hpp" + #include "../helpers/test.hpp" #include #include "../objects/test.hpp" diff --git a/test/unordered/link_test_1.cpp b/test/unordered/link_test_1.cpp index 563f87ff..8df5337e 100644 --- a/test/unordered/link_test_1.cpp +++ b/test/unordered/link_test_1.cpp @@ -4,9 +4,9 @@ // file LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt) #include "../helpers/prefix.hpp" - #include #include +#include "../helpers/postfix.hpp" void foo(boost::unordered_set&, boost::unordered_map&, diff --git a/test/unordered/link_test_2.cpp b/test/unordered/link_test_2.cpp index ff6432de..40ac9ebd 100644 --- a/test/unordered/link_test_2.cpp +++ b/test/unordered/link_test_2.cpp @@ -4,9 +4,9 @@ // file LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt) #include "../helpers/prefix.hpp" - #include #include +#include "../helpers/postfix.hpp" void foo(boost::unordered_set& x1, boost::unordered_map& x2, diff --git a/test/unordered/load_factor_tests.cpp b/test/unordered/load_factor_tests.cpp index 8788da9b..59e91e98 100644 --- a/test/unordered/load_factor_tests.cpp +++ b/test/unordered/load_factor_tests.cpp @@ -4,9 +4,10 @@ // file LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt) #include "../helpers/prefix.hpp" - #include #include +#include "../helpers/postfix.hpp" + #include "../helpers/test.hpp" #include #include "../helpers/random_values.hpp" diff --git a/test/unordered/move_tests.cpp b/test/unordered/move_tests.cpp index ced30486..a99171f2 100644 --- a/test/unordered/move_tests.cpp +++ b/test/unordered/move_tests.cpp @@ -4,9 +4,10 @@ // file LICENSE_1_0.txt or move at http://www.boost.org/LICENSE_1_0.txt) #include "../helpers/prefix.hpp" - #include #include +#include "../helpers/postfix.hpp" + #include "../helpers/test.hpp" #include "../objects/test.hpp" #include "../objects/cxx11_allocator.hpp" diff --git a/test/unordered/rehash_tests.cpp b/test/unordered/rehash_tests.cpp index 434389b0..dbfb84c2 100644 --- a/test/unordered/rehash_tests.cpp +++ b/test/unordered/rehash_tests.cpp @@ -4,9 +4,10 @@ // file LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt) #include "../helpers/prefix.hpp" - #include #include +#include "../helpers/postfix.hpp" + #include "../helpers/test.hpp" #include "../helpers/random_values.hpp" #include "../helpers/tracker.hpp" diff --git a/test/unordered/simple_tests.cpp b/test/unordered/simple_tests.cpp index ca343542..e3d0ebe1 100644 --- a/test/unordered/simple_tests.cpp +++ b/test/unordered/simple_tests.cpp @@ -6,9 +6,10 @@ // This test checks the runtime requirements of containers. #include "../helpers/prefix.hpp" - #include #include +#include "../helpers/postfix.hpp" + #include "../helpers/test.hpp" #include #include diff --git a/test/unordered/swap_tests.cpp b/test/unordered/swap_tests.cpp index 9769af7f..9194a575 100644 --- a/test/unordered/swap_tests.cpp +++ b/test/unordered/swap_tests.cpp @@ -4,12 +4,13 @@ // file LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt) #include "../helpers/prefix.hpp" +#include +#include +#include "../helpers/postfix.hpp" #include #include #include -#include -#include #include "../helpers/test.hpp" #include "../objects/test.hpp" #include "../objects/cxx11_allocator.hpp" diff --git a/test/unordered/unnecessary_copy_tests.cpp b/test/unordered/unnecessary_copy_tests.cpp index d9f85195..c8efe28f 100644 --- a/test/unordered/unnecessary_copy_tests.cpp +++ b/test/unordered/unnecessary_copy_tests.cpp @@ -1,12 +1,14 @@ -#include + // Copyright 2006-2009 Daniel James. // 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 "../helpers/prefix.hpp" - #include #include +#include "../helpers/postfix.hpp" + +#include #include "../helpers/test.hpp" #if defined(BOOST_UNORDERED_VARIADIC_MOVE)