mirror of
https://github.com/boostorg/core.git
synced 2025-07-29 20:37:22 +02:00
Disabled warnings about signed/unsigned mismatch when using BOOST_TEST_EQ/BOOST_TEST_NE.
This commit is contained in:
@ -85,6 +85,22 @@ inline void throw_failed_impl(char const * excep, char const * file, int line, c
|
||||
++test_errors();
|
||||
}
|
||||
|
||||
// In the comparisons below, it is possible that T and U are signed and unsigned integer types, which generates warnings in some compilers.
|
||||
// A cleaner fix would require common_type trait or some meta-programming, which would introduce a dependency on Boost.TypeTraits. To avoid
|
||||
// the dependency we just disable the warnings.
|
||||
#if defined(_MSC_VER)
|
||||
# pragma warning(push)
|
||||
# pragma warning(disable: 4389)
|
||||
#elif defined(__clang__) && defined(__has_warning)
|
||||
# if __has_warning("-Wsign-compare")
|
||||
# pragma clang diagnostic push
|
||||
# pragma clang diagnostic ignored "-Wsign-compare"
|
||||
# endif
|
||||
#elif defined(__GNUC__) && !(defined(__INTEL_COMPILER) || defined(__ICL) || defined(__ICC) || defined(__ECC)) && (__GNUC__ * 100 + __GNUC_MINOR__) >= 406
|
||||
# pragma GCC diagnostic push
|
||||
# pragma GCC diagnostic ignored "-Wsign-compare"
|
||||
#endif
|
||||
|
||||
template<class T, class U> inline void test_eq_impl( char const * expr1, char const * expr2,
|
||||
char const * file, int line, char const * function, T const & t, U const & u )
|
||||
{
|
||||
@ -119,6 +135,16 @@ template<class T, class U> inline void test_ne_impl( char const * expr1, char co
|
||||
}
|
||||
}
|
||||
|
||||
#if defined(_MSC_VER)
|
||||
# pragma warning(pop)
|
||||
#elif defined(__clang__) && defined(__has_warning)
|
||||
# if __has_warning("-Wsign-compare")
|
||||
# pragma clang diagnostic pop
|
||||
# endif
|
||||
#elif defined(__GNUC__) && !(defined(__INTEL_COMPILER) || defined(__ICL) || defined(__ICC) || defined(__ECC)) && (__GNUC__ * 100 + __GNUC_MINOR__) >= 406
|
||||
# pragma GCC diagnostic pop
|
||||
#endif
|
||||
|
||||
} // namespace detail
|
||||
|
||||
inline int report_errors()
|
||||
|
Reference in New Issue
Block a user