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 2805237aa9..28c3032aa4 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 d066c863fb..a6194577ab 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 0a1fe8e263..77746ee916 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 0228fb0f9b..ca0a042840 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 c277f52c08..c4e1146169 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 3e5147a519..8306c88ee3 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 06561edf69..261174735d 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 4ea94e1cdb..fb9b6841b5 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 7bdf7e0179..2f5515dc6b 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 09be121ed1..b2a40423a5 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 45d78f791f..aa6d678fed 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 c51c81721a..a585b2846b 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 d8e7439e02..286c4b9d0a 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 6430dfe505..a95f8a8ea3 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 fd8a92657e..efa595f89b 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 fbcd113204..dea5bb5bac 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 90ab51b2eb..ace5aa82d3 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 aac69b7a10..13ed81217e 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 182147817f..449168d088 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 507bf683e0..f6f51c87a0 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 ],[