From e191b54ecfbd2af619d5cb4b3a0f298305c2145a Mon Sep 17 00:00:00 2001 From: Brian Behlendorf Date: Thu, 10 Jan 2013 16:09:31 -0800 Subject: [PATCH] Only use gcc -Wunused-but-set-variable when available Certain versions of gcc generate an 'unrecognized command line option' error message when -Wunused-but-set-variable is used unconditionally. This in turn can cause several of the autoconf tests to misdetect an interface. Now, the use of -Wunused-but-set-variable in the autoconf tests was introduced by commit b9c59ec8 to address a gcc 4.6 compatibility problem. So we really only need to pass this option for version of gcc which are known to support it. Therefore, the tests have been updated to use the result of the existing ZFS_AC_CONFIG_ALWAYS_NO_UNUSED_BUT_SET_VARIABLE which determines if gcc supports this option. Signed-off-by: Brian Behlendorf Closes #1004 --- config/kernel-bdev-block-device-operations.m4 | 2 +- config/kernel-bdev-logical-size.m4 | 2 +- config/kernel-bdev-physical-size.m4 | 2 +- config/kernel-blk-end-request.m4 | 2 +- config/kernel-blk-fetch-request.m4 | 2 +- config/kernel-blk-queue-discard.m4 | 2 +- config/kernel-blk-queue-flush.m4 | 2 +- config/kernel-blk-queue-io-opt.m4 | 2 +- config/kernel-blk-queue-max-hw-sectors.m4 | 2 +- config/kernel-blk-queue-max-segments.m4 | 2 +- config/kernel-blk-queue-nonrot.m4 | 2 +- config/kernel-blk-queue-physical-block-size.m4 | 2 +- config/kernel-blk-requeue-request.m4 | 2 +- config/kernel-blk-rq-bytes.m4 | 2 +- config/kernel-blk-rq-pos.m4 | 2 +- config/kernel-blk-rq-sectors.m4 | 2 +- config/kernel-elevator-change.m4 | 2 +- config/kernel-get-disk-ro.m4 | 2 +- config/kernel-rq-for-each_segment.m4 | 2 +- config/kernel-rq-is_sync.m4 | 2 +- 20 files changed, 20 insertions(+), 20 deletions(-) diff --git a/config/kernel-bdev-block-device-operations.m4 b/config/kernel-bdev-block-device-operations.m4 index 2805237aa9b3..28c3032aa4e7 100644 --- a/config/kernel-bdev-block-device-operations.m4 +++ b/config/kernel-bdev-block-device-operations.m4 @@ -4,7 +4,7 @@ dnl # AC_DEFUN([ZFS_AC_KERNEL_BDEV_BLOCK_DEVICE_OPERATIONS], [ AC_MSG_CHECKING([block device operation prototypes]) tmp_flags="$EXTRA_KCFLAGS" - EXTRA_KCFLAGS="-Wno-unused-but-set-variable" + EXTRA_KCFLAGS="${NO_UNUSED_BUT_SET_VARIABLE}" ZFS_LINUX_TRY_COMPILE([ #include ],[ diff --git a/config/kernel-bdev-logical-size.m4 b/config/kernel-bdev-logical-size.m4 index d066c863fbd9..a6194577abbd 100644 --- a/config/kernel-bdev-logical-size.m4 +++ b/config/kernel-bdev-logical-size.m4 @@ -8,7 +8,7 @@ dnl # AC_DEFUN([ZFS_AC_KERNEL_BDEV_LOGICAL_BLOCK_SIZE], [ AC_MSG_CHECKING([whether bdev_logical_block_size() is available]) tmp_flags="$EXTRA_KCFLAGS" - EXTRA_KCFLAGS="-Wno-unused-but-set-variable" + EXTRA_KCFLAGS="${NO_UNUSED_BUT_SET_VARIABLE}" ZFS_LINUX_TRY_COMPILE([ #include ],[ diff --git a/config/kernel-bdev-physical-size.m4 b/config/kernel-bdev-physical-size.m4 index 0a1fe8e26385..77746ee91690 100644 --- a/config/kernel-bdev-physical-size.m4 +++ b/config/kernel-bdev-physical-size.m4 @@ -22,7 +22,7 @@ dnl # AC_DEFUN([ZFS_AC_KERNEL_BDEV_PHYSICAL_BLOCK_SIZE], [ AC_MSG_CHECKING([whether bdev_physical_block_size() is available]) tmp_flags="$EXTRA_KCFLAGS" - EXTRA_KCFLAGS="-Wno-unused-but-set-variable" + EXTRA_KCFLAGS="${NO_UNUSED_BUT_SET_VARIABLE}" ZFS_LINUX_TRY_COMPILE([ #include ],[ diff --git a/config/kernel-blk-end-request.m4 b/config/kernel-blk-end-request.m4 index 0228fb0f9b93..ca0a042840bf 100644 --- a/config/kernel-blk-end-request.m4 +++ b/config/kernel-blk-end-request.m4 @@ -6,7 +6,7 @@ dnl # AC_DEFUN([ZFS_AC_KERNEL_BLK_END_REQUEST], [ AC_MSG_CHECKING([whether blk_end_request() is available]) tmp_flags="$EXTRA_KCFLAGS" - EXTRA_KCFLAGS="-Wno-unused-but-set-variable" + EXTRA_KCFLAGS="${NO_UNUSED_BUT_SET_VARIABLE}" ZFS_LINUX_TRY_COMPILE([ #include ],[ diff --git a/config/kernel-blk-fetch-request.m4 b/config/kernel-blk-fetch-request.m4 index c277f52c0867..c4e11461698b 100644 --- a/config/kernel-blk-fetch-request.m4 +++ b/config/kernel-blk-fetch-request.m4 @@ -8,7 +8,7 @@ dnl # AC_DEFUN([ZFS_AC_KERNEL_BLK_FETCH_REQUEST], [ AC_MSG_CHECKING([whether blk_fetch_request() is available]) tmp_flags="$EXTRA_KCFLAGS" - EXTRA_KCFLAGS="-Wno-unused-but-set-variable" + EXTRA_KCFLAGS="${NO_UNUSED_BUT_SET_VARIABLE}" ZFS_LINUX_TRY_COMPILE([ #include ],[ diff --git a/config/kernel-blk-queue-discard.m4 b/config/kernel-blk-queue-discard.m4 index 3e5147a519d5..8306c88ee305 100644 --- a/config/kernel-blk-queue-discard.m4 +++ b/config/kernel-blk-queue-discard.m4 @@ -5,7 +5,7 @@ dnl # AC_DEFUN([ZFS_AC_KERNEL_BLK_QUEUE_DISCARD], [ AC_MSG_CHECKING([whether blk_queue_discard() is available]) tmp_flags="$EXTRA_KCFLAGS" - EXTRA_KCFLAGS="-Wno-unused-but-set-variable" + EXTRA_KCFLAGS="${NO_UNUSED_BUT_SET_VARIABLE}" ZFS_LINUX_TRY_COMPILE([ #include ],[ diff --git a/config/kernel-blk-queue-flush.m4 b/config/kernel-blk-queue-flush.m4 index 06561edf699e..261174735d92 100644 --- a/config/kernel-blk-queue-flush.m4 +++ b/config/kernel-blk-queue-flush.m4 @@ -12,7 +12,7 @@ dnl # AC_DEFUN([ZFS_AC_KERNEL_BLK_QUEUE_FLUSH], [ AC_MSG_CHECKING([whether blk_queue_flush() is available]) tmp_flags="$EXTRA_KCFLAGS" - EXTRA_KCFLAGS="-Wno-unused-but-set-variable" + EXTRA_KCFLAGS="${NO_UNUSED_BUT_SET_VARIABLE}" ZFS_LINUX_TRY_COMPILE([ #include ],[ diff --git a/config/kernel-blk-queue-io-opt.m4 b/config/kernel-blk-queue-io-opt.m4 index 4ea94e1cdbf2..fb9b6841b59c 100644 --- a/config/kernel-blk-queue-io-opt.m4 +++ b/config/kernel-blk-queue-io-opt.m4 @@ -6,7 +6,7 @@ dnl # AC_DEFUN([ZFS_AC_KERNEL_BLK_QUEUE_IO_OPT], [ AC_MSG_CHECKING([whether blk_queue_io_opt() is available]) tmp_flags="$EXTRA_KCFLAGS" - EXTRA_KCFLAGS="-Wno-unused-but-set-variable" + EXTRA_KCFLAGS="${NO_UNUSED_BUT_SET_VARIABLE}" ZFS_LINUX_TRY_COMPILE([ #include ],[ diff --git a/config/kernel-blk-queue-max-hw-sectors.m4 b/config/kernel-blk-queue-max-hw-sectors.m4 index 7bdf7e017996..2f5515dc6b7b 100644 --- a/config/kernel-blk-queue-max-hw-sectors.m4 +++ b/config/kernel-blk-queue-max-hw-sectors.m4 @@ -5,7 +5,7 @@ dnl # AC_DEFUN([ZFS_AC_KERNEL_BLK_QUEUE_MAX_HW_SECTORS], [ AC_MSG_CHECKING([whether blk_queue_max_hw_sectors() is available]) tmp_flags="$EXTRA_KCFLAGS" - EXTRA_KCFLAGS="-Wno-unused-but-set-variable" + EXTRA_KCFLAGS="${NO_UNUSED_BUT_SET_VARIABLE}" ZFS_LINUX_TRY_COMPILE([ #include ],[ diff --git a/config/kernel-blk-queue-max-segments.m4 b/config/kernel-blk-queue-max-segments.m4 index 09be121ed10d..b2a40423a5c8 100644 --- a/config/kernel-blk-queue-max-segments.m4 +++ b/config/kernel-blk-queue-max-segments.m4 @@ -6,7 +6,7 @@ dnl # AC_DEFUN([ZFS_AC_KERNEL_BLK_QUEUE_MAX_SEGMENTS], [ AC_MSG_CHECKING([whether blk_queue_max_segments() is available]) tmp_flags="$EXTRA_KCFLAGS" - EXTRA_KCFLAGS="-Wno-unused-but-set-variable" + EXTRA_KCFLAGS="${NO_UNUSED_BUT_SET_VARIABLE}" ZFS_LINUX_TRY_COMPILE([ #include ],[ diff --git a/config/kernel-blk-queue-nonrot.m4 b/config/kernel-blk-queue-nonrot.m4 index 45d78f791f64..aa6d678fed68 100644 --- a/config/kernel-blk-queue-nonrot.m4 +++ b/config/kernel-blk-queue-nonrot.m4 @@ -8,7 +8,7 @@ dnl # AC_DEFUN([ZFS_AC_KERNEL_BLK_QUEUE_NONROT], [ AC_MSG_CHECKING([whether blk_queue_nonrot() is available]) tmp_flags="$EXTRA_KCFLAGS" - EXTRA_KCFLAGS="-Wno-unused-but-set-variable" + EXTRA_KCFLAGS="${NO_UNUSED_BUT_SET_VARIABLE}" ZFS_LINUX_TRY_COMPILE([ #include ],[ diff --git a/config/kernel-blk-queue-physical-block-size.m4 b/config/kernel-blk-queue-physical-block-size.m4 index c51c81721a25..a585b2846bb7 100644 --- a/config/kernel-blk-queue-physical-block-size.m4 +++ b/config/kernel-blk-queue-physical-block-size.m4 @@ -7,7 +7,7 @@ dnl # AC_DEFUN([ZFS_AC_KERNEL_BLK_QUEUE_PHYSICAL_BLOCK_SIZE], [ AC_MSG_CHECKING([whether blk_queue_physical_block_size() is available]) tmp_flags="$EXTRA_KCFLAGS" - EXTRA_KCFLAGS="-Wno-unused-but-set-variable" + EXTRA_KCFLAGS="${NO_UNUSED_BUT_SET_VARIABLE}" ZFS_LINUX_TRY_COMPILE([ #include ],[ diff --git a/config/kernel-blk-requeue-request.m4 b/config/kernel-blk-requeue-request.m4 index d8e7439e02f2..286c4b9d0ad5 100644 --- a/config/kernel-blk-requeue-request.m4 +++ b/config/kernel-blk-requeue-request.m4 @@ -7,7 +7,7 @@ dnl # AC_DEFUN([ZFS_AC_KERNEL_BLK_REQUEUE_REQUEST], [ AC_MSG_CHECKING([whether blk_requeue_request() is available]) tmp_flags="$EXTRA_KCFLAGS" - EXTRA_KCFLAGS="-Wno-unused-but-set-variable" + EXTRA_KCFLAGS="${NO_UNUSED_BUT_SET_VARIABLE}" ZFS_LINUX_TRY_COMPILE([ #include ],[ diff --git a/config/kernel-blk-rq-bytes.m4 b/config/kernel-blk-rq-bytes.m4 index 6430dfe50538..a95f8a8ea390 100644 --- a/config/kernel-blk-rq-bytes.m4 +++ b/config/kernel-blk-rq-bytes.m4 @@ -7,7 +7,7 @@ dnl # AC_DEFUN([ZFS_AC_KERNEL_BLK_RQ_BYTES], [ AC_MSG_CHECKING([whether blk_rq_bytes() is available]) tmp_flags="$EXTRA_KCFLAGS" - EXTRA_KCFLAGS="-Wno-unused-but-set-variable" + EXTRA_KCFLAGS="${NO_UNUSED_BUT_SET_VARIABLE}" ZFS_LINUX_TRY_COMPILE([ #include ],[ diff --git a/config/kernel-blk-rq-pos.m4 b/config/kernel-blk-rq-pos.m4 index fd8a92657eff..efa595f89b46 100644 --- a/config/kernel-blk-rq-pos.m4 +++ b/config/kernel-blk-rq-pos.m4 @@ -4,7 +4,7 @@ dnl # AC_DEFUN([ZFS_AC_KERNEL_BLK_RQ_POS], [ AC_MSG_CHECKING([whether blk_rq_pos() is available]) tmp_flags="$EXTRA_KCFLAGS" - EXTRA_KCFLAGS="-Wno-unused-but-set-variable" + EXTRA_KCFLAGS="${NO_UNUSED_BUT_SET_VARIABLE}" ZFS_LINUX_TRY_COMPILE([ #include ],[ diff --git a/config/kernel-blk-rq-sectors.m4 b/config/kernel-blk-rq-sectors.m4 index fbcd113204c5..dea5bb5bacc1 100644 --- a/config/kernel-blk-rq-sectors.m4 +++ b/config/kernel-blk-rq-sectors.m4 @@ -4,7 +4,7 @@ dnl # AC_DEFUN([ZFS_AC_KERNEL_BLK_RQ_SECTORS], [ AC_MSG_CHECKING([whether blk_rq_sectors() is available]) tmp_flags="$EXTRA_KCFLAGS" - EXTRA_KCFLAGS="-Wno-unused-but-set-variable" + EXTRA_KCFLAGS="${NO_UNUSED_BUT_SET_VARIABLE}" ZFS_LINUX_TRY_COMPILE([ #include ],[ diff --git a/config/kernel-elevator-change.m4 b/config/kernel-elevator-change.m4 index 90ab51b2eb77..ace5aa82d3d3 100644 --- a/config/kernel-elevator-change.m4 +++ b/config/kernel-elevator-change.m4 @@ -5,7 +5,7 @@ dnl # AC_DEFUN([ZFS_AC_KERNEL_ELEVATOR_CHANGE], [ AC_MSG_CHECKING([whether elevator_change() is available]) tmp_flags="$EXTRA_KCFLAGS" - EXTRA_KCFLAGS="-Wno-unused-but-set-variable" + EXTRA_KCFLAGS="${NO_UNUSED_BUT_SET_VARIABLE}" ZFS_LINUX_TRY_COMPILE([ #include #include diff --git a/config/kernel-get-disk-ro.m4 b/config/kernel-get-disk-ro.m4 index aac69b7a10f2..13ed81217ee3 100644 --- a/config/kernel-get-disk-ro.m4 +++ b/config/kernel-get-disk-ro.m4 @@ -4,7 +4,7 @@ dnl # AC_DEFUN([ZFS_AC_KERNEL_GET_DISK_RO], [ AC_MSG_CHECKING([whether get_disk_ro() is available]) tmp_flags="$EXTRA_KCFLAGS" - EXTRA_KCFLAGS="-Wno-unused-but-set-variable" + EXTRA_KCFLAGS="${NO_UNUSED_BUT_SET_VARIABLE}" ZFS_LINUX_TRY_COMPILE([ #include ],[ diff --git a/config/kernel-rq-for-each_segment.m4 b/config/kernel-rq-for-each_segment.m4 index 182147817f45..449168d088eb 100644 --- a/config/kernel-rq-for-each_segment.m4 +++ b/config/kernel-rq-for-each_segment.m4 @@ -4,7 +4,7 @@ dnl # AC_DEFUN([ZFS_AC_KERNEL_RQ_FOR_EACH_SEGMENT], [ AC_MSG_CHECKING([whether rq_for_each_segment() is available]) tmp_flags="$EXTRA_KCFLAGS" - EXTRA_KCFLAGS="-Wno-unused-but-set-variable" + EXTRA_KCFLAGS="${NO_UNUSED_BUT_SET_VARIABLE}" ZFS_LINUX_TRY_COMPILE([ #include ],[ diff --git a/config/kernel-rq-is_sync.m4 b/config/kernel-rq-is_sync.m4 index 507bf683e0d7..f6f51c87a081 100644 --- a/config/kernel-rq-is_sync.m4 +++ b/config/kernel-rq-is_sync.m4 @@ -4,7 +4,7 @@ dnl # AC_DEFUN([ZFS_AC_KERNEL_RQ_IS_SYNC], [ AC_MSG_CHECKING([whether rq_is_sync() is available]) tmp_flags="$EXTRA_KCFLAGS" - EXTRA_KCFLAGS="-Wno-unused-but-set-variable" + EXTRA_KCFLAGS="${NO_UNUSED_BUT_SET_VARIABLE}" ZFS_LINUX_TRY_COMPILE([ #include ],[