From 02ce50ace227c770df238d117f8c8cefd1f49539 Mon Sep 17 00:00:00 2001 From: smallmodel <15067410+smallmodel@users.noreply.github.com> Date: Thu, 7 Dec 2023 18:32:10 +0100 Subject: [PATCH] Treat "not all control paths return a value" warning as an error --- CMakeLists.txt | 11 ++++++++++- 1 file changed, 10 insertions(+), 1 deletion(-) diff --git a/CMakeLists.txt b/CMakeLists.txt index 04a511d9..48f39608 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -16,8 +16,17 @@ set(CMAKE_DEBUG_POSTFIX "-dbg") if(MSVC) 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) + # 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")' add_compile_options(-Wno-pointer-bool-conversion) endif()