diff options
Diffstat (limited to 'tools/include')
| -rw-r--r-- | tools/include/asm/bug.h | 23 |
1 files changed, 23 insertions, 0 deletions
diff --git a/tools/include/asm/bug.h b/tools/include/asm/bug.h new file mode 100644 index 000000000000..eca78df7b8f2 --- /dev/null +++ b/tools/include/asm/bug.h | |||
| @@ -0,0 +1,23 @@ | |||
| 1 | #ifndef _TOOLS_ASM_BUG_H | ||
| 2 | #define _TOOLS_ASM_BUG_H | ||
| 3 | |||
| 4 | #define __WARN_printf(arg...) do { fprintf(stderr, arg); } while (0) | ||
| 5 | |||
| 6 | #define WARN(condition, format...) ({ \ | ||
| 7 | int __ret_warn_on = !!(condition); \ | ||
| 8 | if (unlikely(__ret_warn_on)) \ | ||
| 9 | __WARN_printf(format); \ | ||
| 10 | unlikely(__ret_warn_on); \ | ||
| 11 | }) | ||
| 12 | |||
| 13 | #define WARN_ONCE(condition, format...) ({ \ | ||
| 14 | static int __warned; \ | ||
| 15 | int __ret_warn_once = !!(condition); \ | ||
| 16 | \ | ||
| 17 | if (unlikely(__ret_warn_once)) \ | ||
| 18 | if (WARN(!__warned, format)) \ | ||
| 19 | __warned = 1; \ | ||
| 20 | unlikely(__ret_warn_once); \ | ||
| 21 | }) | ||
| 22 | |||
| 23 | #endif /* _TOOLS_ASM_BUG_H */ | ||
