From ae7b167a98b48260554fd88cef022547283e125f Mon Sep 17 00:00:00 2001 From: Arvind Sankar Date: Tue, 16 Jun 2020 19:46:04 -0400 Subject: [PATCH] Enable -Wmissing-prototypes/-Wstrict-prototypes Switch on warning flags to detect mismatch between declaration and definition. Reviewed-by: Ryan Moeller Reviewed-by: Brian Behlendorf Signed-off-by: Arvind Sankar Closes #10470 --- config/Rules.am | 3 ++- module/Kbuild.in | 1 + module/Makefile.bsd | 66 +++++++++++---------------------------------- 3 files changed, 18 insertions(+), 52 deletions(-) diff --git a/config/Rules.am b/config/Rules.am index 168cecea2c..fbbca81e65 100644 --- a/config/Rules.am +++ b/config/Rules.am @@ -21,7 +21,8 @@ endif AM_LIBTOOLFLAGS = --silent -AM_CFLAGS = -std=gnu99 -Wall -Wstrict-prototypes -fno-strict-aliasing +AM_CFLAGS = -std=gnu99 -Wall -Wstrict-prototypes -Wmissing-prototypes +AM_CFLAGS += -fno-strict-aliasing AM_CFLAGS += $(NO_OMIT_FRAME_POINTER) AM_CFLAGS += $(DEBUG_CFLAGS) AM_CFLAGS += $(ASAN_CFLAGS) diff --git a/module/Kbuild.in b/module/Kbuild.in index b42ce9e6da..120ce87c58 100644 --- a/module/Kbuild.in +++ b/module/Kbuild.in @@ -16,6 +16,7 @@ ifneq ($(KERNELRELEASE),) obj-$(CONFIG_ZFS) := $(ZFS_MODULES) ZFS_MODULE_CFLAGS += -std=gnu99 -Wno-declaration-after-statement +ZFS_MODULE_CFLAGS += -Wmissing-prototypes ZFS_MODULE_CFLAGS += @KERNEL_DEBUG_CFLAGS@ @NO_FORMAT_ZERO_LENGTH@ ifneq ($(KBUILD_EXTMOD),) diff --git a/module/Makefile.bsd b/module/Makefile.bsd index 92b5c1906c..d23cacd362 100644 --- a/module/Makefile.bsd +++ b/module/Makefile.bsd @@ -303,80 +303,44 @@ beforeinstall: CFLAGS.gcc+= -Wno-pointer-to-int-cast CFLAGS.lapi.c= -Wno-cast-qual -CFLAGS.lcompat.c= -Wno-cast-qual -Wno-missing-prototypes +CFLAGS.lcompat.c= -Wno-cast-qual CFLAGS.lobject.c= -Wno-cast-qual CFLAGS.ltable.c= -Wno-cast-qual CFLAGS.lvm.c= -Wno-cast-qual CFLAGS.nvpair.c= -Wno-cast-qual -CFLAGS.acl_common.c= -Wno-strict-prototypes -Wno-missing-prototypes -CFLAGS.callb.c= -Wno-strict-prototypes -Wno-missing-prototypes -CFLAGS.spl_kstat.c= -Wno-missing-prototypes CFLAGS.spl_string.c= -Wno-cast-qual -CFLAGS.spl_vm.c= -Wno-cast-qual -Wno-missing-prototypes +CFLAGS.spl_vm.c= -Wno-cast-qual CFLAGS.spl_zlib.c= -Wno-cast-qual CFLAGS.abd.c= -Wno-cast-qual -CFLAGS.freebsd_dmu.c= -Wno-missing-prototypes -CFLAGS.freebsd_kmod.c= -Wno-missing-prototypes -CFLAGS.vdev_geom.c= -Wno-missing-prototypes -CFLAGS.zfs_acl.c= -Wno-missing-prototypes -CFLAGS.zfs_ctldir.c= -Wno-missing-prototypes -Wno-strict-prototypes CFLAGS.zfs_log.c= -Wno-cast-qual -CFLAGS.zfs_vfsops.c= -Wno-missing-prototypes -CFLAGS.zfs_vnops.c= -Wno-missing-prototypes -Wno-strict-prototypes -Wno-pointer-arith -CFLAGS.zfs_znode.c= -Wno-missing-prototypes -CFLAGS.zvol.c= -Wno-missing-prototypes +CFLAGS.zfs_vnops.c= -Wno-pointer-arith CFLAGS.u8_textprep.c= -Wno-cast-qual CFLAGS.zfs_fletcher.c= -Wno-cast-qual -Wno-pointer-arith CFLAGS.zfs_fletcher_intel.c= -Wno-cast-qual -Wno-pointer-arith CFLAGS.zfs_fletcher_sse.c= -Wno-cast-qual -Wno-pointer-arith CFLAGS.zfs_fletcher_avx512.c= -Wno-cast-qual -Wno-pointer-arith CFLAGS.zprop_common.c= -Wno-cast-qual -CFLAGS.arc.c= -Wno-missing-prototypes -CFLAGS.blkptr.c= -Wno-missing-prototypes -CFLAGS.dbuf.c= -Wno-missing-prototypes -CFLAGS.dbuf_stats.c= -Wno-missing-prototypes -CFLAGS.ddt.c= -Wno-missing-prototypes -Wno-cast-qual -CFLAGS.dmu.c= -Wno-missing-prototypes -Wno-cast-qual -CFLAGS.dmu_object.c= -Wno-missing-prototypes -CFLAGS.dmu_objset.c= -Wno-missing-prototypes +CFLAGS.ddt.c= -Wno-cast-qual +CFLAGS.dmu.c= -Wno-cast-qual CFLAGS.dmu_traverse.c= -Wno-cast-qual -CFLAGS.dsl_dir.c= -Wno-missing-prototypes -Wno-cast-qual -CFLAGS.dsl_crypt.c= -Wno-missing-prototypes +CFLAGS.dsl_dir.c= -Wno-cast-qual CFLAGS.dsl_deadlist.c= -Wno-cast-qual -CFLAGS.dsl_pool.c= -Wno-missing-prototypes CFLAGS.dsl_prop.c= -Wno-cast-qual -CFLAGS.dsl_scan.c= -Wno-missing-prototypes CFLAGS.fm.c= -Wno-cast-qual -CFLAGS.gzip.c= -Wno-missing-prototypes -CFLAGS.lzjb.c= -Wno-missing-prototypes -CFLAGS.lz4.c= -Wno-missing-prototypes -Wno-cast-qual -CFLAGS.metaslab.c= -Wno-missing-prototypes -CFLAGS.sa.c= -Wno-missing-prototypes -CFLAGS.sha256.c= -Wno-missing-prototypes -CFLAGS.skein_zfs.c= -Wno-missing-prototypes -CFLAGS.spa.c= -Wno-missing-prototypes -Wno-cast-qual -CFLAGS.spa_boot.c= -Wno-missing-prototypes -CFLAGS.spa_misc.c= -Wno-missing-prototypes -Wno-cast-qual -CFLAGS.space_map.c= -Wno-missing-prototypes -CFLAGS.vdev.c= -Wno-missing-prototypes -CFLAGS.vdev_indirect.c= -Wno-missing-prototypes -CFLAGS.vdev_label.c= -Wno-missing-prototypes -CFLAGS.vdev_queue.c= -Wno-missing-prototypes +CFLAGS.lz4.c= -Wno-cast-qual +CFLAGS.spa.c= -Wno-cast-qual +CFLAGS.spa_misc.c= -Wno-cast-qual CFLAGS.vdev_raidz.c= -Wno-cast-qual CFLAGS.vdev_raidz_math.c= -Wno-cast-qual -CFLAGS.vdev_raidz_math_scalar.c= -Wno-cast-qual -Wno-missing-prototypes +CFLAGS.vdev_raidz_math_scalar.c= -Wno-cast-qual CFLAGS.vdev_raidz_math_avx2.c= -Wno-cast-qual -Wno-duplicate-decl-specifier CFLAGS.vdev_raidz_math_avx512f.c= -Wno-cast-qual -Wno-duplicate-decl-specifier CFLAGS.vdev_raidz_math_sse2.c= -Wno-cast-qual -Wno-duplicate-decl-specifier CFLAGS.zap_leaf.c= -Wno-cast-qual -CFLAGS.zap_micro.c= -Wno-missing-prototypes -Wno-cast-qual +CFLAGS.zap_micro.c= -Wno-cast-qual CFLAGS.zcp.c= -Wno-cast-qual -CFLAGS.zcp_get.c= -Wno-missing-prototypes -CFLAGS.zfs_debug.c= -Wno-missing-prototypes CFLAGS.zfs_fm.c= -Wno-cast-qual -CFLAGS.zfs_ioctl.c= -Wno-missing-prototypes -Wno-cast-qual -CFLAGS.zil.c= -Wno-missing-prototypes -Wno-cast-qual -CFLAGS.zio.c= -Wno-missing-prototypes -Wno-cast-qual -CFLAGS.zio_checksum.c= -Wno-missing-prototypes -CFLAGS.zle.c= -Wno-missing-prototypes -CFLAGS.zrlock.c= -Wno-missing-prototypes -Wno-cast-qual +CFLAGS.zfs_ioctl.c= -Wno-cast-qual +CFLAGS.zil.c= -Wno-cast-qual +CFLAGS.zio.c= -Wno-cast-qual +CFLAGS.zrlock.c= -Wno-cast-qual