Re: -mm -> 2.6.13 merge status

Pekka J Enberg
2005-06-27T07:51:22Z

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@cs.helsinki.fi>
---

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