summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorHASUMI Hitoshi <hasumikin@gmail.com>2024-03-19 10:01:48 +0900
committergit <svn-admin@ruby-lang.org>2024-03-19 01:30:38 +0000
commitce544f8dbddf3a41bea28b15b6432b0e3fd516f3 (patch)
tree0bac5eb5eca3b65c9320763d35c33fb1314c44c6
parent6c1e8029d0e8598d075e478ac557091495bc9ffa (diff)
[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
-rw-r--r--prism/defines.h6
1 files changed, 5 insertions, 1 deletions
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