* ext/dl/callback/mkcallback.rb (gencallback): suppress unused

variables.


git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@34305 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
This commit is contained in:
nobu 2012-01-14 13:24:12 +00:00
Родитель 45fd88877f
Коммит 67bf09903f
2 изменённых файлов: 14 добавлений и 5 удалений

Просмотреть файл

@ -1,3 +1,8 @@
Sat Jan 14 22:24:09 2012 Nobuyoshi Nakada <nobu@ruby-lang.org>
* ext/dl/callback/mkcallback.rb (gencallback): suppress unused
variables.
Sat Jan 14 21:56:43 2012 Nobuyoshi Nakada <nobu@ruby-lang.org>
* iseq.c (iseq_data_to_ary): check line info table boundary. line

Просмотреть файл

@ -121,20 +121,24 @@ def foreach_proc_entry
end
def gencallback(ty, calltype, proc_entry, argc, n)
<<-EOS
dltype = DLTYPE[ty]
ret = dltype[:conv]
src = <<-EOS
#{calltype == STDCALL ? "\n#ifdef FUNC_STDCALL" : ""}
static #{DLTYPE[ty][:type]}
static #{dltype[:type]}
FUNC_#{calltype.upcase}(#{func_name(ty,argc,n,calltype)})(#{(0...argc).collect{|i| "DLSTACK_TYPE stack#{i}"}.join(", ")})
{
VALUE ret, cb#{argc > 0 ? ", args[#{argc}]" : ""};
VALUE #{ret ? "ret, " : ""}cb#{argc > 0 ? ", args[#{argc}]" : ""};
#{
(0...argc).collect{|i|
"\n args[#{i}] = PTR2NUM(stack#{i});"
}.join("")
}
cb = rb_ary_entry(rb_ary_entry(#{proc_entry}, #{ty}), #{(n * DLSTACK_SIZE) + argc});
ret = rb_funcall2(cb, rb_dl_cb_call, #{argc}, #{argc > 0 ? 'args' : 'NULL'});
return #{DLTYPE[ty][:conv] ? DLTYPE[ty][:conv] % "ret" : ""};
#{ret ? "ret = " : ""}rb_funcall2(cb, rb_dl_cb_call, #{argc}, #{argc > 0 ? 'args' : 'NULL'});
EOS
src << " return #{ret % "ret"};\n" if ret
src << <<-EOS
}
#{calltype == STDCALL ? "#endif\n" : ""}
EOS