diff options
author | Brian Behlendorf <[email protected]> | 2011-04-19 09:26:48 -0700 |
---|---|---|
committer | Brian Behlendorf <[email protected]> | 2011-04-19 09:41:41 -0700 |
commit | 03318641afc3e2d6dc18614aaa75d6a0125cb933 (patch) | |
tree | 551de9d0c11d07ec8b0bb04299f6fcd765eb5da9 /config/spl-build.m4 | |
parent | 9b0f9079d22f5a13903d3da4d94e8e306cfa40dd (diff) |
Fix gcc configure warnings
Newer versions of gcc are getting smart enough to detect the sloppy
syntax used for the autoconf tests. It is now generating warnings
for unused/undeclared variables. Newer version of gcc even have
the -Wunused-but-set-variable option set by default. This isn't a
problem except when -Werror is set and they get promoted to an error.
In this case the autoconf test will return an incorrect result which
will result in a build failure latter on.
To handle this I'm tightening up many of the autoconf tests to
explicitly mark variables as unused to suppress the gcc warning.
Remember, all of the autoconf code can never actually be run we
just want to get a clean build error to detect which APIs are
available. Never using a variable is absolutely fine for this.
Diffstat (limited to 'config/spl-build.m4')
-rw-r--r-- | config/spl-build.m4 | 45 |
1 files changed, 25 insertions, 20 deletions
diff --git a/config/spl-build.m4 b/config/spl-build.m4 index 84fbb8b92..1a7512c96 100644 --- a/config/spl-build.m4 +++ b/config/spl-build.m4 @@ -638,7 +638,7 @@ AC_DEFUN([SPL_AC_ATOMIC_SPINLOCK], [ SPL_LINUX_TRY_COMPILE([ #include <asm/atomic.h> ],[ - atomic64_t *ptr; + atomic64_t *ptr __attribute__ ((unused)); ],[ have_atomic64_t=yes AC_DEFINE(HAVE_ATOMIC64_T, 1, @@ -720,7 +720,7 @@ AC_DEFUN([SPL_AC_TYPE_UINTPTR_T], SPL_LINUX_TRY_COMPILE([ #include <linux/types.h> ],[ - uintptr_t *ptr; + uintptr_t *ptr __attribute__ ((unused)); ],[ AC_MSG_RESULT([yes]) AC_DEFINE(HAVE_UINTPTR_T, 1, @@ -739,7 +739,7 @@ AC_DEFUN([SPL_AC_3ARGS_INIT_WORK], SPL_LINUX_TRY_COMPILE([ #include <linux/workqueue.h> ],[ - struct work_struct work; + struct work_struct work __attribute__ ((unused)); INIT_WORK(&work, NULL, NULL); ],[ AC_MSG_RESULT(yes) @@ -759,7 +759,7 @@ AC_DEFUN([SPL_AC_2ARGS_REGISTER_SYSCTL], SPL_LINUX_TRY_COMPILE([ #include <linux/sysctl.h> ],[ - return register_sysctl_table(NULL,0); + (void) register_sysctl_table(NULL, 0); ],[ AC_MSG_RESULT(yes) AC_DEFINE(HAVE_2ARGS_REGISTER_SYSCTL, 1, @@ -825,7 +825,7 @@ AC_DEFUN([SPL_AC_PATH_IN_NAMEIDATA], SPL_LINUX_TRY_COMPILE([ #include <linux/namei.h> ],[ - struct nameidata nd; + struct nameidata nd __attribute__ ((unused)); nd.path.mnt = NULL; nd.path.dentry = NULL; @@ -877,7 +877,7 @@ AC_DEFUN([SPL_AC_CTL_NAME], [ SPL_LINUX_TRY_COMPILE([ #include <linux/sysctl.h> ],[ - struct ctl_table ctl; + struct ctl_table ctl __attribute__ ((unused)); ctl.ctl_name = 0; ],[ AC_MSG_RESULT(yes) @@ -997,7 +997,9 @@ AC_DEFUN([SPL_AC_TIMESPEC_SUB], [ SPL_LINUX_TRY_COMPILE([ #include <linux/time.h> ],[ - struct timespec a, b, c = { 0 }; + struct timespec a = { 0 }; + struct timespec b = { 0 }; + struct timespec c __attribute__ ((unused)); c = timespec_sub(a, b); ],[ AC_MSG_RESULT(yes) @@ -1016,7 +1018,8 @@ AC_DEFUN([SPL_AC_INIT_UTSNAME], [ SPL_LINUX_TRY_COMPILE([ #include <linux/utsname.h> ],[ - struct new_utsname *a = init_utsname(); + struct new_utsname *a __attribute__ ((unused)); + a = init_utsname(); ],[ AC_MSG_RESULT(yes) AC_DEFINE(HAVE_INIT_UTSNAME, 1, [init_utsname() is available]) @@ -1047,7 +1050,8 @@ AC_DEFUN([SPL_AC_FILES_FDTABLE], [ #endif ],[ struct files_struct *files = current->files; - struct fdtable *fdt = files_fdtable(files); + struct fdtable *fdt __attribute__ ((unused)); + fdt = files_fdtable(files); ],[ AC_MSG_RESULT(yes) AC_DEFINE(HAVE_FILES_FDTABLE, 1, [files_fdtable() is available]) @@ -1073,7 +1077,8 @@ AC_DEFUN([SPL_AC_KMALLOC_NODE], [ SPL_LINUX_TRY_COMPILE([ #include <linux/slab.h> ],[ - void *a = kmalloc_node(1, GFP_KERNEL, 0); + void *a __attribute__ ((unused)); + a = kmalloc_node(1, GFP_KERNEL, 0); ],[ AC_MSG_RESULT(yes) AC_DEFINE(HAVE_KMALLOC_NODE, 1, [kmalloc_node() is available]) @@ -1125,7 +1130,7 @@ AC_DEFUN([SPL_AC_MUTEX_OWNER], [ SPL_LINUX_TRY_COMPILE([ #include <linux/mutex.h> ],[ - struct mutex mtx; + struct mutex mtx __attribute__ ((unused)); mtx.owner = NULL; ],[ AC_MSG_RESULT(yes) @@ -1301,7 +1306,7 @@ AC_DEFUN([SPL_AC_GLOBAL_PAGE_STATE], [ SPL_LINUX_TRY_COMPILE([ #include <linux/mm.h> ],[ - unsigned long state; + unsigned long state __attribute__ ((unused)); state = global_page_state(0); ],[ AC_MSG_RESULT(yes) @@ -1327,7 +1332,7 @@ AC_DEFUN([SPL_AC_ZONE_STAT_ITEM_FREE], [ SPL_LINUX_TRY_COMPILE([ #include <linux/mm.h> ],[ - enum zone_stat_item zsi; + enum zone_stat_item zsi __attribute__ ((unused)); zsi = NR_FREE_PAGES; ],[ AC_MSG_RESULT(yes) @@ -1354,7 +1359,7 @@ AC_DEFUN([SPL_AC_ZONE_STAT_ITEM_INACTIVE], [ SPL_LINUX_TRY_COMPILE([ #include <linux/mm.h> ],[ - enum zone_stat_item zsi; + enum zone_stat_item zsi __attribute__ ((unused)); zsi = NR_INACTIVE; ],[ AC_MSG_RESULT(yes) @@ -1368,7 +1373,7 @@ AC_DEFUN([SPL_AC_ZONE_STAT_ITEM_INACTIVE], [ SPL_LINUX_TRY_COMPILE([ #include <linux/mm.h> ],[ - enum zone_stat_item zsi; + enum zone_stat_item zsi __attribute__ ((unused)); zsi = NR_INACTIVE_ANON; ],[ AC_MSG_RESULT(yes) @@ -1382,7 +1387,7 @@ AC_DEFUN([SPL_AC_ZONE_STAT_ITEM_INACTIVE], [ SPL_LINUX_TRY_COMPILE([ #include <linux/mm.h> ],[ - enum zone_stat_item zsi; + enum zone_stat_item zsi __attribute__ ((unused)); zsi = NR_INACTIVE_FILE; ],[ AC_MSG_RESULT(yes) @@ -1409,7 +1414,7 @@ AC_DEFUN([SPL_AC_ZONE_STAT_ITEM_ACTIVE], [ SPL_LINUX_TRY_COMPILE([ #include <linux/mm.h> ],[ - enum zone_stat_item zsi; + enum zone_stat_item zsi __attribute__ ((unused)); zsi = NR_ACTIVE; ],[ AC_MSG_RESULT(yes) @@ -1423,7 +1428,7 @@ AC_DEFUN([SPL_AC_ZONE_STAT_ITEM_ACTIVE], [ SPL_LINUX_TRY_COMPILE([ #include <linux/mm.h> ],[ - enum zone_stat_item zsi; + enum zone_stat_item zsi __attribute__ ((unused)); zsi = NR_ACTIVE_ANON; ],[ AC_MSG_RESULT(yes) @@ -1437,7 +1442,7 @@ AC_DEFUN([SPL_AC_ZONE_STAT_ITEM_ACTIVE], [ SPL_LINUX_TRY_COMPILE([ #include <linux/mm.h> ],[ - enum zone_stat_item zsi; + enum zone_stat_item zsi __attribute__ ((unused)); zsi = NR_ACTIVE_FILE; ],[ AC_MSG_RESULT(yes) @@ -1604,7 +1609,7 @@ AC_DEFUN([SPL_AC_CRED_STRUCT], [ SPL_LINUX_TRY_COMPILE([ #include <linux/cred.h> ],[ - struct cred *cr; + struct cred *cr __attribute__ ((unused)); cr = NULL; ],[ AC_MSG_RESULT(yes) |