tools include: Move perf's bug.h to a generic place
So that it can be shared with others like libtraceevent. Signed-off-by: Namhyung Kim <namhyung@kernel.org> Cc: Frederic Weisbecker <fweisbec@gmail.com> Cc: Ingo Molnar <mingo@kernel.org> Cc: Jiri Olsa <jolsa@redhat.com> Cc: Namhyung Kim <namhyung.kim@lge.com> Cc: Steven Rostedt <rostedt@goodmis.org> Link: http://lkml.kernel.org/r/1389276059-8829-4-git-send-email-namhyung@kernel.org [ Added the new header to tools/perf/MANIFEST ] Signed-off-by: Arnaldo Carvalho de Melo <acme@redhat.com>
This commit is contained in:

committed by
Arnaldo Carvalho de Melo

parent
835d44b904
commit
02dfc8d775
23
tools/include/asm/bug.h
Normal file
23
tools/include/asm/bug.h
Normal file
@@ -0,0 +1,23 @@
|
||||
#ifndef _TOOLS_ASM_BUG_H
|
||||
#define _TOOLS_ASM_BUG_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 */
|
Reference in New Issue
Block a user