From 177a1a6706065149180efb11e45a2889311a09e9 Mon Sep 17 00:00:00 2001 From: Berthold Stoeger Date: Thu, 28 Mar 2024 20:49:59 +0100 Subject: [PATCH] make format-warnings hard compile errors Code such as `report_info("msg: %s", i)` may crash if `i` is not a string type. To avoid such problems make format-warnings hard compile errors. Signed-off-by: Berthold Stoeger --- CMakeLists.txt | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/CMakeLists.txt b/CMakeLists.txt index 9e63fdcad..cacc1bbff 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -124,8 +124,8 @@ if (SUBSURFACE_ASAN_BUILD) endif() # every compiler understands -Wall -set (CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -Wall") -set (CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -Wall") +set (CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -Wall -Werror=format") +set (CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -Wall -Werror=format") # by detault optimize with -O2 even for debug builds set (GCC_OPTIMIZATION_FLAGS "-O2" CACHE STRING "GCC optimization flags")