Build system: Add fixes for scanbuild

- Exclude build flags that generate warnings when scanbuild is running
- Add the SCANBUILD_ARGS variable to abuild so we can pass in arguments
to scanbuild.
- Set the default scanbuild argument to -k (--keep-going) so that even
if an error occurs it continues with the scan.  This is similar to what
we do with coverity runs.

Change-Id: I82e7c13d7fd7432b43c17a31834ec82fca158a07
Signed-off-by: Martin Roth <gaumless@gmail.com>
Reviewed-on: https://review.coreboot.org/27595
Tested-by: build bot (Jenkins) <no-reply@coreboot.org>
Reviewed-by: Patrick Georgi <pgeorgi@google.com>
This commit is contained in:
Martin Roth 2018-07-22 10:11:26 -06:00 committed by Patrick Georgi
parent fbc87b638a
commit 21e09b1c15
2 changed files with 5 additions and 7 deletions

View File

@ -385,11 +385,13 @@ CFLAGS_common += -Wstrict-aliasing -Wshadow -Wdate-time
CFLAGS_common += -fno-common -ffreestanding -fno-builtin -fomit-frame-pointer CFLAGS_common += -fno-common -ffreestanding -fno-builtin -fomit-frame-pointer
CFLAGS_common += -ffunction-sections -fdata-sections -fno-pie CFLAGS_common += -ffunction-sections -fdata-sections -fno-pie
ifeq ($(CONFIG_COMPILER_GCC),y) ifeq ($(CONFIG_COMPILER_GCC),y)
CFLAGS_common += -Wno-packed-not-aligned
CFLAGS_common += -fno-delete-null-pointer-checks CFLAGS_common += -fno-delete-null-pointer-checks
# Don't add these GCC specific flags when running scan-build # Don't add these GCC specific flags when running scan-build
ifeq ($(CCC_ANALYZER_OUTPUT_FORMAT),) ifeq ($(CCC_ANALYZER_OUTPUT_FORMAT),)
CFLAGS_common += -Wno-packed-not-aligned
CFLAGS_common += -fconserve-stack CFLAGS_common += -fconserve-stack
# cf. commit f69a99db (coreboot: x86: enable gc-sections)
CFLAGS_common += -Wno-unused-but-set-variable
endif endif
endif endif
@ -439,11 +441,6 @@ ADAFLAGS_common += -gnatyN
LDFLAGS_common := --gc-sections -nostdlib -nostartfiles -static --emit-relocs LDFLAGS_common := --gc-sections -nostdlib -nostartfiles -static --emit-relocs
ifeq ($(CONFIG_COMPILER_GCC),y)
# cf. commit f69a99db (coreboot: x86: enable gc-sections)
CFLAGS_common += -Wno-unused-but-set-variable
endif
ifeq ($(CONFIG_WARNINGS_ARE_ERRORS),y) ifeq ($(CONFIG_WARNINGS_ARE_ERRORS),y)
CFLAGS_common += -Werror CFLAGS_common += -Werror
endif endif

View File

@ -469,7 +469,7 @@ function build_config
if [ "$scanbuild" = "true" ]; then if [ "$scanbuild" = "true" ]; then
scanbuild_out=$TARGET/${BUILD_NAME}-scanbuild scanbuild_out=$TARGET/${BUILD_NAME}-scanbuild
rm -rf "${scanbuild_out}" rm -rf "${scanbuild_out}"
BUILDPREFIX="scan-build -o ${scanbuild_out}tmp" BUILDPREFIX="scan-build ${SCANBUILD_ARGS} -o ${scanbuild_out}tmp"
fi fi
compile_target "${BUILD_NAME}" compile_target "${BUILD_NAME}"
if [ "$scanbuild" = "true" ]; then if [ "$scanbuild" = "true" ]; then
@ -667,6 +667,7 @@ while true ; do
--scan-build) shift --scan-build) shift
scanbuild=true scanbuild=true
customizing="${customizing}, scan-build" customizing="${customizing}, scan-build"
SCANBUILD_ARGS=${SCANBUILD_ARGS:-'-k'}
;; ;;
-y|--ccache) shift -y|--ccache) shift
customizing="${customizing}, ccache" customizing="${customizing}, ccache"