]> git.proxmox.com Git - mirror_spl-debian.git/commitdiff
Only make compiler warnings fatal with --enable-debug
authorBrian Behlendorf <behlendorf1@llnl.gov>
Thu, 1 Jul 2010 00:05:36 +0000 (17:05 -0700)
committerBrian Behlendorf <behlendorf1@llnl.gov>
Thu, 1 Jul 2010 00:05:36 +0000 (17:05 -0700)
While in theory I like the idea of compiler warnings always being
fatal.  In practice this causes problems when small harmless errors
cause build failures for end users.  To handle this I've updated
the build system such that -Werror is only used when --enable-debug
is passed to configure.  This is how I always build when developing
so I'll catch all build warnings and end users will not get stuck
by minor issues.

Makefile.in
cmd/Makefile.in
config/Rules.am
config/spl-build.m4
configure
include/Makefile.in
lib/Makefile.in
scripts/Makefile.in
spl_config.h.in

index f2ec0112bad7a12ee05fbecc5a13ae1d39740824..572e88ec214f8d0acd78f6e379c368a245434bf3 100644 (file)
@@ -140,6 +140,7 @@ CFLAGS = @CFLAGS@
 CPP = @CPP@
 CPPFLAGS = @CPPFLAGS@
 CYGPATH_W = @CYGPATH_W@
+DEBUG_CFLAGS = @DEBUG_CFLAGS@
 DEFS = @DEFS@
 DEPDIR = @DEPDIR@
 DSYMUTIL = @DSYMUTIL@
index 819957e07fff37a976b849cd76ea882dc3d616e1..75e5d8d2fa87c6181af10fe0faf8c42963df7a1e 100644 (file)
@@ -114,6 +114,7 @@ CFLAGS = @CFLAGS@
 CPP = @CPP@
 CPPFLAGS = @CPPFLAGS@
 CYGPATH_W = @CYGPATH_W@
+DEBUG_CFLAGS = @DEBUG_CFLAGS@
 DEFS = @DEFS@
 DEPDIR = @DEPDIR@
 DSYMUTIL = @DSYMUTIL@
@@ -236,8 +237,8 @@ top_srcdir = @top_srcdir@
 DEFAULT_INCLUDES = -include ${top_srcdir}/spl_config.h \
        -I${top_srcdir}/lib
 AM_LIBTOOLFLAGS = --silent
-AM_CFLAGS = -Wall -Wstrict-prototypes -Werror -Wshadow \
-       -D__USE_LARGEFILE64
+AM_CFLAGS = -Wall -Wshadow -Wstrict-prototypes -fno-strict-aliasing \
+       -D__USE_LARGEFILE64 ${DEBUG_CFLAGS}
 spl_SOURCES = spl.c
 splat_SOURCES = splat.c
 splat_LDFLAGS = $(top_builddir)/lib/libcommon.la
index 7b72770b865cc6290e79186a98ba0a4a32b09889..c6b00b6b8f242495c5486306e526650a91e9d4b9 100644 (file)
@@ -9,5 +9,5 @@
 DEFAULT_INCLUDES = -include ${top_srcdir}/spl_config.h
 
 AM_LIBTOOLFLAGS = --silent
