[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
This commit is contained in:
HASUMI Hitoshi 2024-03-19 10:01:48 +09:00 committed by git
parent 6c1e8029d0
commit ce544f8dbd

View File

@ -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