]> granicus.if.org Git - ipset/commitdiff
Add sparse checking support to userspace
authorJozsef Kadlecsik <kadlec@blackhole.kfki.hu>
Thu, 2 May 2013 08:51:55 +0000 (10:51 +0200)
committerJozsef Kadlecsik <kadlec@blackhole.kfki.hu>
Thu, 2 May 2013 08:51:55 +0000 (10:51 +0200)
Make_global.am
Makefile.am
include/libipset/pfxlen.h
lib/Makefile.am
src/Makefile.am

index 33986a2bd874098a59734cc12208d7ecb6020359..29b56789fe1afa7aa637f27894fa3c34a4805076 100644 (file)
@@ -81,3 +81,10 @@ AM_CFLAGS += -g -g3 -ggdb -gdwarf-2 -DIPSET_DEBUG -Wall -Werror
 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 " $<;
+
index 08066233c3ee1d62ebe00aba446684f8f72cdf10..34536046d5be8bc7a6cc6efa9f66c82c8839ff3a 100644 (file)
@@ -17,11 +17,15 @@ endif
 
 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
index 58b4b4fc8e54cb01f34b6733a97499187fb36b7e..c2c7e0c12e072fafe3a6762025c205ea3d0c2cfc 100644 (file)
@@ -18,7 +18,7 @@
  * 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),
index fd853dd257e0eecd80f8986589494bc704a705f1..2d22affd5a076bd758dd3cfc8c61438912905f70 100644 (file)
@@ -35,3 +35,9 @@ libipset_la_SOURCES = \
        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) $< || :
index 717fd14b60ca6906e36998466b2f14f2b0b2b839..810efb7905a998426f92d92080024cf27aa790a0 100644 (file)
@@ -13,3 +13,9 @@ endif
 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) $< || :