From mboxrd@z Thu Jan  1 00:00:00 1970
Received: from gandalf.ozlabs.org (mail.ozlabs.org [IPv6:2404:9400:2221:ea00::3])
	by passt.top (Postfix) with ESMTPS id EF6895A0279
	for <passt-dev@passt.top>; Wed, 28 Feb 2024 10:07:38 +0100 (CET)
DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed;
	d=gibson.dropbear.id.au; s=202312; t=1709111252;
	bh=N0Q7ryKPvP4stOI9FRZW23x5lGZTS6nBxB6RfvliWDI=;
	h=Date:From:To:Cc:Subject:References:In-Reply-To:From;
	b=gOGx3ZhoKNNuYJPyCcL6zjaPpvC1uSi9QEw99hsYKHe/hg/pFj/NNXhzs8LZLbNMP
	 xC7T8xlW8T5JtW+dJq/oe6C9by/WAkEo4azykpluQEfdtavyMb26wReUFW9xDDz2i9
	 4xeTlnhNtoKgacWndpyDXSt4mu9e2U6MM66nAT2kiJ+b6+qNyVse7TmvmgOPgJGX+u
	 wjPeWT5PLFff8uZEukpHqDGi7i1GlFlaAwKh+X+fLB80PStNgya2b9xFK+4qetboHi
	 BNK9PDP8acp72G3hikbS7ShXU02jYVsk/G28bLsYscHueXdJD7Ml+ov5bdF8nbc0FW
	 IDLK1wLRSYeQQ==
Received: by gandalf.ozlabs.org (Postfix, from userid 1007)
	id 4Tl7m43R7yz4wxs; Wed, 28 Feb 2024 20:07:32 +1100 (AEDT)
Date: Wed, 28 Feb 2024 20:07:28 +1100
From: David Gibson <david@gibson.dropbear.id.au>
To: Stefano Brivio <sbrivio@redhat.com>
Subject: Re: [PATCH v2] Makefile: check for cppcheck's --check-level option
 in cppcheck target
Message-ID: <Zd730AJPdCFfMnFL@zatzit>
References: <20240228062414.2851534-1-sbrivio@redhat.com>
MIME-Version: 1.0
Content-Type: multipart/signed; micalg=pgp-sha256;
	protocol="application/pgp-signature"; boundary="0+ldDzbKGdAcMrZK"
Content-Disposition: inline
In-Reply-To: <20240228062414.2851534-1-sbrivio@redhat.com>
Message-ID-Hash: NK7S36TZBRPX7TOII5TIELLULKAR7BRQ
X-Message-ID-Hash: NK7S36TZBRPX7TOII5TIELLULKAR7BRQ
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: passt-dev@passt.top, Rahil Bhimjiani <me@rahil.website>
X-Mailman-Version: 3.3.8
Precedence: list
List-Id: Development discussion and patches for passt <passt-dev.passt.top>
Archived-At: <https://archives.passt.top/passt-dev/Zd730AJPdCFfMnFL@zatzit/>
Archived-At: <https://passt.top/hyperkitty/list/passt-dev@passt.top/message/NK7S36TZBRPX7TOII5TIELLULKAR7BRQ/>
List-Archive: <https://archives.passt.top/passt-dev/>
List-Archive: <https://passt.top/hyperkitty/list/passt-dev@passt.top/>
List-Help: <mailto:passt-dev-request@passt.top?subject=help>
List-Owner: <mailto:passt-dev-owner@passt.top>
List-Post: <mailto:passt-dev@passt.top>
List-Subscribe: <mailto:passt-dev-join@passt.top>
List-Unsubscribe: <mailto:passt-dev-leave@passt.top>


--0+ldDzbKGdAcMrZK
Content-Type: text/plain; charset=us-ascii
Content-Disposition: inline
Content-Transfer-Encoding: quoted-printable

