Commit 9769833b authored by Masami Hiramatsu's avatar Masami Hiramatsu Committed by Ingo Molnar

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: default avatarMasami 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: default avatarIngo Molnar <mingo@elte.hu>
parent 89c69c0e
...@@ -321,6 +321,7 @@ LIB_FILE=libperf.a ...@@ -321,6 +321,7 @@ LIB_FILE=libperf.a
LIB_H += ../../include/linux/perf_event.h LIB_H += ../../include/linux/perf_event.h
LIB_H += ../../include/linux/rbtree.h LIB_H += ../../include/linux/rbtree.h
LIB_H += ../../include/linux/list.h LIB_H += ../../include/linux/list.h
LIB_H += ../../include/linux/stringify.h
LIB_H += util/include/linux/list.h LIB_H += util/include/linux/list.h
LIB_H += perf.h LIB_H += perf.h
LIB_H += util/types.h LIB_H += util/types.h
......
This diff is collapsed.
#ifndef _PROBE_FINDER_H #ifndef _PROBE_FINDER_H
#define _PROBE_FINDER_H #define _PROBE_FINDER_H
#define _stringify(n) #n
#define stringify(n) _stringify(n)
#define ERR_IF(cnd) \
do { if (cnd) { \
fprintf(stderr, "Error (" __FILE__ ":" stringify(__LINE__) \
"): " stringify(cnd) "\n"); \
exit(1); \
} } while (0)
#define MAX_PATH_LEN 256 #define MAX_PATH_LEN 256
#define MAX_PROBE_BUFFER 1024 #define MAX_PROBE_BUFFER 1024
#define MAX_PROBES 128 #define MAX_PROBES 128
......
...@@ -134,6 +134,15 @@ extern void die(const char *err, ...) NORETURN __attribute__((format (printf, 1, ...@@ -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 int error(const char *err, ...) __attribute__((format (printf, 1, 2)));
extern void warning(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 void set_die_routine(void (*routine)(const char *err, va_list params) NORETURN);
extern int prefixcmp(const char *str, const char *prefix); extern int prefixcmp(const char *str, const char *prefix);
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment