mirror of
https://github.com/catchorg/Catch2.git
synced 2025-09-19 03:15:40 +02:00
Add GCC compiler flag. (see #2094)
This commit is contained in:
@@ -12,6 +12,8 @@
|
||||
// in a different namespace.
|
||||
#include <ostream>
|
||||
|
||||
#include <catch2/internal/catch_compiler_capabilities.hpp>
|
||||
|
||||
namespace foo {
|
||||
struct helper_1403 {
|
||||
bool operator==(helper_1403) const { return true; }
|
||||
@@ -23,7 +25,7 @@ namespace bar {
|
||||
struct TypeList {};
|
||||
}
|
||||
|
||||
#ifdef __GNUC__
|
||||
#ifdef CATCH_COMPILER_GCC
|
||||
#pragma GCC diagnostic ignored "-Wmissing-declarations"
|
||||
#endif
|
||||
std::ostream& operator<<(std::ostream& out, foo::helper_1403 const&) {
|
||||
@@ -79,7 +81,7 @@ struct B : private A {
|
||||
#pragma clang diagnostic push
|
||||
#pragma clang diagnostic ignored "-Wunused-function"
|
||||
#endif
|
||||
#ifdef __GNUC__
|
||||
#ifdef CATCH_COMPILER_GCC
|
||||
// Note that because -~GCC~-, this warning cannot be silenced temporarily, by pushing diagnostic stack...
|
||||
// Luckily it is firing in test files and thus can be silenced for the whole file, without losing much.
|
||||
#pragma GCC diagnostic ignored "-Wunused-function"
|
||||
|
@@ -223,7 +223,7 @@ TEST_CASE( "Comparisons with int literals don't warn when mixing signed/ unsigne
|
||||
// Disable warnings about sign conversions for the next two tests
|
||||
// (as we are deliberately invoking them)
|
||||
// - Currently only disabled for GCC/ LLVM. Should add VC++ too
|
||||
#ifdef __GNUC__
|
||||
#ifdef CATCH_COMPILER_GCC
|
||||
#pragma GCC diagnostic push
|
||||
#pragma GCC diagnostic ignored "-Wsign-compare"
|
||||
#pragma GCC diagnostic ignored "-Wsign-conversion"
|
||||
@@ -277,7 +277,7 @@ TEST_CASE( "Comparisons between ints where one side is computed" )
|
||||
CHECK( 54 == 6*9 );
|
||||
}
|
||||
|
||||
#ifdef __GNUC__
|
||||
#ifdef CATCH_COMPILER_GCC
|
||||
#pragma GCC diagnostic pop
|
||||
#endif
|
||||
|
||||
|
@@ -216,7 +216,7 @@ TEST_CASE( "CAPTURE can deal with complex expressions", "[messages][capture]" )
|
||||
#pragma clang diagnostic push
|
||||
#pragma clang diagnostic ignored "-Wunused-value" // In (1, 2), the "1" is unused ...
|
||||
#endif
|
||||
#ifdef __GNUC__
|
||||
#ifdef CATCH_COMPILER_GCC
|
||||
#pragma GCC diagnostic push
|
||||
#pragma GCC diagnostic ignored "-Wunused-value" // All the comma operators are side-effect free
|
||||
#endif
|
||||
@@ -243,7 +243,7 @@ std::ostream& operator<<(std::ostream& out, helper_1436<T1, T2> const& helper) {
|
||||
|
||||
// Clang and gcc have different names for this warning, and clang also
|
||||
// warns about an unused value. This warning must be disabled for C++20.
|
||||
#if defined(__GNUG__) && !defined(__clang__)
|
||||
#if defined(CATCH_COMPILER_GCC) && __cplusplus
|
||||
#pragma GCC diagnostic push
|
||||
#pragma GCC diagnostic ignored "-Wpragmas"
|
||||
#pragma GCC diagnostic ignored "-Wcomma-subscript"
|
||||
@@ -265,7 +265,7 @@ TEST_CASE("CAPTURE can deal with complex expressions involving commas", "[messag
|
||||
SUCCEED();
|
||||
}
|
||||
|
||||
#ifdef __GNUG__
|
||||
#ifdef CATCH_COMPILER_GCC
|
||||
#pragma GCC diagnostic pop
|
||||
#endif
|
||||
|
||||
@@ -279,7 +279,7 @@ TEST_CASE("CAPTURE parses string and character constants", "[messages][capture]"
|
||||
#ifdef __clang__
|
||||
#pragma clang diagnostic pop
|
||||
#endif
|
||||
#ifdef __GNUC__
|
||||
#ifdef CATCH_COMPILER_GCC
|
||||
#pragma GCC diagnostic pop
|
||||
#endif
|
||||
#ifdef _MSC_VER
|
||||
|
@@ -8,9 +8,9 @@
|
||||
|
||||
#include <catch2/catch_test_macros.hpp>
|
||||
|
||||
#include <catch2/internal/catch_compiler_capabilities.hpp>
|
||||
|
||||
|
||||
#if defined(__GNUC__)
|
||||
#if defined(CATCH_COMPILER_GCC)
|
||||
// This has to be left enabled until end of the TU, because the GCC
|
||||
// frontend reports operator<<(std::ostream& os, const has_maker_and_operator&)
|
||||
// as unused anyway
|
||||
|
Reference in New Issue
Block a user