Skip to content

Commit

Permalink
cppcheck: explicitly exclude kernel code from userspace checks
Browse files Browse the repository at this point in the history
Thus extracting the final shred of utility

Reviewed-by: Brian Behlendorf <[email protected]>
Signed-off-by: Ahelenia Ziemiańska <[email protected]>
Closes openzfs#13316
  • Loading branch information
nabijaczleweli authored and behlendorf committed May 10, 2022
1 parent c1851bf commit c982359
Show file tree
Hide file tree
Showing 5 changed files with 3 additions and 7 deletions.
6 changes: 3 additions & 3 deletions config/CppCheck.am
Original file line number Diff line number Diff line change
@@ -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
Expand All @@ -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))
1 change: 0 additions & 1 deletion lib/libavl/Makefile.am
Original file line number Diff line number Diff line change
Expand Up @@ -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
1 change: 0 additions & 1 deletion lib/libicp/Makefile.am
Original file line number Diff line number Diff line change
Expand Up @@ -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 \
Expand Down
1 change: 0 additions & 1 deletion lib/libunicode/Makefile.am
Original file line number Diff line number Diff line change
@@ -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 \
Expand Down
1 change: 0 additions & 1 deletion lib/libzstd/Makefile.am
Original file line number Diff line number Diff line change
Expand Up @@ -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 \
Expand Down

0 comments on commit c982359

Please sign in to comment.