From c665fd7f509226b802b5e063820b2d145f14ed6e Mon Sep 17 00:00:00 2001 From: HoseynHeydari Date: Thu, 14 Apr 2022 16:46:59 +0430 Subject: [PATCH] Add clang compiler flag. (see #2094) --- examples/231-Cfg-OutputStreams.cpp | 4 +++- src/catch2/benchmark/catch_optimizer.hpp | 2 +- src/catch2/benchmark/detail/catch_estimate_clock.hpp | 5 +++-- src/catch2/catch_test_case_info.hpp | 5 +++-- src/catch2/catch_test_spec.hpp | 6 ++++-- src/catch2/internal/catch_clara.hpp | 5 +++-- src/catch2/internal/catch_compiler_capabilities.hpp | 9 +++++++-- src/catch2/internal/catch_console_colour.cpp | 5 +++-- src/catch2/internal/catch_decomposer.hpp | 5 +++-- src/catch2/internal/catch_test_case_tracker.cpp | 5 +++-- src/catch2/internal/catch_test_spec_parser.hpp | 5 +++-- src/catch2/matchers/catch_matchers_floating_point.cpp | 5 +++-- src/catch2/reporters/catch_reporter_console.cpp | 5 +++-- src/catch2/reporters/catch_reporter_teamcity.hpp | 5 +++-- tests/ExtraTests/X02-DisabledMacros.cpp | 7 ++++--- tests/SelfTest/TestRegistrations.cpp | 7 ++++--- tests/SelfTest/UsageTests/Compilation.tests.cpp | 4 ++-- tests/SelfTest/UsageTests/Condition.tests.cpp | 6 ++++-- tests/SelfTest/UsageTests/Exception.tests.cpp | 5 +++-- tests/SelfTest/UsageTests/Generators.tests.cpp | 5 +++-- tests/SelfTest/UsageTests/Matchers.tests.cpp | 5 +++-- tests/SelfTest/UsageTests/MatchersRanges.tests.cpp | 5 +++-- tests/SelfTest/UsageTests/Message.tests.cpp | 7 ++++--- tests/SelfTest/UsageTests/Misc.tests.cpp | 3 ++- tests/SelfTest/UsageTests/Tricky.tests.cpp | 4 +++- 25 files changed, 80 insertions(+), 49 deletions(-) diff --git a/examples/231-Cfg-OutputStreams.cpp b/examples/231-Cfg-OutputStreams.cpp index b77c127354..5dccd54152 100644 --- a/examples/231-Cfg-OutputStreams.cpp +++ b/examples/231-Cfg-OutputStreams.cpp @@ -10,6 +10,8 @@ #include #include +#include + class out_buff : public std::stringbuf { std::FILE* m_stream; public: @@ -31,7 +33,7 @@ class out_buff : public std::stringbuf { out_buff::~out_buff() { pubsync(); } -#if defined(__clang__) +#if defined(CATCH_COMPILER_CLANG) #pragma clang diagnostic ignored "-Wexit-time-destructors" // static variables in cout/cerr/clog #endif diff --git a/src/catch2/benchmark/catch_optimizer.hpp b/src/catch2/benchmark/catch_optimizer.hpp index 30dd7594f4..b327852ca4 100644 --- a/src/catch2/benchmark/catch_optimizer.hpp +++ b/src/catch2/benchmark/catch_optimizer.hpp @@ -21,7 +21,7 @@ namespace Catch { namespace Benchmark { -#if defined(CATCH_COMPILER_GCC) || defined(__clang__) +#if defined(CATCH_COMPILER_GCC) || defined(CATCH_COMPILER_CLANG) template inline void keep_memory(T* p) { asm volatile("" : : "g"(p) : "memory"); diff --git a/src/catch2/benchmark/detail/catch_estimate_clock.hpp b/src/catch2/benchmark/detail/catch_estimate_clock.hpp index c392ca4f7e..0ae439f1a1 100644 --- a/src/catch2/benchmark/detail/catch_estimate_clock.hpp +++ b/src/catch2/benchmark/detail/catch_estimate_clock.hpp @@ -16,6 +16,7 @@ #include #include #include +#include #include #include @@ -95,12 +96,12 @@ namespace Catch { template Environment> measure_environment() { -#if defined(__clang__) +#if defined(CATCH_COMPILER_CLANG) # pragma clang diagnostic push # pragma clang diagnostic ignored "-Wexit-time-destructors" #endif static Catch::Detail::unique_ptr>> env; -#if defined(__clang__) +#if defined(CATCH_COMPILER_CLANG) # pragma clang diagnostic pop #endif if (env) { diff --git a/src/catch2/catch_test_case_info.hpp b/src/catch2/catch_test_case_info.hpp index 6cfc2aaf99..5477ccc2f1 100644 --- a/src/catch2/catch_test_case_info.hpp +++ b/src/catch2/catch_test_case_info.hpp @@ -8,6 +8,7 @@ #ifndef CATCH_TEST_CASE_INFO_HPP_INCLUDED #define CATCH_TEST_CASE_INFO_HPP_INCLUDED +#include #include #include #include @@ -18,7 +19,7 @@ #include #include -#ifdef __clang__ +#ifdef CATCH_COMPILER_CLANG #pragma clang diagnostic push #pragma clang diagnostic ignored "-Wpadded" #endif @@ -123,7 +124,7 @@ namespace Catch { SourceLineInfo const& lineInfo ); } -#ifdef __clang__ +#ifdef CATCH_COMPILER_CLANG #pragma clang diagnostic pop #endif diff --git a/src/catch2/catch_test_spec.hpp b/src/catch2/catch_test_spec.hpp index 499bfaa56c..9f1556903b 100644 --- a/src/catch2/catch_test_spec.hpp +++ b/src/catch2/catch_test_spec.hpp @@ -8,7 +8,9 @@ #ifndef CATCH_TEST_SPEC_HPP_INCLUDED #define CATCH_TEST_SPEC_HPP_INCLUDED -#ifdef __clang__ +#include + +#ifdef CATCH_COMPILER_CLANG #pragma clang diagnostic push #pragma clang diagnostic ignored "-Wpadded" #endif @@ -81,7 +83,7 @@ namespace Catch { }; } -#ifdef __clang__ +#ifdef CATCH_COMPILER_CLANG #pragma clang diagnostic pop #endif diff --git a/src/catch2/internal/catch_clara.hpp b/src/catch2/internal/catch_clara.hpp index 93be04696c..3010225125 100644 --- a/src/catch2/internal/catch_clara.hpp +++ b/src/catch2/internal/catch_clara.hpp @@ -8,7 +8,7 @@ #ifndef CATCH_CLARA_HPP_INCLUDED #define CATCH_CLARA_HPP_INCLUDED -#if defined( __clang__ ) +#if defined( CATCH_COMPILER_CLANG ) # pragma clang diagnostic push # pragma clang diagnostic ignored "-Wweak-vtables" # pragma clang diagnostic ignored "-Wshadow" @@ -29,6 +29,7 @@ # endif #endif +#include #include #include #include @@ -698,7 +699,7 @@ namespace Catch { } // namespace Clara } // namespace Catch -#if defined( __clang__ ) +#if defined( CATCH_COMPILER_CLANG ) # pragma clang diagnostic pop #endif diff --git a/src/catch2/internal/catch_compiler_capabilities.hpp b/src/catch2/internal/catch_compiler_capabilities.hpp index e2d44dc187..c98a2791f0 100644 --- a/src/catch2/internal/catch_compiler_capabilities.hpp +++ b/src/catch2/internal/catch_compiler_capabilities.hpp @@ -24,6 +24,7 @@ // Many features, at point of detection, define an _INTERNAL_ macro, so they // can be combined, en-mass, with the _NO_ forms later. +#include #include #include @@ -31,6 +32,10 @@ #define CATCH_COMPILER_GCC #endif +#if defined(__clang__) && !defined(_MSC_VER) +#define CATCH_COMPILER_CLANG +#endif + #ifdef __cplusplus # if (__cplusplus >= 201402L) || (defined(_MSVC_LANG) && _MSVC_LANG >= 201402L) @@ -61,7 +66,7 @@ #endif -#if defined(__clang__) && !defined(_MSC_VER) +#if defined(CATCH_COMPILER_CLANG) # define CATCH_INTERNAL_START_WARNINGS_SUPPRESSION _Pragma( "clang diagnostic push" ) # define CATCH_INTERNAL_STOP_WARNINGS_SUPPRESSION _Pragma( "clang diagnostic pop" ) @@ -103,7 +108,7 @@ # define CATCH_INTERNAL_SUPPRESS_UNUSED_TEMPLATE_WARNINGS \ _Pragma( "clang diagnostic ignored \"-Wunused-template\"" ) -#endif // __clang__ +#endif // CATCH_COMPILER_CLANG //////////////////////////////////////////////////////////////////////////////// diff --git a/src/catch2/internal/catch_console_colour.cpp b/src/catch2/internal/catch_console_colour.cpp index e9fa55f73a..54ea3a7046 100644 --- a/src/catch2/internal/catch_console_colour.cpp +++ b/src/catch2/internal/catch_console_colour.cpp @@ -5,12 +5,13 @@ // https://www.boost.org/LICENSE_1_0.txt) // SPDX-License-Identifier: BSL-1.0 -#if defined(__clang__) +#if defined(CATCH_COMPILER_CLANG) # pragma clang diagnostic push # pragma clang diagnostic ignored "-Wexit-time-destructors" #endif +#include #include #include #include @@ -277,7 +278,7 @@ namespace Catch { } // end namespace Catch -#if defined(__clang__) +#if defined(CATCH_COMPILER_CLANG) # pragma clang diagnostic pop #endif diff --git a/src/catch2/internal/catch_decomposer.hpp b/src/catch2/internal/catch_decomposer.hpp index 7f4dcc8f59..8d64eded13 100644 --- a/src/catch2/internal/catch_decomposer.hpp +++ b/src/catch2/internal/catch_decomposer.hpp @@ -9,6 +9,7 @@ #define CATCH_DECOMPOSER_HPP_INCLUDED #include +#include #include #include @@ -23,7 +24,7 @@ #pragma warning(disable:4800) // Forcing result to true or false #endif -#ifdef __clang__ +#ifdef CATCH_COMPILER_CLANG # pragma clang diagnostic push # pragma clang diagnostic ignored "-Wsign-compare" #elif defined CATCH_COMPILER_GCC @@ -259,7 +260,7 @@ namespace Catch { #ifdef _MSC_VER #pragma warning(pop) #endif -#ifdef __clang__ +#ifdef CATCH_COMPILER_CLANG # pragma clang diagnostic pop #elif defined CATCH_COMPILER_GCC # pragma GCC diagnostic pop diff --git a/src/catch2/internal/catch_test_case_tracker.cpp b/src/catch2/internal/catch_test_case_tracker.cpp index ce76dcba89..7fd7fc55e6 100644 --- a/src/catch2/internal/catch_test_case_tracker.cpp +++ b/src/catch2/internal/catch_test_case_tracker.cpp @@ -7,6 +7,7 @@ // SPDX-License-Identifier: BSL-1.0 #include +#include #include #include #include @@ -14,7 +15,7 @@ #include #include -#if defined(__clang__) +#if defined(CATCH_COMPILER_CLANG) # pragma clang diagnostic push # pragma clang diagnostic ignored "-Wexit-time-destructors" #endif @@ -245,6 +246,6 @@ namespace TestCaseTracking { } // namespace Catch -#if defined(__clang__) +#if defined(CATCH_COMPILER_CLANG) # pragma clang diagnostic pop #endif diff --git a/src/catch2/internal/catch_test_spec_parser.hpp b/src/catch2/internal/catch_test_spec_parser.hpp index 75f2fd760c..1a216be3f2 100644 --- a/src/catch2/internal/catch_test_spec_parser.hpp +++ b/src/catch2/internal/catch_test_spec_parser.hpp @@ -8,11 +8,12 @@ #ifndef CATCH_TEST_SPEC_PARSER_HPP_INCLUDED #define CATCH_TEST_SPEC_PARSER_HPP_INCLUDED -#ifdef __clang__ +#ifdef CATCH_COMPILER_CLANG #pragma clang diagnostic push #pragma clang diagnostic ignored "-Wpadded" #endif +#include #include #include @@ -75,7 +76,7 @@ namespace Catch { } // namespace Catch -#ifdef __clang__ +#ifdef CATCH_COMPILER_CLANG #pragma clang diagnostic pop #endif diff --git a/src/catch2/matchers/catch_matchers_floating_point.cpp b/src/catch2/matchers/catch_matchers_floating_point.cpp index ad0fd378c5..f88548472d 100644 --- a/src/catch2/matchers/catch_matchers_floating_point.cpp +++ b/src/catch2/matchers/catch_matchers_floating_point.cpp @@ -6,6 +6,7 @@ // SPDX-License-Identifier: BSL-1.0 #include +#include #include #include #include @@ -115,7 +116,7 @@ namespace Detail { "IEEE-754 compatible floating point representation" ); } -#if defined(__clang__) +#if defined(CATCH_COMPILER_CLANG) #pragma clang diagnostic push // Clang <3.5 reports on the default branch in the switch below #pragma clang diagnostic ignored "-Wunreachable-code" @@ -132,7 +133,7 @@ namespace Detail { } } -#if defined(__clang__) +#if defined(CATCH_COMPILER_CLANG) #pragma clang diagnostic pop #endif diff --git a/src/catch2/reporters/catch_reporter_console.cpp b/src/catch2/reporters/catch_reporter_console.cpp index b8e64fb3cc..f0b7751e67 100644 --- a/src/catch2/reporters/catch_reporter_console.cpp +++ b/src/catch2/reporters/catch_reporter_console.cpp @@ -9,6 +9,7 @@ #include #include +#include #include #include #include @@ -28,7 +29,7 @@ // Note that 4062 (not all labels are handled and default is missing) is enabled #endif -#if defined(__clang__) +#if defined(CATCH_COMPILER_CLANG) # pragma clang diagnostic push // For simplicity, benchmarking-only helpers are always enabled # pragma clang diagnostic ignored "-Wunused-function" @@ -714,6 +715,6 @@ void ConsoleReporter::printTestFilters() { #pragma warning(pop) #endif -#if defined(__clang__) +#if defined(CATCH_COMPILER_CLANG) # pragma clang diagnostic pop #endif diff --git a/src/catch2/reporters/catch_reporter_teamcity.hpp b/src/catch2/reporters/catch_reporter_teamcity.hpp index 5007193bbe..b15c04a77a 100644 --- a/src/catch2/reporters/catch_reporter_teamcity.hpp +++ b/src/catch2/reporters/catch_reporter_teamcity.hpp @@ -8,12 +8,13 @@ #ifndef CATCH_REPORTER_TEAMCITY_HPP_INCLUDED #define CATCH_REPORTER_TEAMCITY_HPP_INCLUDED +#include #include #include #include -#ifdef __clang__ +#ifdef CATCH_COMPILER_CLANG # pragma clang diagnostic push # pragma clang diagnostic ignored "-Wpadded" #endif @@ -59,7 +60,7 @@ namespace Catch { } // end namespace Catch -#ifdef __clang__ +#ifdef CATCH_COMPILER_CLANG # pragma clang diagnostic pop #endif diff --git a/tests/ExtraTests/X02-DisabledMacros.cpp b/tests/ExtraTests/X02-DisabledMacros.cpp index aea3b1a3e3..d2d8f1e5ae 100644 --- a/tests/ExtraTests/X02-DisabledMacros.cpp +++ b/tests/ExtraTests/X02-DisabledMacros.cpp @@ -14,6 +14,7 @@ #include #include +#include #include #include @@ -28,7 +29,7 @@ struct foo { } }; -#if defined(__clang__) +#if defined(CATCH_COMPILER_CLANG) #pragma clang diagnostic push #pragma clang diagnostic ignored "-Wglobal-constructors" #endif @@ -36,7 +37,7 @@ struct foo { foo f; -#if defined(__clang__) +#if defined(CATCH_COMPILER_CLANG) // The test is unused since the registration is disabled #pragma clang diagnostic ignored "-Wunused-function" #endif @@ -60,6 +61,6 @@ TEST_CASE( "Disabled Macros" ) { BENCHMARK( "Disabled benchmark" ) { REQUIRE( 1 == 2 ); }; } -#if defined(__clang__) +#if defined(CATCH_COMPILER_CLANG) #pragma clang diagnostic pop #endif diff --git a/tests/SelfTest/TestRegistrations.cpp b/tests/SelfTest/TestRegistrations.cpp index 2586ffabbd..d5d9b5643d 100644 --- a/tests/SelfTest/TestRegistrations.cpp +++ b/tests/SelfTest/TestRegistrations.cpp @@ -7,9 +7,10 @@ // SPDX-License-Identifier: BSL-1.0 #include -#include -#include #include +#include +#include +#include #include @@ -17,7 +18,7 @@ CATCH_REGISTER_TAG_ALIAS("[@nhf]", "[failing]~[.]") CATCH_REGISTER_TAG_ALIAS("[@tricky]", "[tricky]~[.]") -#ifdef __clang__ +#ifdef CATCH_COMPILER_CLANG # pragma clang diagnostic ignored "-Wpadded" # pragma clang diagnostic ignored "-Wweak-vtables" # pragma clang diagnostic ignored "-Wc++98-compat" diff --git a/tests/SelfTest/UsageTests/Compilation.tests.cpp b/tests/SelfTest/UsageTests/Compilation.tests.cpp index b05e6ce0d7..2c049a320e 100644 --- a/tests/SelfTest/UsageTests/Compilation.tests.cpp +++ b/tests/SelfTest/UsageTests/Compilation.tests.cpp @@ -77,7 +77,7 @@ struct B : private A { bool operator==(int) const { return true; } }; -#ifdef __clang__ +#ifdef CATCH_COMPILER_CLANG #pragma clang diagnostic push #pragma clang diagnostic ignored "-Wunused-function" #endif @@ -91,7 +91,7 @@ B f(); std::ostream g(); -#ifdef __clang__ +#ifdef CATCH_COMPILER_CLANG #pragma clang diagnostic pop #endif diff --git a/tests/SelfTest/UsageTests/Condition.tests.cpp b/tests/SelfTest/UsageTests/Condition.tests.cpp index 59709caa5a..da7ac0e776 100644 --- a/tests/SelfTest/UsageTests/Condition.tests.cpp +++ b/tests/SelfTest/UsageTests/Condition.tests.cpp @@ -6,7 +6,9 @@ // SPDX-License-Identifier: BSL-1.0 -#ifdef __clang__ +#include + +#ifdef CATCH_COMPILER_CLANG # pragma clang diagnostic push # pragma clang diagnostic ignored "-Wpadded" // Wdouble-promotion is not supported until 3.8 @@ -188,7 +190,7 @@ TEST_CASE( "Ordering comparison checks that should fail", "[.][failing]" ) CHECK( data.str_hello <= "a" ); } -#ifdef __clang__ +#ifdef CATCH_COMPILER_CLANG # pragma clang diagnostic pop #endif diff --git a/tests/SelfTest/UsageTests/Exception.tests.cpp b/tests/SelfTest/UsageTests/Exception.tests.cpp index 9b6d2a5823..6e0d32210a 100644 --- a/tests/SelfTest/UsageTests/Exception.tests.cpp +++ b/tests/SelfTest/UsageTests/Exception.tests.cpp @@ -8,6 +8,7 @@ #include #include +#include #include #include @@ -16,7 +17,7 @@ #ifdef _MSC_VER #pragma warning(disable:4702) // Unreachable code -- unconditional throws and so on #endif -#ifdef __clang__ +#ifdef CATCH_COMPILER_CLANG #pragma clang diagnostic push #pragma clang diagnostic ignored "-Wweak-vtables" #pragma clang diagnostic ignored "-Wmissing-noreturn" @@ -196,6 +197,6 @@ TEST_CASE( "#748 - captures with unexpected exceptions", "[.][failing][!throws][ } } -#ifdef __clang__ +#ifdef CATCH_COMPILER_CLANG #pragma clang diagnostic pop #endif diff --git a/tests/SelfTest/UsageTests/Generators.tests.cpp b/tests/SelfTest/UsageTests/Generators.tests.cpp index 5b205c85c7..30ef24a4f5 100644 --- a/tests/SelfTest/UsageTests/Generators.tests.cpp +++ b/tests/SelfTest/UsageTests/Generators.tests.cpp @@ -7,6 +7,7 @@ // SPDX-License-Identifier: BSL-1.0 #include +#include #include #include #include @@ -235,7 +236,7 @@ namespace { } } -#if defined(__clang__) +#if defined(CATCH_COMPILER_CLANG) #pragma clang diagnostic push #pragma clang diagnostic ignored "-Wexit-time-destructors" #endif @@ -277,6 +278,6 @@ TEST_CASE("#1913 - GENERATEs can share a line", "[regression][generators]") { REQUIRE(i != j); } -#if defined(__clang__) +#if defined(CATCH_COMPILER_CLANG) #pragma clang diagnostic pop #endif diff --git a/tests/SelfTest/UsageTests/Matchers.tests.cpp b/tests/SelfTest/UsageTests/Matchers.tests.cpp index afb124950d..cee4efe7f8 100644 --- a/tests/SelfTest/UsageTests/Matchers.tests.cpp +++ b/tests/SelfTest/UsageTests/Matchers.tests.cpp @@ -8,6 +8,7 @@ #include #include +#include #include #include #include @@ -21,7 +22,7 @@ #include #include -#ifdef __clang__ +#ifdef CATCH_COMPILER_CLANG # pragma clang diagnostic push # pragma clang diagnostic ignored "-Wweak-vtables" # pragma clang diagnostic ignored "-Wpadded" @@ -1083,7 +1084,7 @@ TEST_CASE( "Matchers can take references", REQUIRE_THAT( 22, ReferencingMatcher{} ); } -#ifdef __clang__ +#ifdef CATCH_COMPILER_CLANG # pragma clang diagnostic pop #endif diff --git a/tests/SelfTest/UsageTests/MatchersRanges.tests.cpp b/tests/SelfTest/UsageTests/MatchersRanges.tests.cpp index 1e4b252e3e..42a6f30ca7 100644 --- a/tests/SelfTest/UsageTests/MatchersRanges.tests.cpp +++ b/tests/SelfTest/UsageTests/MatchersRanges.tests.cpp @@ -7,6 +7,7 @@ // SPDX-License-Identifier: BSL-1.0 #include +#include #include #include #include @@ -46,7 +47,7 @@ namespace unrelated { }; } // end unrelated namespace -#if defined(__clang__) +#if defined(CATCH_COMPILER_CLANG) # pragma clang diagnostic push # pragma clang diagnostic ignored "-Wunused-function" #endif @@ -107,7 +108,7 @@ class has_different_begin_end_types { } }; -#if defined(__clang__) +#if defined(CATCH_COMPILER_CLANG) # pragma clang diagnostic pop #endif diff --git a/tests/SelfTest/UsageTests/Message.tests.cpp b/tests/SelfTest/UsageTests/Message.tests.cpp index 23a8f5eaf5..0612f38013 100644 --- a/tests/SelfTest/UsageTests/Message.tests.cpp +++ b/tests/SelfTest/UsageTests/Message.tests.cpp @@ -7,6 +7,7 @@ // SPDX-License-Identifier: BSL-1.0 #include +#include #include TEST_CASE( "INFO and WARN do not abort tests", "[messages][.]" ) { @@ -212,7 +213,7 @@ TEST_CASE( "CAPTURE can deal with complex expressions", "[messages][capture]" ) SUCCEED(); } -#ifdef __clang__ +#ifdef CATCH_COMPILER_CLANG #pragma clang diagnostic push #pragma clang diagnostic ignored "-Wunused-value" // In (1, 2), the "1" is unused ... #endif @@ -247,7 +248,7 @@ std::ostream& operator<<(std::ostream& out, helper_1436 const& helper) { #pragma GCC diagnostic push #pragma GCC diagnostic ignored "-Wpragmas" #pragma GCC diagnostic ignored "-Wcomma-subscript" -#elif defined(__clang__) +#elif defined(CATCH_COMPILER_CLANG) #pragma clang diagnostic push #pragma clang diagnostic ignored "-Wunknown-pragmas" #pragma clang diagnostic ignored "-Wunknown-warning-option" @@ -276,7 +277,7 @@ TEST_CASE("CAPTURE parses string and character constants", "[messages][capture]" SUCCEED(); } -#ifdef __clang__ +#ifdef CATCH_COMPILER_CLANG #pragma clang diagnostic pop #endif #ifdef CATCH_COMPILER_GCC diff --git a/tests/SelfTest/UsageTests/Misc.tests.cpp b/tests/SelfTest/UsageTests/Misc.tests.cpp index 33734d436b..829f50860b 100644 --- a/tests/SelfTest/UsageTests/Misc.tests.cpp +++ b/tests/SelfTest/UsageTests/Misc.tests.cpp @@ -8,10 +8,11 @@ #include #include +#include #include #include -#ifdef __clang__ +#ifdef CATCH_COMPILER_CLANG # pragma clang diagnostic ignored "-Wc++98-compat" # pragma clang diagnostic ignored "-Wc++98-compat-pedantic" #endif diff --git a/tests/SelfTest/UsageTests/Tricky.tests.cpp b/tests/SelfTest/UsageTests/Tricky.tests.cpp index bcfa7e699d..c304e617dc 100644 --- a/tests/SelfTest/UsageTests/Tricky.tests.cpp +++ b/tests/SelfTest/UsageTests/Tricky.tests.cpp @@ -6,7 +6,9 @@ // SPDX-License-Identifier: BSL-1.0 -#ifdef __clang__ +#include + +#ifdef CATCH_COMPILER_CLANG #pragma clang diagnostic ignored "-Wpadded" #endif