diff options
author | Masami Hiramatsu <mhiramat@redhat.com> | 2009-10-16 20:08:18 -0400 |
---|---|---|
committer | Ingo Molnar <mingo@elte.hu> | 2009-10-17 09:54:01 +0200 |
commit | 9769833b8e4425dc93fc837bf124c6cb02a51abb (patch) | |
tree | 3e5d2a12e8df8528e50f35c4f122d56b4f59b2cd /tools/perf/util/util.h | |
parent | 89c69c0eee7515cdc217f4278de43547284b3458 (diff) | |
download | op-kernel-dev-9769833b8e4425dc93fc837bf124c6cb02a51abb.zip op-kernel-dev-9769833b8e4425dc93fc837bf124c6cb02a51abb.tar.gz |
perf: Add DIE_IF() macro for error checking
Add DIE_IF() macro and replace ERR_IF() with it, and use
linux/stringify.h.
Signed-off-by: Masami Hiramatsu <mhiramat@redhat.com>
Cc: Frederic Weisbecker <fweisbec@gmail.com>
Cc: Arnaldo Carvalho de Melo <acme@redhat.com>
Cc: Steven Rostedt <rostedt@goodmis.org>
Cc: Paul Mackerras <paulus@samba.org>
Cc: Peter Zijlstra <a.p.zijlstra@chello.nl>
LKML-Reference: <20091017000818.16556.82452.stgit@dhcp-100-2-132.bos.redhat.com>
Signed-off-by: Ingo Molnar <mingo@elte.hu>
Diffstat (limited to 'tools/perf/util/util.h')
-rw-r--r-- | tools/perf/util/util.h | 9 |
1 files changed, 9 insertions, 0 deletions
diff --git a/tools/perf/util/util.h b/tools/perf/util/util.h index 9de2329..0daa341 100644 --- a/tools/perf/util/util.h +++ b/tools/perf/util/util.h @@ -134,6 +134,15 @@ extern void die(const char *err, ...) NORETURN __attribute__((format (printf, 1, extern int error(const char *err, ...) __attribute__((format (printf, 1, 2))); extern void warning(const char *err, ...) __attribute__((format (printf, 1, 2))); +#include "../../../include/linux/stringify.h" + +#define DIE_IF(cnd) \ + do { if (cnd) \ + die(" at (" __FILE__ ":" __stringify(__LINE__) "): " \ + __stringify(cnd) "\n"); \ + } while (0) + + extern void set_die_routine(void (*routine)(const char *err, va_list params) NORETURN); extern int prefixcmp(const char *str, const char *prefix); |