]> git.proxmox.com Git - zfsonlinux.git/blame - zfs-patches/0004-Make-enable-debug-fail-when-given-bogus-args.patch
update ZFS submodule to debian/0.7.9-2
[zfsonlinux.git] / zfs-patches / 0004-Make-enable-debug-fail-when-given-bogus-args.patch
CommitLineData
75b07eca
FG
1From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
2From: Richard Yao <richard.yao@clusterhq.com>
3Date: Tue, 23 Sep 2014 13:31:33 -0400
4Subject: [PATCH] Make --enable-debug fail when given bogus args
5MIME-Version: 1.0
6Content-Type: text/plain; charset=UTF-8
7Content-Transfer-Encoding: 8bit
8
9Currently, bogus options to --enable-debug become --disable-debug. That
10means that passing --enable-debug=true is analogous to --disable-debug,
11but the result is counterintuitive. We switch to AS_CASE to allow us to
12fail when given a bogus option.
13
14Also, we modify the text printed to clarify that --enable-debug enables
15assertions.
16
17Reviewed-by: Chunwei Chen <tuxoko@gmail.com>
18Reviewed-by: Brian Behlendorf <behlendorf1@llnl.gov>
19Signed-off-by: Richard Yao <richard.yao@clusterhq.com>
20Closes #2734
21(cherry picked from commit 0f1ff38476ba255eb1f066f675c8721168ff2295)
22Signed-off-by: Fabian Grünbichler <f.gruenbichler@proxmox.com>
23---
24 config/zfs-build.m4 | 43 +++++++++++++++++++++++++------------------
25 1 file changed, 25 insertions(+), 18 deletions(-)
26
27diff --git a/config/zfs-build.m4 b/config/zfs-build.m4
28index 7651dc2c1..78a87aef7 100644
29--- a/config/zfs-build.m4
30+++ b/config/zfs-build.m4
31@@ -6,30 +6,37 @@ AC_DEFUN([ZFS_AC_LICENSE], [
32 AC_MSG_RESULT([$ZFS_META_LICENSE])
33 ])
34
35+AC_DEFUN([ZFS_AC_DEBUG_ENABLE], [
36+ KERNELCPPFLAGS="${KERNELCPPFLAGS} -DDEBUG -Werror"
37+ HOSTCFLAGS="${HOSTCFLAGS} -DDEBUG -Werror"
38+ DEBUG_CFLAGS="-DDEBUG -Werror"
39+ DEBUG_STACKFLAGS="-fstack-check"
40+ DEBUG_ZFS="_with_debug"
41+ AC_DEFINE(ZFS_DEBUG, 1, [zfs debugging enabled])
42+])
43+
44+AC_DEFUN([ZFS_AC_DEBUG_DISABLE], [
45+ KERNELCPPFLAGS="${KERNELCPPFLAGS} -DNDEBUG "
46+ HOSTCFLAGS="${HOSTCFLAGS} -DNDEBUG "
47+ DEBUG_CFLAGS="-DNDEBUG"
48+ DEBUG_STACKFLAGS=""
49+ DEBUG_ZFS="_without_debug"
50+])
51+
52 AC_DEFUN([ZFS_AC_DEBUG], [
53- AC_MSG_CHECKING([whether debugging is enabled])
54+ AC_MSG_CHECKING([whether assertion support will be enabled])
55 AC_ARG_ENABLE([debug],
56 [AS_HELP_STRING([--enable-debug],
57- [Enable generic debug support @<:@default=no@:>@])],
58+ [Enable assertion support @<:@default=no@:>@])],
59 [],
60 [enable_debug=no])
61
62- AS_IF([test "x$enable_debug" = xyes],
63- [
64- KERNELCPPFLAGS="${KERNELCPPFLAGS} -DDEBUG -Werror"
65- HOSTCFLAGS="${HOSTCFLAGS} -DDEBUG -Werror"
66- DEBUG_CFLAGS="-DDEBUG -Werror"
67- DEBUG_STACKFLAGS="-fstack-check"
68- DEBUG_ZFS="_with_debug"
69- AC_DEFINE(ZFS_DEBUG, 1, [zfs debugging enabled])
70- ],
71- [
72- KERNELCPPFLAGS="${KERNELCPPFLAGS} -DNDEBUG "
73- HOSTCFLAGS="${HOSTCFLAGS} -DNDEBUG "
74- DEBUG_CFLAGS="-DNDEBUG"
75- DEBUG_STACKFLAGS=""
76- DEBUG_ZFS="_without_debug"
77- ])
78+ AS_CASE(["x$enable_debug"],
79+ ["xyes"],
80+ [ZFS_AC_DEBUG_ENABLE],
81+ ["xno"],
82+ [ZFS_AC_DEBUG_DISABLE],
83+ [AC_MSG_ERROR([Unknown option $enable_debug])])
84
85 AC_SUBST(DEBUG_CFLAGS)
86 AC_SUBST(DEBUG_STACKFLAGS)
87--
882.14.2
89