From: Brian Behlendorf Date: Fri, 11 Jan 2013 00:09:31 +0000 (-0800) Subject: Only use gcc -Wunused-but-set-variable when available X-Git-Tag: zfs-0.6.0-rc14~37 X-Git-Url: https://granicus.if.org/sourcecode?a=commitdiff_plain;h=e191b54ecfbd2af619d5cb4b3a0f298305c2145a;p=zfs 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 --- diff --git a/config/kernel-bdev-block-device-operations.m4 b/config/kernel-bdev-block-device-operations.m4 index 2805237aa..28c3032aa 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 d066c863f..a6194577a 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 0a1fe8e26..77746ee91 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 0228fb0f9..ca0a04284 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 c277f52c0..c4e114616 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 3e5147a51..8306c88ee 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 06561edf6..261174735 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 4ea94e1cd..fb9b6841b 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 7bdf7e017..2f5515dc6 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 09be121ed..b2a40423a 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 45d78f791..aa6d678fe 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 c51c81721..a585b2846 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 d8e7439e0..286c4b9d0 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 6430dfe50..a95f8a8ea 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 fd8a92657..efa595f89 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 fbcd11320..dea5bb5ba 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 90ab51b2e..ace5aa82d 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 aac69b7a1..13ed81217 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 182147817..449168d08 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 507bf683e..f6f51c87a 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 ],[