Skip to content

Commit 7c1ed0c

Browse files
behlendorftonyhutter
authored andcommitted
cppcheck: integrete cppcheck
In order for cppcheck to perform a proper analysis it needs to be aware of how the sources are compiled (source files, include paths/files, extra defines, etc). All the needed information is available from the Makefiles and can be leveraged with a generic cppcheck Makefile target. So let's add one. Additional minor changes: * Removing the cppcheck-suppressions.txt file. With cppcheck 2.3 and these changes it appears to no longer be needed. Some inline suppressions were also removed since they appear not to be needed. We can add them back if it turns out they're needed for older versions of cppcheck. * Added the ax_count_cpus m4 macro to detect at configure time how many processors are available in order to run multiple cppcheck jobs. This value is also now used as a replacement for nproc when executing the kernel interface checks. * "PHONY =" line moved in to the Rules.am file which is included at the top of all Makefile.am's. This is just convenient becase it allows us to use the += syntax to add phony targets. * One upside of this integration worth mentioning is it now allows `make cppcheck` to be run in any directory to check that subtree. * For the moment, cppcheck is not run against the FreeBSD specific kernel sources. The cppcheck-FreeBSD target will need to be implemented and testing on FreeBSD to support this. Reviewed-by: Ryan Moeller <[email protected]> Signed-off-by: Brian Behlendorf <[email protected]> Closes openzfs#11508
1 parent c76d01b commit 7c1ed0c

File tree

41 files changed

+234
-30
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

41 files changed

+234
-30
lines changed

Makefile.am

Lines changed: 6 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -25,7 +25,6 @@ endif
2525

2626
AUTOMAKE_OPTIONS = foreign
2727
EXTRA_DIST = autogen.sh copy-builtin
28-
EXTRA_DIST += cppcheck-suppressions.txt
2928
EXTRA_DIST += config/config.awk config/rpm.am config/deb.am config/tgz.am
3029
EXTRA_DIST += META AUTHORS COPYRIGHT LICENSE NEWS NOTICE README.md
3130
EXTRA_DIST += CODE_OF_CONDUCT.md
@@ -204,13 +203,13 @@ vcscheck:
204203
PHONY += lint
205204
lint: cppcheck paxcheck
206205

206+
CPPCHECKDIRS = cmd lib module
207207
PHONY += cppcheck
208-
cppcheck:
209-
@if type cppcheck > /dev/null 2>&1; then \
210-
cppcheck --quiet --force --error-exitcode=2 --inline-suppr \
211-
--suppressions-list=${top_srcdir}/cppcheck-suppressions.txt \
212-
-UHAVE_SSE2 -UHAVE_AVX512F -UHAVE_UIO_ZEROCOPY \
213-
${top_srcdir}; \
208+
cppcheck: $(CPPCHECKDIRS)
209+
@if test -n "$(CPPCHECK)"; then \
210+
set -e ; for dir in $(CPPCHECKDIRS) ; do \
211+
$(MAKE) -C $$dir cppcheck ; \
212+
done \
214213
else \
215214
echo "skipping cppcheck because cppcheck is not installed"; \
216215
fi

cmd/Makefile.am

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,20 @@
11
SUBDIRS = zfs zpool zdb zhack zinject zstream zstreamdump ztest
22
SUBDIRS += fsck_zfs vdev_id raidz_test zfs_ids_to_path
33

4+
CPPCHECKDIRS = zfs zpool zdb zhack zinject zstream ztest
5+
CPPCHECKDIRS += raidz_test zfs_ids_to_path zpool_influxdb
6+
47
if USING_PYTHON
58
SUBDIRS += arcstat arc_summary dbufstat
69
endif
710

811
if BUILD_LINUX
912
SUBDIRS += mount_zfs zed zgenhostid zvol_id zvol_wait
13+
CPPCHECKDIRS += mount_zfs zed zgenhostid zvol_id
1014
endif
15+
16+
PHONY = cppcheck
17+
cppcheck: $(CPPCHECKDIRS)
18+
set -e ; for dir in $(CPPCHECKDIRS) ; do \
19+
$(MAKE) -C $$dir cppcheck ; \
20+
done

cmd/mount_zfs/Makefile.am

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -18,3 +18,5 @@ mount_zfs_LDADD = \
1818
$(abs_top_builddir)/lib/libnvpair/libnvpair.la
1919

