blob: 9e5f4846967fcf6e098c039c61b455f1a9326b64 [file] [log] [blame]
Namhyung Kim02dfc8d2014-01-09 23:00:54 +09001#ifndef _TOOLS_ASM_BUG_H
2#define _TOOLS_ASM_BUG_H
Arnaldo Carvalho de Melob32d1332009-11-24 12:05:15 -02003
Namhyung Kim741a0c52014-01-09 23:00:55 +09004#include <linux/compiler.h>
5
Arnaldo Carvalho de Melob32d1332009-11-24 12:05:15 -02006#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 Kim02dfc8d2014-01-09 23:00:54 +090024
25#endif /* _TOOLS_ASM_BUG_H */