diff options
author | ichizok <gclient.gaap@gmail.com> | 2021-12-28 15:51:45 +0000 |
---|---|---|
committer | Bram Moolenaar <Bram@vim.org> | 2021-12-28 15:51:45 +0000 |
commit | 8bb3fe4d4dcd27c02e903f6772fdc8fe2e9eba70 (patch) | |
tree | 8580fd12601cf226570353cd10d9f2ab2e24abc5 /src/if_ruby.c | |
parent | d9da86e94ea8dbaa056270a666892945c40a6674 (diff) |
patch 8.2.3922: cannot build with dynamic Ruby 3.1v8.2.3922
Problem: Cannot build with dynamic Ruby 3.1.
Solution: Add "_EXTRA" variables for CI. Add missing functions. (Ozaki
Kiichi, closes #9420)
Diffstat (limited to 'src/if_ruby.c')
-rw-r--r-- | src/if_ruby.c | 57 |
1 files changed, 47 insertions, 10 deletions
diff --git a/src/if_ruby.c b/src/if_ruby.c index 0d7eaf2e89..07c817dcec 100644 --- a/src/if_ruby.c +++ b/src/if_ruby.c @@ -73,35 +73,40 @@ # if RUBY_VERSION >= 19 // Ruby 1.9 defines a number of static functions which use rb_num2long and // rb_int2big -# define rb_num2long rb_num2long_stub -# define rb_int2big rb_int2big_stub +# define rb_num2long rb_num2long_stub +# define rb_int2big rb_int2big_stub # if RUBY_VERSION >= 30 || VIM_SIZEOF_INT < VIM_SIZEOF_LONG // Ruby 1.9 defines a number of static functions which use rb_fix2int and // rb_num2int if VIM_SIZEOF_INT < VIM_SIZEOF_LONG (64bit) -# define rb_fix2int rb_fix2int_stub -# define rb_num2int rb_num2int_stub +# define rb_fix2int rb_fix2int_stub +# define rb_num2int rb_num2int_stub # endif # endif # if RUBY_VERSION == 21 // Ruby 2.1 adds new GC called RGenGC and RARRAY_PTR uses // rb_gc_writebarrier_unprotect_promoted if USE_RGENGC -# define rb_gc_writebarrier_unprotect_promoted rb_gc_writebarrier_unprotect_promoted_stub +# define rb_gc_writebarrier_unprotect_promoted rb_gc_writebarrier_unprotect_promoted_stub # endif # if RUBY_VERSION >= 22 -# define rb_gc_writebarrier_unprotect rb_gc_writebarrier_unprotect_stub +# define rb_gc_writebarrier_unprotect rb_gc_writebarrier_unprotect_stub # endif # if RUBY_VERSION >= 26 -# define rb_ary_detransient rb_ary_detransient_stub +# define rb_ary_detransient rb_ary_detransient_stub # endif # if RUBY_VERSION >= 30 -# define rb_check_type rb_check_type_stub -# define rb_num2uint rb_num2uint_stub -# define ruby_malloc_size_overflow ruby_malloc_size_overflow_stub +# define rb_check_type rb_check_type_stub +# define rb_num2uint rb_num2uint_stub +# define ruby_malloc_size_overflow ruby_malloc_size_overflow_stub +# endif + +# if RUBY_VERSION >= 31 +# define rb_debug_rstring_null_ptr rb_debug_rstring_null_ptr_stub +# define rb_unexpected_type rb_unexpected_type_stub # endif #endif // ifdef DYNAMIC_RUBY @@ -173,6 +178,14 @@ # undef HAVE_DUP #endif +// Avoid redefining TRUE/FALSE in vterm.h. +#ifdef TRUE +# undef TRUE +#endif +#ifdef FALSE +# undef FALSE +#endif + #include "vim.h" #include "version.h" @@ -411,6 +424,9 @@ static VALUE (*dll_rb_data_typed_object_alloc) (VALUE, void*, const rb_data_type # else static VALUE (*dll_rb_data_object_alloc) (VALUE, void*, RUBY_DATA_FUNC, RUBY_DATA_FUNC); # endif +# if RUBY_VERSION >= 31 +static void (*dll_rb_debug_rstring_null_ptr) (const char*); +# endif static VALUE (*dll_rb_define_class_under) (VALUE, const char*, VALUE); static void (*dll_rb_define_const) (VALUE,const char*,VALUE); static void (*dll_rb_define_global_function) (const char*,VALUE(*)(),int); @@ -485,6 +501,9 @@ static void (*dll_NtInitialize) (int*, char***); static int (*dll_rb_w32_snprintf)(char*, size_t, const char*, ...); # endif # endif +# if RUBY_VERSION >= 31 +static void (*dll_rb_unexpected_type) (VALUE, int) ATTRIBUTE_NORETURN; +# endif # if RUBY_VERSION >= 18 static char * (*dll_rb_string_value_ptr) (volatile VALUE*); static VALUE (*dll_rb_float_new) (double); @@ -629,6 +648,18 @@ ruby_malloc_size_overflow_stub(size_t x, size_t y) dll_ruby_malloc_size_overflow(x, y); } # endif +# if RUBY_VERSION >= 31 + void +rb_debug_rstring_null_ptr_stub(const char *func) +{ + dll_rb_debug_rstring_null_ptr(func); +} + void +rb_unexpected_type_stub(VALUE self, int t) +{ + dll_rb_unexpected_type(self, t); +} +# endif # endif // ifndef PROTO static HINSTANCE hinstRuby = NULL; // Instance of ruby.dll @@ -672,6 +703,9 @@ static struct # else {"rb_data_object_alloc", (RUBY_PROC*)&dll_rb_data_object_alloc}, # endif +# if RUBY_VERSION >= 31 + {"rb_debug_rstring_null_ptr", (RUBY_PROC*)&dll_rb_debug_rstring_null_ptr}, +# endif {"rb_define_class_under", (RUBY_PROC*)&dll_rb_define_class_under}, {"rb_define_const", (RUBY_PROC*)&dll_rb_define_const}, {"rb_define_global_function", (RUBY_PROC*)&dll_rb_define_global_function}, @@ -745,6 +779,9 @@ static struct {"rb_w32_snprintf", (RUBY_PROC*)&dll_rb_w32_snprintf}, # endif # endif +# if RUBY_VERSION >= 31 + {"rb_unexpected_type", (RUBY_PROC*)&dll_rb_unexpected_type}, +# endif # if RUBY_VERSION >= 18 {"rb_string_value_ptr", (RUBY_PROC*)&dll_rb_string_value_ptr}, # if RUBY_VERSION <= 19 |