mirror of
https://github.com/torvalds/linux.git
synced 2026-10-07 22:37:45 -04:00
Since it uses unlikely() macro inside WARN() Signed-off-by: Namhyung Kim <[email protected]> Cc: Frederic Weisbecker <[email protected]> Cc: Ingo Molnar <[email protected]> Cc: Jiri Olsa <[email protected]> Cc: Namhyung Kim <[email protected]> Cc: Steven Rostedt <[email protected]> Link: http://lkml.kernel.org/r/[email protected] Signed-off-by: Arnaldo Carvalho de Melo <[email protected]>
26 lines
596 B
C
26 lines
596 B
C
#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 */
|