Improve -Wparentheses supression for gcc

If the gcc version supports `_Pragma` properly, we use that to disable
it locally inside assertions.

Otherwise we disable it for the entire TU.

Fixes #674
This commit is contained in:
Martin Hořeňovský
2017-02-15 17:11:39 +01:00
parent 1f71d1f760
commit 2e0ae01b05
2 changed files with 11 additions and 1 deletions

View File

@@ -96,11 +96,15 @@
// GCC
#ifdef __GNUC__
# if __GNUC__ > 4 || (__GNUC__ == 4 && __GNUC_MINOR__ >= 8)
# define CATCH_GCC_HAS_NEW_PRAGMA
# endif
# if __GNUC__ == 4 && __GNUC_MINOR__ >= 6 && defined(__GXX_EXPERIMENTAL_CXX0X__)
# define CATCH_INTERNAL_CONFIG_CPP11_NULLPTR
# endif
# if !defined(CATCH_INTERNAL_SUPPRESS_PARENTHESES_WARNINGS) && defined(CATCH_CPP11_OR_GREATER)
# if !defined(CATCH_INTERNAL_SUPPRESS_PARENTHESES_WARNINGS) && defined(CATCH_GCC_HAS_NEW_PRAGMA)
# define CATCH_INTERNAL_SUPPRESS_PARENTHESES_WARNINGS \
_Pragma( "GCC diagnostic push" ) \
_Pragma( "GCC diagnostic ignored \"-Wparentheses\"" )