[前][次][番号順一覧][スレッド一覧]

ruby-changes:22256

From: nobu <ko1@a...>
Date: Sat, 14 Jan 2012 22:24:37 +0900 (JST)
Subject: [ruby-changes:22256] nobu:r34305 (trunk): * ext/dl/callback/mkcallback.rb (gencallback): suppress unused

nobu	2012-01-14 22:24:12 +0900 (Sat, 14 Jan 2012)

  New Revision: 34305

  http://svn.ruby-lang.org/cgi-bin/viewvc.cgi?view=rev&revision=34305

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

  Modified files:
    trunk/ChangeLog
    trunk/ext/dl/callback/mkcallback.rb

Index: ChangeLog
===================================================================
--- ChangeLog	(revision 34304)
+++ ChangeLog	(revision 34305)
@@ -1,3 +1,8 @@
+Sat Jan 14 22:24:09 2012  Nobuyoshi Nakada  <nobu@r...>
+
+	* ext/dl/callback/mkcallback.rb (gencallback): suppress unused
+	  variables.
+
 Sat Jan 14 21:56:43 2012  Nobuyoshi Nakada  <nobu@r...>
 
 	* iseq.c (iseq_data_to_ary): check line info table boundary.  line
Index: ext/dl/callback/mkcallback.rb
===================================================================
--- ext/dl/callback/mkcallback.rb	(revision 34304)
+++ ext/dl/callback/mkcallback.rb	(revision 34305)
@@ -121,20 +121,24 @@
 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

--
ML: ruby-changes@q...
Info: http://www.atdot.net/~ko1/quickml/

[前][次][番号順一覧][スレッド一覧]