-AM_CFLAGS  = -Wall -Wstrict-prototypes -Werror -Wshadow
-AM_CFLAGS += -D__USE_LARGEFILE64
+AM_CFLAGS  = -Wall -Wshadow -Wstrict-prototypes -fno-strict-aliasing
+AM_CFLAGS += -D__USE_LARGEFILE64 ${DEBUG_CFLAGS}
index 135783cdccbc0193f3e77e00677aaacb62d8fed7..9fd97c06f831cddb33d09a09fe08e5d620a15976 100644 (file)
@@ -12,7 +12,7 @@ AC_DEFUN([SPL_AC_CONFIG_KERNEL], [
        dnl # -Wall -fno-strict-aliasing -Wstrict-prototypes and other
        dnl # compiler options are added by the kernel build system.
        abs_srcdir=`readlink -f ${srcdir}`
-       KERNELCPPFLAGS="$KERNELCPPFLAGS -Wstrict-prototypes -Werror"
+       KERNELCPPFLAGS="$KERNELCPPFLAGS -Wstrict-prototypes"
        KERNELCPPFLAGS="$KERNELCPPFLAGS -I${abs_srcdir}/include"
        KERNELCPPFLAGS="$KERNELCPPFLAGS -include ${abs_srcdir}/spl_config.h"
 
@@ -235,6 +235,7 @@ dnl # Enable if the SPL should be compiled with internal debugging enabled.
 dnl # By default this support is disabled.
 dnl #
 AC_DEFUN([SPL_AC_DEBUG], [
+       AC_MSG_CHECKING([whether debugging is enabled])
        AC_ARG_ENABLE([debug],
                [AS_HELP_STRING([--enable-debug],
                [Enable generic debug support @<:@default=no@:>@])],
@@ -242,10 +243,18 @@ AC_DEFUN([SPL_AC_DEBUG], [
                [enable_debug=no])
 
        AS_IF([test "x$enable_debug" = xyes],
-               [KERNELCPPFLAGS="${KERNELCPPFLAGS} -DDEBUG"],
-               [KERNELCPPFLAGS="${KERNELCPPFLAGS} -DNDEBUG"])
+       [
+               AC_DEFINE([DEBUG], [1], [Define to 1 to enable debug])
+               KERNELCPPFLAGS="${KERNELCPPFLAGS} -DDEBUG -Werror"
+               DEBUG_CFLAGS="-DDEBUG -Werror"
+       ],
+       [
+               AC_DEFINE([NDEBUG], [1], [Define to 1 to enable debug])
+               KERNELCPPFLAGS="${KERNELCPPFLAGS} -DNDEBUG"
+               DEBUG_CFLAGS="-DNDEBUG"
+       ])
 
-       AC_MSG_CHECKING([whether debugging is enabled])
+       AC_SUBST(DEBUG_CFLAGS)
        AC_MSG_RESULT([$enable_debug])
 ])
 
index fe3de76dca58e46d72fe0e534315e267a6a0d9ce..a0d4cf890045c46f49a7e3f959e5bc8830784fd3 100755 (executable)
--- a/configure
+++ b/configure
@@ -791,6 +791,7 @@ CONFIG_KERNEL_FALSE
 CONFIG_KERNEL_TRUE
 CONFIG_USER_FALSE
 CONFIG_USER_TRUE
+DEBUG_CFLAGS
 KERNELCPPFLAGS
 KERNELMAKE_PARAMS
 LINUX_SYMBOLS
@@ -4759,13 +4760,13 @@ if test "${lt_cv_nm_interface+set}" = set; then
 else
   lt_cv_nm_interface="BSD nm"
   echo "int some_variable = 0;" > conftest.$ac_ext
-  (eval echo "\"\$as_me:4762: $ac_compile\"" >&5)
+  (eval echo "\"\$as_me:4763: $ac_compile\"" >&5)
   (eval "$ac_compile" 2>conftest.err)
   cat conftest.err >&5
-  (eval echo "\"\$as_me:4765: $NM \\\"conftest.$ac_objext\\\"\"" >&5)
+  (eval echo "\"\$as_me:4766: $NM \\\"conftest.$ac_objext\\\"\"" >&5)
   (eval "$NM \"conftest.$ac_objext\"" 2>conftest.err > conftest.out)
   cat conftest.err >&5
-  (eval echo "\"\$as_me:4768: output\"" >&5)
+  (eval echo "\"\$as_me:4769: output\"" >&5)
   cat conftest.out >&5
   if $GREP 'External.*some_variable' conftest.out > /dev/null; then
     lt_cv_nm_interface="MS dumpbin"
@@ -5971,7 +5972,7 @@ ia64-*-hpux*)
   ;;
 *-*-irix6*)
   # Find out which ABI we are using.
-  echo '#line 5974 "configure"' > conftest.$ac_ext
+  echo '#line 5975 "configure"' > conftest.$ac_ext
   if { (eval echo "$as_me:$LINENO: \"$ac_compile\"") >&5
   (eval $ac_compile) 2>&5
   ac_status=$?
@@ -7824,11 +7825,11 @@ else
    -e 's:.*FLAGS}\{0,1\} :&$lt_compiler_flag :; t' \
    -e 's: [^ ]*conftest\.: $lt_compiler_flag&:; t' \
    -e 's:$: $lt_compiler_flag:'`
-   (eval echo "\"\$as_me:7827: $lt_compile\"" >&5)
+   (eval echo "\"\$as_me:7828: $lt_compile\"" >&5)
    (eval "$lt_compile" 2>conftest.err)
    ac_status=$?
    cat conftest.err >&5
-   echo "$as_me:7831: \$? = $ac_status" >&5
+   echo "$as_me:7832: \$? = $ac_status" >&5
    if (exit $ac_status) && test -s "$ac_outfile"; then
      # The compiler can only warn and ignore the option if not recognized
      # So say no if there are warnings other than the usual output.
@@ -8163,11 +8164,11 @@ else
    -e 's:.*FLAGS}\{0,1\} :&$lt_compiler_flag :; t' \
    -e 's: [^ ]*conftest\.: $lt_compiler_flag&:; t' \
    -e 's:$: $lt_compiler_flag:'`
-   (eval echo "\"\$as_me:8166: $lt_compile\"" >&5)
+   (eval echo "\"\$as_me:8167: $lt_compile\"" >&5)
    (eval "$lt_compile" 2>conftest.err)
    ac_status=$?
    cat conftest.err >&5
-   echo "$as_me:8170: \$? = $ac_status" >&5
+   echo "$as_me:8171: \$? = $ac_status" >&5
    if (exit $ac_status) && test -s "$ac_outfile"; then
      # The compiler can only warn and ignore the option if not recognized
      # So say no if there are warnings other than the usual output.
@@ -8268,11 +8269,11 @@ else
    -e 's:.*FLAGS}\{0,1\} :&$lt_compiler_flag :; t' \
    -e 's: [^ ]*conftest\.: $lt_compiler_flag&:; t' \
    -e 's:$: $lt_compiler_flag:'`
-   (eval echo "\"\$as_me:8271: $lt_compile\"" >&5)
+   (eval echo "\"\$as_me:8272: $lt_compile\"" >&5)
    (eval "$lt_compile" 2>out/conftest.err)
    ac_status=$?
    cat out/conftest.err >&5
-   echo "$as_me:8275: \$? = $ac_status" >&5
+   echo "$as_me:8276: \$? = $ac_status" >&5
    if (exit $ac_status) && test -s out/conftest2.$ac_objext
    then
      # The compiler can only warn and ignore the option if not recognized
@@ -8323,11 +8324,11 @@ else
    -e 's:.*FLAGS}\{0,1\} :&$lt_compiler_flag :; t' \
    -e 's: [^ ]*conftest\.: $lt_compiler_flag&:; t' \
    -e 's:$: $lt_compiler_flag:'`
-   (eval echo "\"\$as_me:8326: $lt_compile\"" >&5)
+   (eval echo "\"\$as_me:8327: $lt_compile\"" >&5)
    (eval "$lt_compile" 2>out/conftest.err)
    ac_status=$?
    cat out/conftest.err >&5
-   echo "$as_me:8330: \$? = $ac_status" >&5
+   echo "$as_me:8331: \$? = $ac_status" >&5
    if (exit $ac_status) && test -s out/conftest2.$ac_objext
    then
      # The compiler can only warn and ignore the option if not recognized
@@ -11126,7 +11127,7 @@ else
   lt_dlunknown=0; lt_dlno_uscore=1; lt_dlneed_uscore=2
   lt_status=$lt_dlunknown
   cat > conftest.$ac_ext <<_LT_EOF
-#line 11129 "configure"
+#line 11130 "configure"
 #include "confdefs.h"
 
 #if HAVE_DLFCN_H
@@ -11222,7 +11223,7 @@ else
   lt_dlunknown=0; lt_dlno_uscore=1; lt_dlneed_uscore=2
   lt_status=$lt_dlunknown
   cat > conftest.$ac_ext <<_LT_EOF
-#line 11225 "configure"
+#line 11226 "configure"
 #include "confdefs.h"
 
 #if HAVE_DLFCN_H
@@ -11605,7 +11606,7 @@ $as_echo "$LINUX_SYMBOLS" >&6; }
 
 
                        abs_srcdir=`readlink -f ${srcdir}`
-       KERNELCPPFLAGS="$KERNELCPPFLAGS -Wstrict-prototypes -Werror"
+       KERNELCPPFLAGS="$KERNELCPPFLAGS -Wstrict-prototypes"
        KERNELCPPFLAGS="$KERNELCPPFLAGS -I${abs_srcdir}/include"
        KERNELCPPFLAGS="$KERNELCPPFLAGS -include ${abs_srcdir}/spl_config.h"
 
@@ -11617,6 +11618,8 @@ $as_echo "$LINUX_SYMBOLS" >&6; }
 
 
 
