diff options
author | Masami Hiramatsu <mhiramat@redhat.com> | 2009-10-16 20:08:18 -0400 |
---|---|---|
committer | Ingo Molnar <mingo@elte.hu> | 2009-10-17 03:54:01 -0400 |
commit | 9769833b8e4425dc93fc837bf124c6cb02a51abb (patch) | |
tree | 3e5d2a12e8df8528e50f35c4f122d56b4f59b2cd /tools/perf/util/util.h | |
parent | 89c69c0eee7515cdc217f4278de43547284b3458 (diff) |
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 9de2329dd44d..0daa341734f9 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, | |||
134 | extern int error(const char *err, ...) __attribute__((format (printf, 1, 2))); | 134 | extern int error(const char *err, ...) __attribute__((format (printf, 1, 2))); |
135 | extern void warning(const char *err, ...) __attribute__((format (printf, 1, 2))); | 135 | extern void warning(const char *err, ...) __attribute__((format (printf, 1, 2))); |
136 | 136 | ||
137 | #include "../../../include/linux/stringify.h" | ||
138 | |||
139 | #define DIE_IF(cnd) \ | ||
140 | do { if (cnd) \ | ||
141 | die(" at (" __FILE__ ":" __stringify(__LINE__) "): " \ | ||
142 | __stringify(cnd) "\n"); \ | ||
143 | } while (0) | ||
144 | |||
145 | |||
137 | extern void set_die_routine(void (*routine)(const char *err, va_list params) NORETURN); | 146 | extern void set_die_routine(void (*routine)(const char *err, va_list params) NORETURN); |
138 | 147 | ||
139 | extern int prefixcmp(const char *str, const char *prefix); | 148 | extern int prefixcmp(const char *str, const char *prefix); |