mirror of
https://github.com/catchorg/Catch2.git
synced 2025-09-19 11:25:38 +02:00
Add clang compiler flag. (see #2094)
This commit is contained in:
@@ -14,6 +14,7 @@
|
||||
|
||||
#include <catch2/catch_test_macros.hpp>
|
||||
#include <catch2/benchmark/catch_benchmark.hpp>
|
||||
#include <catch2/internal/catch_compiler_capabilities.hpp>
|
||||
#include <catch2/matchers/catch_matchers.hpp>
|
||||
#include <catch2/matchers/catch_matchers_predicate.hpp>
|
||||
|
||||
@@ -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
|
||||
|
@@ -7,9 +7,10 @@
|
||||
// SPDX-License-Identifier: BSL-1.0
|
||||
|
||||
#include <catch2/catch_tag_alias_autoregistrar.hpp>
|
||||
#include <catch2/reporters/catch_reporter_event_listener.hpp>
|
||||
#include <catch2/internal/catch_enforce.hpp>
|
||||
#include <catch2/catch_test_case_info.hpp>
|
||||
#include <catch2/internal/catch_compiler_capabilities.hpp>
|
||||
#include <catch2/internal/catch_enforce.hpp>
|
||||
#include <catch2/reporters/catch_reporter_event_listener.hpp>
|
||||
#include <catch2/reporters/catch_reporter_registrars.hpp>
|
||||
|
||||
|
||||
@@ -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"
|
||||
|
@@ -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
|
||||
|
||||
|
@@ -6,7 +6,9 @@
|
||||
|
||||
// SPDX-License-Identifier: BSL-1.0
|
||||
|
||||
#ifdef __clang__
|
||||
#include <catch2/internal/catch_compiler_capabilities.hpp>
|
||||
|
||||
#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
|
||||
|
||||
|
@@ -8,6 +8,7 @@
|
||||
|
||||
#include <catch2/catch_test_macros.hpp>
|
||||
#include <catch2/catch_translate_exception.hpp>
|
||||
#include <catch2/internal/catch_compiler_capabilities.hpp>
|
||||
#include <catch2/matchers/catch_matchers_string.hpp>
|
||||
|
||||
#include <string>
|
||||
@@ -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
|
||||
|
@@ -7,6 +7,7 @@
|
||||
// SPDX-License-Identifier: BSL-1.0
|
||||
|
||||
#include <catch2/catch_test_macros.hpp>
|
||||
#include <catch2/internal/catch_compiler_capabilities.hpp>
|
||||
#include <catch2/generators/catch_generator_exception.hpp>
|
||||
#include <catch2/generators/catch_generators_adapters.hpp>
|
||||
#include <catch2/generators/catch_generators_random.hpp>
|
||||
@@ -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
|
||||
|
@@ -8,6 +8,7 @@
|
||||
|
||||
#include <catch2/catch_test_macros.hpp>
|
||||
#include <catch2/catch_template_test_macros.hpp>
|
||||
#include <catch2/internal/catch_compiler_capabilities.hpp>
|
||||
#include <catch2/matchers/catch_matchers_exception.hpp>
|
||||
#include <catch2/matchers/catch_matchers_floating_point.hpp>
|
||||
#include <catch2/matchers/catch_matchers_predicate.hpp>
|
||||
@@ -21,7 +22,7 @@
|
||||
#include <list>
|
||||
#include <sstream>
|
||||
|
||||
#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
|
||||
|
||||
|
@@ -7,6 +7,7 @@
|
||||
// SPDX-License-Identifier: BSL-1.0
|
||||
|
||||
#include <catch2/catch_test_macros.hpp>
|
||||
#include <catch2/internal/catch_compiler_capabilities.hpp>
|
||||
#include <catch2/matchers/catch_matchers_container_properties.hpp>
|
||||
#include <catch2/matchers/catch_matchers_contains.hpp>
|
||||
#include <catch2/matchers/catch_matchers_floating_point.hpp>
|
||||
@@ -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 @@ public:
|
||||
}
|
||||
};
|
||||
|
||||
#if defined(__clang__)
|
||||
#if defined(CATCH_COMPILER_CLANG)
|
||||
# pragma clang diagnostic pop
|
||||
#endif
|
||||
|
||||
|
@@ -7,6 +7,7 @@
|
||||
// SPDX-License-Identifier: BSL-1.0
|
||||
|
||||
#include <catch2/catch_test_macros.hpp>
|
||||
#include <catch2/internal/catch_compiler_capabilities.hpp>
|
||||
#include <iostream>
|
||||
|
||||
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<T1, T2> 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
|
||||
|
@@ -8,10 +8,11 @@
|
||||
|
||||
#include <catch2/catch_test_macros.hpp>
|
||||
#include <catch2/catch_template_test_macros.hpp>
|
||||
#include <catch2/internal/catch_compiler_capabilities.hpp>
|
||||
#include <catch2/internal/catch_config_wchar.hpp>
|
||||
#include <catch2/internal/catch_windows_h_proxy.hpp>
|
||||
|
||||
#ifdef __clang__
|
||||
#ifdef CATCH_COMPILER_CLANG
|
||||
# pragma clang diagnostic ignored "-Wc++98-compat"
|
||||
# pragma clang diagnostic ignored "-Wc++98-compat-pedantic"
|
||||
#endif
|
||||
|
@@ -6,7 +6,9 @@
|
||||
|
||||
// SPDX-License-Identifier: BSL-1.0
|
||||
|
||||
#ifdef __clang__
|
||||
#include <catch2/internal/catch_compiler_capabilities.hpp>
|
||||
|
||||
#ifdef CATCH_COMPILER_CLANG
|
||||
#pragma clang diagnostic ignored "-Wpadded"
|
||||
#endif
|
||||
|
||||
|
Reference in New Issue
Block a user