Bunch of warning fixes

This commit is contained in:
Martin Hořeňovský 2020-02-21 21:13:57 +01:00
parent 04f18d996b
commit 34e7a5e0cf
No known key found for this signature in database
GPG Key ID: DE48307B8B0D381A
3 changed files with 16 additions and 2 deletions

View File

@ -279,7 +279,7 @@
#define WARN( msg ) (void)(0) #define WARN( msg ) (void)(0)
#define CAPTURE( msg ) (void)(0) #define CAPTURE( msg ) (void)(0)
#define TEST_CASE( ... ) INTERNAL_CATCH_TESTCASE_NO_REGISTRATION(INTERNAL_CATCH_UNIQUE_NAME( ____C_A_T_C_H____T_E_S_T____ )) #define TEST_CASE( ... ) INTERNAL_CATCH_TESTCASE_NO_REGISTRATION(INTERNAL_CATCH_UNIQUE_NAME( ____C_A_T_C_H____T_E_S_T____ ), __VA_ARGS__)
#define TEST_CASE_METHOD( className, ... ) INTERNAL_CATCH_TESTCASE_NO_REGISTRATION(INTERNAL_CATCH_UNIQUE_NAME( ____C_A_T_C_H____T_E_S_T____ )) #define TEST_CASE_METHOD( className, ... ) INTERNAL_CATCH_TESTCASE_NO_REGISTRATION(INTERNAL_CATCH_UNIQUE_NAME( ____C_A_T_C_H____T_E_S_T____ ))
#define METHOD_AS_TEST_CASE( method, ... ) #define METHOD_AS_TEST_CASE( method, ... )
#define REGISTER_TEST_CASE( Function, ... ) (void)(0) #define REGISTER_TEST_CASE( Function, ... ) (void)(0)

View File

@ -54,7 +54,7 @@ struct AutoReg : NonCopyable {
#if defined(CATCH_CONFIG_DISABLE) #if defined(CATCH_CONFIG_DISABLE)
#define INTERNAL_CATCH_TESTCASE_NO_REGISTRATION( TestName, ... ) \ #define INTERNAL_CATCH_TESTCASE_NO_REGISTRATION( TestName, ... ) \
static void TestName() static inline void TestName()
#define INTERNAL_CATCH_TESTCASE_METHOD_NO_REGISTRATION( TestName, ClassName, ... ) \ #define INTERNAL_CATCH_TESTCASE_METHOD_NO_REGISTRATION( TestName, ClassName, ... ) \
namespace{ \ namespace{ \
struct TestName : INTERNAL_CATCH_REMOVE_PARENS(ClassName) { \ struct TestName : INTERNAL_CATCH_REMOVE_PARENS(ClassName) { \

View File

@ -16,11 +16,25 @@ struct foo {
} }
}; };
#if defined(__clang__)
#pragma clang diagnostic push
#pragma clang diagnostic ignored "-Wglobal-constructors"
#endif
// Construct foo, but `foo::print` should not be run // Construct foo, but `foo::print` should not be run
foo f; foo f;
#if defined(__clang__)
// The test is unused since the registration is disabled
#pragma clang diagnostic ignored "-Wunused-function"
#endif
// This test should not be run, because it won't be registered // This test should not be run, because it won't be registered
TEST_CASE( "Disabled Macros" ) { TEST_CASE( "Disabled Macros" ) {
std::cout << "This should not happen\n"; std::cout << "This should not happen\n";
FAIL(); FAIL();
} }
#if defined(__clang__)
#pragma clang diagnostic pop
#endif