cppcheck: explicitly exclude kernel code from userspace checks

Thus extracting the final shred of utility

Reviewed-by: Brian Behlendorf <behlendorf1@llnl.gov>
Signed-off-by: Ahelenia Ziemiańska <nabijaczleweli@nabijaczleweli.xyz>
Closes #13316
This commit is contained in:
наб 2022-04-25 23:27:03 +02:00 committed by Brian Behlendorf
parent c1851bf081
commit c982359460
5 changed files with 3 additions and 7 deletions

View File

@ -1,5 +1,5 @@
#
# Default rules for running cppcheck against the user space components.
# cppcheck for userspace nodist_*_SOURCES are kernel code and cppcheck goes crazy on them.
#
PHONY += cppcheck
@ -15,7 +15,7 @@ cppcheck-recursive-%:
_CTGT = $(subst cppcheck-for-,,$@)
cppcheck-for-%:
@[ -n "$($(_CTGT)_SOURCES)$(dist_$(_CTGT)_SOURCES)$(nodist_$(_CTGT)_SOURCES)" ]
$(CPPCHECK) -j$(CPU_COUNT) $(CPPCHECKFLAGS) $(patsubst -U%,,$(patsubst -D%,,$(filter-out $(AM_CPPFLAGS_NOCHECK),$(or $($(_CTGT)_CPPFLAGS),$(AM_CPPFLAGS))))) $($(_CTGT)_SOURCES) $(dist_$(_CTGT)_SOURCES) $(nodist_$(_CTGT)_SOURCES)
@[ -n "$($(_CTGT)_SOURCES)$(dist_$(_CTGT)_SOURCES)" ]
$(CPPCHECK) -j$(CPU_COUNT) $(CPPCHECKFLAGS) $(patsubst -U%,,$(patsubst -D%,,$(filter-out $(AM_CPPFLAGS_NOCHECK),$(or $($(_CTGT)_CPPFLAGS),$(AM_CPPFLAGS))))) $($(_CTGT)_SOURCES) $(dist_$(_CTGT)_SOURCES)
cppcheck: $(addprefix cppcheck-for-,$(subst -,_,$(subst .,_,$(subst /,_,$(CPPCHECKTARGETS))))) $(addprefix cppcheck-recursive-,$(CPPCHECKDIRS))

View File

@ -2,7 +2,6 @@ libavl_la_CFLAGS = $(AM_CFLAGS) $(KERNEL_CFLAGS) $(LIBRARY_CFLAGS)
libavl_la_CFLAGS += -fvisibility=hidden
noinst_LTLIBRARIES += libavl.la
CPPCHECKTARGETS += libavl.la
nodist_libavl_la_SOURCES = \
module/avl/avl.c

View File

@ -2,7 +2,6 @@ libicp_la_CCASFLAGS = $(AM_CCASFLAGS)
libicp_la_CFLAGS = $(AM_CFLAGS) $(KERNEL_CFLAGS) $(LIBRARY_CFLAGS)
noinst_LTLIBRARIES += libicp.la
CPPCHECKTARGETS += libicp.la
nodist_libicp_la_SOURCES = \
module/icp/spi/kcf_spi.c \

View File

@ -1,7 +1,6 @@
libunicode_la_CFLAGS = $(AM_CFLAGS) $(KERNEL_CFLAGS) $(LIBRARY_CFLAGS)
noinst_LTLIBRARIES += libunicode.la
CPPCHECKTARGETS += libunicode.la
nodist_libunicode_la_SOURCES = \
module/unicode/u8_textprep.c \

View File

@ -4,7 +4,6 @@ libzstd_la_CFLAGS = $(AM_CFLAGS) $(LIBRARY_CFLAGS)
libzstd_la_CFLAGS += -fno-tree-vectorize
noinst_LTLIBRARIES += libzstd.la
CPPCHECKTARGETS += libzstd.la
nodist_libzstd_la_SOURCES = \
module/zstd/lib/common/entropy_common.c \