From ce544f8dbddf3a41bea28b15b6432b0e3fd516f3 Mon Sep 17 00:00:00 2001 From: HASUMI Hitoshi Date: Tue, 19 Mar 2024 10:01:48 +0900 Subject: [PATCH] [ruby/prism] [Compatibility] Improve printf format For better compatibility, this patch suggests using __MINGW_PRINTF_FORMAT that GCC provides for MINGW environment. https://github.com/ruby/prism/commit/a3a792b64f --- prism/defines.h | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/prism/defines.h b/prism/defines.h index 00411a0eb6..aca3c6dc08 100644 --- a/prism/defines.h +++ b/prism/defines.h @@ -49,7 +49,11 @@ * compiler-agnostic way. */ #if defined(__GNUC__) -# define PRISM_ATTRIBUTE_FORMAT(string_index, argument_index) __attribute__((format(printf, string_index, argument_index))) +# if defined(__MINGW_PRINTF_FORMAT) +# define PRISM_ATTRIBUTE_FORMAT(string_index, argument_index) __attribute__((format(__MINGW_PRINTF_FORMAT, string_index, argument_index))) +# else +# define PRISM_ATTRIBUTE_FORMAT(string_index, argument_index) __attribute__((format(printf, string_index, argument_index))) +# endif #elif defined(__clang__) # define PRISM_ATTRIBUTE_FORMAT(string_index, argument_index) __attribute__((__format__(__printf__, string_index, argument_index))) #else