From 995dc21f6bf37f76a75e2b77a64207f3d2d24156 Mon Sep 17 00:00:00 2001 From: Philippe Proulx Date: Fri, 19 May 2017 20:32:45 -0400 Subject: [PATCH] logging-internal.h: use __attribute__((format)) to check parameters MIME-Version: 1.0 Content-Type: text/plain; charset=utf8 Content-Transfer-Encoding: 8bit Signed-off-by: Philippe Proulx Signed-off-by: Jérémie Galarneau --- include/babeltrace/logging-internal.h | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/include/babeltrace/logging-internal.h b/include/babeltrace/logging-internal.h index 1480a082..ffcf1cdc 100644 --- a/include/babeltrace/logging-internal.h +++ b/include/babeltrace/logging-internal.h @@ -434,9 +434,13 @@ #endif #if defined(__printflike) - #define _BT_LOG_PRINTFLIKE(a, b) __printflike(a, b) + #define _BT_LOG_PRINTFLIKE(str_index, first_to_check) \ + __printflike(str_index, first_to_check) +#elif defined(__GNUC__) + #define _BT_LOG_PRINTFLIKE(str_index, first_to_check) \ + __attribute__((format(__printf__, str_index, first_to_check))) #else - #define _BT_LOG_PRINTFLIKE(a, b) + #define _BT_LOG_PRINTFLIKE(str_index, first_to_check) #endif #if (defined(_WIN32) || defined(_WIN64)) && !defined(__GNUC__) -- 2.34.1