1 #ifndef _ASM_GENERIC_BUG_H
2 #define _ASM_GENERIC_BUG_H
4 #include <linux/compiler.h>
9 printk("BUG: failure at %s:%d/%s()!\n", __FILE__, __LINE__, __FUNCTION__); \
14 #ifndef HAVE_ARCH_BUG_ON
15 #define BUG_ON(condition) do { if (unlikely((condition)!=0)) BUG(); } while(0)
18 #ifndef HAVE_ARCH_WARN_ON
19 #define WARN_ON(condition) ({ \
20 typeof(condition) __ret_warn_on = (condition); \
21 if (unlikely(__ret_warn_on)) { \
22 printk("BUG: warning at %s:%d/%s()\n", __FILE__, \
23 __LINE__, __FUNCTION__); \
26 unlikely(__ret_warn_on); \
30 #else /* !CONFIG_BUG */
35 #ifndef HAVE_ARCH_BUG_ON
36 #define BUG_ON(condition) do { if (condition) ; } while(0)
39 #ifndef HAVE_ARCH_WARN_ON
40 #define WARN_ON(condition) ({ \
41 typeof(condition) __ret_warn_on = (condition); \
42 unlikely(__ret_warn_on); \
47 #define WARN_ON_ONCE(condition) ({ \
48 static int __warned; \
49 typeof(condition) __ret_warn_once = (condition); \
51 if (unlikely(__ret_warn_once)) \
52 if (WARN_ON(!__warned)) \
54 unlikely(__ret_warn_once); \
58 # define WARN_ON_SMP(x) WARN_ON(x)
60 # define WARN_ON_SMP(x) do { } while (0)