From mboxrd@z Thu Jan 1 00:00:00 1970 Authentication-Results: passt.top; dmarc=none (p=none dis=none) header.from=gibson.dropbear.id.au Authentication-Results: passt.top; dkim=pass (2048-bit key; secure) header.d=gibson.dropbear.id.au header.i=@gibson.dropbear.id.au header.a=rsa-sha256 header.s=202410 header.b=DDbAmGoA; dkim-atps=neutral Received: from mail.ozlabs.org (gandalf.ozlabs.org [150.107.74.76]) by passt.top (Postfix) with ESMTPS id 2F22C5A061D for ; Fri, 08 Nov 2024 03:53:34 +0100 (CET) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gibson.dropbear.id.au; s=202410; t=1731034409; bh=yCvbg2pSyvvRSe/cKQfhShuNRSu7hK0jID1gsv0gxIY=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=DDbAmGoAwlPfRlAZCouehVlYrL4zKIGF+lNa89C2g43gppdd8wS4sWxM2ckTX7v1n Lo9gF1jrjqepelfa2+YyRoKX7YdLpkU00xbDKgeyAoyBX9EfYf0SROURPi8N14KitS XwFdiTxJWk+3hjh5azTrcZOHClAgFHUDhAWTvF6n7fuy4d7uHo4gUghuflAPSfzhw5 ttSD3BwPr7fgk0Kf7BH3+POuk6tO3V0hXJepdYvSgAnsUmQh7Sc4NelAp1kWuyVhqN PnQnBuAu4pcdNwWlLaanElBrvi71OpYUQAzc4XS0qdSZydS4HqVIXMutKcpAMHirHx Fwynr8qxg/zoA== Received: by gandalf.ozlabs.org (Postfix, from userid 1007) id 4Xl3RF3nlgz4x89; Fri, 8 Nov 2024 13:53:29 +1100 (AEDT) From: David Gibson To: Stefano Brivio , passt-dev@passt.top Subject: [PATCH v2 4/4] cppcheck: Don't check the system headers Date: Fri, 8 Nov 2024 13:53:30 +1100 Message-ID: <20241108025330.3161314-5-david@gibson.dropbear.id.au> X-Mailer: git-send-email 2.47.0 In-Reply-To: <20241108025330.3161314-1-david@gibson.dropbear.id.au> References: <20241108025330.3161314-1-david@gibson.dropbear.id.au> MIME-Version: 1.0 Content-Transfer-Encoding: 8bit Message-ID-Hash: GKBRXRFNDXOJFBC2GPYDTH4WQ7CSD4SJ X-Message-ID-Hash: GKBRXRFNDXOJFBC2GPYDTH4WQ7CSD4SJ X-MailFrom: dgibson@gandalf.ozlabs.org X-Mailman-Rule-Misses: dmarc-mitigation; no-senders; approved; emergency; loop; banned-address; member-moderation; nonmember-moderation; administrivia; implicit-dest; max-recipients; max-size; news-moderation; no-subject; digests; suspicious-header CC: David Gibson X-Mailman-Version: 3.3.8 Precedence: list List-Id: Development discussion and patches for passt Archived-At: Archived-At: List-Archive: List-Archive: List-Help: List-Owner: List-Post: List-Subscribe: List-Unsubscribe: We pass -I options to cppcheck so that it will find the system headers. Then we need to pass a bunch more options to suppress the zillions of cppcheck errors found in those headers. It turns out, however, that it's not recommended to give the system headers to cppcheck anyway. Instead it has built-in knowledge of the ANSI libc and uses that as the basis of its checks. We do need to suppress missingIncludeSystem warnings instead though. Not bothering with the system headers makes the cppcheck runtime go from ~37s to ~14s on my machine, which is a pretty nice win. Signed-off-by: David Gibson --- Makefile | 10 +--------- 1 file changed, 1 insertion(+), 9 deletions(-) diff --git a/Makefile b/Makefile index 0ba85b4..258d298 100644 --- a/Makefile +++ b/Makefile @@ -163,11 +163,6 @@ clang-tidy: $(PASST_SRCS) $(HEADERS) clang-tidy $(PASST_SRCS) -- $(filter-out -pie,$(FLAGS) $(CFLAGS) $(CPPFLAGS)) \ -DCLANG_TIDY_58992 -SYSTEM_INCLUDES := /usr/include $(wildcard /usr/include/$(TARGET)) -ifeq ($(shell $(CC) -v 2>&1 | grep -c "gcc version"),1) -VER := $(shell $(CC) -dumpversion) -SYSTEM_INCLUDES += /usr/lib/gcc/$(TARGET)/$(VER)/include -endif cppcheck: $(PASST_SRCS) $(HEADERS) if cppcheck --check-level=exhaustive /dev/null > /dev/null 2>&1; then \ CPPCHECK_EXHAUSTIVE="--check-level=exhaustive"; \ @@ -177,11 +172,8 @@ cppcheck: $(PASST_SRCS) $(HEADERS) cppcheck --std=c11 --error-exitcode=1 --enable=all --force \ --inconclusive --library=posix --quiet \ $${CPPCHECK_EXHAUSTIVE} \ - $(SYSTEM_INCLUDES:%=-I%) \ - $(SYSTEM_INCLUDES:%=--config-exclude=%) \ - $(SYSTEM_INCLUDES:%=--suppress=*:%/*) \ - $(SYSTEM_INCLUDES:%=--suppress=unmatchedSuppression:%/*) \ --inline-suppr \ + --suppress=missingIncludeSystem \ --suppress=unusedStructMember \ $(filter -D%,$(FLAGS) $(CFLAGS) $(CPPFLAGS)) -D CPPCHECK_6936 \ $(PASST_SRCS) $(HEADERS) -- 2.47.0