Stricter warnings for unordered and hash.

There are still warnings in hash_complex_test.

[SVN r57537]
This commit is contained in:
Daniel James
2009-11-10 08:15:55 +00:00
parent d108788cf6
commit ed8c404ca6
3 changed files with 29 additions and 5 deletions

View File

@@ -7,9 +7,16 @@ import testing ;
project hash-tests project hash-tests
: requirements : 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:<define>_GLIBCXX_DEBUG
<toolset>gcc:<cxxflags>-Wsign-promo <toolset>darwin:<define>_GLIBCXX_DEBUG
#<toolset>gcc:<cxxflags>-Wextra <toolset>msvc:<warnings-as-errors>on
<toolset>gcc:<warnings-as-errors>on
<toolset>darwin:<warnings-as-errors>on
; ;
test-suite functional/hash test-suite functional/hash
@@ -33,13 +40,14 @@ test-suite functional/hash
[ run hash_deque_test.cpp ] [ run hash_deque_test.cpp ]
[ run hash_set_test.cpp ] [ run hash_set_test.cpp ]
[ run hash_map_test.cpp ] [ run hash_map_test.cpp ]
[ run hash_complex_test.cpp ] [ run hash_complex_test.cpp : : : <warnings-as-errors>off ]
[ run link_test.cpp link_test_2.cpp ] [ run link_test.cpp link_test_2.cpp ]
[ run link_ext_test.cpp link_no_ext_test.cpp ] [ run link_ext_test.cpp link_no_ext_test.cpp ]
[ run extensions_hpp_test.cpp ] [ run extensions_hpp_test.cpp ]
[ run container_fwd_test.cpp ] [ run container_fwd_test.cpp ]
[ compile-fail hash_no_ext_fail_test.cpp ] # Don't want compile-fail tests to fail because of warnings.
[ compile-fail namespace_fail_test.cpp ] [ compile-fail hash_no_ext_fail_test.cpp : : : <warnings-as-errors>off ]
[ compile-fail namespace_fail_test.cpp : : : <warnings-as-errors>off ]
[ run hash_no_ext_macro_1.cpp ] [ run hash_no_ext_macro_1.cpp ]
[ run hash_no_ext_macro_2.cpp ] [ run hash_no_ext_macro_2.cpp ]
; ;

View File

@@ -12,8 +12,11 @@
#include <boost/functional/hash.hpp> #include <boost/functional/hash.hpp>
#include <boost/functional/hash.hpp> #include <boost/functional/hash.hpp>
template <class T> void ignore(T const&) {}
int main() int main()
{ {
HASH_NAMESPACE::hash< int[10] > hasher; HASH_NAMESPACE::hash< int[10] > hasher;
ignore(hasher);
return 0; return 0;
} }

View File

@@ -197,6 +197,15 @@ namespace boost
return x + (x >> 3); 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) #if BOOST_WORKAROUND(BOOST_MSVC, < 1300)
template <class T> template <class T>
inline void hash_combine(std::size_t& seed, T& v) inline void hash_combine(std::size_t& seed, T& v)
@@ -209,6 +218,10 @@ namespace boost
seed ^= hasher(v) + 0x9e3779b9 + (seed<<6) + (seed>>2); seed ^= hasher(v) + 0x9e3779b9 + (seed<<6) + (seed>>2);
} }
#if defined(BOOST_MSVC)
#pragma warning(pop)
#endif
template <class It> template <class It>
inline std::size_t hash_range(It first, It last) inline std::size_t hash_range(It first, It last)
{ {