diff options
author | Eugene Syromiatnikov <esyr@redhat.com> | 2017-08-04 08:03:34 +0200 |
---|---|---|
committer | Dmitry V. Levin <ldv@altlinux.org> | 2017-12-13 00:35:31 +0000 |
commit | 41c5738fe63670106247135d8785c541c0a010ec (patch) | |
tree | 3d3404986bb0c0ea9991f6ae6a837e4450cea435 | |
parent | 859bc3444ca932c04c2715194beda6b0b6af55dc (diff) | |
download | strace-41c5738fe63670106247135d8785c541c0a010ec.tar.gz |
error_prints.h: add *_func_* printing macros
In order to reduce boilerplate for the cases when __func__ is desired
to be printed.
* error_prints.h (error_func_msg, perror_func_msg, debug_func_msg,
debug_func_perror_msg, error_func_msg_and_die, perror_func_msg_and_die):
New macro definitions.
-rw-r--r-- | error_prints.h | 14 |
1 files changed, 14 insertions, 0 deletions
diff --git a/error_prints.h b/error_prints.h index 19ecb8f78..99c803895 100644 --- a/error_prints.h +++ b/error_prints.h @@ -62,4 +62,18 @@ void error_msg_and_die(const char *fmt, ...) perror_msg(__VA_ARGS__); \ } while (0) +/* Simple wrappers for providing function name in error messages */ +#define error_func_msg(fmt_, ...) \ + error_msg("%s: " fmt_, __func__, ##__VA_ARGS__) +#define perror_func_msg(fmt_, ...) \ + perror_msg("%s: " fmt_, __func__, ##__VA_ARGS__) +#define debug_func_msg(fmt_, ...) \ + debug_msg("%s: " fmt_, __func__, ##__VA_ARGS__) +#define debug_func_perror_msg(fmt_, ...) \ + debug_perror_msg("%s: " fmt_, __func__, ##__VA_ARGS__) +#define error_func_msg_and_die(fmt_, ...) \ + error_msg_and_die("%s: " fmt_, __func__, ##__VA_ARGS__) +#define perror_func_msg_and_die(fmt_, ...) \ + perror_msg_and_die("%s: " fmt_, __func__, ##__VA_ARGS__) + #endif /* !STRACE_ERROR_PRINTS_H */ |