aboutsummaryrefslogtreecommitdiffstats
path: root/xen/include/xen/lib.h
diff options
context:
space:
mode:
authorkfraser@localhost.localdomain <kfraser@localhost.localdomain>2007-02-21 14:40:37 +0000
committerkfraser@localhost.localdomain <kfraser@localhost.localdomain>2007-02-21 14:40:37 +0000
commita7eb758852ae403380f8d31da0df540c77979320 (patch)
treeef56033ee951856cca6c4a98d6076ab0061ee893 /xen/include/xen/lib.h
parent180211a7532d1a7b2f71dc8a6267bedcef86a3c8 (diff)
downloadxen-a7eb758852ae403380f8d31da0df540c77979320.tar.gz
xen-a7eb758852ae403380f8d31da0df540c77979320.tar.bz2
xen-a7eb758852ae403380f8d31da0df540c77979320.zip
x86: Better BUG() and ASSERT() logging.
Signed-off-by: Keir Fraser <keir@xensource.com>
Diffstat (limited to 'xen/include/xen/lib.h')
-rw-r--r--xen/include/xen/lib.h22
1 files changed, 12 insertions, 10 deletions
diff --git a/xen/include/xen/lib.h b/xen/include/xen/lib.h
index ded2cfbb38..f5f59441f1 100644
--- a/xen/include/xen/lib.h
+++ b/xen/include/xen/lib.h
@@ -16,18 +16,20 @@ void __bug(char *file, int line) __attribute__((noreturn));
/* Force a compilation error if condition is true */
#define BUILD_BUG_ON(condition) ((void)sizeof(char[1 - 2 * !!(condition)]))
+#ifndef assert_failed
+#define assert_failed(p) \
+do { \
+ printk("Assertion '%s' failed, line %d, file %s\n", #p , \
+ __LINE__, __FILE__); \
+ BUG(); \
+} while (0)
+#endif
+
#ifndef NDEBUG
-#define ASSERT(_p) \
- do { \
- if ( unlikely(!(_p)) ) \
- { \
- printk("Assertion '%s' failed, line %d, file %s\n", #_p , \
- __LINE__, __FILE__); \
- BUG(); \
- } \
- } while ( 0 )
+#define ASSERT(p) \
+ do { if ( unlikely(!(p)) ) assert_failed(p); } while (0)
#else
-#define ASSERT(_p) ((void)0)
+#define ASSERT(p) ((void)0)
#endif
#define SWAP(_a, _b) \