sparse: add sparse support

With this adding "-DSPARSE=y" to the "west build" command line
performs a sparse check of the project build. So far only gcc-based
builds are supported.

Signed-off-by: Guennadi Liakhovetski <guennadi.liakhovetski@linux.intel.com>
This commit is contained in:
Guennadi Liakhovetski 2022-03-14 17:26:18 +01:00 committed by Anas Nashif
commit 7a85ff7683
5 changed files with 45 additions and 2 deletions

View file

@ -267,6 +267,10 @@ if(CONFIG_COMPILER_COLOR_DIAGNOSTICS)
zephyr_compile_options($<TARGET_PROPERTY:compiler,diagnostic>)
endif()
if("${SPARSE}" STREQUAL "y")
list(APPEND TOOLCHAIN_C_FLAGS -D__CHECKER__)
endif()
zephyr_compile_options(
${TOOLCHAIN_C_FLAGS}
)