mirror of
https://github.com/catchorg/Catch2.git
synced 2024-11-16 18:52:25 +01:00
Fix comma-subscript warning suppression to only target GCC 10.1+
Fixes #2416
This commit is contained in:
parent
e33de8fc05
commit
20d413b8b6
@ -241,17 +241,19 @@ std::ostream& operator<<(std::ostream& out, helper_1436<T1, T2> const& helper) {
|
|||||||
return out;
|
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
|
// Clang and gcc have different names for this warning, and clang also
|
||||||
// warns about an unused value
|
// warns about an unused value
|
||||||
#if defined(__GNUG__) && !defined(__clang__)
|
#if defined( __GNUG__ ) && !defined( __clang__ ) && \
|
||||||
#pragma GCC diagnostic push
|
( __GNUG__ > 10 || ( __GNUG__ == 10 && __GNUC_MINOR__ >= 1 ) )
|
||||||
#pragma GCC diagnostic ignored "-Wcomma-subscript"
|
#pragma GCC diagnostic ignored "-Wcomma-subscript"
|
||||||
#elif defined(__clang__)
|
#elif defined(__clang__)
|
||||||
#pragma clang diagnostic push
|
|
||||||
#pragma clang diagnostic ignored "-Wdeprecated-comma-subscript"
|
#pragma clang diagnostic ignored "-Wdeprecated-comma-subscript"
|
||||||
#pragma clang diagnostic ignored "-Wunused-value"
|
#pragma clang diagnostic ignored "-Wunused-value"
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
TEST_CASE("CAPTURE can deal with complex expressions involving commas", "[messages][capture]") {
|
TEST_CASE("CAPTURE can deal with complex expressions involving commas", "[messages][capture]") {
|
||||||
CAPTURE(std::vector<int>{1, 2, 3}[0, 1, 2],
|
CAPTURE(std::vector<int>{1, 2, 3}[0, 1, 2],
|
||||||
std::vector<int>{1, 2, 3}[(0, 1)],
|
std::vector<int>{1, 2, 3}[(0, 1)],
|
||||||
@ -261,8 +263,7 @@ TEST_CASE("CAPTURE can deal with complex expressions involving commas", "[messag
|
|||||||
CAPTURE( (1, 2), (2, 3) );
|
CAPTURE( (1, 2), (2, 3) );
|
||||||
SUCCEED();
|
SUCCEED();
|
||||||
}
|
}
|
||||||
|
#if defined( __GNUG__ ) || defined(__clang__)
|
||||||
#ifdef __GNUG__
|
|
||||||
# pragma GCC diagnostic pop
|
# pragma GCC diagnostic pop
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user