aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authornobu <nobu@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2018-09-03 08:20:41 +0000
committernobu <nobu@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2018-09-03 08:20:41 +0000
commit2082e7ab0cc6bd6ea94e5716983f8d4283485827 (patch)
treef9af139ddb057dbeb190614779602347b12d0ca4
parentc7ec09d1235a347376d7d0566e882395839cf431 (diff)
downloadruby-2082e7ab0cc6bd6ea94e5716983f8d4283485827.tar.gz
Declare as gnu_printf on mingw
[Bug #13496] From: MSP-Greg <MSP-Greg@users.noreply.github.com> git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@64620 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
-rw-r--r--include/ruby/defines.h5
-rw-r--r--tool/m4/ruby_check_printf_prefix.m45
2 files changed, 10 insertions, 0 deletions
diff --git a/include/ruby/defines.h b/include/ruby/defines.h
index 5774870e76..f5fd5bfcef 100644
--- a/include/ruby/defines.h
+++ b/include/ruby/defines.h
@@ -90,8 +90,13 @@ extern "C" {
#endif /* __GNUC__ >= 3 */
#ifdef __GNUC__
+#ifdef __MINGW32__
+#define PRINTF_ARGS(decl, string_index, first_to_check) \
+ decl __attribute__((format(gnu_printf, string_index, first_to_check)))
+#else
#define PRINTF_ARGS(decl, string_index, first_to_check) \
decl __attribute__((format(printf, string_index, first_to_check)))
+#endif
#else
#define PRINTF_ARGS(decl, string_index, first_to_check) decl
#endif
diff --git a/tool/m4/ruby_check_printf_prefix.m4 b/tool/m4/ruby_check_printf_prefix.m4
index 449afef6a7..eab5dbeac6 100644
--- a/tool/m4/ruby_check_printf_prefix.m4
+++ b/tool/m4/ruby_check_printf_prefix.m4
@@ -8,8 +8,13 @@ AC_CACHE_CHECK([for printf prefix for $1], [rb_cv_pri_prefix_]AS_TR_SH($1),[
[@%:@include <stdio.h>
@%:@include <stddef.h>
@%:@ifdef __GNUC__
+ @%:@ifdef __MINGW32__
+ @%:@define PRINTF_ARGS(decl, string_index, first_to_check) \
+ decl __attribute__((format(gnu_printf, string_index, first_to_check)))
+ @%:@else
@%:@define PRINTF_ARGS(decl, string_index, first_to_check) \
decl __attribute__((format(printf, string_index, first_to_check)))
+ @%:@endif
@%:@else
@%:@define PRINTF_ARGS(decl, string_index, first_to_check) decl
@%:@endif