mirror of
				https://github.com/catchorg/Catch2.git
				synced 2025-11-04 05:59:32 +01:00 
			
		
		
		
	Disable Wmissing-noreturn for test files
Adding unreachable to `FAIL` and `SKIP` made Clang become very good at figuring out that tests of `FAIL` and `SKIP` will never return and thus could be marked as [[noreturn]]. To avoid introducing lot of warning suppression noise into the test files, we just disable it instead.
This commit is contained in:
		@@ -103,7 +103,13 @@ if(CATCH_BUILD_FUZZERS)
 | 
				
			|||||||
endif()
 | 
					endif()
 | 
				
			||||||
 | 
					
 | 
				
			||||||
if(CATCH_DEVELOPMENT_BUILD)
 | 
					if(CATCH_DEVELOPMENT_BUILD)
 | 
				
			||||||
  add_warnings_to_targets("${CATCH_WARNING_TARGETS}")
 | 
					  set(CATCH_ALL_TARGETS ${CATCH_IMPL_TARGETS} ${CATCH_TEST_TARGETS})
 | 
				
			||||||
 | 
					  add_warnings_to_targets("${CATCH_ALL_TARGETS}")
 | 
				
			||||||
 | 
					  # After we added the noreturn hint to FAIL and SKIP, Clang became
 | 
				
			||||||
 | 
					  # extremely good at diagnosing tests that test these macros as being
 | 
				
			||||||
 | 
					  # noreturn, but not marked as such. This made the warning useless for
 | 
				
			||||||
 | 
					  # our test files.
 | 
				
			||||||
 | 
					  add_cxx_flag_if_supported_to_targets("-Wno-missing-noreturn" "${CATCH_TEST_TARGETS}")
 | 
				
			||||||
endif()
 | 
					endif()
 | 
				
			||||||
 | 
					
 | 
				
			||||||
# Only perform the installation steps when Catch is not being used as
 | 
					# Only perform the installation steps when Catch is not being used as
 | 
				
			||||||
 
 | 
				
			|||||||
@@ -54,5 +54,5 @@ foreach(name ${ALL_EXAMPLE_TARGETS})
 | 
				
			|||||||
  target_link_libraries(${name} Catch2WithMain)
 | 
					  target_link_libraries(${name} Catch2WithMain)
 | 
				
			||||||
endforeach()
 | 
					endforeach()
 | 
				
			||||||
 | 
					
 | 
				
			||||||
list(APPEND CATCH_WARNING_TARGETS ${ALL_EXAMPLE_TARGETS})
 | 
					list(APPEND CATCH_TEST_TARGETS ${ALL_EXAMPLE_TARGETS})
 | 
				
			||||||
set(CATCH_WARNING_TARGETS ${CATCH_WARNING_TARGETS} PARENT_SCOPE)
 | 
					set(CATCH_TEST_TARGETS ${CATCH_TEST_TARGETS} PARENT_SCOPE)
 | 
				
			||||||
 
 | 
				
			|||||||
@@ -451,8 +451,8 @@ if(CATCH_BUILD_EXAMPLES OR CATCH_BUILD_EXTRA_TESTS)
 | 
				
			|||||||
  target_compile_features(Catch2_buildall_interface INTERFACE cxx_std_14)
 | 
					  target_compile_features(Catch2_buildall_interface INTERFACE cxx_std_14)
 | 
				
			||||||
endif()
 | 
					endif()
 | 
				
			||||||
 | 
					
 | 
				
			||||||
list(APPEND CATCH_WARNING_TARGETS Catch2 Catch2WithMain)
 | 
					list(APPEND CATCH_IMPL_TARGETS Catch2 Catch2WithMain)
 | 
				
			||||||
set(CATCH_WARNING_TARGETS ${CATCH_WARNING_TARGETS} PARENT_SCOPE)
 | 
					set(CATCH_IMPL_TARGETS ${CATCH_IMPL_TARGETS} PARENT_SCOPE)
 | 
				
			||||||
 | 
					
 | 
				
			||||||
