From c982359460268cca466ce5fae3e6ef6a6c3e7c12 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=D0=BD=D0=B0=D0=B1?= Date: Mon, 25 Apr 2022 23:27:03 +0200 Subject: [PATCH] cppcheck: explicitly exclude kernel code from userspace checks MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Thus extracting the final shred of utility Reviewed-by: Brian Behlendorf Signed-off-by: Ahelenia Ziemiańska Closes #13316 --- config/CppCheck.am | 6 +++--- lib/libavl/Makefile.am | 1 - lib/libicp/Makefile.am | 1 - lib/libunicode/Makefile.am | 1 - lib/libzstd/Makefile.am | 1 - 5 files changed, 3 insertions(+), 7 deletions(-) diff --git a/config/CppCheck.am b/config/CppCheck.am index 0c2502f3d..89a067d81 100644 --- a/config/CppCheck.am +++ b/config/CppCheck.am @@ -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)) diff --git a/lib/libavl/Makefile.am b/lib/libavl/Makefile.am index 5eaf4c087..3b302ee9d 100644 --- a/lib/libavl/Makefile.am +++ b/lib/libavl/Makefile.am @@ -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 diff --git a/lib/libicp/Makefile.am b/lib/libicp/Makefile.am index 00bfc5c36..304f49e39 100644 --- a/lib/libicp/Makefile.am +++ b/lib/libicp/Makefile.am @@ -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 \ diff --git a/lib/libunicode/Makefile.am b/lib/libunicode/Makefile.am index 82fee0101..906759471 100644 --- a/lib/libunicode/Makefile.am +++ b/lib/libunicode/Makefile.am @@ -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 \ diff --git a/lib/libzstd/Makefile.am b/lib/libzstd/Makefile.am index 729856862..49bfb328a 100644 --- a/lib/libzstd/Makefile.am +++ b/lib/libzstd/Makefile.am @@ -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 \