mirror of
https://git.proxmox.com/git/mirror_zfs.git
synced 2026-05-22 10:37:35 +03:00
Only make compiler warnings fatal with --enable-debug
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.
This commit is contained in:
+2
-2
@@ -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}
|
||||
|
||||
+13
-4
@@ -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])
|
||||
])
|
||||
|
||||
|
||||
Reference in New Issue
Block a user