From 895300d84030b370decaeaac0b3d6b7798227fe9 Mon Sep 17 00:00:00 2001 From: John Levon Date: Thu, 12 May 2022 10:40:11 +0100 Subject: [PATCH] libvfio-user: support scan-build Signed-off-by: John Levon Change-Id: If338f8e7ddbd31f4fe6a1ce2e2028c2a01b5eec3 Reviewed-on: https://review.spdk.io/gerrit/c/spdk/spdk/+/12648 Reviewed-by: Ben Walker Reviewed-by: Jim Harris Tested-by: SPDK CI Jenkins Community-CI: Broadcom CI Community-CI: Mellanox Build Bot --- autobuild.sh | 3 --- vfiouserbuild/Makefile | 12 ++++++++++-- 2 files changed, 10 insertions(+), 5 deletions(-) diff --git a/autobuild.sh b/autobuild.sh index 819205c18..4a668916f 100755 --- a/autobuild.sh +++ b/autobuild.sh @@ -24,9 +24,6 @@ if [ -n "$SPDK_TEST_NATIVE_DPDK" ]; then else scanbuild_exclude="--exclude $rootdir/dpdk/" fi -if [[ "$SPDK_TEST_VFIOUSER" -eq 1 ]]; then - scanbuild_exclude+=" --exclude $rootdir/libvfio-user/" -fi scanbuild="scan-build -o $output_dir/scan-build-tmp $scanbuild_exclude --status-bugs" config_params=$(get_config_params) diff --git a/vfiouserbuild/Makefile b/vfiouserbuild/Makefile index df28f7418..2b6d02371 100644 --- a/vfiouserbuild/Makefile +++ b/vfiouserbuild/Makefile @@ -36,18 +36,26 @@ include $(SPDK_ROOT_DIR)/mk/spdk.common.mk .PHONY: all clean install uninstall -# Force-disable scan-build +# Force-disable scan-build: we support it below, but meson has its own special +# target instead of allowing CC=scan-build like everyone else. SUB_CC = $(patsubst %ccc-analyzer,$(DEFAULT_CC),$(CC)) VFIO_USER_CFG_OPTS = --buildtype $(VFIO_USER_BUILD_TYPE) -Ddefault_library=static -Dlibdir=$(VFIO_USER_LIB_PREFIX) -all: +all: scan-build + +build: $(Q)test -d $(VFIO_USER_BUILD_DIR) || \ CC=$(SUB_CC) meson setup $(VFIO_USER_BUILD_DIR) $(VFIO_USER_SRC_DIR) $(Q)meson configure $(VFIO_USER_BUILD_DIR) $(VFIO_USER_CFG_OPTS) $(Q)meson compile $(MESON_COMPILE_OPTS) -C $(VFIO_USER_BUILD_DIR) DESTDIR=$(VFIO_USER_INSTALL_DIR) meson install --quiet -C $(VFIO_USER_BUILD_DIR) +scan-build: build + $(Q)if [ $(CC) = "scan-build" ]; then \ + ninja -C $(VFIO_USER_BUILD_DIR) scan-build; \ + fi + install: all uninstall: