summaryrefslogtreecommitdiff
path: root/print_time.c
diff options
context:
space:
mode:
authorDmitry V. Levin <ldv@altlinux.org>2016-05-21 22:53:06 +0000
committerDmitry V. Levin <ldv@altlinux.org>2016-05-21 22:53:06 +0000
commita8fce09e344a644aa0279f0efe54e4faeb64ca29 (patch)
tree54d542dc34bb18022ac484dd187bdaab370182a6 /print_time.c
parent4bf7ab7005b0fb53d8894c70ebdb6c1cfa075330 (diff)
downloadstrace-a8fce09e344a644aa0279f0efe54e4faeb64ca29.tar.gz
mpers: add support of conditionally compiled printers
We used to declare and define all printers marked with MPERS_PRINTER_DECL, including ifdef'ed ones. That approach left us no way to conditionally compile mpersified printers, which was not a problem until btrfs ioctls appeared on the horizon. With this change, those mpersified printers that are not going to be compiled are also won't be declared and won't be added to struct_printers. This is implemented by filtering all source files containing MPERS_PRINTER_DECL markers through CPP. As a nice side effect, this also lifts an ugly requirement of writing all MPERS_PRINTER_DECL declarations in a single line. * README-mpers: Update description of MPERS_PRINTER_DECL syntax. * defs.h [IN_MPERS_BOOTSTRAP] (MPERS_PRINTER_DECL): Turn into a recursive variadic macro. [!IN_MPERS_BOOTSTRAP] (MPERS_PRINTER_DECL): Turn into a variadic macro. All callers changed. * Makefile.am (mpers_preproc_files, mpers_printer_decl_pattern): New variables. (CLEANFILES): Add $(mpers_preproc_files). (%.c.mpers.i): New rule. (printers.h, %_printer_decls.h, %_printer_defs.h): Use mpers_preproc_files instead of srcdir_mpers_source_files, use mpers_printer_decl_pattern. * .gitignore: Add /*.mpers.i.
Diffstat (limited to 'print_time.c')
-rw-r--r--print_time.c24
1 files changed, 16 insertions, 8 deletions
diff --git a/print_time.c b/print_time.c
index dddb3f16a..500ce8e5b 100644
--- a/print_time.c
+++ b/print_time.c
@@ -73,7 +73,8 @@ print_timeval_t(const timeval_t *t)
tprintf(time_fmt, (intmax_t) t->tv_sec, (intmax_t) t->tv_usec);
}
-MPERS_PRINTER_DECL(void, print_timespec)(struct tcb *tcp, const long addr)
+MPERS_PRINTER_DECL(void, print_timespec,
+ struct tcb *tcp, const long addr)
{
timespec_t t;
@@ -83,7 +84,8 @@ MPERS_PRINTER_DECL(void, print_timespec)(struct tcb *tcp, const long addr)
print_timespec_t(&t);
}
-MPERS_PRINTER_DECL(const char *, sprint_timespec)(struct tcb *tcp, const long addr)
+MPERS_PRINTER_DECL(const char *, sprint_timespec,
+ struct tcb *tcp, const long addr)
{
timespec_t t;
static char buf[sizeof(time_fmt) + 3 * sizeof(t)];
@@ -101,7 +103,8 @@ MPERS_PRINTER_DECL(const char *, sprint_timespec)(struct tcb *tcp, const long ad
return buf;
}
-MPERS_PRINTER_DECL(void, print_timespec_utime_pair)(struct tcb *tcp, const long addr)
+MPERS_PRINTER_DECL(void, print_timespec_utime_pair,
+ struct tcb *tcp, const long addr)
{
timespec_t t[2];
@@ -115,7 +118,8 @@ MPERS_PRINTER_DECL(void, print_timespec_utime_pair)(struct tcb *tcp, const long
tprints("]");
}
-MPERS_PRINTER_DECL(void, print_itimerspec)(struct tcb *tcp, const long addr)
+MPERS_PRINTER_DECL(void, print_itimerspec,
+ struct tcb *tcp, const long addr)
{
timespec_t t[2];
@@ -129,7 +133,8 @@ MPERS_PRINTER_DECL(void, print_itimerspec)(struct tcb *tcp, const long addr)
tprints("}");
}
-MPERS_PRINTER_DECL(void, print_timeval)(struct tcb *tcp, const long addr)
+MPERS_PRINTER_DECL(void, print_timeval,
+ struct tcb *tcp, const long addr)
{
timeval_t t;
@@ -139,7 +144,8 @@ MPERS_PRINTER_DECL(void, print_timeval)(struct tcb *tcp, const long addr)
print_timeval_t(&t);
}
-MPERS_PRINTER_DECL(void, print_timeval_pair)(struct tcb *tcp, const long addr)
+MPERS_PRINTER_DECL(void, print_timeval_pair,
+ struct tcb *tcp, const long addr)
{
timeval_t t[2];
@@ -153,7 +159,8 @@ MPERS_PRINTER_DECL(void, print_timeval_pair)(struct tcb *tcp, const long addr)
tprints("]");
}
-MPERS_PRINTER_DECL(const char *, sprint_timeval)(struct tcb *tcp, const long addr)
+MPERS_PRINTER_DECL(const char *, sprint_timeval,
+ struct tcb *tcp, const long addr)
{
timeval_t t;
static char buf[sizeof(time_fmt) + 3 * sizeof(t)];
@@ -171,7 +178,8 @@ MPERS_PRINTER_DECL(const char *, sprint_timeval)(struct tcb *tcp, const long add
return buf;
}
-MPERS_PRINTER_DECL(void, print_itimerval)(struct tcb *tcp, const long addr)
+MPERS_PRINTER_DECL(void, print_itimerval,
+ struct tcb *tcp, const long addr)
{
timeval_t t[2];