diff options
| author | Martin Hořeňovský | 2020-02-21 21:13:57 +0100 |
|---|---|---|
| committer | Martin Hořeňovský | 2020-02-21 23:10:22 +0100 |
| commit | 34e7a5e0cf2c3aa4aecb903271fe1e568f72897a (patch) | |
| tree | 1f074d85798893dbf8d79187716d71b61ef5ed55 | |
| parent | 04f18d996ba7d71fda1d28662e2413c06c5e5a49 (diff) | |
| download | catch3-34e7a5e0cf2c3aa4aecb903271fe1e568f72897a.tar.gz | |
Bunch of warning fixes
| -rw-r--r-- | src/catch2/catch_test_macros.hpp | 2 | ||||
| -rw-r--r-- | src/catch2/catch_test_registry.h | 2 | ||||
| -rw-r--r-- | tests/ExtraTests/X02-DisabledMacros.cpp | 14 |
3 files changed, 16 insertions, 2 deletions
diff --git a/src/catch2/catch_test_macros.hpp b/src/catch2/catch_test_macros.hpp index a5b2d0c3..a3159a3c 100644 --- a/src/catch2/catch_test_macros.hpp +++ b/src/catch2/catch_test_macros.hpp @@ -279,7 +279,7 @@ #define WARN( 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 METHOD_AS_TEST_CASE( method, ... ) #define REGISTER_TEST_CASE( Function, ... ) (void)(0) diff --git a/src/catch2/catch_test_registry.h b/src/catch2/catch_test_registry.h index 3c2c5386..68815752 100644 --- a/src/catch2/catch_test_registry.h +++ b/src/catch2/catch_test_registry.h @@ -54,7 +54,7 @@ struct AutoReg : NonCopyable { #if defined(CATCH_CONFIG_DISABLE) #define INTERNAL_CATCH_TESTCASE_NO_REGISTRATION( TestName, ... ) \ - static void TestName() + static inline void TestName() #define INTERNAL_CATCH_TESTCASE_METHOD_NO_REGISTRATION( TestName, ClassName, ... ) \ namespace{ \ struct TestName : INTERNAL_CATCH_REMOVE_PARENS(ClassName) { \ diff --git a/tests/ExtraTests/X02-DisabledMacros.cpp b/tests/ExtraTests/X02-DisabledMacros.cpp index 0577da09..1c7385c7 100644 --- a/tests/ExtraTests/X02-DisabledMacros.cpp +++ b/tests/ExtraTests/X02-DisabledMacros.cpp @@ -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 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 TEST_CASE( "Disabled Macros" ) { std::cout << "This should not happen\n"; FAIL(); } + +#if defined(__clang__) +#pragma clang diagnostic pop +#endif |