btrfs-progs: Fix warning_trace compile error if backtrace is disabled
authorQu Wenruo <quwenruo@cn.fujitsu.com>
Thu, 6 Oct 2016 08:47:19 +0000 (16:47 +0800)
committerDavid Sterba <dsterba@suse.com>
Mon, 10 Oct 2016 07:46:42 +0000 (09:46 +0200)
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>
kerncompat.h

index ea04ef3..4a8f813 100644 (file)
@@ -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))