summaryrefslogtreecommitdiffstats
path: root/config
diff options
context:
space:
mode:
authorBrian Behlendorf <[email protected]>2011-04-19 10:39:31 -0700
committerBrian Behlendorf <[email protected]>2011-04-19 10:44:10 -0700
commit12c1acde76683108441827ae9affba1872f3afe5 (patch)
tree6800b49b99d7e5c868a64d8511ab9232bb3a1b73 /config
parent79713039a2b6e0ed223d141b4a8a8455f282d2f2 (diff)
Set -Wno-unused-but-set-variable globally
As of gcc-4.6 the option -Wunused-but-set-variable is enabled by default. While this is a useful warning there are numerous places in the ZFS code when a variable is set and then only checked in an ASSERT(). To avoid having to update every instance of this in the code we now set -Wno-unused-but-set-variable to suppress the warning. Additionally, when building with --enable-debug and -Werror set these warning also become fatal. We can reevaluate the suppression of these error at a later time if it becomes an issue. For now we are basically just reverting to the previous gcc behavior.
Diffstat (limited to 'config')
-rw-r--r--config/Rules.am3
-rw-r--r--config/kernel.m41
2 files changed, 3 insertions, 1 deletions
diff --git a/config/Rules.am b/config/Rules.am
index 19ee4a32c..2abafcd4d 100644
--- a/config/Rules.am
+++ b/config/Rules.am
@@ -1,7 +1,8 @@
DEFAULT_INCLUDES = -include ${top_builddir}/zfs_config.h
AM_LIBTOOLFLAGS = --silent
-AM_CFLAGS = -Wall -Wstrict-prototypes -fno-strict-aliasing ${DEBUG_CFLAGS}
+AM_CFLAGS = -Wall -Wstrict-prototypes
+AM_CFLAGS += -fno-strict-aliasing -Wno-unused-but-set-variable ${DEBUG_CFLAGS}
AM_CFLAGS += -D_GNU_SOURCE -D__EXTENSIONS__ -D_REENTRANT
AM_CFLAGS += -D_POSIX_PTHREAD_SEMANTICS -D_FILE_OFFSET_BITS=64
AM_CFLAGS += -D_LARGEFILE64_SOURCE -DTEXT_DOMAIN=\"zfs-linux-user\"
diff --git a/config/kernel.m4 b/config/kernel.m4
index 510f6dbc7..f31d93c97 100644
--- a/config/kernel.m4
+++ b/config/kernel.m4
@@ -44,6 +44,7 @@ AC_DEFUN([ZFS_AC_CONFIG_KERNEL], [
dnl # -Wall -fno-strict-aliasing -Wstrict-prototypes and other
dnl # compiler options are added by the kernel build system.
+ KERNELCPPFLAGS="$KERNELCPPFLAGS -Wno-unused-but-set-variable"
KERNELCPPFLAGS="$KERNELCPPFLAGS -DHAVE_SPL -D_KERNEL"
KERNELCPPFLAGS="$KERNELCPPFLAGS -DTEXT_DOMAIN=\\\"zfs-linux-kernel\\\""