From: "Steven Rostedt (VMware)" <rostedt@xxxxxxxxxxx> Add the gcc printf format attribute to die(), __die() and warning() such that any mistake in the formats of the output will be caught by the compiler. Link: https://lore.kernel.org/linux-trace-devel/20210422165148.6d0ea90e@xxxxxxxxxxxxxxxxxx/ Signed-off-by: Steven Rostedt (VMware) <rostedt@xxxxxxxxxxx> --- tracecmd/include/trace-local.h | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/tracecmd/include/trace-local.h b/tracecmd/include/trace-local.h index 4235ae21..eadf103e 100644 --- a/tracecmd/include/trace-local.h +++ b/tracecmd/include/trace-local.h @@ -27,6 +27,9 @@ typedef unsigned long long u64; struct buffer_instance; +#define __printf(a, b) __attribute__((format(printf,a,b))) + +__printf(1,2) void warning(const char *fmt, ...); /* for local shared information with trace-cmd executable */ @@ -331,8 +334,10 @@ int trace_open_vsock(unsigned int cid, unsigned int port); char *trace_get_guest_file(const char *file, const char *guest); /* No longer in event-utils.h */ +__printf(1,2) void __noreturn die(const char *fmt, ...); /* Can be overriden */ void *malloc_or_die(unsigned int size); /* Can be overridden */ +__printf(1,2) void __noreturn __die(const char *fmt, ...); void __noreturn _vdie(const char *fmt, va_list ap); -- 2.29.2