1 #ifndef _ASM_GENERIC_BUG_H
2 #define _ASM_GENERIC_BUG_H
4 #include <linux/compiler.h>
7 extern const char *print_tainted(void);
12 #ifdef CONFIG_GENERIC_BUG
15 unsigned long bug_addr;
16 #ifdef CONFIG_DEBUG_BUGVERBOSE
22 #endif /* __ASSEMBLY__ */
24 #define BUGFLAG_WARNING (1<<0)
25 #endif /* CONFIG_GENERIC_BUG */
29 printk("BUG: failure at %s:%d/%s()! (%s)\n", __FILE__, __LINE__, __FUNCTION__, print_tainted()); \
34 #ifndef HAVE_ARCH_BUG_ON
35 #define BUG_ON(condition) do { if (unlikely((condition)!=0)) BUG(); } while(0)
38 #ifndef HAVE_ARCH_WARN_ON
39 #define WARN_ON(condition) ({ \
40 typeof(condition) __ret_warn_on = (condition); \
41 if (unlikely(__ret_warn_on)) { \
42 printk("BUG: warning at %s:%d/%s() (%s)\n", __FILE__, __LINE__, __FUNCTION__, print_tainted()); \
45 unlikely(__ret_warn_on); \
49 #else /* !CONFIG_BUG */
54 #ifndef HAVE_ARCH_BUG_ON
55 #define BUG_ON(condition) do { if (condition) ; } while(0)
58 #ifndef HAVE_ARCH_WARN_ON
59 #define WARN_ON(condition) ({ \
60 typeof(condition) __ret_warn_on = (condition); \
61 unlikely(__ret_warn_on); \
66 #define WARN_ON_ONCE(condition) ({ \
67 static int __warned; \
68 typeof(condition) __ret_warn_once = (condition); \
70 if (unlikely(__ret_warn_once)) \
71 if (WARN_ON(!__warned)) \
73 unlikely(__ret_warn_once); \
77 # define WARN_ON_SMP(x) WARN_ON(x)
79 # define WARN_ON_SMP(x) do { } while (0)