+       { $as_echo "$as_me:$LINENO: checking whether debugging is enabled" >&5
+$as_echo_n "checking whether debugging is enabled... " >&6; }
        # Check whether --enable-debug was given.
 if test "${enable_debug+set}" = set; then
   enableval=$enable_debug;
 
 
        if test "x$enable_debug" = xyes; then
-  KERNELCPPFLAGS="${KERNELCPPFLAGS} -DDEBUG"
+
+
+cat >>confdefs.h <<\_ACEOF
+#define DEBUG 1
+_ACEOF
+
+               KERNELCPPFLAGS="${KERNELCPPFLAGS} -DDEBUG -Werror"
+               DEBUG_CFLAGS="-DDEBUG -Werror"
+
 else
-  KERNELCPPFLAGS="${KERNELCPPFLAGS} -DNDEBUG"
+
+
+cat >>confdefs.h <<\_ACEOF
+#define NDEBUG 1
+_ACEOF
+
+               KERNELCPPFLAGS="${KERNELCPPFLAGS} -DNDEBUG"
+               DEBUG_CFLAGS="-DNDEBUG"
+
 fi
 
 
-       { $as_echo "$as_me:$LINENO: checking whether debugging is enabled" >&5
-$as_echo_n "checking whether debugging is enabled... " >&6; }
+
        { $as_echo "$as_me:$LINENO: result: $enable_debug" >&5
 $as_echo "$enable_debug" >&6; }
 
