Fedora kernel-2.6.17-1.2142_FC4 patched with stable patch-2.6.17.4-vs2.0.2-rc26.diff
[linux-2.6.git] / include / asm-generic / bug.h
1 #ifndef _ASM_GENERIC_BUG_H
2 #define _ASM_GENERIC_BUG_H
3
4 #include <linux/compiler.h>
5 #include <linux/config.h>
6
7 #ifndef __ASSEMBLY__
8 extern const char *print_tainted(void);
9 #endif
10
11 #ifdef CONFIG_BUG
12 #ifndef HAVE_ARCH_BUG
13 #define BUG() do { \
14         printk("BUG: failure at %s:%d/%s()! (%s)\n", __FILE__, __LINE__, __FUNCTION__, print_tainted()); \
15         panic("BUG!"); \
16 } while (0)
17 #endif
18
19 #ifndef HAVE_ARCH_BUG_ON
20 #define BUG_ON(condition) do { if (unlikely((condition)!=0)) BUG(); } while(0)
21 #endif
22
23 #ifndef HAVE_ARCH_WARN_ON
24 #define WARN_ON(condition) do { \
25         if (unlikely((condition)!=0)) { \
26                 printk("BUG: warning at %s:%d/%s() (%s)\n", __FILE__, __LINE__, __FUNCTION__, print_tainted()); \
27                 dump_stack(); \
28         } \
29 } while (0)
30 #endif
31
32 #else /* !CONFIG_BUG */
33 #ifndef HAVE_ARCH_BUG
34 #define BUG()
35 #endif
36
37 #ifndef HAVE_ARCH_BUG_ON
38 #define BUG_ON(condition) do { if (condition) ; } while(0)
39 #endif
40
41 #ifndef HAVE_ARCH_WARN_ON
42 #define WARN_ON(condition) do { if (condition) ; } while(0)
43 #endif
44 #endif
45
46 #endif