You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
185 lines
5.6 KiB
185 lines
5.6 KiB
2 years ago
|
From f65ec60f45532418e141a1d4a1ce98aac89cb094 Mon Sep 17 00:00:00 2001
|
||
|
From: Sergey Cherevko <s.cherevko@msvsphere.ru>
|
||
|
Date: Fri, 4 Aug 2023 18:52:36 +0300
|
||
|
Subject: [PATCH 3/3] Fix build if_ruby/dyn
|
||
|
|
||
|
---
|
||
|
src/Makefile | 2 +-
|
||
|
src/auto/configure | 1 +
|
||
|
src/config.mk.in | 1 +
|
||
|
src/configure.ac | 1 +
|
||
|
src/if_ruby.c | 52 ++++++++++++++++++++++++++++++++++++++++++++++
|
||
|
src/vim.h | 9 ++++++++
|
||
|
6 files changed, 65 insertions(+), 1 deletion(-)
|
||
|
|
||
|
diff --git a/src/Makefile b/src/Makefile
|
||
|
index 85de383..a28ea39 100644
|
||
|
--- a/src/Makefile
|
||
|
+++ b/src/Makefile
|
||
|
@@ -3177,7 +3177,7 @@ objects/if_python3.o: if_python3.c if_py_both.h
|
||
|
$(CCC_NF) $(PYTHON3_CFLAGS) $(PYTHON3_CFLAGS_EXTRA) $(ALL_CFLAGS) -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
|
||
|
diff --git a/src/auto/configure b/src/auto/configure
|
||
|
index c1d477c..a5cb8d0 100755
|
||
|
--- a/src/auto/configure
|
||
|
+++ b/src/auto/configure
|
||
|
@@ -664,6 +664,7 @@ NETBEANS_SRC
|
||
|
WORKSHOP_OBJ
|
||
|
WORKSHOP_SRC
|
||
|
RUBY_LIBS
|
||
|
+RUBY_CFLAGS_EXTRA
|
||
|
RUBY_CFLAGS
|
||
|
RUBY_PRO
|
||
|
RUBY_OBJ
|
||
|
diff --git a/src/config.mk.in b/src/config.mk.in
|
||
|
index 84c1590..85e9b95 100644
|
||
|
--- a/src/config.mk.in
|
||
|
+++ b/src/config.mk.in
|
||
|
@@ -96,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@
|
||
|
diff --git a/src/configure.ac b/src/configure.ac
|
||
|
index 7f55281..cecdd21 100644
|
||
|
--- a/src/configure.ac
|
||
|
+++ b/src/configure.ac
|
||
|
@@ -1973,6 +1973,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)
|
||
|
diff --git a/src/if_ruby.c b/src/if_ruby.c
|
||
|
index 1497104..f83d0f9 100644
|
||
|
--- a/src/if_ruby.c
|
||
|
+++ b/src/if_ruby.c
|
||
|
@@ -117,6 +117,20 @@
|
||
|
# define rb_gc_writebarrier_unprotect rb_gc_writebarrier_unprotect_stub
|
||
|
#endif
|
||
|
|
||
|
+#if defined(DYNAMIC_RUBY_VER) && DYNAMIC_RUBY_VER >= 26
|
||
|
+# define rb_ary_detransient rb_ary_detransient_stub
|
||
|
+#endif
|
||
|
+
|
||
|
+# if RUBY_VERSION >= 30
|
||
|
+# define rb_check_type rb_check_type_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
|
||
|
+
|
||
|
#include <ruby.h>
|
||
|
#ifdef RUBY19_OR_LATER
|
||
|
# include <ruby/encoding.h>
|
||
|
@@ -351,6 +365,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);
|
||
|
@@ -413,6 +430,12 @@ static void (*dll_ruby_sysinit) (int*, char***);
|
||
|
static int (*dll_rb_w32_snprintf)(char*, size_t, const char*, ...);
|
||
|
# endif
|
||
|
# endif
|
||
|
+#if defined(DYNAMIC_RUBY_VER) && DYNAMIC_RUBY_VER >= 26
|
||
|
+static void (*dll_rb_ary_detransient) (VALUE);
|
||
|
+#endif
|
||
|
+# if RUBY_VERSION >= 31
|
||
|
+static void (*dll_rb_unexpected_type) (VALUE, int) ATTRIBUTE_NORETURN;
|
||
|
+# endif
|
||
|
# if defined(DYNAMIC_RUBY_VER) && DYNAMIC_RUBY_VER >= 18
|
||
|
static char * (*dll_rb_string_value_ptr) (volatile VALUE*);
|
||
|
static VALUE (*dll_rb_float_new) (double);
|
||
|
@@ -507,6 +530,26 @@ void rb_gc_writebarrier_unprotect_stub(VALUE obj)
|
||
|
dll_rb_gc_writebarrier_unprotect(obj);
|
||
|
}
|
||
|
# 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
|
||
|
+
|
||
|
+# if defined(DYNAMIC_RUBY_VER) && DYNAMIC_RUBY_VER >= 26
|
||
|
+void rb_ary_detransient_stub(VALUE x)
|
||
|
+{
|
||
|
+ dll_rb_ary_detransient(x);
|
||
|
+}
|
||
|
# endif
|
||
|
|
||
|
static HINSTANCE hinstRuby = NULL; /* Instance of ruby.dll */
|
||
|
@@ -547,6 +590,9 @@ static struct
|
||
|
# endif
|
||
|
# 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},
|
||
|
@@ -612,6 +658,12 @@ static struct
|
||
|
{"rb_w32_snprintf", (RUBY_PROC*)&dll_rb_w32_snprintf},
|
||
|
# endif
|
||
|
# endif
|
||
|
+#if defined(DYNAMIC_RUBY_VER) && DYNAMIC_RUBY_VER >= 26
|
||
|
+ {"rb_ary_detransient", (RUBY_PROC*)&dll_rb_ary_detransient},
|
||
|
+#endif
|
||
|
+# if RUBY_VERSION >= 31
|
||
|
+ {"rb_unexpected_type", (RUBY_PROC*)&dll_rb_unexpected_type},
|
||
|
+# endif
|
||
|
# if defined(DYNAMIC_RUBY_VER) && DYNAMIC_RUBY_VER >= 18
|
||
|
{"rb_string_value_ptr", (RUBY_PROC*)&dll_rb_string_value_ptr},
|
||
|
# if DYNAMIC_RUBY_VER <= 19
|
||
|
diff --git a/src/vim.h b/src/vim.h
|
||
|
index df396ec..6dd66f0 100644
|
||
|
--- a/src/vim.h
|
||
|
+++ b/src/vim.h
|
||
|
@@ -2087,6 +2087,15 @@ typedef struct stat stat_T;
|
||
|
|
||
|
#if defined(__GNUC__) && !defined(__MINGW32__)
|
||
|
# define USE_PRINTF_FORMAT_ATTRIBUTE
|
||
|
+# 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 ATTRIBUTE_COLD
|
||
|
+# define ATTRIBUTE_NORETURN
|
||
|
#endif
|
||
|
|
||
|
typedef enum
|
||
|
--
|
||
|
2.39.2
|
||
|
|