[PATCH 0/1] MR18: include: Use __MINGW_PRINTF_FORMAT when compiling with MinGW.
The default for MinGW is always ms_printf rather than gnu_printf, but if we are using ucrtbase or ANSI stdio, we want gnu_printf. -- https://gitlab.winehq.org/wine/vkd3d/-/merge_requests/18
From: Zebediah Figura <zfigura(a)codeweavers.com> The default for MinGW is always ms_printf rather than gnu_printf, but if we are using ucrtbase or ANSI stdio, we want gnu_printf. --- include/private/vkd3d_common.h | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/include/private/vkd3d_common.h b/include/private/vkd3d_common.h index c041b52d..349b1acf 100644 --- a/include/private/vkd3d_common.h +++ b/include/private/vkd3d_common.h @@ -54,7 +54,11 @@ static inline size_t align(size_t addr, size_t alignment) #ifdef __GNUC__ # define VKD3D_NORETURN __attribute__((noreturn)) -# define VKD3D_PRINTF_FUNC(fmt, args) __attribute__((format(printf, fmt, args))) +# if defined(__MINGW32__) +# define VKD3D_PRINTF_FUNC(fmt, args) __attribute__((format(__MINGW_PRINTF_FORMAT, fmt, args))) +# else +# define VKD3D_PRINTF_FUNC(fmt, args) __attribute__((format(printf, fmt, args))) +# endif # define VKD3D_UNUSED __attribute__((unused)) #else # define VKD3D_NORETURN -- GitLab https://gitlab.winehq.org/wine/vkd3d/-/merge_requests/18
```diff +# if defined(__MINGW32__) +# define VKD3D_PRINTF_FUNC(fmt, args) __attribute__((format(__MINGW_PRINTF_FORMAT, fmt, args))) +# else +# define VKD3D_PRINTF_FUNC(fmt, args) __attribute__((format(printf, fmt, args))) +# endif ```
Should we just check whether \_\_MINGW_PRINTF_FORMAT is defined instead of \_\_MINGW32\_\_? -- https://gitlab.winehq.org/wine/vkd3d/-/merge_requests/18#note_9366
On 9/27/22 05:28, Henri Verbeet (@hverbeet) wrote:
```diff +# if defined(__MINGW32__) +# define VKD3D_PRINTF_FUNC(fmt, args) __attribute__((format(__MINGW_PRINTF_FORMAT, fmt, args))) +# else +# define VKD3D_PRINTF_FUNC(fmt, args) __attribute__((format(printf, fmt, args))) +# endif ```
Should we just check whether \_\_MINGW_PRINTF_FORMAT is defined instead of \_\_MINGW32\_\_?
I don't think it makes a difference, but sure, that works too.
participants (4)
-
Henri Verbeet (@hverbeet) -
Zebediah Figura -
Zebediah Figura -
Zebediah Figura (@zfigura)