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=202602 header.b=ifqzdxF0; dkim-atps=neutral Received: from mail.ozlabs.org (gandalf.ozlabs.org [150.107.74.76]) by passt.top (Postfix) with ESMTPS id 58CFB5A0275 for ; Tue, 12 May 2026 07:53:07 +0200 (CEST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gibson.dropbear.id.au; s=202602; t=1778565179; bh=mUl9+/x09A4xkbmoZGPQF3h83lSIMKbjy9ZrNIUx42M=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=ifqzdxF0dxb3P70YiWIyfKK1mwHtuwOw5XmGBRJ/jlAuTi9sUavlNWtj1V6TgsCuo nW+bnrqYwIO8ONVyIds3On5MYO8XM+NbmAOHk6hVNE8Ru2TTCGcsJiDBYzMaWtkQGo pw1y9Y7UV7G5eLdv41cynble7NL6PdN3LShKtpeblsjDsL2eqCISsooGM43eiKgFNZ sLAGSgVeWtUYKWrn0esxb9AykVkZwq+1folivNS1F9FwbXns8arI29r92vsJauUAuz eQM29EBYBRKF0sA8RSSvFs7DJ2B+AtnqVln9gIXwUwxaRQNhO+OE7J4dxLNjvktsC3 aexLz5QPNI/1w== Received: by gandalf.ozlabs.org (Postfix, from userid 1007) id 4gF5NW1ddZz4wTV; Tue, 12 May 2026 15:52:59 +1000 (AEST) From: David Gibson To: passt-dev@passt.top, Stefano Brivio Subject: [PATCH v3 07/12] cppcheck, clang-tidy: Static checkers don't need non-preprocessor flags Date: Tue, 12 May 2026 15:52:51 +1000 Message-ID: <20260512055256.1800449-8-david@gibson.dropbear.id.au> X-Mailer: git-send-email 2.54.0 In-Reply-To: <20260512055256.1800449-1-david@gibson.dropbear.id.au> References: <20260512055256.1800449-1-david@gibson.dropbear.id.au> MIME-Version: 1.0 Content-Transfer-Encoding: 8bit Message-ID-Hash: 3ALVJXKCFRZN5Q2RK4JJCJL43UCTBG43 X-Message-ID-Hash: 3ALVJXKCFRZN5Q2RK4JJCJL43UCTBG43 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: Currently we pass all our compiler flags to clang-tidy, except -pie, which it won't accept. In fact in order to run the checker, we only need the preprocessor flags. Simplify the command line by passing only those. For cppcheck we already filter out just -D options from the compiler flags. Simplify this by only passing preprocessor flags, now that we've split those out into their own variables. Furthermore, one of cppcheck's features which we're currently not exploiting is to check multiple / all preprocessor option combinations in a single pass. Therefore, pass only $(BASE_CPPFLAGS), which contains the mandatory options with which we can't compile at all. While we're there remove a redundant $^ that slipped in at some point. Signed-off-by: David Gibson --- Makefile | 8 ++------ 1 file changed, 2 insertions(+), 6 deletions(-) diff --git a/Makefile b/Makefile index 697f229f..c6dbbc67 100644 --- a/Makefile +++ b/Makefile @@ -194,9 +194,7 @@ CLANG_TIDY = clang-tidy CLANG_TIDY_FLAGS = -DCLANG_TIDY_58992 clang-tidy: $(PASST_SRCS) - $(CLANG_TIDY) $^ -- \ - $(filter-out -pie,$(BASE_CPPFLAGS) $(CPPFLAGS) $(BASE_CFLAGS) $(CFLAGS)) \ - $(CLANG_TIDY_FLAGS) + $(CLANG_TIDY) $^ -- $(BASE_CPPFLAGS) $(CPPFLAGS) $(CLANG_TIDY_FLAGS) CPPCHECK = cppcheck CPPCHECK_FLAGS = --std=c11 --error-exitcode=1 --enable=all --force \ @@ -212,6 +210,4 @@ CPPCHECK_FLAGS = --std=c11 --error-exitcode=1 --enable=all --force \ -D CPPCHECK_6936 cppcheck: $(PASST_SRCS) $(PASST_HEADERS) seccomp.h - $(CPPCHECK) $(CPPCHECK_FLAGS) \ - $(filter -D%,$(BASE_CPPFLAGS) $(CPPFLAGS) $(BASE_CFLAGS) $(CFLAGS)) $^ \ - $^ + $(CPPCHECK) $(CPPCHECK_FLAGS) $(BASE_CPPFLAGS) $^ -- 2.54.0