mirror of
				https://github.com/catchorg/Catch2.git
				synced 2025-10-31 20:27:11 +01:00 
			
		
		
		
	Sweep out some extra warnings
Swept: `-Wpadded` in some places (where it caused extra size, instead of just saying "hey, we padded struct at the end to align, just as standard says") `-Wweak-vtables` everywhere (Clang) `-Wexit-time-destructors` everywhere (Clang) `-Wmissing-noreturn` everywhere (Clang) The last three are enabled for Clang compilation going forward. Also enabled `-Wunreachable-code` for Clang and GCC
This commit is contained in:
		| @@ -1003,6 +1003,6 @@ with expansion: | ||||
|   "{?}" == "1" | ||||
|  | ||||
| =============================================================================== | ||||
| test cases: 177 | 126 passed | 47 failed |  4 failed as expected | ||||
| test cases: 176 | 125 passed | 47 failed |  4 failed as expected | ||||
| assertions: 878 | 761 passed | 96 failed | 21 failed as expected | ||||
|  | ||||
|   | ||||
| @@ -7434,6 +7434,6 @@ MiscTests.cpp:<line number>: | ||||
| PASSED: | ||||
|  | ||||
| =============================================================================== | ||||
| test cases: 177 | 124 passed | 49 failed |  4 failed as expected | ||||
| test cases: 176 | 123 passed | 49 failed |  4 failed as expected | ||||
| assertions: 877 | 757 passed | 99 failed | 21 failed as expected | ||||
|  | ||||
|   | ||||
| @@ -6946,9 +6946,6 @@ Message from section two | ||||
|       </Section> | ||||
|       <OverallResult success="true"/> | ||||
|     </TestCase> | ||||
|     <TestCase name="assertions with commas are allowed" filename="projects/<exe-name>/TrickyTests.cpp" > | ||||
|       <OverallResult success="true"/> | ||||
|     </TestCase> | ||||
|     <TestCase name="atomic if" tags="[0][failing]" filename="projects/<exe-name>/MiscTests.cpp" > | ||||
|       <Expression success="true" type="REQUIRE" filename="projects/<exe-name>/MiscTests.cpp" > | ||||
|         <Original> | ||||
|   | ||||
| @@ -6,7 +6,9 @@ | ||||
|  *  file LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt) | ||||
|  */ | ||||
| #ifdef __clang__ | ||||
| #   pragma clang diagnostic push | ||||
| #   pragma clang diagnostic ignored "-Wpadded" | ||||
| #   pragma clang diagnostic ignored "-Wdouble-promotion" | ||||
| #endif | ||||
|  | ||||
| #include "catch.hpp" | ||||
| @@ -161,6 +163,11 @@ TEST_CASE( "Ordering comparison checks that should fail", "[.][failing]" ) | ||||
|     CHECK( data.str_hello <= "a" ); | ||||
| } | ||||
|  | ||||
| #ifdef __clang__ | ||||
| #   pragma clang diagnostic pop | ||||
| #endif | ||||
|  | ||||
|  | ||||
| // Comparisons with int literals | ||||
| TEST_CASE( "Comparisons with int literals don't warn when mixing signed/ unsigned" ) | ||||
| { | ||||
|   | ||||
| @@ -14,6 +14,10 @@ | ||||
| #ifdef _MSC_VER | ||||
| #pragma warning(disable:4702) // Unreachable code -- MSVC 19 (VS 2015) sees right through the indirection | ||||
| #endif | ||||
| #ifdef __clang__ | ||||
| #pragma clang diagnostic push | ||||
| #pragma clang diagnostic ignored "-Wweak-vtables" | ||||
| #endif | ||||
|  | ||||
| namespace | ||||
| { | ||||
| @@ -219,3 +223,7 @@ TEST_CASE( "#748 - captures with unexpected exceptions", "[.][failing][!throws][ | ||||
|         REQUIRE_THROWS( thisThrows() ); | ||||
|     } | ||||
| } | ||||
|  | ||||
| #ifdef __clang__ | ||||
| #pragma clang diagnostic pop | ||||
| #endif | ||||
|   | ||||
| @@ -8,6 +8,12 @@ | ||||
|  | ||||
| #include "catch.hpp" | ||||
|  | ||||
| #ifdef __clang__ | ||||
| #pragma clang diagnostic push | ||||
| #pragma clang diagnostic ignored "-Wweak-vtables" | ||||
| #pragma clang diagnostic ignored "-Wpadded" | ||||
| #endif | ||||
|  | ||||
| #ifndef CATCH_CONFIG_DISABLE_MATCHERS | ||||
|  | ||||
| inline const char* testStringForMatching() | ||||
| @@ -166,16 +172,18 @@ TEST_CASE( "Vector matchers that fail", "[matchers][vector][.][failing]" ) { | ||||
| #include <exception> | ||||
|  | ||||
| struct SpecialException : std::exception { | ||||
|     SpecialException(int i):i(i) {} | ||||
|     SpecialException(int i_):i(i_) {} | ||||
|     int i; | ||||
| }; | ||||
|  | ||||
| void doesNotThrow() {} | ||||
|  | ||||
| [[noreturn]] | ||||
| void throws(int i) { | ||||
|     throw SpecialException{ i }; | ||||
| } | ||||
|  | ||||
| [[noreturn]] | ||||
| void throwsAsInt(int i) { | ||||
|     throw i; | ||||
| } | ||||
| @@ -217,3 +225,7 @@ TEST_CASE("Exception matchers that fail", "[matchers][exceptions][!throws][.fail | ||||
| } | ||||
|  | ||||
| #endif // CATCH_CONFIG_DISABLE_MATCHERS | ||||
|  | ||||
| #ifdef __clang__ | ||||
| #pragma clang diagnostic pop | ||||
| #endif | ||||
|   | ||||
| @@ -1,3 +0,0 @@ | ||||
| // This file is only here to verify (to the extent possible) the self sufficiency of the header | ||||
| #include "internal/catch_suppress_warnings.h" | ||||
| #include "internal/catch_interfaces_capture.h" | ||||
| @@ -1,2 +0,0 @@ | ||||
| #include "internal/catch_suppress_warnings.h" | ||||
| #include "internal/catch_interfaces_config.h" | ||||
| @@ -1,2 +0,0 @@ | ||||
| #include "internal/catch_suppress_warnings.h" | ||||
| #include "internal/catch_interfaces_exception.h" | ||||
| @@ -1,3 +0,0 @@ | ||||
| // This file is only here to verify (to the extent possible) the self sufficiency of the header | ||||
| #include "internal/catch_suppress_warnings.h" | ||||
| #include "internal/catch_interfaces_registry_hub.h" | ||||
| @@ -1 +0,0 @@ | ||||
| #include "internal/catch_interfaces_runner.h" | ||||
| @@ -1,2 +0,0 @@ | ||||
| #include "internal/catch_suppress_warnings.h" | ||||
| #include "internal/catch_interfaces_testcase.h" | ||||
| @@ -1,3 +0,0 @@ | ||||
| // This file is only here to verify (to the extent possible) the self sufficiency of the header | ||||
| #include "internal/catch_suppress_warnings.h" | ||||
| #include "internal/catch_streambuf.h" | ||||
| @@ -265,4 +265,4 @@ struct AutoTestReg { | ||||
|         REGISTER_TEST_CASE( manuallyRegisteredTestFunction, "ManuallyRegistered" ); | ||||
|     } | ||||
| }; | ||||
| AutoTestReg autoTestReg; | ||||
| static AutoTestReg autoTestReg; | ||||
|   | ||||
| @@ -381,12 +381,9 @@ TEST_CASE( "has printf" ) { | ||||
|     printf( "loose text artifact\n" ); | ||||
| } | ||||
|  | ||||
| TEST_CASE( "assertions with commas are allowed" ) { | ||||
| } | ||||
|  | ||||
| namespace { | ||||
|     struct constructor_throws { | ||||
|         constructor_throws() { | ||||
|         [[noreturn]] constructor_throws() { | ||||
|             throw 1; | ||||
|         } | ||||
|     }; | ||||
|   | ||||
		Reference in New Issue
	
	Block a user
	 Martin Hořeňovský
					Martin Hořeňovský