loader/asm_offset: Add __USE_MINGW_ANSI_STDIO
authorChristopher Degawa <ccom@randomderp.com>
Mon, 2 Oct 2023 04:37:04 +0000 (23:37 -0500)
committerCharles Giessen <46324611+charles-lunarg@users.noreply.github.com>
Wed, 4 Oct 2023 17:34:16 +0000 (11:34 -0600)
This fixes warnings generated when compiling with mingw-w64 regarding
printf format specifiers that are not available with base msvcrt.

Signed-off-by: Christopher Degawa <ccom@randomderp.com>
loader/asm_offset.c

index a4b49332bd3522233a0f788a0f8ec6d54725ebd6..f99ff56a0453d2c7d14fc80dc205e20f2063fe71 100644 (file)
 
 // This code generates an assembly file which provides offsets to get struct members from assembly code.
 
+// __USE_MINGW_ANSI_STDIO is needed to use the %zu format specifier with mingw-w64.
+// Otherwise the compiler will complain about an unknown format specifier.
+#if defined(__MINGW32__) && !defined(__USE_MINGW_ANSI_STDIO)
+#define __USE_MINGW_ANSI_STDIO 1
+#endif
+
 #include <stdio.h>
 #include "loader_common.h"
 #include "log.h"