else
AM_CFLAGS += -O2 -DNDEBUG
endif
+
+SPARSE = sparse
+SPARSE_FLAGS = -Wsparse-all -I../include
+IPSET_AM_V_CHECK = $(ipset_am__v_CHECK_$(V))
+ipset_am__v_CHECK_ = $(ipset_am__v_CHECK_$(AM_DEFAULT_VERBOSITY))
+ipset_am__v_CHECK_0 = @echo " CHECK " $<;
+
SUBDIRS = include/libipset lib src
+sparse-check:
+ $(MAKE) -C lib sparse-check
+ $(MAKE) -C src sparse-check
+
modules_sparse:
if WITH_KMOD
${MAKE} -C $(KBUILD_OUTPUT) M=$$PWD/kernel/net/netfilter \
- V=$V C=2 CF=-D__CHECK_ENDIAN__ \
- KCFLAGS="-DPACKAGE_VERSION=$(PACKAGE_VERSION)" \
+ V=$V W=1 C=2 CF="-D__CHECK_ENDIAN__ -Wsparse-all" \
+ KCFLAGS="-DPACKAGE_VERSION=$(PACKAGE_VERSION) -DCHECK_KCONFIG -Wextra" \
IP_SET_MAX=$(IP_SET_MAX) KDIR=$$PWD/kernel modules
else
@echo Skipping kernel modules due to --with-kmod=no
* This table works for both IPv4 and IPv6;
* just use prefixlen_netmask_map[prefixlength].ip.
*/
-const union nf_inet_addr prefixlen_netmask_map[] = {
+static const union nf_inet_addr prefixlen_netmask_map[] = {
E(0x00000000, 0x00000000, 0x00000000, 0x00000000),
E(0x80000000, 0x00000000, 0x00000000, 0x00000000),
E(0xC0000000, 0x00000000, 0x00000000, 0x00000000),
types_init.c
EXTRA_DIST = $(IPSET_SETTYPE_LIST) libipset.map
+
+sparse-check: $(libipset_la_SOURCES:.c=.d)
+
+%.d: %.c
+ $(IPSET_AM_V_CHECK)\
+ $(SPARSE) $(SPARSE_FLAGS) $(AM_CFLAGS) $(AM_CPPFLAGS) $< || :
endif
dist_man_MANS = ipset.8
+
+sparse-check: $(ipset_SOURCES:.c=.d)
+
+%.d: %.c
+ $(IPSET_AM_V_CHECK)\
+ $(SPARSE) -I.. $(SPARSE_FLAGS) $(AM_CFLAGS) $(AM_CPPFLAGS) $< || :