C API changed in Ruby 2.2:

rb_num2long now returns a long instead of SIGNED_VALUE and
rb_num2ulong returns an unsigned long instead of VALUE.

As a consequence Vim fails to compile (tried to build a version with dynamic 
Ruby; MinGW x64 under Windows) with the following errors:

if_ruby.c:399:14: error: conflicting types for 'rb_num2long_stub'
 SIGNED_VALUE rb_num2long_stub(VALUE x)
              ^
if_ruby.c:87:22: note: previous declaration of 'rb_num2long_stub' was here
 # define rb_num2long rb_num2long_stub
                      ^
c:/Ruby22/include/ruby-2.2.0/ruby/ruby.h:608:6: note: in expansion of macro 
'rb_num2long'
 long rb_num2long(VALUE);
      ^
if_ruby.c:424:7: error: conflicting types for 'rb_num2ulong'
 VALUE rb_num2ulong(VALUE x)
       ^
In file included from c:/Ruby22/include/ruby-2.2.0/ruby.h:33:0,
                 from if_ruby.c:109:
c:/Ruby22/include/ruby-2.2.0/ruby/ruby.h:609:15: note: previous declaration of 
'rb_num2ulong' was here
 unsigned long rb_num2ulong(VALUE);
               ^


Here's the patch I used as a workaround:

diff -r 9ae4737fc48f src/if_ruby.c
--- a/src/if_ruby.c     Fri Apr 03 17:59:43 2015 +0200
+++ b/src/if_ruby.c     Sun Apr 05 07:03:40 2015 +0200
@@ -396,7 +396,11 @@
 # endif

 # if defined(RUBY19_OR_LATER) && !defined(PROTO)
+#  if defined(DYNAMIC_RUBY_VER) && DYNAMIC_RUBY_VER >= 22
+long rb_num2long_stub(VALUE x)
+#  else
 SIGNED_VALUE rb_num2long_stub(VALUE x)
+#  endif
 {
     return dll_rb_num2long(x);
 }
@@ -421,7 +425,11 @@
 {
     return dll_rb_float_new(d);
 }
+#   if defined(DYNAMIC_RUBY_VER) && DYNAMIC_RUBY_VER >= 22
+unsigned long rb_num2ulong(VALUE x)
+#   else
 VALUE rb_num2ulong(VALUE x)
+#   endif
 {
     return (long)RSHIFT((SIGNED_VALUE)(x),1);
 }

-- 
-- 
You received this message from the "vim_dev" maillist.
Do not top-post! Type your reply below the text you are replying to.
For more information, visit http://www.vim.org/maillist.php

--- 
You received this message because you are subscribed to the Google Groups 
"vim_dev" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to [email protected].
For more options, visit https://groups.google.com/d/optout.

Raspunde prin e-mail lui