mirror of
https://passt.top/passt
synced 2024-12-22 05:35:23 +00:00
cppcheck: Explicitly give files to check
Currently "make cppcheck" invokes cppcheck on ".", so it will check all the
.c and .h files it can find in the source tree. This isn't ideal, because
it can find files that aren't actually part of the real build, or even
stale files which aren't in git.
More practically, some upcoming changes are looking at downloading other
source trees for some tests. Static errors in there is Not Our Problem,
so checking them is both slow and pointless.
So, change the Makefile to invoke cppcheck only on the specific source
files that are part of the build. For some reason in this format the
badBitmaskCheck warnings in seccomp.h which were suppressed by 5beb3472e
("cppcheck: Avoid errors due to zeroes in bitwise ORs") no longer trigger.
That means we get unmatchedSuppression warnings instead. We add an
unmatchedSuppression suppression instead of simply removing the original
suppressions, just in case this odd behaviour isn't the same for all
cppcheck versions.
Signed-off-by: David Gibson <david@gibson.dropbear.id.au>
Signed-off-by: Stefano Brivio <sbrivio@redhat.com>
This commit is contained in:
parent
97e8b33f87
commit
ef2cb13b49
2
Makefile
2
Makefile
@ -308,4 +308,4 @@ cppcheck: $(SRCS) $(HEADERS)
|
|||||||
--inline-suppr \
|
--inline-suppr \
|
||||||
--suppress=unusedStructMember \
|
--suppress=unusedStructMember \
|
||||||
$(filter -D%,$(FLAGS) $(CFLAGS) $(CPPFLAGS)) \
|
$(filter -D%,$(FLAGS) $(CFLAGS) $(CPPFLAGS)) \
|
||||||
.
|
$(SRCS) $(HEADERS)
|
||||||
|
@ -29,11 +29,11 @@ HEADER="/* This file was automatically generated by $(basename ${0}) */
|
|||||||
# Prefix for each profile: check that 'arch' in seccomp_data is matching
|
# Prefix for each profile: check that 'arch' in seccomp_data is matching
|
||||||
PRE='
|
PRE='
|
||||||
struct sock_filter filter_@PROFILE@[] = {
|
struct sock_filter filter_@PROFILE@[] = {
|
||||||
/* cppcheck-suppress badBitmaskCheck */
|
/* cppcheck-suppress [badBitmaskCheck, unmatchedSuppression] */
|
||||||
BPF_STMT(BPF_LD | BPF_W | BPF_ABS,
|
BPF_STMT(BPF_LD | BPF_W | BPF_ABS,
|
||||||
(offsetof(struct seccomp_data, arch))),
|
(offsetof(struct seccomp_data, arch))),
|
||||||
BPF_JUMP(BPF_JMP | BPF_JEQ | BPF_K, PASST_AUDIT_ARCH, 0, @KILL@),
|
BPF_JUMP(BPF_JMP | BPF_JEQ | BPF_K, PASST_AUDIT_ARCH, 0, @KILL@),
|
||||||
/* cppcheck-suppress badBitmaskCheck */
|
/* cppcheck-suppress [badBitmaskCheck, unmatchedSuppression] */
|
||||||
BPF_STMT(BPF_LD | BPF_W | BPF_ABS,
|
BPF_STMT(BPF_LD | BPF_W | BPF_ABS,
|
||||||
(offsetof(struct seccomp_data, nr))),
|
(offsetof(struct seccomp_data, nr))),
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user