diff options
author | Stephan Bergmann <sbergman@redhat.com> | 2012-02-14 11:38:02 +0100 |
---|---|---|
committer | Stephan Bergmann <sbergman@redhat.com> | 2012-02-14 11:38:02 +0100 |
commit | 0f75eaa0b8de3d68e8b5b5447fbc009531183cb5 (patch) | |
tree | e0dff2b8c580ab6885293c8eae7785bcc93064fa | |
parent | 7a09bf3a88e99d85c4dec2ad296309dbec2987c3 (diff) |
GCC -Werror=sign-promo
-rw-r--r-- | include/cppunit/TestAssert.h | 15 |
1 files changed, 15 insertions, 0 deletions
diff --git a/include/cppunit/TestAssert.h b/include/cppunit/TestAssert.h index f74797b..851a444 100644 --- a/include/cppunit/TestAssert.h +++ b/include/cppunit/TestAssert.h @@ -8,6 +8,12 @@ #include <stdio.h> #include <float.h> // For struct assertion_traits<double> +// Work around "passing 'T' chooses 'int' over 'unsigned int'" warnings when T +// is an enum type: +#if defined __GNUC__ && (__GNUC__ < 4 || (__GNUC__ == 4 && __GNUC_MINOR__ < 6)) +#pragma GCC system_header +#endif + CPPUNIT_NS_BEGIN @@ -46,7 +52,16 @@ struct assertion_traits static std::string toString( const T& x ) { OStringStream ost; +// Work around "passing 'T' chooses 'int' over 'unsigned int'" warnings when T +// is an enum type: +#if defined __GNUC__ && ((__GNUC__ == 4 && __GNUC_MINOR__ >= 6) || __GNUC__ > 4) +#pragma GCC diagnostic push +#pragma GCC diagnostic ignored "-Wsign-promo" +#endif ost << x; +#if defined __GNUC__ && ((__GNUC__ == 4 && __GNUC_MINOR__ >= 6) || __GNUC__ > 4) +#pragma GCC diagnostic pop +#endif return ost.str(); } }; |