@@ -15068,7 +15086,7 @@ $as_echo "$LINUX_SYMBOLS" >&6; }
 
 
                        abs_srcdir=`readlink -f ${srcdir}`
-       KERNELCPPFLAGS="$KERNELCPPFLAGS -Wstrict-prototypes -Werror"
+       KERNELCPPFLAGS="$KERNELCPPFLAGS -Wstrict-prototypes"
        KERNELCPPFLAGS="$KERNELCPPFLAGS -I${abs_srcdir}/include"
        KERNELCPPFLAGS="$KERNELCPPFLAGS -include ${abs_srcdir}/spl_config.h"
 
@@ -15080,6 +15098,8 @@ $as_echo "$LINUX_SYMBOLS" >&6; }
 
 
 
+       { $as_echo "$as_me:$LINENO: checking whether debugging is enabled" >&5
+$as_echo_n "checking whether debugging is enabled... " >&6; }
        # Check whether --enable-debug was given.
 if test "${enable_debug+set}" = set; then
   enableval=$enable_debug;
 
 
        if test "x$enable_debug" = xyes; then
-  KERNELCPPFLAGS="${KERNELCPPFLAGS} -DDEBUG"
+
+
+cat >>confdefs.h <<\_ACEOF
+#define DEBUG 1
+_ACEOF
+
+               KERNELCPPFLAGS="${KERNELCPPFLAGS} -DDEBUG -Werror"
+               DEBUG_CFLAGS="-DDEBUG -Werror"
+
 else
