From 49144f9429e52db74c96a023754ac87be9866fd2 Mon Sep 17 00:00:00 2001 From: Paul Dino Jones Date: Fri, 23 Dec 2022 22:43:37 +0000 Subject: [PATCH] Added static analysis --- CMakeLists.txt | 8 +++++++- README.md | 2 +- 2 files changed, 8 insertions(+), 2 deletions(-) diff --git a/CMakeLists.txt b/CMakeLists.txt index 326d222..a136282 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -11,7 +11,7 @@ endif() SET_SOURCE_FILES_PROPERTIES( src/monocoque.c PROPERTIES LANGUAGE C) -set(CMAKE_BUILD_TYPE Debug) +#set(CMAKE_BUILD_TYPE Debug) project(monocoque) @@ -122,6 +122,12 @@ else() # GCC/Clang warning option # e.g. at the time of writing, GCC does not support -Wdocumentation # # enable all warnings about 'questionable constructs' + + if(analyze) + message("-- Analyzer is on") + target_compile_options(monocoque PRIVATE -fanalyzer -Wno-analyzer-possible-null-argument -Wno-analyzer-possible-null-dereference) + endif() + enable_cxx_compiler_flag_if_supported("-Wall") # issue 'pedantic' warnings for strict ISO compliance enable_cxx_compiler_flag_if_supported("-pedantic") diff --git a/README.md b/README.md index 57569ef..29106b7 100644 --- a/README.md +++ b/README.md @@ -48,7 +48,7 @@ make ``` mkdir build; cd build make clean - CFLAGS=-fanalyzer cmake .. + cmake -Danalyze=on .. make ``` ### Valgrind