summaryrefslogtreecommitdiffstats
path: root/kernel/tools/include/asm/bug.h
blob: 9e5f4846967fcf6e098c039c61b455f1a9326b64 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
#ifndef _TOOLS_ASM_BUG_H
#define _TOOLS_ASM_BUG_H

#include <linux/compiler.h>

#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);		\
})

#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);		\
})

#endif /* _TOOLS_ASM_BUG_H */