2020
mount_zfs_LDADD += $(LTLIBINTL)
21+
22+
include $(top_srcdir)/config/CppCheck.am

cmd/raidz_test/Makefile.am

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -18,3 +18,5 @@ raidz_test_LDADD = \
1818
$(abs_top_builddir)/lib/libzfs_core/libzfs_core.la
1919

2020
raidz_test_LDADD += -lm
21+
22+
include $(top_srcdir)/config/CppCheck.am

cmd/zdb/Makefile.am

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -14,3 +14,5 @@ zdb_LDADD = \
1414
$(abs_top_builddir)/lib/libzpool/libzpool.la \
1515
$(abs_top_builddir)/lib/libzfs_core/libzfs_core.la \
1616
$(abs_top_builddir)/lib/libnvpair/libnvpair.la
17+
18+
include $(top_srcdir)/config/CppCheck.am

cmd/zed/Makefile.am

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -47,3 +47,5 @@ zed_LDADD += -lrt $(LIBUDEV_LIBS) $(LIBUUID_LIBS)
4747
zed_LDFLAGS = -pthread
4848

4949
EXTRA_DIST = agents/README.md
50+
51+
include $(top_srcdir)/config/CppCheck.am

cmd/zfs/Makefile.am

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -21,3 +21,5 @@ zfs_LDADD += $(LTLIBINTL)
2121
if BUILD_FREEBSD
2222
zfs_LDADD += -lgeom -ljail
2323
endif
24+
25+
include $(top_srcdir)/config/CppCheck.am

cmd/zfs_ids_to_path/Makefile.am

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -7,3 +7,5 @@ zfs_ids_to_path_SOURCES = \
77

88
zfs_ids_to_path_LDADD = \
99
$(abs_top_builddir)/lib/libzfs/libzfs.la
10+
11+
include $(top_srcdir)/config/CppCheck.am

cmd/zgenhostid/Makefile.am

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3,3 +3,5 @@ include $(top_srcdir)/config/Rules.am
33
sbin_PROGRAMS = zgenhostid
44

55
zgenhostid_SOURCES = zgenhostid.c
6+
7+
include $(top_srcdir)/config/CppCheck.am

cmd/zhack/Makefile.am

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -12,3 +12,5 @@ zhack_LDADD = \
1212
$(abs_top_builddir)/lib/libzpool/libzpool.la \
1313
$(abs_top_builddir)/lib/libzfs_core/libzfs_core.la \
1414
$(abs_top_builddir)/lib/libnvpair/libnvpair.la
15+
16+
include $(top_srcdir)/config/CppCheck.am

cmd/zinject/Makefile.am

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -11,3 +11,5 @@ zinject_LDADD = \
1111
$(abs_top_builddir)/lib/libzfs/libzfs.la \
1212
$(abs_top_builddir)/lib/libzfs_core/libzfs_core.la \
1313
$(abs_top_builddir)/lib/libnvpair/libnvpair.la
14+
15+
include $(top_srcdir)/config/CppCheck.am

cmd/zpool/Makefile.am

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -34,6 +34,8 @@ zpool_LDADD += -lgeom
3434
endif
3535
zpool_LDADD += -lm $(LIBBLKID_LIBS) $(LIBUUID_LIBS)
3636

37+
include $(top_srcdir)/config/CppCheck.am
38+
3739
zpoolconfdir = $(sysconfdir)/zfs/zpool.d
3840
zpoolexecdir = $(zfsexecdir)/zpool.d
3941

cmd/zstream/Makefile.am

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -13,3 +13,5 @@ zstream_LDADD = \
1313
$(abs_top_builddir)/lib/libzfs/libzfs.la \
1414
$(abs_top_builddir)/lib/libzfs_core/libzfs_core.la \
1515
$(abs_top_builddir)/lib/libnvpair/libnvpair.la
16+
17+
include $(top_srcdir)/config/CppCheck.am

cmd/ztest/Makefile.am

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -21,3 +21,5 @@ ztest_LDADD = \
2121

2222
ztest_LDADD += -lm
2323
ztest_LDFLAGS = -pthread
24+
25+
include $(top_srcdir)/config/CppCheck.am

cmd/zvol_id/Makefile.am

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -8,3 +8,5 @@ udev_PROGRAMS = zvol_id
88

