Namhyung Kim | 02dfc8d | 2014-01-09 23:00:54 +0900 | [diff] [blame] | 1 | #ifndef _TOOLS_ASM_BUG_H |
| 2 | #define _TOOLS_ASM_BUG_H |
Arnaldo Carvalho de Melo | b32d133 | 2009-11-24 12:05:15 -0200 | [diff] [blame] | 3 | |
Namhyung Kim | 741a0c5 | 2014-01-09 23:00:55 +0900 | [diff] [blame] | 4 | #include <linux/compiler.h> |
| 5 | |
Arnaldo Carvalho de Melo | b32d133 | 2009-11-24 12:05:15 -0200 | [diff] [blame] | 6 | #define __WARN_printf(arg...) do { fprintf(stderr, arg); } while (0) |
| 7 | |
| 8 | #define WARN(condition, format...) ({ \ |
| 9 | int __ret_warn_on = !!(condition); \ |
| 10 | if (unlikely(__ret_warn_on)) \ |
| 11 | __WARN_printf(format); \ |
| 12 | unlikely(__ret_warn_on); \ |
| 13 | }) |
| 14 | |
| 15 | #define WARN_ONCE(condition, format...) ({ \ |
| 16 | static int __warned; \ |
| 17 | int __ret_warn_once = !!(condition); \ |
| 18 | \ |
| 19 | if (unlikely(__ret_warn_once)) \ |
| 20 | if (WARN(!__warned, format)) \ |
| 21 | __warned = 1; \ |
| 22 | unlikely(__ret_warn_once); \ |
| 23 | }) |
Namhyung Kim | 02dfc8d | 2014-01-09 23:00:54 +0900 | [diff] [blame] | 24 | |
| 25 | #endif /* _TOOLS_ASM_BUG_H */ |