]> git.proxmox.com Git - zfsonlinux.git/blob - zfs-patches/0004-Make-enable-debug-fail-when-given-bogus-args.patch
d751a53dd8db02884895a2fc6ef56bb9ce394219
[zfsonlinux.git] / zfs-patches / 0004-Make-enable-debug-fail-when-given-bogus-args.patch
1 From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
2 From: Richard Yao <richard.yao@clusterhq.com>
3 Date: Tue, 23 Sep 2014 13:31:33 -0400
4 Subject: [PATCH] Make --enable-debug fail when given bogus args
5 MIME-Version: 1.0
6 Content-Type: text/plain; charset=UTF-8
7 Content-Transfer-Encoding: 8bit
8
9 Currently, bogus options to --enable-debug become --disable-debug. That
10 means that passing --enable-debug=true is analogous to --disable-debug,
11 but the result is counterintuitive. We switch to AS_CASE to allow us to
12 fail when given a bogus option.
13
14 Also, we modify the text printed to clarify that --enable-debug enables
15 assertions.
16
17 Reviewed-by: Chunwei Chen <tuxoko@gmail.com>
18 Reviewed-by: Brian Behlendorf <behlendorf1@llnl.gov>
19 Signed-off-by: Richard Yao <richard.yao@clusterhq.com>
20 Closes #2734
21 (cherry picked from commit 0f1ff38476ba255eb1f066f675c8721168ff2295)
22 Signed-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
27 diff --git a/config/zfs-build.m4 b/config/zfs-build.m4
28 index 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 --
88 2.14.2
89