summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorQu Wenruo <quwenruo@cn.fujitsu.com>2016-10-06 16:47:19 +0800
committerDavid Sterba <dsterba@suse.com>2016-10-10 09:46:42 +0200
commitbb5bcb8a4a2792eb9aa4683be58da1a030786198 (patch)
tree4e7645cecd86d137dbc54181b24a53d9908cb945
parent01ddfdbbcbb353815a912ceef560bd146d90fe5e (diff)
btrfs-progs: Fix warning_trace compile error if backtrace is disabled
If we disable backtrace, btrfs-progs can't be compiled since we don't have warning_trace defined. Fix by move it out of #ifndef BTRFS_DISABLE_BACKTRACE block. Signed-off-by: Qu Wenruo <quwenruo@cn.fujitsu.com> [ move warning_trace to the right place ] Signed-off-by: David Sterba <dsterba@suse.com>
-rw-r--r--kerncompat.h11
1 files changed, 7 insertions, 4 deletions
diff --git a/kerncompat.h b/kerncompat.h
index ea04ef3a..4a8f8135 100644
--- a/kerncompat.h
+++ b/kerncompat.h
@@ -99,6 +99,11 @@ static inline void assert_trace(const char *assertion, const char *filename,
exit(1);
}
+#define BUG() assert_trace(NULL, __FILE__, __func__, __LINE__, 0)
+#else
+#define BUG() assert(0)
+#endif
+
static inline void warning_trace(const char *assertion, const char *filename,
const char *func, unsigned line, int val,
int trace)
@@ -113,14 +118,12 @@ static inline void warning_trace(const char *assertion, const char *filename,
fprintf(stderr,
"%s:%d: %s: Warning: assertion failed, value %d.\n",
filename, line, func, val);
+#ifndef BTRFS_DISABLE_BACKTRACE
if (trace)
print_trace();
+#endif
}
-#define BUG() assert_trace(NULL, __FILE__, __func__, __LINE__, 0)
-#else
-#define BUG() assert(0)
-#endif
#ifdef __CHECKER__
#define __force __attribute__((force))