Project

General

Profile

Actions

Bug #5679

closed

Too many arguments for format warnings on mingw32 build

Added by phasis68 (Heesob Park) about 13 years ago. Updated about 12 years ago.

Status:
Closed
Target version:
ruby -v:
-
Backport:
[ruby-core:41351]

Description

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

Actions

Also available in: Atom PDF

Like0
Like0Like0Like0Like0Like0