From 37430e821176e15e9aa524edf31b1646bf0ba200 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=D0=BD=D0=B0=D0=B1?= Date: Wed, 16 Feb 2022 16:06:08 +0100 Subject: [PATCH] libtpool: -Wno-clobbered MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Also remove -Wno-unused-but-set-variable Upstream-bug: https://gcc.gnu.org/bugzilla/show_bug.cgi?id=61118 Reviewed-by: Alejandro Colomar Reviewed-by: Brian Behlendorf Signed-off-by: Ahelenia ZiemiaƄska Closes #13110 --- config/always-compiler-options.m4 | 18 +++++++++--------- config/kernel-blk-queue.m4 | 16 ++++++++-------- config/kernel-block-device-operations.m4 | 17 ++++++++++++----- config/kernel-get-disk-ro.m4 | 4 ++-- config/zfs-build.m4 | 2 +- lib/libtpool/Makefile.am | 3 +++ lib/libzfs/Makefile.am | 1 - lib/libzpool/Makefile.am | 3 --- lib/libzutil/Makefile.am | 2 -- module/os/linux/zfs/zio_crypt.c | 2 +- 10 files changed, 36 insertions(+), 32 deletions(-) diff --git a/config/always-compiler-options.m4 b/config/always-compiler-options.m4 index ce84f7e606..0028f4bbea 100644 --- a/config/always-compiler-options.m4 +++ b/config/always-compiler-options.m4 @@ -88,7 +88,7 @@ AC_DEFUN([ZFS_AC_CONFIG_ALWAYS_CC_NO_FORMAT_TRUNCATION], [ ]) dnl # -dnl # Check if gcc supports -Wno-format-truncation option. +dnl # Check if gcc supports -Wno-format-zero-length option. dnl # AC_DEFUN([ZFS_AC_CONFIG_ALWAYS_CC_NO_FORMAT_ZERO_LENGTH], [ AC_MSG_CHECKING([whether $CC supports -Wno-format-zero-length]) @@ -136,29 +136,29 @@ AC_DEFUN([ZFS_AC_CONFIG_ALWAYS_CC_NO_BOOL_COMPARE], [ ]) dnl # -dnl # Check if gcc supports -Wno-unused-but-set-variable option. +dnl # Check if gcc supports -Wno-clobbered option. dnl # -dnl # We actually invoke gcc with the -Wunused-but-set-variable option +dnl # We actually invoke gcc with the -Wclobbered option dnl # and infer the 'no-' version does or doesn't exist based upon dnl # the results. This is required because when checking any of dnl # no- prefixed options gcc always returns success. dnl # -AC_DEFUN([ZFS_AC_CONFIG_ALWAYS_CC_NO_UNUSED_BUT_SET_VARIABLE], [ - AC_MSG_CHECKING([whether $CC supports -Wno-unused-but-set-variable]) +AC_DEFUN([ZFS_AC_CONFIG_ALWAYS_CC_NO_CLOBBERED], [ + AC_MSG_CHECKING([whether $CC supports -Wno-clobbered]) saved_flags="$CFLAGS" - CFLAGS="$CFLAGS -Werror -Wunused-but-set-variable" + CFLAGS="$CFLAGS -Werror -Wclobbered" AC_COMPILE_IFELSE([AC_LANG_PROGRAM([], [])], [ - NO_UNUSED_BUT_SET_VARIABLE=-Wno-unused-but-set-variable + NO_CLOBBERED=-Wno-clobbered AC_MSG_RESULT([yes]) ], [ - NO_UNUSED_BUT_SET_VARIABLE= + NO_CLOBBERED= AC_MSG_RESULT([no]) ]) CFLAGS="$saved_flags" - AC_SUBST([NO_UNUSED_BUT_SET_VARIABLE]) + AC_SUBST([NO_CLOBBERED]) ]) dnl # diff --git a/config/kernel-blk-queue.m4 b/config/kernel-blk-queue.m4 index 16251726cc..6f42b98125 100644 --- a/config/kernel-blk-queue.m4 +++ b/config/kernel-blk-queue.m4 @@ -259,17 +259,17 @@ AC_DEFUN([ZFS_AC_KERNEL_SRC_BLK_QUEUE_FLUSH], [ ZFS_LINUX_TEST_SRC([blk_queue_flush], [ #include ], [ - struct request_queue *q = NULL; + struct request_queue *q __attribute__ ((unused)) = NULL; (void) blk_queue_flush(q, REQ_FLUSH); - ], [$NO_UNUSED_BUT_SET_VARIABLE], [ZFS_META_LICENSE]) + ], [], [ZFS_META_LICENSE]) ZFS_LINUX_TEST_SRC([blk_queue_write_cache], [ #include #include ], [ - struct request_queue *q = NULL; + struct request_queue *q __attribute__ ((unused)) = NULL; blk_queue_write_cache(q, true, true); - ], [$NO_UNUSED_BUT_SET_VARIABLE], [ZFS_META_LICENSE]) + ], [], [ZFS_META_LICENSE]) ]) AC_DEFUN([ZFS_AC_KERNEL_BLK_QUEUE_FLUSH], [ @@ -322,9 +322,9 @@ AC_DEFUN([ZFS_AC_KERNEL_SRC_BLK_QUEUE_MAX_HW_SECTORS], [ ZFS_LINUX_TEST_SRC([blk_queue_max_hw_sectors], [ #include ], [ - struct request_queue *q = NULL; + struct request_queue *q __attribute__ ((unused)) = NULL; (void) blk_queue_max_hw_sectors(q, BLK_SAFE_MAX_SECTORS); - ], [$NO_UNUSED_BUT_SET_VARIABLE]) + ], []) ]) AC_DEFUN([ZFS_AC_KERNEL_BLK_QUEUE_MAX_HW_SECTORS], [ @@ -345,9 +345,9 @@ AC_DEFUN([ZFS_AC_KERNEL_SRC_BLK_QUEUE_MAX_SEGMENTS], [ ZFS_LINUX_TEST_SRC([blk_queue_max_segments], [ #include ], [ - struct request_queue *q = NULL; + struct request_queue *q __attribute__ ((unused)) = NULL; (void) blk_queue_max_segments(q, BLK_MAX_SEGMENTS); - ], [$NO_UNUSED_BUT_SET_VARIABLE]) + ], []) ]) AC_DEFUN([ZFS_AC_KERNEL_BLK_QUEUE_MAX_SEGMENTS], [ diff --git a/config/kernel-block-device-operations.m4 b/config/kernel-block-device-operations.m4 index a48618185b..84e39dc8a2 100644 --- a/config/kernel-block-device-operations.m4 +++ b/config/kernel-block-device-operations.m4 @@ -6,13 +6,16 @@ AC_DEFUN([ZFS_AC_KERNEL_SRC_BLOCK_DEVICE_OPERATIONS_CHECK_EVENTS], [ #include unsigned int blk_check_events(struct gendisk *disk, - unsigned int clearing) { return (0); } + unsigned int clearing) { + (void) disk, (void) clearing; + return (0); + } static const struct block_device_operations bops __attribute__ ((unused)) = { .check_events = blk_check_events, }; - ], [], [$NO_UNUSED_BUT_SET_VARIABLE]) + ], [], []) ]) AC_DEFUN([ZFS_AC_KERNEL_BLOCK_DEVICE_OPERATIONS_CHECK_EVENTS], [ @@ -31,7 +34,10 @@ AC_DEFUN([ZFS_AC_KERNEL_SRC_BLOCK_DEVICE_OPERATIONS_RELEASE_VOID], [ ZFS_LINUX_TEST_SRC([block_device_operations_release_void], [ #include - void blk_release(struct gendisk *g, fmode_t mode) { return; } + void blk_release(struct gendisk *g, fmode_t mode) { + (void) g, (void) mode; + return; + } static const struct block_device_operations bops __attribute__ ((unused)) = { @@ -40,7 +46,7 @@ AC_DEFUN([ZFS_AC_KERNEL_SRC_BLOCK_DEVICE_OPERATIONS_RELEASE_VOID], [ .ioctl = NULL, .compat_ioctl = NULL, }; - ], [], [$NO_UNUSED_BUT_SET_VARIABLE]) + ], [], []) ]) AC_DEFUN([ZFS_AC_KERNEL_BLOCK_DEVICE_OPERATIONS_RELEASE_VOID], [ @@ -61,6 +67,7 @@ AC_DEFUN([ZFS_AC_KERNEL_SRC_BLOCK_DEVICE_OPERATIONS_REVALIDATE_DISK], [ #include int blk_revalidate_disk(struct gendisk *disk) { + (void) disk; return(0); } @@ -68,7 +75,7 @@ AC_DEFUN([ZFS_AC_KERNEL_SRC_BLOCK_DEVICE_OPERATIONS_REVALIDATE_DISK], [ bops __attribute__ ((unused)) = { .revalidate_disk = blk_revalidate_disk, }; - ], [], [$NO_UNUSED_BUT_SET_VARIABLE]) + ], [], []) ]) AC_DEFUN([ZFS_AC_KERNEL_BLOCK_DEVICE_OPERATIONS_REVALIDATE_DISK], [ diff --git a/config/kernel-get-disk-ro.m4 b/config/kernel-get-disk-ro.m4 index 8a379c7669..acfcb69acc 100644 --- a/config/kernel-get-disk-ro.m4 +++ b/config/kernel-get-disk-ro.m4 @@ -5,9 +5,9 @@ AC_DEFUN([ZFS_AC_KERNEL_SRC_GET_DISK_RO], [ ZFS_LINUX_TEST_SRC([get_disk_ro], [ #include ],[ - struct gendisk *disk = NULL; + struct gendisk *disk __attribute__ ((unused)) = NULL; (void) get_disk_ro(disk); - ], [$NO_UNUSED_BUT_SET_VARIABLE]) + ], []) ]) AC_DEFUN([ZFS_AC_KERNEL_GET_DISK_RO], [ diff --git a/config/zfs-build.m4 b/config/zfs-build.m4 index c60eb01355..2be007149c 100644 --- a/config/zfs-build.m4 +++ b/config/zfs-build.m4 @@ -209,7 +209,7 @@ AC_DEFUN([ZFS_AC_CONFIG_ALWAYS], [ AX_COUNT_CPUS([]) AC_SUBST(CPU_COUNT) - ZFS_AC_CONFIG_ALWAYS_CC_NO_UNUSED_BUT_SET_VARIABLE + ZFS_AC_CONFIG_ALWAYS_CC_NO_CLOBBERED ZFS_AC_CONFIG_ALWAYS_CC_NO_BOOL_COMPARE ZFS_AC_CONFIG_ALWAYS_CC_IMPLICIT_FALLTHROUGH ZFS_AC_CONFIG_ALWAYS_CC_FRAME_LARGER_THAN diff --git a/lib/libtpool/Makefile.am b/lib/libtpool/Makefile.am index aa8bde32f9..3aff56f05f 100644 --- a/lib/libtpool/Makefile.am +++ b/lib/libtpool/Makefile.am @@ -1,5 +1,8 @@ include $(top_srcdir)/config/Rules.am +# https://gcc.gnu.org/bugzilla/show_bug.cgi?id=61118 +AM_CFLAGS += $(NO_CLOBBERED) + noinst_LTLIBRARIES = libtpool.la USER_C = \ diff --git a/lib/libzfs/Makefile.am b/lib/libzfs/Makefile.am index 31267fd9a5..7acaee4183 100644 --- a/lib/libzfs/Makefile.am +++ b/lib/libzfs/Makefile.am @@ -6,7 +6,6 @@ VPATH = \ $(top_srcdir)/lib/libzfs # Suppress unused but set variable warnings often due to ASSERTs -AM_CFLAGS += $(NO_UNUSED_BUT_SET_VARIABLE) AM_CFLAGS += $(LIBCRYPTO_CFLAGS) $(ZLIB_CFLAGS) pkgconfig_DATA = libzfs.pc diff --git a/lib/libzpool/Makefile.am b/lib/libzpool/Makefile.am index c9a55591e5..db7c376318 100644 --- a/lib/libzpool/Makefile.am +++ b/lib/libzpool/Makefile.am @@ -17,9 +17,6 @@ endif # Unconditionally enable debugging for libzpool AM_CPPFLAGS += -DDEBUG -UNDEBUG -DZFS_DEBUG -# Suppress unused but set variable warnings often due to ASSERTs -AM_CFLAGS += $(NO_UNUSED_BUT_SET_VARIABLE) - # Includes kernel code generate warnings for large stack frames AM_CFLAGS += $(FRAME_LARGER_THAN) diff --git a/lib/libzutil/Makefile.am b/lib/libzutil/Makefile.am index 2f0357e9f9..6351e0ebf6 100644 --- a/lib/libzutil/Makefile.am +++ b/lib/libzutil/Makefile.am @@ -1,7 +1,5 @@ include $(top_srcdir)/config/Rules.am -# Suppress unused but set variable warnings often due to ASSERTs -AM_CFLAGS += $(NO_UNUSED_BUT_SET_VARIABLE) AM_CFLAGS += $(LIBBLKID_CFLAGS) $(LIBUDEV_CFLAGS) DEFAULT_INCLUDES += -I$(srcdir) diff --git a/module/os/linux/zfs/zio_crypt.c b/module/os/linux/zfs/zio_crypt.c index a13fc2aa25..381769eab6 100644 --- a/module/os/linux/zfs/zio_crypt.c +++ b/module/os/linux/zfs/zio_crypt.c @@ -1937,7 +1937,7 @@ zio_do_crypt_data(boolean_t encrypt, zio_crypt_key_t *key, */ if (qat_crypt_use_accel(datalen) && ot != DMU_OT_INTENT_LOG && ot != DMU_OT_DNODE) { - uint8_t *srcbuf, *dstbuf; + uint8_t __attribute__((unused)) *srcbuf, *dstbuf; if (encrypt) { srcbuf = plainbuf;