From dbb9d18decbe607767b4d5e201c0ff18cba6b818 Mon Sep 17 00:00:00 2001 From: Tomasz Kramkowski Date: Wed, 9 Sep 2020 20:44:05 +0100 Subject: attribute format on some appropriate functions --- trace.c | 1 + trace.h | 8 ++++++++ 2 files changed, 9 insertions(+) diff --git a/trace.c b/trace.c index 82c00f1..04dbae6 100644 --- a/trace.c +++ b/trace.c @@ -10,6 +10,7 @@ enum pack_trace pack_trace = PACK_TRACE_OFF; +ATTRIBUTE_FORMAT(printf, 2, 0) static void trace(enum pack_trace level, const char *fmt, va_list va) { char *type; diff --git a/trace.h b/trace.h index cef9927..8dee696 100644 --- a/trace.h +++ b/trace.h @@ -5,7 +5,15 @@ #ifndef PACK_TRACE_H #define PACK_TRACE_H +#ifdef DEVEL +#define ATTRIBUTE_FORMAT(type, fmt, args) __attribute__((format(type, fmt, args))) +#else +#define ATTRIBUTE_FORMAT(type, fmt, args) +#endif + +ATTRIBUTE_FORMAT(printf, 1, 2) void tr_call(const char *fmt, ...); +ATTRIBUTE_FORMAT(printf, 1, 2) void tr_debug(const char *fmt, ...); #endif // !PACK_TRACE_H -- cgit v1.2.3-54-g00ecf