Issue #5679 has been reported by Heesob Park.

----------------------------------------
Bug #5679: Too many arguments for format warnings on mingw32 build
http://redmine.ruby-lang.org/issues/5679

Author: Heesob Park
Status: Open
Priority: Normal
Assignee: 
Category: 
Target version: 
ruby -v: ruby 2.0.0dev (2011-11-27) [i386-mingw32]


I can see the following warnings during mingw32 build.

gc.c: In function 'gc_profile_result':
gc.c:3581:4: warning: unknown conversion type character 'z' in format
gc.c:3581:4: warning: unknown conversion type character 'z' in format
gc.c:3581:4: warning: unknown conversion type character 'z' in format
gc.c:3581:4: warning: format '%30.20f' expects type 'double', but argument 5 has type 'unsigned int'
gc.c:3581:4: warning: too many arguments for format

transcode.c: In function 'str_transcode0':
transcode.c:2734:9: warning: unknown conversion type character 't' in format
transcode.c:2734:9: warning: too many arguments for format

iseq.c: In function 'insn_operand_intern':
iseq.c:826:50: warning: unknown conversion type character 't' in format
iseq.c:826:50: warning: too many arguments for format
iseq.c: In function 'rb_iseq_disasm_insn':
iseq.c:860:2: warning: unknown conversion type character 'z' in format
iseq.c:860:2: warning: format '%-16s' expects type 'char *', but argument 3 has type 'size_t'
iseq.c:860:2: warning: too many arguments for format
iseq.c:864:7: warning: unknown conversion type character 'z' in format
iseq.c:864:7: warning: format '%-16.*s' expects type 'char *', but argument 4 has type 'int'
iseq.c:864:7: warning: too many arguments for format

In file included from vm_exec.c:106:0,
                 from vm.c:25:
insns.def: In function 'vm_exec_core':
insns.def:1087:6: warning: unknown conversion type character 't' in format
insns.def:1087:6: warning: unknown conversion type character 't' in format
insns.def:1087:6: warning: too many arguments for format


rubyext.c: In function 'rb_syck_err_handler':
rubyext.c:687:12: warning: unknown conversion type character 't' in format
rubyext.c:687:12: warning: format '%s' expects type 'char *', but argument 5 has type 'int'
rubyext.c:687:12: warning: too many arguments for format


And I know these warnings are completely meaningless because Ruby uses it's own BSD_vfprintf implementaion.

Here is a patch of include/ruby/ruby.h for suppressing format warnings on mingw32

--- ruby.h      2011-11-28 14:21:11.000000000 +0900
+++ ruby.h.new  2011-11-28 14:23:01.000000000 +0900
@@ -37,7 +37,7 @@
 # define NOINLINE(x) x
 #endif

-#ifdef __GNUC__
+#if defined(__GNUC__) && !defined(__MINGW32__)
 #define PRINTF_ARGS(decl, string_index, first_to_check) \
   decl __attribute__((format(printf, string_index, first_to_check)))
 #else



-- 
http://redmine.ruby-lang.org