fix MinGW format attribute

Setting -D__USE_MINGW_ANSI_STDIO=1 is wrong and should not be used. MinGW
internally uses a macro to select between gnu_printf and printf. Just use
that instead of using a wrong format under clang backends.

Signed-off-by: Rosen Penev <rosenp@gmail.com>
Signed-off-by: David Gibson <david@gibson.dropbear.id.au>
This commit is contained in:
Rosen Penev 2024-03-04 16:55:23 -08:00 committed by David Gibson
parent 24f60011fd
commit 5e6cefa17e
2 changed files with 3 additions and 8 deletions

4
util.h
View file

@ -13,7 +13,9 @@
*/
#ifdef __GNUC__
#if __GNUC__ >= 5 || (__GNUC__ == 4 && __GNUC_MINOR__ >= 4)
#ifdef __MINGW_PRINTF_FORMAT
#define PRINTF(i, j) __attribute__((format (__MINGW_PRINTF_FORMAT, i, j)))
#elif __GNUC__ >= 5 || (__GNUC__ == 4 && __GNUC_MINOR__ >= 4)
#define PRINTF(i, j) __attribute__((format (gnu_printf, i, j)))
#else
#define PRINTF(i, j) __attribute__((format (printf, i, j)))