Added static analysis

This commit is contained in:
Paul Dino Jones 2022-12-23 22:43:37 +00:00
parent 55dd14b4f9
commit 49144f9429
2 changed files with 8 additions and 2 deletions

View File

@ -11,7 +11,7 @@ endif()
SET_SOURCE_FILES_PROPERTIES( src/monocoque.c PROPERTIES LANGUAGE C) SET_SOURCE_FILES_PROPERTIES( src/monocoque.c PROPERTIES LANGUAGE C)
set(CMAKE_BUILD_TYPE Debug) #set(CMAKE_BUILD_TYPE Debug)
project(monocoque) project(monocoque)
@ -122,6 +122,12 @@ else() # GCC/Clang warning option
# e.g. at the time of writing, GCC does not support -Wdocumentation # e.g. at the time of writing, GCC does not support -Wdocumentation
# #
# enable all warnings about 'questionable constructs' # 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") enable_cxx_compiler_flag_if_supported("-Wall")
# issue 'pedantic' warnings for strict ISO compliance # issue 'pedantic' warnings for strict ISO compliance
enable_cxx_compiler_flag_if_supported("-pedantic") enable_cxx_compiler_flag_if_supported("-pedantic")

View File

@ -48,7 +48,7 @@ make
``` ```
mkdir build; cd build mkdir build; cd build
make clean make clean
CFLAGS=-fanalyzer cmake .. cmake -Danalyze=on ..
make make
``` ```
### Valgrind ### Valgrind