Re: -mm -> 2.6.13 merge status

From: Pekka J Enberg
Date: Mon Jun 27 2005 - 02:53:30 EST


On Mon, 2005-06-27 at 09:28 +0200, Andi Kleen wrote:
> You can just dump the expression (with #argument). That is what
> traditional userspace assert did forever.
>
> It won't help for BUG_ON(a || b || c || d || e) but these
> are bad style anyways and should be avoided.

Sounds good to me. Jens, would this work for you?

Pekka

Show BUG_ON expression when assertion fails.

Signed-off-by: Pekka Enberg <penberg@xxxxxxxxxxxxxx>
---

bug.h | 7 ++++++-
1 files changed, 6 insertions(+), 1 deletion(-)

Index: 2.6/include/asm-generic/bug.h
===================================================================
--- 2.6.orig/include/asm-generic/bug.h
+++ 2.6/include/asm-generic/bug.h
@@ -13,7 +13,12 @@
#endif

#ifndef HAVE_ARCH_BUG_ON
-#define BUG_ON(condition) do { if (unlikely((condition)!=0)) BUG(); } while(0)
+#define BUG_ON(condition) do { \
+ if (unlikely((condition) != 0)) { \
+ printk("kernel BUG '%s' at %s:%d!\n", #condition, __FILE__, __LINE__); \
+ panic("BUG!"); \
+ } \
+} while(0)
#endif

#ifndef HAVE_ARCH_WARN_ON

-
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/