mirror of
https://github.com/catchorg/Catch2.git
synced 2025-09-20 19:45:40 +02:00
Add MSVC compiler flag. (see #2094)
This commit is contained in:
@@ -6,12 +6,13 @@
|
||||
|
||||
// SPDX-License-Identifier: BSL-1.0
|
||||
|
||||
#include <catch2/internal/catch_compiler_capabilities.hpp>
|
||||
#include <catch2/catch_test_macros.hpp>
|
||||
#include <catch2/internal/catch_enforce.hpp>
|
||||
#include <catch2/internal/catch_case_insensitive_comparisons.hpp>
|
||||
#include <catch2/internal/catch_optional.hpp>
|
||||
|
||||
#if defined(_MSC_VER)
|
||||
#if defined(CATCH_COMPILER_MSC)
|
||||
#pragma warning(push)
|
||||
#pragma warning(disable:4702) // unreachable code in the macro expansions
|
||||
#endif
|
||||
@@ -24,7 +25,7 @@ TEST_CASE("Check that our error handling macros throw the right exceptions", "[!
|
||||
REQUIRE_NOTHROW([](){CATCH_ENFORCE(true, "");}());
|
||||
}
|
||||
|
||||
#if defined(_MSC_VER)
|
||||
#if defined(CATCH_COMPILER_MSC)
|
||||
#pragma warning(pop) // unreachable code in the macro expansions
|
||||
#endif
|
||||
|
||||
|
@@ -197,7 +197,7 @@ TEST_CASE("#1548", "[compilation]") {
|
||||
inline static void synchronizing_callback( void * ) { }
|
||||
}
|
||||
|
||||
#if defined (_MSC_VER)
|
||||
#if defined (CATCH_COMPILER_MSC)
|
||||
#pragma warning(push)
|
||||
// The function pointer comparison below triggers warning because of
|
||||
// calling conventions
|
||||
@@ -207,7 +207,7 @@ TEST_CASE("#1548", "[compilation]") {
|
||||
TestClass test;
|
||||
REQUIRE(utility::synchronizing_callback != test.testMethod_uponComplete_arg);
|
||||
}
|
||||
#if defined (_MSC_VER)
|
||||
#if defined (CATCH_COMPILER_MSC)
|
||||
#pragma warning(pop)
|
||||
#endif
|
||||
|
||||
|
@@ -230,7 +230,7 @@ TEST_CASE( "Comparisons with int literals don't warn when mixing signed/ unsigne
|
||||
#pragma GCC diagnostic ignored "-Wsign-compare"
|
||||
#pragma GCC diagnostic ignored "-Wsign-conversion"
|
||||
#endif
|
||||
#ifdef _MSC_VER
|
||||
#ifdef CATCH_COMPILER_MSC
|
||||
#pragma warning(disable:4389) // '==' : signed/unsigned mismatch
|
||||
#endif
|
||||
|
||||
|
@@ -14,7 +14,7 @@
|
||||
#include <string>
|
||||
#include <stdexcept>
|
||||
|
||||
#ifdef _MSC_VER
|
||||
#ifdef CATCH_COMPILER_MSC
|
||||
#pragma warning(disable:4702) // Unreachable code -- unconditional throws and so on
|
||||
#endif
|
||||
#ifdef CATCH_COMPILER_CLANG
|
||||
|
@@ -41,7 +41,7 @@ namespace {
|
||||
static bool alwaysTrue( int ) { return true; }
|
||||
static bool alwaysFalse( int ) { return false; }
|
||||
|
||||
#ifdef _MSC_VER
|
||||
#ifdef CATCH_COMPILER_MSC
|
||||
# pragma warning( disable : 4702 ) // Unreachable code -- MSVC 19 (VS 2015)
|
||||
// sees right through the indirection
|
||||
#endif
|
||||
|
@@ -221,7 +221,7 @@ TEST_CASE( "CAPTURE can deal with complex expressions", "[messages][capture]" )
|
||||
#pragma GCC diagnostic push
|
||||
#pragma GCC diagnostic ignored "-Wunused-value" // All the comma operators are side-effect free
|
||||
#endif
|
||||
#ifdef _MSC_VER
|
||||
#ifdef CATCH_COMPILER_MSC
|
||||
#pragma warning(push)
|
||||
#pragma warning(disable:4709) // comma in indexing operator
|
||||
#endif
|
||||
@@ -283,6 +283,6 @@ TEST_CASE("CAPTURE parses string and character constants", "[messages][capture]"
|
||||
#ifdef CATCH_COMPILER_GCC
|
||||
#pragma GCC diagnostic pop
|
||||
#endif
|
||||
#ifdef _MSC_VER
|
||||
#ifdef CATCH_COMPILER_MSC
|
||||
#pragma warning(pop)
|
||||
#endif
|
||||
|
@@ -12,7 +12,7 @@
|
||||
#pragma clang diagnostic ignored "-Wpadded"
|
||||
#endif
|
||||
|
||||
#ifdef _MSC_VER
|
||||
#ifdef CATCH_COMPILER_MSC
|
||||
#pragma warning (disable : 4702) // Disable unreachable code warning for the last test
|
||||
// that is triggered when compiling as Win32|Release
|
||||
#endif
|
||||
|
Reference in New Issue
Block a user