Mercurial > vim
changeset 26788:fccd67ae58c8 v8.2.3922
patch 8.2.3922: cannot build with dynamic Ruby 3.1
Commit: https://github.com/vim/vim/commit/8bb3fe4d4dcd27c02e903f6772fdc8fe2e9eba70
Author: ichizok <gclient.gaap@gmail.com>
Date: Tue Dec 28 15:51:45 2021 +0000
patch 8.2.3922: cannot build with dynamic Ruby 3.1
Problem: Cannot build with dynamic Ruby 3.1.
Solution: Add "_EXTRA" variables for CI. Add missing functions. (Ozaki
Kiichi, closes #9420)
author | Bram Moolenaar <Bram@vim.org> |
---|---|
date | Tue, 28 Dec 2021 17:00:04 +0100 |
parents | cd8dfdcab93c |
children | 236fb5192776 |
files | ci/config.mk.clang-12.sed ci/config.mk.clang.sed ci/config.mk.sed src/Makefile src/auto/configure src/config.mk.in src/configure.ac src/if_ruby.c src/version.c src/vim.h |
diffstat | 10 files changed, 98 insertions(+), 31 deletions(-) [+] |
line wrap: on
line diff
--- a/ci/config.mk.clang-12.sed +++ b/ci/config.mk.clang-12.sed @@ -1,3 +1,3 @@ # Clang 12 (or Apple clang 13) and later makes a warning '-Wcompound-token-split-by-macro' enable by default. -/^PERL_CFLAGS[[:blank:]]*=/s/$/ -Wno-error=compound-token-split-by-macro/ -/^RUBY_CFLAGS[[:blank:]]*=/s/$/ -Wno-error=compound-token-split-by-macro/ +/^PERL_CFLAGS_EXTRA[[:blank:]]*=/s/$/ -Wno-error=compound-token-split-by-macro/ +/^RUBY_CFLAGS_EXTRA[[:blank:]]*=/s/$/ -Wno-error=compound-token-split-by-macro/
--- a/ci/config.mk.clang.sed +++ b/ci/config.mk.clang.sed @@ -1,2 +1,2 @@ /^CFLAGS[[:blank:]]*=/s/$/ -Wno-error=missing-field-initializers/ -/^RUBY_CFLAGS[[:blank:]]*=/s/$/ -Wno-error=unknown-attributes -Wno-error=ignored-attributes/ +/^RUBY_CFLAGS_EXTRA[[:blank:]]*=/s/$/ -Wno-error=unknown-attributes -Wno-error=ignored-attributes/
--- a/ci/config.mk.sed +++ b/ci/config.mk.sed @@ -1,2 +1,3 @@ /^CFLAGS[[:blank:]]*=/s/$/ -Wall -Wextra -Wshadow -Werror/ -/^PERL_CFLAGS[[:blank:]]*=/s/$/ -Wno-error=unused-function/ +/^PERL_CFLAGS_EXTRA[[:blank:]]*=/s/$/ -Wno-error=unused-function/ +/^RUBY_CFLAGS_EXTRA[[:blank:]]*=/s/$/ -Wno-error=unused-parameter/
--- a/src/Makefile +++ b/src/Makefile @@ -1491,13 +1491,14 @@ POST_DEFS = $(X_CFLAGS) $(MZSCHEME_CFLAG ALL_CFLAGS = $(PRE_DEFS) $(CFLAGS) $(PROFILE_CFLAGS) $(SANITIZER_CFLAGS) $(LEAK_CFLAGS) $(ABORT_CFLAGS) $(POST_DEFS) +ALL_IF_CFLAGS = $(LUA_CFLAGS) $(PERL_CFLAGS) $(PYTHON_CFLAGS) $(PYTHON3_CFLAGS) $(RUBY_CFLAGS) $(TCL_CFLAGS) +ALL_IF_CFLAGS_EXTRA = $(LUA_CFLAGS_EXTRA) $(PERL_CFLAGS_EXTRA) $(PYTHON_CFLAGS_EXTRA) $(PYTHON3_CFLAGS_EXTRA) $(RUBY_CFLAGS_EXTRA) $(TCL_CFLAGS_EXTRA) + # Exclude $CFLAGS for osdef.sh, for Mac 10.4 some flags don't work together # with "-E". OSDEF_CFLAGS = $(PRE_DEFS) $(POST_DEFS) -LINT_CFLAGS = -DLINT -I. $(PRE_DEFS) $(POST_DEFS) \ - $(RUBY_CFLAGS) $(LUA_CFLAGS) $(PERL_CFLAGS) $(PYTHON_CFLAGS) \ - $(PYTHON3_CFLAGS) $(TCL_CFLAGS) $(VTERM_CFLAGS) \ +LINT_CFLAGS = -DLINT -I. $(PRE_DEFS) $(POST_DEFS) $(ALL_IF_CFLAGS) $(VTERM_CFLAGS) \ -Dinline= -D__extension__= -Dalloca=alloca LINT_EXTRA = -D"__attribute__(x)=" @@ -3357,7 +3358,7 @@ objects/if_xcmdsrv.o: if_xcmdsrv.c $(CCC) -o $@ if_xcmdsrv.c objects/if_lua.o: if_lua.c - $(CCC_NF) $(LUA_CFLAGS) $(ALL_CFLAGS) -o $@ if_lua.c + $(CCC_NF) $(LUA_CFLAGS) $(ALL_CFLAGS) $(LUA_CFLAGS_EXTRA) -o $@ if_lua.c objects/if_mzsch.o: if_mzsch.c $(MZSCHEME_EXTRA) $(CCC) -o $@ $(MZSCHEME_CFLAGS_EXTRA) if_mzsch.c @@ -3366,22 +3367,22 @@ mzscheme_base.c: $(MZSCHEME_MZC) --c-mods mzscheme_base.c ++lib scheme/base objects/if_perl.o: auto/if_perl.c - $(CCC_NF) $(PERL_CFLAGS) $(ALL_CFLAGS) -o $@ auto/if_perl.c + $(CCC_NF) $(PERL_CFLAGS) $(ALL_CFLAGS) $(PERL_CFLAGS_EXTRA) -o $@ auto/if_perl.c objects/if_perlsfio.o: if_perlsfio.c - $(CCC_NF) $(PERL_CFLAGS) $(ALL_CFLAGS) -o $@ if_perlsfio.c + $(CCC_NF) $(PERL_CFLAGS) $(ALL_CFLAGS) $(PERL_CFLAGS_EXTRA) -o $@ if_perlsfio.c objects/if_python.o: if_python.c if_py_both.h - $(CCC_NF) $(PYTHON_CFLAGS) $(PYTHON_CFLAGS_EXTRA) $(ALL_CFLAGS) -o $@ if_python.c + $(CCC_NF) $(PYTHON_CFLAGS) $(ALL_CFLAGS) $(PYTHON_CFLAGS_EXTRA) -o $@ if_python.c objects/if_python3.o: if_python3.c if_py_both.h - $(CCC_NF) $(PYTHON3_CFLAGS) $(PYTHON3_CFLAGS_EXTRA) $(ALL_CFLAGS) -o $@ if_python3.c + $(CCC_NF) $(PYTHON3_CFLAGS) $(ALL_CFLAGS) $(PYTHON3_CFLAGS_EXTRA) -o $@ if_python3.c objects/if_ruby.o: if_ruby.c - $(CCC_NF) $(RUBY_CFLAGS) $(ALL_CFLAGS) -o $@ if_ruby.c + $(CCC_NF) $(RUBY_CFLAGS) $(ALL_CFLAGS) $(RUBY_CFLAGS_EXTRA) -o $@ if_ruby.c objects/if_tcl.o: if_tcl.c - $(CCC_NF) $(TCL_CFLAGS) $(ALL_CFLAGS) -o $@ if_tcl.c + $(CCC_NF) $(TCL_CFLAGS) $(ALL_CFLAGS) $(TCL_CFLAGS_EXTRA) -o $@ if_tcl.c objects/indent.o: indent.c $(CCC) -o $@ indent.c @@ -3459,10 +3460,10 @@ objects/ops.o: ops.c $(CCC) -o $@ ops.c objects/option.o: option.c optiondefs.h - $(CCC_NF) $(LUA_CFLAGS) $(PERL_CFLAGS) $(PYTHON_CFLAGS) $(PYTHON3_CFLAGS) $(RUBY_CFLAGS) $(TCL_CFLAGS) $(ALL_CFLAGS) -o $@ option.c + $(CCC_NF) $(ALL_IF_CFLAGS) $(ALL_CFLAGS) $(ALL_IF_CFLAGS_EXTRA) -o $@ option.c objects/optionstr.o: optionstr.c - $(CCC_NF) $(LUA_CFLAGS) $(PERL_CFLAGS) $(PYTHON_CFLAGS) $(PYTHON3_CFLAGS) $(RUBY_CFLAGS) $(TCL_CFLAGS) $(ALL_CFLAGS) -o $@ optionstr.c + $(CCC_NF) $(ALL_IF_CFLAGS) $(ALL_CFLAGS) $(ALL_IF_CFLAGS_EXTRA) -o $@ optionstr.c objects/os_qnx.o: os_qnx.c $(VIM_H_DEPENDENCIES) $(CCC) -o $@ os_qnx.c
--- a/src/auto/configure +++ b/src/auto/configure @@ -662,12 +662,14 @@ CHANNEL_SRC NETBEANS_OBJ NETBEANS_SRC RUBY_LIBS +RUBY_CFLAGS_EXTRA RUBY_CFLAGS RUBY_PRO RUBY_OBJ RUBY_SRC vi_cv_path_ruby TCL_LIBS +TCL_CFLAGS_EXTRA TCL_CFLAGS TCL_PRO TCL_OBJ @@ -675,15 +677,18 @@ TCL_SRC vi_cv_path_tcl PYTHON3_OBJ PYTHON3_SRC +PYTHON3_CFLAGS_EXTRA PYTHON3_CFLAGS PYTHON3_LIBS vi_cv_path_python3 PYTHON_OBJ PYTHON_SRC +PYTHON_CFLAGS_EXTRA PYTHON_CFLAGS PYTHON_LIBS vi_cv_path_python PERL_LIBS +PERL_CFLAGS_EXTRA PERL_CFLAGS PERL_PRO PERL_OBJ @@ -700,6 +705,7 @@ MZSCHEME_PRO MZSCHEME_OBJ MZSCHEME_SRC vi_cv_path_mzscheme +LUA_CFLAGS_EXTRA LUA_CFLAGS LUA_LIBS LUA_PRO @@ -5658,6 +5664,7 @@ rm -f core conftest.err conftest.$ac_obj + fi @@ -6273,6 +6280,7 @@ fi + { $as_echo "$as_me:${as_lineno-$LINENO}: checking --enable-pythoninterp argument" >&5 $as_echo_n "checking --enable-pythoninterp argument... " >&6; } # Check whether --enable-pythoninterp was given. @@ -6623,6 +6631,7 @@ fi + { $as_echo "$as_me:${as_lineno-$LINENO}: checking --enable-python3interp argument" >&5 $as_echo_n "checking --enable-python3interp argument... " >&6; } # Check whether --enable-python3interp was given. @@ -6969,6 +6978,7 @@ fi + if test "$python_ok" = yes && test "$python3_ok" = yes; then $as_echo "#define DYNAMIC_PYTHON 1" >>confdefs.h @@ -7549,6 +7559,7 @@ fi + { $as_echo "$as_me:${as_lineno-$LINENO}: checking --enable-rubyinterp argument" >&5 $as_echo_n "checking --enable-rubyinterp argument... " >&6; } # Check whether --enable-rubyinterp was given. @@ -7712,6 +7723,7 @@ fi + { $as_echo "$as_me:${as_lineno-$LINENO}: checking --enable-cscope argument" >&5 $as_echo_n "checking --enable-cscope argument... " >&6; } # Check whether --enable-cscope was given.
--- a/src/config.mk.in +++ b/src/config.mk.in @@ -41,6 +41,7 @@ LUA_LIBS = @LUA_LIBS@ LUA_SRC = @LUA_SRC@ LUA_OBJ = @LUA_OBJ@ LUA_CFLAGS = @LUA_CFLAGS@ +LUA_CFLAGS_EXTRA = @LUA_CFLAGS_EXTRA@ LUA_PRO = @LUA_PRO@ MZSCHEME_LIBS = @MZSCHEME_LIBS@ @@ -60,15 +61,18 @@ PERL_SRC = @PERL_SRC@ PERL_OBJ = @PERL_OBJ@ PERL_PRO = @PERL_PRO@ PERL_CFLAGS = @PERL_CFLAGS@ +PERL_CFLAGS_EXTRA = @PERL_CFLAGS_EXTRA@ PYTHON_SRC = @PYTHON_SRC@ PYTHON_OBJ = @PYTHON_OBJ@ PYTHON_CFLAGS = @PYTHON_CFLAGS@ +PYTHON_CFLAGS_EXTRA = @PYTHON_CFLAGS_EXTRA@ PYTHON_LIBS = @PYTHON_LIBS@ PYTHON3_SRC = @PYTHON3_SRC@ PYTHON3_OBJ = @PYTHON3_OBJ@ PYTHON3_CFLAGS = @PYTHON3_CFLAGS@ +PYTHON3_CFLAGS_EXTRA = @PYTHON3_CFLAGS_EXTRA@ PYTHON3_LIBS = @PYTHON3_LIBS@ TCL = @vi_cv_path_tcl@ @@ -76,6 +80,7 @@ TCL_SRC = @TCL_SRC@ TCL_OBJ = @TCL_OBJ@ TCL_PRO = @TCL_PRO@ TCL_CFLAGS = @TCL_CFLAGS@ +TCL_CFLAGS_EXTRA = @TCL_CFLAGS_EXTRA@ TCL_LIBS = @TCL_LIBS@ NETBEANS_SRC = @NETBEANS_SRC@ @@ -91,6 +96,7 @@ RUBY_SRC = @RUBY_SRC@ RUBY_OBJ = @RUBY_OBJ@ RUBY_PRO = @RUBY_PRO@ RUBY_CFLAGS = @RUBY_CFLAGS@ +RUBY_CFLAGS_EXTRA = @RUBY_CFLAGS_EXTRA@ RUBY_LIBS = @RUBY_LIBS@ AWK = @AWK@
--- a/src/configure.ac +++ b/src/configure.ac @@ -781,6 +781,7 @@ if test "$enable_luainterp" = "yes" -o " AC_SUBST(LUA_PRO) AC_SUBST(LUA_LIBS) AC_SUBST(LUA_CFLAGS) + AC_SUBST(LUA_CFLAGS_EXTRA) fi @@ -1201,6 +1202,7 @@ AC_SUBST(PERL_SRC) AC_SUBST(PERL_OBJ) AC_SUBST(PERL_PRO) AC_SUBST(PERL_CFLAGS) +AC_SUBST(PERL_CFLAGS_EXTRA) AC_SUBST(PERL_LIBS) AC_MSG_CHECKING(--enable-pythoninterp argument) @@ -1433,6 +1435,7 @@ fi AC_SUBST(PYTHON_LIBS) AC_SUBST(PYTHON_CFLAGS) +AC_SUBST(PYTHON_CFLAGS_EXTRA) AC_SUBST(PYTHON_SRC) AC_SUBST(PYTHON_OBJ) @@ -1650,6 +1653,7 @@ fi AC_SUBST(PYTHON3_LIBS) AC_SUBST(PYTHON3_CFLAGS) +AC_SUBST(PYTHON3_CFLAGS_EXTRA) AC_SUBST(PYTHON3_SRC) AC_SUBST(PYTHON3_OBJ) @@ -1946,6 +1950,7 @@ AC_SUBST(TCL_SRC) AC_SUBST(TCL_OBJ) AC_SUBST(TCL_PRO) AC_SUBST(TCL_CFLAGS) +AC_SUBST(TCL_CFLAGS_EXTRA) AC_SUBST(TCL_LIBS) AC_MSG_CHECKING(--enable-rubyinterp argument) @@ -2050,6 +2055,7 @@ AC_SUBST(RUBY_SRC) AC_SUBST(RUBY_OBJ) AC_SUBST(RUBY_PRO) AC_SUBST(RUBY_CFLAGS) +AC_SUBST(RUBY_CFLAGS_EXTRA) AC_SUBST(RUBY_LIBS) AC_MSG_CHECKING(--enable-cscope argument)
--- 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_ # 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*, c 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, 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
--- a/src/version.c +++ b/src/version.c @@ -750,6 +750,8 @@ static char *(features[]) = static int included_patches[] = { /* Add new patch number below this line */ /**/ + 3922, +/**/ 3921, /**/ 3920,
--- a/src/vim.h +++ b/src/vim.h @@ -2177,13 +2177,15 @@ typedef struct stat stat_T; #endif #if defined(__GNUC__) || defined(__clang__) -# define likely(x) __builtin_expect((x), 1) -# define unlikely(x) __builtin_expect((x), 0) -# define ATTRIBUTE_COLD __attribute__((cold)) +# define likely(x) __builtin_expect((x), 1) +# define unlikely(x) __builtin_expect((x), 0) +# define ATTRIBUTE_COLD __attribute__((cold)) +# define ATTRIBUTE_NORETURN __attribute__((noreturn)) #else -# define unlikely(x) (x) -# define likely(x) (x) +# define unlikely(x) (x) +# define likely(x) (x) # define ATTRIBUTE_COLD +# define ATTRIBUTE_NORETURN #endif typedef enum {