On Wed, Feb 28, 2024 at 07:24:14AM +0100, Stefano Brivio wrote:
> Don't run cppcheck to find out if the --check-level=3Dexhaustive option
> is available, unless we're actually going to run cppcheck later.
>=20
> To avoid this, move this check under the cppcheck target, and
> implement it in shell script instead of using Makefile directives,
> because we can't easily implement conditionals in recipes.
>=20
> Reported-by: Rahil Bhimjiani <me@rahil.website>
> Link: https://bugs.gentoo.org/920795
> Fixes: 8640d62af719 ("cppcheck: Use "exhaustive" level checking when avai=
lable")
> Signed-off-by: Stefano Brivio <sbrivio@redhat.com>

Reviewed-by: David Gibson <david@gibson.dropbear.id.au>

> ---
> v2: Actually fetch the shell variable for cppcheck's command line
>=20
>  Makefile | 12 ++++++------
>  1 file changed, 6 insertions(+), 6 deletions(-)
>=20
> diff --git a/Makefile b/Makefile
> index af4fa87..75f49dc 100644
> --- a/Makefile
> +++ b/Makefile
> @@ -287,20 +287,20 @@ clang-tidy: $(SRCS) $(HEADERS)
>  	-config=3D'{CheckOptions: [{key: bugprone-suspicious-string-compare.War=
nOnImplicitComparison, value: "false"}]}' \
>  	--warnings-as-errors=3D* $(SRCS) -- $(filter-out -pie,$(FLAGS) $(CFLAGS=
) $(CPPFLAGS)) -DCLANG_TIDY_58992
> =20
> -CPPCHECK_EXHAUSTIVE :=3D
> -ifeq ($(shell cppcheck --check-level=3Dexhaustive /dev/null > /dev/null =
2>&1; echo $$?),0)
> -	CPPCHECK_EXHAUSTIVE +=3D --check-level=3Dexhaustive
> -endif
> -
>  SYSTEM_INCLUDES :=3D /usr/include $(wildcard /usr/include/$(TARGET))
>  ifeq ($(shell $(CC) -v 2>&1 | grep -c "gcc version"),1)
>  VER :=3D $(shell $(CC) -dumpversion)
>  SYSTEM_INCLUDES +=3D /usr/lib/gcc/$(TARGET)/$(VER)/include
>  endif
>  cppcheck: $(SRCS) $(HEADERS)
> +	if cppcheck --check-level=3Dexhaustive /dev/null > /dev/null 2>&1; then=
 \
> +		CPPCHECK_EXHAUSTIVE=3D"--check-level=3Dexhaustive";		\
> +	else								\
> +		CPPCHECK_EXHAUSTIVE=3D;					\
> +	fi;								\
>  	cppcheck --std=3Dc11 --error-exitcode=3D1 --enable=3Dall --force	\
>  	--inconclusive --library=3Dposix --quiet				\
> -	$(CPPCHECK_EXHAUSTIVE)						\
> +	$${CPPCHECK_EXHAUSTIVE}						\
>  	$(SYSTEM_INCLUDES:%=3D-I%)					\
>  	$(SYSTEM_INCLUDES:%=3D--config-exclude=3D%)				\
>  	$(SYSTEM_INCLUDES:%=3D--suppress=3D*:%/*)				\

--=20
David Gibson			| I'll have my music baroque, and my code
david AT gibson.dropbear.id.au	| minimalist, thank you.  NOT _the_ _other_
				| _way_ _around_!
http://www.ozlabs.org/~dgibson

--0+ldDzbKGdAcMrZK
Content-Type: application/pgp-signature; name="signature.asc"

-----BEGIN PGP SIGNATURE-----

iQIzBAEBCAAdFiEEO+dNsU4E3yXUXRK2zQJF27ox2GcFAmXe988ACgkQzQJF27ox
2GfK4w/6A6yySQqyVYs9zl1/M31ppu6nS9C+5olGADUcdl8Ep7p7aw7SBTm6LDaK
VeLoVcjuRa/QprSJCs3FxczwhNCouY3pF2lXijNSHgH0rrNijfHWAvrYwf30VmVe
tbb/JB/gS3ZJDrlXxtp9RjjdXEE5xWJeG0GfBroO9VAStz/d7PVAtv0De84Rzmdy
u+Y72MVTCunNTfBshSmVuUVgbMP/XCI9IWK9ekwKuMHNAjQPtPhaPCJzMipmkPlL
pOuBhbMtN77sMvfi4Gia7Joxm4vnZonlvrkdYDTnTtvB57RJOBhffnUP9SoiUq8u
LkJeJ0jCRgF8ulPFS85JC1WLJ88wKffrHBTEbWUe2ZN+JBKMTiz+q0gtQKgsj9wJ
8sdRbnVv9L6t0nnVRz9BBXpvukbzepNCkjnkBtzO8IHdO6an7fdLfuJPSuDxnm3x
vw4kwQFWP1n9KnXleMCuNaESlW3b4WYw5VcntdIU+vju4UlhpH0X1KjbZcev2tDi
NsYaeTnOVhHhp+20JMhZ5QcVf+xyxDI+RplGqUqVydOz31hqjDf74Aa2uhf0LP3y
3lbT6Ob9oSRP3+y3Lhztlx8r7+jgfjLd4en9zItCqJjV0Pw2W+FhIFXVbbK3kKcg
3Z7D7fD3V1tJCn3TuMDGvg8Gf71ydkiOGX12VZXx23ERGGiMkw4=
=lny3
-----END PGP SIGNATURE-----

--0+ldDzbKGdAcMrZK--