-  KERNELCPPFLAGS="${KERNELCPPFLAGS} -DNDEBUG"
+
+
+cat >>confdefs.h <<\_ACEOF
+#define NDEBUG 1
+_ACEOF
+
+               KERNELCPPFLAGS="${KERNELCPPFLAGS} -DNDEBUG"
+               DEBUG_CFLAGS="-DNDEBUG"
+
 fi
 
 
-       { $as_echo "$as_me:$LINENO: checking whether debugging is enabled" >&5
-$as_echo_n "checking whether debugging is enabled... " >&6; }
+
        { $as_echo "$as_me:$LINENO: result: $enable_debug" >&5
 $as_echo "$enable_debug" >&6; }
 
index 97c854e209fa8e7bee65c3bc1f47f76e0827ab69..21ce72f8e7e53dc3c782e547d565ff51dae28468 100644 (file)
@@ -73,6 +73,7 @@ CFLAGS = @CFLAGS@
 CPP = @CPP@
 CPPFLAGS = @CPPFLAGS@
 CYGPATH_W = @CYGPATH_W@
+DEBUG_CFLAGS = @DEBUG_CFLAGS@
 DEFS = @DEFS@
 DEPDIR = @DEPDIR@
 DSYMUTIL = @DSYMUTIL@
index 3ba39fff7df2d41899a9fd20267fe6478eb33a6e..eb2e83134d2d054f764c4e29b745d11a392295b5 100644 (file)
@@ -106,6 +106,7 @@ CFLAGS = @CFLAGS@
 CPP = @CPP@
 CPPFLAGS = @CPPFLAGS@
 CYGPATH_W = @CYGPATH_W@
+DEBUG_CFLAGS = @DEBUG_CFLAGS@
 DEFS = @DEFS@
 DEPDIR = @DEPDIR@
 DSYMUTIL = @DSYMUTIL@
@@ -227,8 +228,8 @@ top_builddir = @top_builddir@
 top_srcdir = @top_srcdir@
 DEFAULT_INCLUDES = -include ${top_srcdir}/spl_config.h
 AM_LIBTOOLFLAGS = --silent
-AM_CFLAGS = -Wall -Wstrict-prototypes -Werror -Wshadow \
-       -D__USE_LARGEFILE64
+AM_CFLAGS = -Wall -Wshadow -Wstrict-prototypes -fno-strict-aliasing \
+       -D__USE_LARGEFILE64 ${DEBUG_CFLAGS}
 noinst_LTLIBRARIES = libcommon.la
 libcommon_la_SOURCES = list.c
 EXTRA_DIST = list.h
index b171b01ffec3603153a8b7a3820a6577e32d5ea8..64e414acb73ccd84920da8f3992d3c6a7a3ccbe9 100644 (file)
@@ -68,6 +68,7 @@ CFLAGS = @CFLAGS@
 CPP = @CPP@
 CPPFLAGS = @CPPFLAGS@
 CYGPATH_W = @CYGPATH_W@
+DEBUG_CFLAGS = @DEBUG_CFLAGS@
 DEFS = @DEFS@
 DEPDIR = @DEPDIR@
 DSYMUTIL = @DSYMUTIL@
index a22ca7b8b9a362b9e6921def8f9a54146b990886..540b793923ec9c8641453d2430385fcd71bf6983 100644 (file)
@@ -3,6 +3,9 @@
 /* Atomic types use spinlocks */
 #undef ATOMIC_SPINLOCK
 
+/* Define to 1 to enable debug */
+#undef DEBUG
+
 /* Define to 1 to enable basic kmem accounting */
 #undef DEBUG_KMEM
 
    */
 #undef LT_OBJDIR
 
+/* Define to 1 to enable debug */
+#undef NDEBUG
+
 /* get_zone_counts() is needed */
 #undef NEED_GET_ZONE_COUNTS