Treat "not all control paths return a value" warning as an error

This commit is contained in:
smallmodel 2023-12-07 18:32:10 +01:00
parent 4a4a552a05
commit 02ce50ace2
No known key found for this signature in database
GPG key ID: 9F2D623CEDF08512

View file

@ -16,8 +16,17 @@ set(CMAKE_DEBUG_POSTFIX "-dbg")
if(MSVC) if(MSVC)
add_definitions(-D_CRT_SECURE_NO_WARNINGS -D_CRT_NONSTDC_NO_DEPRECATE) add_definitions(-D_CRT_SECURE_NO_WARNINGS -D_CRT_NONSTDC_NO_DEPRECATE)
elseif(CMAKE_CXX_COMPILER_ID STREQUAL "Clang") # Treat no return type as error
add_compile_options(/we4715)
endif()
if(CMAKE_CXX_COMPILER_ID STREQUAL "Clang" OR CMAKE_CXX_COMPILER_ID STREQUAL "GNU")
add_compile_options(-Wno-comment) add_compile_options(-Wno-comment)
# Treat no return type as error
add_compile_options(-Werror=return-type)
endif()
if(CMAKE_CXX_COMPILER_ID STREQUAL "Clang")
# Ignore warnings for code like 'assert("Assert string")' # Ignore warnings for code like 'assert("Assert string")'
add_compile_options(-Wno-pointer-bool-conversion) add_compile_options(-Wno-pointer-bool-conversion)
endif() endif()