Subject:
[ruby-ffi] ruby-ffi and ruby -w
From:
John Mettraux
Date:
9/22/09 12:17 AM
To:
ruby-ffi@googlegroups.com


Hi,

I've written code leveraging ruby-ffi and lately people have been
complaining about running it with ruby -w. I cleaned my code but I'm
left with things like :

---8<---
#!/usr/bin/env ruby -w

require 'rubygems'
require 'ffi'

module Lib
  extend FFI::Library
  attach_function :strlen, [ :string ], :int
end
--->8---
(http://gist.github.com/190829)

On SnoLeo (ruby-ffi 0.5.0),

Ruby 1.8.7p72 says :
---
/Library/Ruby/Gems/1.8/gems/ffi-0.5.0/lib/ffi/variadic.rb:10: warning:
method redefined; discarding old call
---

Ruby 1.9.1p243 says :
---
/Users/jmettraux/.rvm/gems/ruby/1.9.1/gems/ffi-0.5.0/lib/ffi_c.bundle:
warning: method redefined; discarding old inspect
/Users/jmettraux/.rvm/gems/ruby/1.9.1/gems/ffi-0.5.0/lib/ffi/variadic.rb:10:
warning: method redefined; discarding old call
/Users/jmettraux/.rvm/gems/ruby/1.9.1/gems/ffi-0.5.0/lib/ffi/library.rb:93:
warning: method redefined; discarding old strlen
---

On arch-linux (ruby-ffi 0.4.0),

Ruby 1.8.7p174 says :
---
/usr/lib/ruby/gems/1.8/gems/ffi-0.4.0/lib/ffi/struct.rb:26: warning:
method redefined; discarding old offset
/usr/lib/ruby/gems/1.8/gems/ffi-0.4.0/lib/ffi/variadic.rb:15: warning:
method redefined; discarding old call
---

Ruby 1.9.1p243 says :
---
/home/jmettraux/.rvm/gems/ruby/1.9.1/gems/ffi-0.4.0/lib/ffi_c.so:
warning: method redefined; discarding old inspect
/home/jmettraux/.rvm/gems/ruby/1.9.1/gems/ffi-0.4.0/lib/ffi/struct.rb:26:
warning: method redefined; discarding old offset
/home/jmettraux/.rvm/gems/ruby/1.9.1/gems/ffi-0.4.0/lib/ffi/variadic.rb:15:
warning: method redefined; discarding old call
/home/jmettraux/.rvm/gems/ruby/1.9.1/gems/ffi-0.4.0/lib/ffi/library.rb:78:
warning: method redefined; discarding old strlen
---

Is there a way to minimize that warning output ? There is one warning
output per method attached.


Best regards,

-- John Mettraux - http://jmettraux.wordpress.com