mirror of
https://github.com/catchorg/Catch2.git
synced 2024-11-26 15:26:11 +01:00
Fix Wparentheses for GCC
Sadly most versions still cannot properly handle the suppression via `_Pragma`, so it has to leak to the users when they use older GCC versions to compile their code
This commit is contained in:
parent
6e270958a2
commit
e9caeb7d0b
@ -13,6 +13,12 @@
|
|||||||
#include <catch2/catch_message.h>
|
#include <catch2/catch_message.h>
|
||||||
#include <catch2/catch_stringref.h>
|
#include <catch2/catch_stringref.h>
|
||||||
|
|
||||||
|
// We need this suppression to leak, because it took until GCC 9
|
||||||
|
// for the front end to handle local suppression via _Pragma properly
|
||||||
|
#if defined(__GNUC__) && !defined(__clang__) && !defined(__ICC) && __GNUC__ < 9
|
||||||
|
#pragma GCC diagnostic ignored "-Wparentheses"
|
||||||
|
#endif
|
||||||
|
|
||||||
#if !defined(CATCH_CONFIG_DISABLE)
|
#if !defined(CATCH_CONFIG_DISABLE)
|
||||||
|
|
||||||
#if !defined(CATCH_CONFIG_DISABLE_STRINGIFICATION)
|
#if !defined(CATCH_CONFIG_DISABLE_STRINGIFICATION)
|
||||||
|
@ -48,6 +48,11 @@
|
|||||||
#if defined(__GNUC__) && !defined(__clang__) && !defined(__ICC)
|
#if defined(__GNUC__) && !defined(__clang__) && !defined(__ICC)
|
||||||
# define CATCH_INTERNAL_START_WARNINGS_SUPPRESSION _Pragma( "GCC diagnostic push" )
|
# define CATCH_INTERNAL_START_WARNINGS_SUPPRESSION _Pragma( "GCC diagnostic push" )
|
||||||
# define CATCH_INTERNAL_STOP_WARNINGS_SUPPRESSION _Pragma( "GCC diagnostic pop" )
|
# define CATCH_INTERNAL_STOP_WARNINGS_SUPPRESSION _Pragma( "GCC diagnostic pop" )
|
||||||
|
|
||||||
|
// This only works on GCC 9+. so we have to also add a global suppression of Wparentheses
|
||||||
|
// for older versions of GCC.
|
||||||
|
# define CATCH_INTERNAL_SUPPRESS_PARENTHESES_WARNINGS \
|
||||||
|
_Pragma( "GCC diagnostic ignored \"-Wparentheses\"" )
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#if defined(__clang__)
|
#if defined(__clang__)
|
||||||
|
Loading…
Reference in New Issue
Block a user