From: David Gibson <david@gibson.dropbear.id.au>
To: passt-dev@passt.top, Stefano Brivio <sbrivio@redhat.com>
Cc: David Gibson <david@gibson.dropbear.id.au>
Subject: [PATCH 3/4] cppcheck: Use "exhaustive" level checking when available
Date: Fri, 29 Sep 2023 15:50:21 +1000 [thread overview]
Message-ID: <20230929055022.48624-4-david@gibson.dropbear.id.au> (raw)
In-Reply-To: <20230929055022.48624-1-david@gibson.dropbear.id.au>
Recent enough cppcheck versions (at least as of cppcheck 2.12) give this
error processing conf.c:
conf.c:1179:1: information: ValueFlow analysis is limited in conf. Use --check-level=exhaustive if full analysis is wanted. [checkLevelNormal]
Adding --check-level=exhaustive doesn't seem to significantly increase the
cppcheck run time for us, so enable it when possible, suppressing that
warning.
Signed-off-by: David Gibson <david@gibson.dropbear.id.au>
---
Makefile | 6 ++++++
1 file changed, 6 insertions(+)
diff --git a/Makefile b/Makefile
index af3bc75..941086a 100644
--- a/Makefile
+++ b/Makefile
@@ -278,6 +278,11 @@ clang-tidy: $(SRCS) $(HEADERS)
-config='{CheckOptions: [{key: bugprone-suspicious-string-compare.WarnOnImplicitComparison, value: "false"}]}' \
--warnings-as-errors=* $(SRCS) -- $(filter-out -pie,$(FLAGS) $(CFLAGS) $(CPPFLAGS)) -DCLANG_TIDY_58992
+CPPCHECK_EXHAUSTIVE :=
+ifeq ($(shell cppcheck --check-level=exhaustive /dev/null > /dev/null 2>&1; echo $$?),0)
+ CPPCHECK_EXHAUSTIVE += --check-level=exhaustive
+endif
+
SYSTEM_INCLUDES := /usr/include $(wildcard /usr/include/$(TARGET))
ifeq ($(shell $(CC) -v 2>&1 | grep -c "gcc version"),1)
VER := $(shell $(CC) -dumpversion)
@@ -286,6 +291,7 @@ endif
cppcheck: $(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=*:%/*) \
--
@@ -278,6 +278,11 @@ clang-tidy: $(SRCS) $(HEADERS)
-config='{CheckOptions: [{key: bugprone-suspicious-string-compare.WarnOnImplicitComparison, value: "false"}]}' \
--warnings-as-errors=* $(SRCS) -- $(filter-out -pie,$(FLAGS) $(CFLAGS) $(CPPFLAGS)) -DCLANG_TIDY_58992
+CPPCHECK_EXHAUSTIVE :=
+ifeq ($(shell cppcheck --check-level=exhaustive /dev/null > /dev/null 2>&1; echo $$?),0)
+ CPPCHECK_EXHAUSTIVE += --check-level=exhaustive
+endif
+
SYSTEM_INCLUDES := /usr/include $(wildcard /usr/include/$(TARGET))
ifeq ($(shell $(CC) -v 2>&1 | grep -c "gcc version"),1)
VER := $(shell $(CC) -dumpversion)
@@ -286,6 +291,7 @@ endif
cppcheck: $(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=*:%/*) \
--
2.41.0
next prev parent reply other threads:[~2023-09-29 5:50 UTC|newest]
Thread overview: 9+ messages / expand[flat|nested] mbox.gz Atom feed top
2023-09-29 5:50 [PATCH 0/4] RFC: Updates for cppcheck-2.12 warnings David Gibson
2023-09-29 5:50 ` [PATCH 1/4] cppcheck: Make many pointers const David Gibson
2023-09-29 5:50 ` [PATCH 2/4] conf: Remove overly cryptic selection of forward table David Gibson
2023-09-29 5:50 ` David Gibson [this message]
2023-09-29 5:50 ` [PATCH 4/4] cppcheck: Work around bug in cppcheck 2.12.0 David Gibson
2023-09-29 5:52 ` [PATCH 0/4] RFC: Updates for cppcheck-2.12 warnings David Gibson
2023-09-29 15:31 ` Stefano Brivio
2023-10-03 2:36 ` David Gibson
2023-10-05 6:19 ` Stefano Brivio
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20230929055022.48624-4-david@gibson.dropbear.id.au \
--to=david@gibson.dropbear.id.au \
--cc=passt-dev@passt.top \
--cc=sbrivio@redhat.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
Code repositories for project(s) associated with this public inbox
https://passt.top/passt
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for IMAP folder(s).