99
zvol_id_SOURCES = \
1010
zvol_id_main.c
11+
12+
include $(top_srcdir)/config/CppCheck.am

config/CppCheck.am

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,11 @@
1+
#
2+
# Default rules for running cppcheck against the the user space components.
3+
#
4+
5+
PHONY += cppcheck
6+
7+
CPPCHECKFLAGS = --std=c99 --quiet --max-configs=1 --error-exitcode=2
8+
CPPCHECKFLAGS += --inline-suppr -U_KERNEL
9+
10+
cppcheck:
11+
$(CPPCHECK) -j$(CPU_COUNT) $(CPPCHECKFLAGS) $(DEFAULT_INCLUDES) $(SOURCES)

config/Rules.am

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,7 @@
33
# should include these rules and override or extend them as needed.
44
#
55

6+
PHONY =
67
DEFAULT_INCLUDES = \
78
-include $(top_builddir)/zfs_config.h \
89
-I$(top_builddir)/include \

config/always-cppcheck.m4

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,6 @@
1+
dnl #
2+
dnl # Check if cppcheck is available.
3+
dnl #
4+
AC_DEFUN([ZFS_AC_CONFIG_ALWAYS_CPPCHECK], [
5+
AC_CHECK_PROG([CPPCHECK], [cppcheck], [cppcheck])
6+
])

config/ax_count_cpus.m4

