diff options
| author | Phil Nash | 2017-02-15 09:38:38 +0000 |
|---|---|---|
| committer | Phil Nash | 2017-02-15 10:03:28 +0000 |
| commit | fe690a68ef1e41d08e90589480fa8190219aa5b0 (patch) | |
| tree | c51550e9ff8d28f34a3c7ce7becbc035fb1dbb7c /include | |
| parent | c9a37c59c471aaa6546ac43e4fc0898e471dc5dc (diff) | |
| download | catch3-fe690a68ef1e41d08e90589480fa8190219aa5b0.tar.gz | |
push/pop warnings when disabling parentheses warnings within assertion (gcc/ clang)
Diffstat (limited to 'include')
| -rw-r--r-- | include/internal/catch_capture.hpp | 1 | ||||
| -rw-r--r-- | include/internal/catch_compiler_capabilities.h | 15 |
2 files changed, 14 insertions, 2 deletions
diff --git a/include/internal/catch_capture.hpp b/include/internal/catch_capture.hpp index 0ffe5b9a..ef0fcc7c 100644 --- a/include/internal/catch_capture.hpp +++ b/include/internal/catch_capture.hpp @@ -45,6 +45,7 @@ try { \ CATCH_INTERNAL_SUPPRESS_PARENTHESES_WARNINGS \ ( __catchResult <= expr ).endExpression(); \ + CATCH_INTERNAL_UNSUPPRESS_PARENTHESES_WARNINGS \ } \ catch( ... ) { \ __catchResult.useActiveException( resultDisposition ); \ diff --git a/include/internal/catch_compiler_capabilities.h b/include/internal/catch_compiler_capabilities.h index 93d2bf00..2eccc390 100644 --- a/include/internal/catch_compiler_capabilities.h +++ b/include/internal/catch_compiler_capabilities.h @@ -62,7 +62,11 @@ # endif # if defined(CATCH_CPP11_OR_GREATER) -# define CATCH_INTERNAL_SUPPRESS_PARENTHESES_WARNINGS _Pragma( "clang diagnostic ignored \"-Wparentheses\"" ) +# define CATCH_INTERNAL_SUPPRESS_PARENTHESES_WARNINGS \ + _Pragma( "clang diagnostic push" ) \ + _Pragma( "clang diagnostic ignored \"-Wparentheses\"" ) +# define CATCH_INTERNAL_UNSUPPRESS_PARENTHESES_WARNINGS \ + _Pragma( "clang diagnostic pop" ) # endif #endif // __clang__ @@ -97,9 +101,15 @@ # endif # if !defined(CATCH_INTERNAL_SUPPRESS_PARENTHESES_WARNINGS) && defined(CATCH_CPP11_OR_GREATER) -# define CATCH_INTERNAL_SUPPRESS_PARENTHESES_WARNINGS _Pragma( "GCC diagnostic ignored \"-Wparentheses\"" ) +# define CATCH_INTERNAL_SUPPRESS_PARENTHESES_WARNINGS \ + _Pragma( "GCC diagnostic push" ) \ + _Pragma( "GCC diagnostic ignored \"-Wparentheses\"" ) +# define CATCH_INTERNAL_UNSUPPRESS_PARENTHESES_WARNINGS \ + _Pragma( "GCC diagnostic pop" ) # endif + + // - otherwise more recent versions define __cplusplus >= 201103L // and will get picked up below @@ -242,6 +252,7 @@ #if !defined(CATCH_INTERNAL_SUPPRESS_PARENTHESES_WARNINGS) # define CATCH_INTERNAL_SUPPRESS_PARENTHESES_WARNINGS +# define CATCH_INTERNAL_UNSUPPRESS_PARENTHESES_WARNINGS #endif // noexcept support: |