From 89b01cc02522d50843710242934daaab6687af97 Mon Sep 17 00:00:00 2001 From: Michel Zou Date: Sat, 21 Nov 2020 13:34:18 +0100 Subject: [PATCH] util: fix mingw format-extra-args warning Reviewed-by: Jose Fonseca Part-of: --- src/util/macros.h | 7 ++++++- src/util/u_debug.h | 6 +----- 2 files changed, 7 insertions(+), 6 deletions(-) diff --git a/src/util/macros.h b/src/util/macros.h index 98ce8bbf61d..6856e48cdfc 100644 --- a/src/util/macros.h +++ b/src/util/macros.h @@ -24,6 +24,7 @@ #ifndef UTIL_MACROS_H #define UTIL_MACROS_H +#include #include #include "c99_compat.h" @@ -126,7 +127,11 @@ do { \ #endif #ifdef HAVE_FUNC_ATTRIBUTE_FORMAT -#define PRINTFLIKE(f, a) __attribute__ ((format(__printf__, f, a))) +#if defined (__MINGW_PRINTF_FORMAT) +# define PRINTFLIKE(f, a) __attribute__ ((format(__MINGW_PRINTF_FORMAT, f, a))) +#else +# define PRINTFLIKE(f, a) __attribute__ ((format(__printf__, f, a))) +#endif #else #define PRINTFLIKE(f, a) #endif diff --git a/src/util/u_debug.h b/src/util/u_debug.h index fc06c582b0d..6318f39dd56 100644 --- a/src/util/u_debug.h +++ b/src/util/u_debug.h @@ -54,11 +54,7 @@ extern "C" { #endif -#if defined(__GNUC__) -#define _util_printf_format(fmt, list) __attribute__ ((format (printf, fmt, list))) -#else -#define _util_printf_format(fmt, list) -#endif +#define _util_printf_format(fmt, list) PRINTFLIKE(fmt, list) void _debug_vprintf(const char *format, va_list ap);