catch3
Progmasoft Catch3: an independently maintained C++17 test framework with a parallel runner, property checks, snapshots and structured results.
Clonegit clone https://git.progmasoft.com/catch3
Fix comma-subscript warning suppression to only target GCC 10.1+
- Commit
20d413b8b6803c6d456874935d7014fe684e9426- Author
- Martin Hořeňovský ·
- Parents
e33de8fc05ca
Changes
projects/SelfTest/UsageTests/Message.tests.cpp | 15 ++++++++------- 1 file changed, 8 insertions(+), 7 deletions(-) diff --git a/projects/SelfTest/UsageTests/Message.tests.cpp b/projects/SelfTest/UsageTests/Message.tests.cpp index d151b2ba..e2bd486f 100644 --- a/projects/SelfTest/UsageTests/Message.tests.cpp +++ b/projects/SelfTest/UsageTests/Message.tests.cpp @@ -241,17 +241,19 @@ std::ostream& operator<<(std::ostream& out, helper_1436<T1, T2> const& helper) { return out; } +// clang can handle GCC's diagnostic pragma +#if defined( __GNUG__ ) || defined(__clang__) +# pragma GCC diagnostic push +#endif // Clang and gcc have different names for this warning, and clang also // warns about an unused value -#if defined(__GNUG__) && !defined(__clang__) -#pragma GCC diagnostic push +#if defined( __GNUG__ ) && !defined( __clang__ ) && \ + ( __GNUG__ > 10 || ( __GNUG__ == 10 && __GNUC_MINOR__ >= 1 ) ) #pragma GCC diagnostic ignored "-Wcomma-subscript" #elif defined(__clang__) -#pragma clang diagnostic push #pragma clang diagnostic ignored "-Wdeprecated-comma-subscript" #pragma clang diagnostic ignored "-Wunused-value" #endif - TEST_CASE("CAPTURE can deal with complex expressions involving commas", "[messages][capture]") { CAPTURE(std::vector<int>{1, 2, 3}[0, 1, 2], std::vector<int>{1, 2, 3}[(0, 1)], @@ -261,9 +263,8 @@ TEST_CASE("CAPTURE can deal with complex expressions involving commas", "[messag CAPTURE( (1, 2), (2, 3) ); SUCCEED(); } - -#ifdef __GNUG__ -#pragma GCC diagnostic pop +#if defined( __GNUG__ ) || defined(__clang__) +# pragma GCC diagnostic pop #endif TEST_CASE("CAPTURE parses string and character constants", "[messages][capture]") {