# We still do not support building dynamic library with hidden visibility
 | 
					# We still do not support building dynamic library with hidden visibility
 | 
				
			||||||
# so we want to check & warn users if they do this. However, we won't abort
 | 
					# so we want to check & warn users if they do this. However, we won't abort
 | 
				
			||||||
 
 | 
				
			|||||||
@@ -662,5 +662,5 @@ foreach(reporterName # "Automake" - the simple .trs format does not support any
 | 
				
			|||||||
  )
 | 
					  )
 | 
				
			||||||
endforeach()
 | 
					endforeach()
 | 
				
			||||||
 | 
					
 | 
				
			||||||
list(APPEND CATCH_WARNING_TARGETS SelfTest)
 | 
					list(APPEND CATCH_TEST_TARGETS SelfTest)
 | 
				
			||||||
set(CATCH_WARNING_TARGETS ${CATCH_WARNING_TARGETS} PARENT_SCOPE)
 | 
					set(CATCH_TEST_TARGETS ${CATCH_TEST_TARGETS} PARENT_SCOPE)
 | 
				
			||||||
 
 | 
				
			|||||||
@@ -215,7 +215,7 @@ if(MSVC)
 | 
				
			|||||||
  add_executable(WindowsHeader ${TESTS_DIR}/X90-WindowsHeaderInclusion.cpp)
 | 
					  add_executable(WindowsHeader ${TESTS_DIR}/X90-WindowsHeaderInclusion.cpp)
 | 
				
			||||||
  target_link_libraries(WindowsHeader Catch2WithMain)
 | 
					  target_link_libraries(WindowsHeader Catch2WithMain)
 | 
				
			||||||
  add_test(NAME WindowsHeader COMMAND WindowsHeader -r compact)
 | 
					  add_test(NAME WindowsHeader COMMAND WindowsHeader -r compact)
 | 
				
			||||||
  list(APPEND CATCH_WARNING_TARGETS ${EXTRA_TEST_BINARIES} WindowsHeader)
 | 
					  list(APPEND CATCH_TEST_TARGETS ${EXTRA_TEST_BINARIES} WindowsHeader)
 | 
				
			||||||
endif()
 | 
					endif()
 | 
				
			||||||
 | 
					
 | 
				
			||||||
add_executable(PartialTestCaseEvents ${TESTS_DIR}/X21-PartialTestCaseEvents.cpp)
 | 
					add_executable(PartialTestCaseEvents ${TESTS_DIR}/X21-PartialTestCaseEvents.cpp)
 | 
				
			||||||
@@ -502,8 +502,8 @@ set(EXTRA_TEST_BINARIES
 | 
				
			|||||||
# Notice that we are modifying EXTRA_TEST_BINARIES destructively, do not
 | 
					# Notice that we are modifying EXTRA_TEST_BINARIES destructively, do not
 | 
				
			||||||
# use it after this point!
 | 
					# use it after this point!
 | 
				
			||||||
list(FILTER EXTRA_TEST_BINARIES EXCLUDE REGEX "DisabledExceptions.*")
 | 
					list(FILTER EXTRA_TEST_BINARIES EXCLUDE REGEX "DisabledExceptions.*")
 | 
				
			||||||
list(APPEND CATCH_WARNING_TARGETS ${EXTRA_TEST_BINARIES})
 | 
					list(APPEND CATCH_TEST_TARGETS ${EXTRA_TEST_BINARIES})
 | 
				
			||||||
set(CATCH_WARNING_TARGETS ${CATCH_WARNING_TARGETS} PARENT_SCOPE)
 | 
					set(CATCH_TEST_TARGETS ${CATCH_TEST_TARGETS} PARENT_SCOPE)
 | 
				
			||||||
 | 
					
 | 
				
			||||||
# This sets up a one-off executable that compiles against the amalgamated
 | 
					# This sets up a one-off executable that compiles against the amalgamated
 | 
				
			||||||
# files, and then runs it for a super simple check that the amalgamated
 | 
					# files, and then runs it for a super simple check that the amalgamated
 | 
				
			||||||
 
 | 
				
			|||||||
		Reference in New Issue
	
	Block a user