1 #ifndef __TOOLS_LINUX_BUG_H
2 #define __TOOLS_LINUX_BUG_H
5 #include <linux/compiler.h>
7 #define BUILD_BUG_ON_NOT_POWER_OF_2(n) \
8 BUILD_BUG_ON((n) == 0 || (((n) & ((n) - 1)) != 0))
9 #define BUILD_BUG_ON_ZERO(e) (sizeof(struct { int:-!!(e); }))
10 #define BUILD_BUG_ON_NULL(e) ((void *)sizeof(struct { int:-!!(e); }))
12 #define BUILD_BUG_ON(condition) ((void)sizeof(char[1 - 2*!!(condition)]))
14 #define BUG() do { assert(0); unreachable(); } while (0)
15 #define BUG_ON(cond) assert(!(cond))
17 #define WARN_ON_ONCE(cond) assert(!(cond))
18 #define WARN_ONCE(cond, msg) assert(!(cond))
20 #define __WARN() assert(0)
21 #define __WARN_printf(arg...) assert(0)
22 #define WARN(cond, ...) assert(!(cond))
24 #define WARN_ON(condition) ({ \
25 int __ret_warn_on = !!(condition); \
26 if (unlikely(__ret_warn_on)) \
28 unlikely(__ret_warn_on); \
31 #endif /* __TOOLS_LINUX_BUG_H */