aboutsummaryrefslogtreecommitdiffstats
path: root/fs/xfs/support/debug.h
diff options
context:
space:
mode:
authorChristoph Hellwig <hch@infradead.org>2007-08-16 01:38:08 -0400
committerTim Shimmin <tes@chook.melbourne.sgi.com>2007-09-05 00:49:30 -0400
commitee5c80239d5f152d99f69165afbd115518353563 (patch)
tree2ea198960e12fe010b18ce9b52645c7865ec1082 /fs/xfs/support/debug.h
parent34521c5e4971d01f6ef650fdee59e07be6c2c5e3 (diff)
[XFS] fix ASSERT and ASSERT_ALWAYS
- remove the != 0 inside the unlikely in ASSERT_ALWAYS because sparse now complains about comparisons between pointers and 0 - add a standalone ASSERT implementation because defining it to ASSERT_ALWAYS means the string is expanded before the token passing stringification. This way we get the actual content of the assertion in the assfail message and don't overflow sparse's stringification buffer leading to sparse error messages. SGI-PV: 968555 SGI-Modid: xfs-linux-melb:xfs-kern:29310a Signed-off-by: Christoph Hellwig <hch@infradead.org> Signed-off-by: David Chinner <dgc@sgi.com> Signed-off-by: Tim Shimmin <tes@sgi.com>
Diffstat (limited to 'fs/xfs/support/debug.h')
-rw-r--r--fs/xfs/support/debug.h10
1 files changed, 6 insertions, 4 deletions
diff --git a/fs/xfs/support/debug.h b/fs/xfs/support/debug.h
index a27a7c8c0526..855da0408647 100644
--- a/fs/xfs/support/debug.h
+++ b/fs/xfs/support/debug.h
@@ -34,10 +34,10 @@ extern void cmn_err(int, char *, ...)
34extern void assfail(char *expr, char *f, int l); 34extern void assfail(char *expr, char *f, int l);
35 35
36#define ASSERT_ALWAYS(expr) \ 36#define ASSERT_ALWAYS(expr) \
37 (unlikely((expr) != 0) ? (void)0 : assfail(#expr, __FILE__, __LINE__)) 37 (unlikely(expr) ? (void)0 : assfail(#expr, __FILE__, __LINE__))
38 38
39#ifndef DEBUG 39#ifndef DEBUG
40# define ASSERT(expr) ((void)0) 40#define ASSERT(expr) ((void)0)
41 41
42#ifndef STATIC 42#ifndef STATIC
43# define STATIC static noinline 43# define STATIC static noinline
@@ -49,8 +49,10 @@ extern void assfail(char *expr, char *f, int l);
49 49
50#else /* DEBUG */ 50#else /* DEBUG */
51 51
52# define ASSERT(expr) ASSERT_ALWAYS(expr) 52#include <linux/random.h>
53# include <linux/random.h> 53
54#define ASSERT(expr) \
55 (unlikely(expr) ? (void)0 : assfail(#expr, __FILE__, __LINE__))
54 56
55#ifndef STATIC 57#ifndef STATIC
56# define STATIC noinline 58# define STATIC noinline