2014-01-09 14:00:54 +00:00
|
|
|
#ifndef _TOOLS_ASM_BUG_H
|
|
|
|
#define _TOOLS_ASM_BUG_H
|
2009-11-24 14:05:15 +00:00
|
|
|
|
2014-01-09 14:00:55 +00:00
|
|
|
#include <linux/compiler.h>
|
|
|
|
|
2009-11-24 14:05:15 +00:00
|
|
|
#define __WARN_printf(arg...) do { fprintf(stderr, arg); } while (0)
|
|
|
|
|
|
|
|
#define WARN(condition, format...) ({ \
|
|
|
|
int __ret_warn_on = !!(condition); \
|
|
|
|
if (unlikely(__ret_warn_on)) \
|
|
|
|
__WARN_printf(format); \
|
|
|
|
unlikely(__ret_warn_on); \
|
|
|
|
})
|
|
|
|
|
2016-12-19 16:07:17 +00:00
|
|
|
#define WARN_ON(condition) ({ \
|
|
|
|
int __ret_warn_on = !!(condition); \
|
|
|
|
if (unlikely(__ret_warn_on)) \
|
|
|
|
__WARN_printf("assertion failed at %s:%d\n", \
|
|
|
|
__FILE__, __LINE__); \
|
|
|
|
unlikely(__ret_warn_on); \
|
|
|
|
})
|
|
|
|
|
2016-12-14 23:07:56 +00:00
|
|
|
#define WARN_ON_ONCE(condition) ({ \
|
|
|
|
static int __warned; \
|
|
|
|
int __ret_warn_once = !!(condition); \
|
|
|
|
\
|
|
|
|
if (unlikely(__ret_warn_once && !__warned)) { \
|
|
|
|
__warned = true; \
|
|
|
|
WARN_ON(1); \
|
|
|
|
} \
|
|
|
|
unlikely(__ret_warn_once); \
|
|
|
|
})
|
|
|
|
|
2009-11-24 14:05:15 +00:00
|
|
|
#define WARN_ONCE(condition, format...) ({ \
|
|
|
|
static int __warned; \
|
|
|
|
int __ret_warn_once = !!(condition); \
|
|
|
|
\
|
|
|
|
if (unlikely(__ret_warn_once)) \
|
|
|
|
if (WARN(!__warned, format)) \
|
|
|
|
__warned = 1; \
|
|
|
|
unlikely(__ret_warn_once); \
|
|
|
|
})
|
2014-01-09 14:00:54 +00:00
|
|
|
|
|
|
|
#endif /* _TOOLS_ASM_BUG_H */
|