From fb264f560b49cbd74662ed09c18a6598b317135f Mon Sep 17 00:00:00 2001 From: Eyal Rozenberg <eyalroz1@gmx.com> Date: Thu, 2 Jun 2022 23:41:20 +0300 Subject: [PATCH] Fixes #129: Using the `gnu_printf` attribute when the compiler supports it, otherwise the `printf` attribute. Fix due to karlsboeckda <david.karlsboeck@at.trumpf.com>. --- src/printf/printf.h | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/src/printf/printf.h b/src/printf/printf.h index 39d9e893..b85f24d4 100644 --- a/src/printf/printf.h +++ b/src/printf/printf.h @@ -49,8 +49,13 @@ extern "C" { #endif #ifdef __GNUC__ +# if ((__GNUC__ == 4 && __GNUC_MINOR__>= 4) || __GNUC__ > 4) +# define ATTR_PRINTF(one_based_format_index, first_arg) \ +__attribute__((format(gnu_printf, (one_based_format_index), (first_arg)))) +# else # define ATTR_PRINTF(one_based_format_index, first_arg) \ -__attribute__((format(__printf__, (one_based_format_index), (first_arg)))) +__attribute__((format(printf, (one_based_format_index), (first_arg)))) +# endif # define ATTR_VPRINTF(one_based_format_index) ATTR_PRINTF((one_based_format_index), 0) #else # define ATTR_PRINTF(one_based_format_index, first_arg)