@@ -86,28 +86,10 @@ static inline void print_trace(void)
size = backtrace(array, MAX_BACKTRACE);
backtrace_symbols_fd(array, size, 2);
}
-
-static inline void assert_trace(const char *assertion, const char *filename,
- const char *func, unsigned line, long val)
-{
- if (!val)
- return;
- if (assertion)
- fprintf(stderr, "%s:%d: %s: Assertion `%s` failed, value %ld\n",
- filename, line, func, assertion, val);
- else
- fprintf(stderr, "%s:%d: %s: Assertion failed, value %ld.\n",
- filename, line, func, val);
- print_trace();
- abort();
- exit(1);
-}
-
#endif
static inline void warning_trace(const char *assertion, const char *filename,
- const char *func, unsigned line, long val,
- int trace)
+ const char *func, unsigned line, long val)
{
if (!val)
return;
@@ -120,8 +102,7 @@ static inline void warning_trace(const char *assertion, const char *filename,
"%s:%d: %s: Warning: assertion failed, value %ld.\n",
filename, line, func, val);
#ifndef BTRFS_DISABLE_BACKTRACE
- if (trace)
- print_trace();
+ print_trace();
#endif
}
@@ -296,13 +277,23 @@ static inline long IS_ERR(const void *ptr)
#define vfree(x) free(x)
#ifndef BTRFS_DISABLE_BACKTRACE
+static inline void assert_trace(const char *assertion, const char *filename,
+ const char *func, unsigned line, long val)
+{
+ if (!val)
+ return;
+ warning_trace(assertion, filename, func, line, val);
+ abort();
+ exit(1);
+}
+
#define BUG_ON(c) assert_trace(#c, __FILE__, __func__, __LINE__, (long)(c))
-#define WARN_ON(c) warning_trace(#c, __FILE__, __func__, __LINE__, (long)(c), 1)
+#define WARN_ON(c) warning_trace(#c, __FILE__, __func__, __LINE__, (long)(c))
#define ASSERT(c) assert_trace(#c, __FILE__, __func__, __LINE__, (long)!(c))
#define BUG() assert_trace(NULL, __FILE__, __func__, __LINE__, 1)
#else
#define BUG_ON(c) assert(!(c))
-#define WARN_ON(c) warning_trace(#c, __FILE__, __func__, __LINE__, (long)(c), 0)
+#define WARN_ON(c) warning_trace(#c, __FILE__, __func__, __LINE__, (long)(c))
#define ASSERT(c) assert(!(c))
#define BUG() assert(0)
#endif