Lines changed: 101 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,101 @@
1+
# ===========================================================================
2+
# https://www.gnu.org/software/autoconf-archive/ax_count_cpus.html
3+
# ===========================================================================
4+
#
5+
# SYNOPSIS
6+
#
7+
# AX_COUNT_CPUS([ACTION-IF-DETECTED],[ACTION-IF-NOT-DETECTED])
8+
#
9+
# DESCRIPTION
10+
#
11+
# Attempt to count the number of logical processor cores (including
12+
# virtual and HT cores) currently available to use on the machine and
13+
# place detected value in CPU_COUNT variable.
14+
#
15+
# On successful detection, ACTION-IF-DETECTED is executed if present. If
16+
# the detection fails, then ACTION-IF-NOT-DETECTED is triggered. The
17+
# default ACTION-IF-NOT-DETECTED is to set CPU_COUNT to 1.
18+
#
19+
# LICENSE
20+
#
21+
# Copyright (c) 2014,2016 Karlson2k (Evgeny Grin) <[email protected]>
22+
# Copyright (c) 2012 Brian Aker <[email protected]>
23+
# Copyright (c) 2008 Michael Paul Bailey <[email protected]>
24+
# Copyright (c) 2008 Christophe Tournayre <[email protected]>
25+
#
26+
# Copying and distribution of this file, with or without modification, are
27+
# permitted in any medium without royalty provided the copyright notice
28+
# and this notice are preserved. This file is offered as-is, without any
29+
# warranty.
30+
31+
#serial 22
32+
33+
AC_DEFUN([AX_COUNT_CPUS],[dnl
34+
AC_REQUIRE([AC_CANONICAL_HOST])dnl
35+
AC_REQUIRE([AC_PROG_EGREP])dnl
36+
AC_MSG_CHECKING([the number of available CPUs])
37+
CPU_COUNT="0"
38+
39+
# Try generic methods
40+
41+
# 'getconf' is POSIX utility, but '_NPROCESSORS_ONLN' and
42+
# 'NPROCESSORS_ONLN' are platform-specific
43+
command -v getconf >/dev/null 2>&1 && \
44+
CPU_COUNT=`getconf _NPROCESSORS_ONLN 2>/dev/null || getconf NPROCESSORS_ONLN 2>/dev/null` || CPU_COUNT="0"
45+
AS_IF([[test "$CPU_COUNT" -gt "0" 2>/dev/null || ! command -v nproc >/dev/null 2>&1]],[[: # empty]],[dnl
46+
# 'nproc' is part of GNU Coreutils and is widely available
47+
CPU_COUNT=`OMP_NUM_THREADS='' nproc 2>/dev/null` || CPU_COUNT=`nproc 2>/dev/null` || CPU_COUNT="0"
48+
])dnl
49+
50+
AS_IF([[test "$CPU_COUNT" -gt "0" 2>/dev/null]],[[: # empty]],[dnl
51+
# Try platform-specific preferred methods
52+
AS_CASE([[$host_os]],dnl
53+
[[*linux*]],[[CPU_COUNT=`lscpu -p 2>/dev/null | $EGREP -e '^@<:@0-9@:>@+,' -c` || CPU_COUNT="0"]],dnl
54+
[[*darwin*]],[[CPU_COUNT=`sysctl -n hw.logicalcpu 2>/dev/null` || CPU_COUNT="0"]],dnl
55+
[[freebsd*]],[[command -v sysctl >/dev/null 2>&1 && CPU_COUNT=`sysctl -n kern.smp.cpus 2>/dev/null` || CPU_COUNT="0"]],dnl
56+
[[netbsd*]], [[command -v sysctl >/dev/null 2>&1 && CPU_COUNT=`sysctl -n hw.ncpuonline 2>/dev/null` || CPU_COUNT="0"]],dnl
57+
[[solaris*]],[[command -v psrinfo >/dev/null 2>&1 && CPU_COUNT=`psrinfo 2>/dev/null | $EGREP -e '^@<:@0-9@:>@.*on-line' -c 2>/dev/null` || CPU_COUNT="0"]],dnl
58+
[[mingw*]],[[CPU_COUNT=`ls -qpU1 /proc/registry/HKEY_LOCAL_MACHINE/HARDWARE/DESCRIPTION/System/CentralProcessor/ 2>/dev/null | $EGREP -e '^@<:@0-9@:>@+/' -c` || CPU_COUNT="0"]],dnl
59+
[[msys*]],[[CPU_COUNT=`ls -qpU1 /proc/registry/HKEY_LOCAL_MACHINE/HARDWARE/DESCRIPTION/System/CentralProcessor/ 2>/dev/null | $EGREP -e '^@<:@0-9@:>@+/' -c` || CPU_COUNT="0"]],dnl
60+
[[cygwin*]],[[CPU_COUNT=`ls -qpU1 /proc/registry/HKEY_LOCAL_MACHINE/HARDWARE/DESCRIPTION/System/CentralProcessor/ 2>/dev/null | $EGREP -e '^@<:@0-9@:>@+/' -c` || CPU_COUNT="0"]]dnl
61+
)dnl
62+
])dnl
63+
64+
AS_IF([[test "$CPU_COUNT" -gt "0" 2>/dev/null || ! command -v sysctl >/dev/null 2>&1]],[[: # empty]],[dnl
65+
# Try less preferred generic method
66+
# 'hw.ncpu' exist on many platforms, but not on GNU/Linux
67+
CPU_COUNT=`sysctl -n hw.ncpu 2>/dev/null` || CPU_COUNT="0"
68+
])dnl
69+
70+
AS_IF([[test "$CPU_COUNT" -gt "0" 2>/dev/null]],[[: # empty]],[dnl
71+
# Try platform-specific fallback methods
72+
# They can be less accurate and slower then preferred methods
73+
AS_CASE([[$host_os]],dnl
74+
[[*linux*]],[[CPU_COUNT=`$EGREP -e '^processor' -c /proc/cpuinfo 2>/dev/null` || CPU_COUNT="0"]],dnl
75+
[[*darwin*]],[[CPU_COUNT=`system_profiler SPHardwareDataType 2>/dev/null | $EGREP -i -e 'number of cores:'|cut -d : -f 2 -s|tr -d ' '` || CPU_COUNT="0"]],dnl
76+
[[freebsd*]],[[CPU_COUNT=`dmesg 2>/dev/null| $EGREP -e '^cpu@<:@0-9@:>@+: '|sort -u|$EGREP -e '^' -c` || CPU_COUNT="0"]],dnl
77+
[[netbsd*]], [[CPU_COUNT=`command -v cpuctl >/dev/null 2>&1 && cpuctl list 2>/dev/null| $EGREP -e '^@<:@0-9@:>@+ .* online ' -c` || \
78+
CPU_COUNT=`dmesg 2>/dev/null| $EGREP -e '^cpu@<:@0-9@:>@+ at'|sort -u|$EGREP -e '^' -c` || CPU_COUNT="0"]],dnl
79+
[[solaris*]],[[command -v kstat >/dev/null 2>&1 && CPU_COUNT=`kstat -m cpu_info -s state -p 2>/dev/null | $EGREP -c -e 'on-line'` || \
80+
CPU_COUNT=`kstat -m cpu_info 2>/dev/null | $EGREP -c -e 'module: cpu_info'` || CPU_COUNT="0"]],dnl
81+
[[mingw*]],[AS_IF([[CPU_COUNT=`reg query 'HKLM\\Hardware\\Description\\System\\CentralProcessor' 2>/dev/null | $EGREP -e '\\\\@<:@0-9@:>@+$' -c`]],dnl
82+
[[: # empty]],[[test "$NUMBER_OF_PROCESSORS" -gt "0" 2>/dev/null && CPU_COUNT="$NUMBER_OF_PROCESSORS"]])],dnl
83+
[[msys*]],[[test "$NUMBER_OF_PROCESSORS" -gt "0" 2>/dev/null && CPU_COUNT="$NUMBER_OF_PROCESSORS"]],dnl
84+
[[cygwin*]],[[test "$NUMBER_OF_PROCESSORS" -gt "0" 2>/dev/null && CPU_COUNT="$NUMBER_OF_PROCESSORS"]]dnl
85+
)dnl
86+
])dnl
87+
88+
AS_IF([[test "x$CPU_COUNT" != "x0" && test "$CPU_COUNT" -gt 0 2>/dev/null]],[dnl
89+
AC_MSG_RESULT([[$CPU_COUNT]])
90+
m4_ifvaln([$1],[$1],)dnl
91+
],[dnl
92+
m4_ifval([$2],[dnl
93+
AS_UNSET([[CPU_COUNT]])
94+
AC_MSG_RESULT([[unable to detect]])
95+
$2
96+
], [dnl
97+
CPU_COUNT="1"
98+
AC_MSG_RESULT([[unable to detect (assuming 1)]])
99+
])dnl
100+
])dnl
101+
])dnl

config/zfs-build.m4

Lines changed: 6 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -153,6 +153,9 @@ AC_DEFUN([ZFS_AC_DEBUG_KMEM_TRACKING], [
153153
])
154154

155155
AC_DEFUN([ZFS_AC_CONFIG_ALWAYS], [
156+
AX_COUNT_CPUS([])
157+
AC_SUBST(CPU_COUNT)
158+
156159
ZFS_AC_CONFIG_ALWAYS_CC_NO_UNUSED_BUT_SET_VARIABLE
157160
ZFS_AC_CONFIG_ALWAYS_CC_NO_BOOL_COMPARE
158161
ZFS_AC_CONFIG_ALWAYS_CC_FRAME_LARGER_THAN
@@ -167,6 +170,7 @@ AC_DEFUN([ZFS_AC_CONFIG_ALWAYS], [
167170
ZFS_AC_CONFIG_ALWAYS_PYTHON
168171
ZFS_AC_CONFIG_ALWAYS_PYZFS
169172
ZFS_AC_CONFIG_ALWAYS_SED
173+
ZFS_AC_CONFIG_ALWAYS_CPPCHECK
170174
])
171175

172176
AC_DEFUN([ZFS_AC_CONFIG], [
@@ -191,12 +195,10 @@ AC_DEFUN([ZFS_AC_CONFIG], [
191195
192196
ZFS_AC_CONFIG_ALWAYS
193197
194-
195198
AM_COND_IF([BUILD_LINUX], [
196-
AC_ARG_VAR([TEST_JOBS],
197-
[simultaneous jobs during configure (defaults to $(nproc))])
199+
AC_ARG_VAR([TEST_JOBS], [simultaneous jobs during configure])
198200
if test "x$ac_cv_env_TEST_JOBS_set" != "xset"; then
199-
TEST_JOBS=$(nproc)
201+
TEST_JOBS=$CPU_COUNT
200202
fi
201203
AC_SUBST(TEST_JOBS)
202204
])

cppcheck-suppressions.txt

Lines changed: 0 additions & 8 deletions
This file was deleted.

lib/Makefile.am

Lines changed: 9 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,12 @@
11
# NB: GNU Automake Manual, Chapter 8.3.5: Libtool Convenience Libraries
22
# These nine libraries are intermediary build components.
33
SUBDIRS = libavl libicp libshare libspl libtpool libzstd
4+
CPPCHECKDIRS = libavl libicp libnvpair libshare libspl libtpool libunicode
5+
CPPCHECKDIRS += libuutil libzfs libzfs_core libzfsbootenv libzpool libzutil
46

57
if BUILD_LINUX
68
SUBDIRS += libefi
9+
CPPCHECKDIRS += libefi
710
endif
811

912
# libnvpair is installed as part of the final build product
@@ -23,7 +26,7 @@ DISTLIBS += libnvpair
2326
# is only linked against by ztest and zdb and no stable ABI is provided.
2427
ABILIBS = libnvpair libuutil libzfs_core libzfs libzfsbootenv
2528

26-
PHONY = checkabi storeabi
29+
PHONY = checkabi storeabi cppcheck
2730
checkabi: $(ABILIBS)
2831
set -e ; for dir in $(ABILIBS) ; do \
2932
$(MAKE) -C $$dir checkabi ; \
@@ -33,3 +36,8 @@ storeabi: $(ABILIBS)
3336
set -e ; for dir in $(ABILIBS) ; do \
3437
$(MAKE) -C $$dir storeabi ; \
3538
done
39+
40+
cppcheck: $(CPPCHECKDIRS)
41+
set -e ; for dir in $(CPPCHECKDIRS) ; do \
42+
$(MAKE) -C $$dir cppcheck ; \
43+
done

lib/libavl/Makefile.am

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -12,3 +12,5 @@ KERNEL_C = \
1212

1313
nodist_libavl_la_SOURCES = \
1414
$(KERNEL_C)
15+
16+
include $(top_srcdir)/config/CppCheck.am

lib/libefi/Makefile.am

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -10,3 +10,5 @@ USER_C = \
1010
libefi_la_SOURCES = $(USER_C)
1111

1212
libefi_la_LIBADD = $(LIBUUID_LIBS) $(ZLIB_LIBS)
13+
14+
include $(top_srcdir)/config/CppCheck.am

lib/libicp/Makefile.am

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -71,3 +71,5 @@ KERNEL_ASM = $(ASM_SOURCES_AS)
7171
nodist_libicp_la_SOURCES = \
7272
$(KERNEL_C) \
7373
$(KERNEL_ASM)
74+
75+
include $(top_srcdir)/config/CppCheck.am

lib/libnvpair/Makefile.am

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,4 @@
11
include $(top_srcdir)/config/Rules.am
2-
PHONY =
32

43
VPATH = \
54
$(top_srcdir)/module/nvpair \
@@ -42,5 +41,7 @@ endif
4241

4342
libnvpair_la_LDFLAGS += -version-info 3:0:0
4443

44+
include $(top_srcdir)/config/CppCheck.am
45+
4546
# Library ABI
4647
EXTRA_DIST = libnvpair.abi libnvpair.suppr

lib/libshare/Makefile.am

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -23,3 +23,5 @@ USER_C += \
2323
endif
2424

2525
libshare_la_SOURCES = $(USER_C)
26+
27+
include $(top_srcdir)/config/CppCheck.am

lib/libspl/Makefile.am

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -55,3 +55,12 @@ libspl_la_LIBADD = \
5555
libspl_assert.la
5656

5757
libspl_la_LIBADD += $(LIBCLOCK_GETTIME)
58+
59+
include $(top_srcdir)/config/CppCheck.am
60+
61+
# Override the default SOURCES which includes TARGET_CPU_ATOMIC_SOURCE
62+
# in order to always evaluate the generic asm-generic/atomic.c source.
63+
CPPCHECKSRC = $(USER_C) asm-generic/atomic.c
64+
cppcheck:
65+
$(CPPCHECK) -j$(CPU_COUNT) $(CPPCHECKFLAGS) --force \
66+
$(DEFAULT_INCLUDES) $(CPPCHECKSRC)

lib/libtpool/Makefile.am

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -7,3 +7,5 @@ USER_C = \
77
thread_pool_impl.h
88

99
libtpool_la_SOURCES = $(USER_C)
10+
11+
include $(top_srcdir)/config/CppCheck.am

lib/libunicode/Makefile.am

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -13,3 +13,5 @@ KERNEL_C = \
1313

1414
nodist_libunicode_la_SOURCES = \
1515
$(KERNEL_C)
16+
17+
include $(top_srcdir)/config/CppCheck.am

0 commit comments

Comments
 (0)