!90 fix build fail

Merge pull request !90 from 桐小哥/openEuler-22.03-LTS-Next
This commit is contained in:
openeuler-ci-bot 2022-01-05 09:27:43 +00:00 committed by Gitee
commit c0d8f10409
No known key found for this signature in database
GPG Key ID: 173E9B9CA92EEF8F
14 changed files with 1603 additions and 114 deletions

View File

@ -1,111 +0,0 @@
From 5d35e2ad1027e394877e096f618536da0ad11ffa Mon Sep 17 00:00:00 2001
From: Felix Yan <felixonmars@archlinux.org>
Date: Mon, 22 Jun 2020 00:00:44 +0800
Subject: [PATCH] Fix build failures with Perl 5.32
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
More functions are needed in latest Perl 5.32. This patch fixes the following build failures:
```
In file included from /usr/lib/perl5/5.32/core_perl/CORE/perl.h:3909,
from if_perl.xs:61:
if_perl.xs: In function perl_win_free:
/usr/lib/perl5/5.32/core_perl/CORE/sv.h:351:26: warning: implicit declaration of function Perl_SvREFCNT_dec; did you mean S_SvREFCNT_dec? [-Wimplicit-function-declaration]
351 | #define SvREFCNT_dec(sv) Perl_SvREFCNT_dec(aTHX_ MUTABLE_SV(sv))
| ^~~~~~~~~~~~~~~~~
/usr/lib/perl5/5.32/core_perl/CORE/sv.h:351:26: note: in definition of macro SvREFCNT_dec
351 | #define SvREFCNT_dec(sv) Perl_SvREFCNT_dec(aTHX_ MUTABLE_SV(sv))
| ^~~~~~~~~~~~~~~~~
if_perl.xs: In function ex_perl:
/usr/lib/perl5/5.32/core_perl/CORE/sv.h:1842:28: warning: implicit declaration of function Perl_SvTRUE [-Wimplicit-function-declaration]
1842 | #define SvTRUE(sv) Perl_SvTRUE(aTHX_ sv)
| ^~~~~~~~~~~
/usr/lib/perl5/5.32/core_perl/CORE/sv.h:1842:28: note: in definition of macro SvTRUE
1842 | #define SvTRUE(sv) Perl_SvTRUE(aTHX_ sv)
| ^~~~~~~~~~~
In file included from /usr/lib/perl5/5.32/core_perl/CORE/perl.h:5544,
from if_perl.xs:61:
if_perl.c: In function XS_VIM_Msg:
/usr/lib/perl5/5.32/core_perl/CORE/pp.h:71:17: warning: implicit declaration of function Perl_POPMARK; did you mean S_POPMARK? [-Wimplicit-function-declaration]
71 | #define POPMARK Perl_POPMARK(aTHX)
| ^~~~~~~~~~~~
/usr/lib/perl5/5.32/core_perl/CORE/pp.h:71:17: note: in definition of macro POPMARK
71 | #define POPMARK Perl_POPMARK(aTHX)
| ^~~~~~~~~~~~
/usr/lib/perl5/5.32/core_perl/CORE/XSUB.h:157:7: note: in expansion of macro dAXMARK
157 | dSP; dAXMARK; dITEMS
| ^~~~~~~
if_perl.c:1661:11: note: in expansion of macro dXSARGS
gcc -c -I. -Iproto -DHAVE_CONFIG_H -march=x86-64 -mtune=generic -O2 -pipe -fno-plt -U_FORTIFY_SOURCE -D_FORTIFY_SOURCE=1 version.c -o objects/version.o
link.sh: $LINK_AS_NEEDED set to 'yes': invoking linker directly.
gcc -L. -Wl,-O1,--sort-common,--as-needed,-z,relro,-z,now -fstack-protector-strong -rdynamic -Wl,-export-dynamic -Wl,-E -Wl,-rpath,/usr/lib/perl5/5.32/core_perl/CORE -Wl,-O1,--sort-common,--as-needed,-z,relro,-z,now -L/usr/local/lib -Wl,--as-needed -o vim objects/arabic.o objects/arglist.o objects/autocmd.o objects/beval.o objects/buffer.o objects/change.o objects/blob.o objects/blowfish.o objects/cindent.o objects/clientserver.o objects/clipboard.o objects/cmdexpand.o objects/cmdhist.o objects/crypt.o objects/crypt_zip.o objects/debugger.o objects/dict.o objects/diff.o objects/digraph.o objects/drawline.o objects/drawscreen.o objects/edit.o objects/eval.o objects/evalbuffer.o objects/evalfunc.o objects/evalvars.o objects/evalwindow.o objects/ex_cmds.o objects/ex_cmds2.o objects/ex_docmd.o objects/ex_eval.o objects/ex_getln.o objects/fileio.o objects/filepath.o objects/findfile.o objects/fold.o objects/getchar.o objects/hardcopy.o objects/hashtab.o objects/highlight.o objects/if_cscope.o objects/if_xcmdsrv.o objects/indent.o objects/insexpand.o objects/list.o objects/map.o objects/mark.o objects/mbyte.o objects/memline.o objects/menu.o objects/misc1.o objects/misc2.o objects/mouse.o objects/move.o objects/normal.o objects/ops.o objects/option.o objects/optionstr.o objects/os_unix.o objects/pathdef.o objects/popupmenu.o objects/popupwin.o objects/profiler.o objects/pty.o objects/quickfix.o objects/regexp.o objects/register.o objects/screen.o objects/scriptfile.o objects/search.o objects/session.o objects/sha256.o objects/sign.o objects/sound.o objects/spell.o objects/spellfile.o objects/spellsuggest.o objects/syntax.o objects/tag.o objects/term.o objects/terminal.o objects/testing.o objects/textformat.o objects/textobject.o objects/textprop.o objects/time.o objects/ui.o objects/undo.o objects/usercmd.o objects/userfunc.o objects/version.o objects/vim9compile.o objects/vim9execute.o objects/vim9script.o objects/viminfo.o objects/window.o objects/bufwrite.o objects/vterm_encoding.o objects/vterm_keyboard.o objects/vterm_mouse.o objects/vterm_parser.o objects/vterm_pen.o objects/vterm_screen.o objects/vterm_state.o objects/vterm_unicode.o objects/vterm_vterm.o objects/if_lua.o objects/if_perl.o objects/if_perlsfio.o objects/if_python.o objects/if_python3.o objects/if_tcl.o objects/if_ruby.o objects/netbeans.o objects/channel.o objects/xdiffi.o objects/xemit.o objects/xprepare.o objects/xutils.o objects/xhistogram.o objects/xpatience.o objects/charset.o objects/json.o objects/main.o objects/memfile.o objects/message.o -lm -ltinfo -lelf -lacl -lattr -lgpm -ldl -Wl,-E -Wl,-rpath,/usr/lib/perl5/5.32/core_perl/CORE -Wl,-O1,--sort-common,--as-needed,-z,relro,-z,now -fstack-protector-strong -L/usr/local/lib -L/usr/lib/perl5/5.32/core_perl/CORE -lperl -lpthread -ldl -lm -lcrypt -lutil -lc -L/usr/lib -ltclstub8.6 -ldl -lz -lpthread -lm
/usr/bin/ld: objects/if_perl.o: in function `cur_val':
if_perl.c:(.text+0xaee): undefined reference to `Perl_SvREFCNT_dec'
/usr/bin/ld: objects/if_perl.o: in function `XS_VIBUF_Count':
if_perl.c:(.text+0xc29): undefined reference to `Perl_POPMARK'
/usr/bin/ld: objects/if_perl.o: in function `XS_VIBUF_Number':
if_perl.c:(.text+0xe89): undefined reference to `Perl_POPMARK'
/usr/bin/ld: objects/if_perl.o: in function `XS_VIBUF_Name':
if_perl.c:(.text+0x10e9): undefined reference to `Perl_POPMARK'
/usr/bin/ld: objects/if_perl.o: in function `XS_VIBUF_DESTROY':
if_perl.c:(.text+0x13f5): undefined reference to `Perl_POPMARK'
/usr/bin/ld: objects/if_perl.o: in function `XS_VIBUF_Append':
if_perl.c:(.text+0x15ea): undefined reference to `Perl_POPMARK'
/usr/bin/ld: objects/if_perl.o:if_perl.c:(.text+0x1a4a): more undefined references to `Perl_POPMARK' follow
/usr/bin/ld: objects/if_perl.o: in function `perl_win_free':
if_perl.c:(.text+0x4bb7): undefined reference to `Perl_SvREFCNT_dec'
/usr/bin/ld: objects/if_perl.o: in function `perl_buf_free':
if_perl.c:(.text+0x4c27): undefined reference to `Perl_SvREFCNT_dec'
/usr/bin/ld: objects/if_perl.o: in function `ex_perl':
if_perl.c:(.text+0x4d58): undefined reference to `Perl_SvTRUE'
/usr/bin/ld: if_perl.c:(.text+0x4d8a): undefined reference to `Perl_SvREFCNT_dec'
/usr/bin/ld: objects/if_perl.o: in function `do_perleval':
if_perl.c:(.text+0x51f7): undefined reference to `Perl_SvTRUE'
/usr/bin/ld: if_perl.c:(.text+0x5433): undefined reference to `Perl_SvREFCNT_dec'
/usr/bin/ld: objects/if_perl.o: in function `ex_perldo':
if_perl.c:(.text+0x577c): undefined reference to `Perl_SvREFCNT_dec'
/usr/bin/ld: if_perl.c:(.text+0x5943): undefined reference to `Perl_SvTRUE'
collect2: error: ld returned 1 exit status
link.sh: Linking failed
```
---
src/if_perl.xs | 19 +++++++++++++++++++
1 file changed, 19 insertions(+)
diff -Naur a/src/if_perl.xs b/src/if_perl.xs
--- a/src/if_perl.xs 2019-02-23 22:00:57.000000000 +0800
+++ b/src/if_perl.xs 2020-08-15 10:43:20.621318684 +0800
@@ -649,6 +649,10 @@
Perl_sv_free2(aTHX_ sv, rc);
}
}
+/* perl-5.32 needs Perl_SvREFCNT_dec */
+# if (PERL_REVISION == 5) && (PERL_VERSION >= 32)
+#define Perl_SvREFCNT_dec S_SvREFCNT_dec
+# endif
# endif
/* perl-5.26 also needs S_TOPMARK and S_POPMARK. */
@@ -673,6 +677,21 @@
assert((PL_markstack_ptr > PL_markstack) || !"MARK underflow");
return *PL_markstack_ptr--;
}
+/* perl-5.32 needs Perl_POPMARK */
+# if (PERL_REVISION == 5) && (PERL_VERSION >= 32)
+#define Perl_POPMARK S_POPMARK
+# endif
+# endif
+
+/* perl-5.32 needs Perl_SvTRUE */
+# if (PERL_REVISION == 5) && (PERL_VERSION >= 32)
+PERL_STATIC_INLINE bool
+Perl_SvTRUE(pTHX_ SV *sv) {
+ if (!LIKELY(sv))
+ return FALSE;
+ SvGETMAGIC(sv);
+ return SvTRUE_nomg_NN(sv);
+}
# endif
/*

View File

@ -0,0 +1,90 @@
From efc0d94afc48a03b07955e91315e7e67945cd079 Mon Sep 17 00:00:00 2001
From: Bram Moolenaar <Bram@vim.org>
Date: Sun, 11 Oct 2020 18:05:02 +0200
Subject: [PATCH] patch 8.2.1834: PyEval_InitThreads() is deprecated in Python
3.9
Problem: PyEval_InitThreads() is deprecated in Python 3.9.
Solution: Do not call PyEval_InitThreads in Python 3.9 and later. (Ken
Takata, closes #7113) Avoid warnings for functions.
---
src/if_py_both.h | 8 ++++----
src/if_python3.c | 21 +++++++++++----------
2 files changed, 15 insertions(+), 14 deletions(-)
diff --git a/src/if_py_both.h b/src/if_py_both.h
index 0763c65..63f4329 100644
--- a/src/if_py_both.h
+++ b/src/if_py_both.h
@@ -306,7 +306,7 @@ ObjectDir(PyObject *self, char **attributes)
// Output buffer management
// Function to write a line, points to either msg() or emsg().
-typedef void (*writefn)(char_u *);
+typedef int (*writefn)(char *);
static PyTypeObject OutputType;
@@ -358,8 +358,8 @@ PythonIO_Flush(void)
{
if (old_fn != NULL && io_ga.ga_len > 0)
{
- ((char_u *)io_ga.ga_data)[io_ga.ga_len] = NUL;
- old_fn((char_u *)io_ga.ga_data);
+ ((char *)io_ga.ga_data)[io_ga.ga_len] = NUL;
+ old_fn((char *)io_ga.ga_data);
}
io_ga.ga_len = 0;
}
@@ -389,7 +389,7 @@ writer(writefn fn, char_u *str, PyInt n)
mch_memmove(((char *)io_ga.ga_data) + io_ga.ga_len, str, (size_t)len);
((char *)io_ga.ga_data)[io_ga.ga_len + len] = NUL;
- fn((char_u *)io_ga.ga_data);
+ fn((char *)io_ga.ga_data);
str = ptr + 1;
n -= len + 1;
io_ga.ga_len = 0;
diff --git a/src/if_python3.c b/src/if_python3.c
index 45dc308..7c9e140 100644
--- a/src/if_python3.c
+++ b/src/if_python3.c
@@ -958,11 +958,10 @@ Python3_Init(void)
Py_Initialize();
- // Initialise threads, and below save the state using
- // PyEval_SaveThread. Without the call to PyEval_SaveThread, thread
- // specific state (such as the system trace hook), will be lost
- // between invocations of Python code.
+#if PY_VERSION_HEX < 0x03090000
+ // Initialise threads. This is deprecated since Python 3.9.
PyEval_InitThreads();
+#endif
#ifdef DYNAMIC_PYTHON3
get_py3_exceptions();
#endif
@@ -980,12 +979,14 @@ Python3_Init(void)
// sys.path.
PyRun_SimpleString("import vim; import sys; sys.path = list(filter(lambda x: not x.endswith('must>not&exist'), sys.path))");
- // lock is created and acquired in PyEval_InitThreads() and thread
- // state is created in Py_Initialize()
- // there _PyGILState_NoteThreadState() also sets gilcounter to 1
- // (python must have threads enabled!)
- // so the following does both: unlock GIL and save thread state in TLS
- // without deleting thread state
+ // Without the call to PyEval_SaveThread, thread specific state (such
+ // as the system trace hook), will be lost between invocations of
+ // Python code.
+ // GIL may have been created and acquired in PyEval_InitThreads() and
+ // thread state is created in Py_Initialize(); there
+ // _PyGILState_NoteThreadState() also sets gilcounter to 1 (python must
+ // have threads enabled!), so the following does both: unlock GIL and
+ // save thread state in TLS without deleting thread state
PyEval_SaveThread();
py3initialised = 1;
--
1.8.3.1

View File

@ -0,0 +1,23 @@
From a65bb53514a1af1ec0dc5c4831dfaef69f139a48 Mon Sep 17 00:00:00 2001
From: Bram Moolenaar <Bram@vim.org>
Date: Wed, 4 Mar 2020 22:06:07 +0100
Subject: [PATCH] patch 8.2.0354: Python 3.9 does not define _Py_DEC_REFTOTAL
Problem: Python 3.9 does not define _Py_DEC_REFTOTAL. (Zdenek Dohnal)
Solution: Remove it, it was only for debugging.
---
src/if_python3.c | 1 -
1 files changed, 1 deletion(-)
diff --git a/src/if_python3.c b/src/if_python3.c
index 6e4b81acd0e..2985e9c894b 100644
--- a/src/if_python3.c
+++ b/src/if_python3.c
@@ -603,7 +603,6 @@ static struct
static inline void
py3__Py_DECREF(const char *filename UNUSED, int lineno UNUSED, PyObject *op)
{
- _Py_DEC_REFTOTAL;
if (--op->ob_refcnt != 0)
{
# ifdef Py_REF_DEBUG

View File

@ -0,0 +1,29 @@
From 0e12140550a63bb1e45771edb89b941959440cfe Mon Sep 17 00:00:00 2001
From: Bram Moolenaar <Bram@vim.org>
Date: Thu, 10 Dec 2020 20:50:34 +0100
Subject: [PATCH] patch 8.2.2126: Ruby: missing function prototype
Problem: Ruby: missing function prototype.
Solution: Add the prototype.
---
src/if_ruby.c | 4 ++++
1 file changed, 4 insertions(+)
diff --git a/src/if_ruby.c b/src/if_ruby.c
index d0f8acf..906a902 100644
--- a/src/if_ruby.c
+++ b/src/if_ruby.c
@@ -492,6 +492,10 @@ static void (*dll_rb_gc_writebarrier_unprotect)(VALUE obj);
# endif
# endif
+# if RUBY_VERSION >= 26
+void rb_ary_detransient_stub(VALUE x);
+# endif
+
# if (RUBY_VERSION >= 19) && !defined(PROTO)
# if RUBY_VERSION >= 22
long
--
2.13.7

View File

@ -0,0 +1,50 @@
From f5433fbfe4324fd443664fb924116b5ed675bef5 Mon Sep 17 00:00:00 2001
From: Bram Moolenaar <Bram@vim.org>
Date: Sun, 21 Jun 2020 20:06:54 +0200
Subject: [PATCH] patch 8.2.1031: build failure with Perl5.32
Problem: Build failure with Perl5.32.
Solution: Define a few more functions. (Felix Yan, closes #6310)
---
src/if_perl.xs | 19 +++++++++++++++++++
1 file changed, 19 insertions(+)
diff --git a/src/if_perl.xs b/src/if_perl.xs
index 099d386..5adccce 100644
--- a/src/if_perl.xs
+++ b/src/if_perl.xs
@@ -651,6 +651,11 @@ S_SvREFCNT_dec(pTHX_ SV *sv)
}
# endif
+/* perl-5.32 needs Perl_SvREFCNT_dec */
+# if (PERL_REVISION == 5) && (PERL_VERSION >= 32)
+# define Perl_SvREFCNT_dec S_SvREFCNT_dec
+# endif
+
/* perl-5.26 also needs S_TOPMARK and S_POPMARK. */
# if (PERL_REVISION == 5) && (PERL_VERSION >= 26)
PERL_STATIC_INLINE I32
@@ -675,6 +680,20 @@ S_POPMARK(pTHX)
}
# endif
+/* perl-5.32 needs Perl_POPMARK */
+# if (PERL_REVISION == 5) && (PERL_VERSION >= 32)
+# define Perl_POPMARK S_POPMARK
+
+/* perl-5.32 needs Perl_SvTRUE */
+PERL_STATIC_INLINE bool
+Perl_SvTRUE(pTHX_ SV *sv) {
+ if (!LIKELY(sv))
+ return FALSE;
+ SvGETMAGIC(sv);
+ return SvTRUE_nomg_NN(sv);
+}
+# endif
+
/*
* Make all runtime-links of perl.
*
--
2.27.0

View File

@ -0,0 +1,32 @@
From 467b59c2eb06f7fe6c2b5b677855cd422adbc45c Mon Sep 17 00:00:00 2001
From: Bram Moolenaar <Bram@vim.org>
Date: Fri, 8 Jan 2021 19:31:39 +0100
Subject: [PATCH] patch 8.2.2312: build failure with Ruby 3.0 and 32 bits
Problem: Build failure with Ruby 3.0 and 32 bits.
Solution: Add #ifdef. (closes #7638)
---
src/if_ruby.c | 2 ++
1 file changed, 2 insertions(+)
diff --git a/src/if_ruby.c b/src/if_ruby.c
index 6522d07..b29f8be 100644
--- a/src/if_ruby.c
+++ b/src/if_ruby.c
@@ -596,11 +596,13 @@ rb_check_type_stub(VALUE obj, int t)
{
dll_rb_check_type(obj, t);
}
+# if VIM_SIZEOF_INT < VIM_SIZEOF_LONG // 64 bits only
unsigned long
rb_num2uint_stub(VALUE x)
{
return dll_rb_num2uint(x);
}
+# endif
void
ruby_malloc_size_overflow_stub(size_t x, size_t y)
{
--
2.13.7

View File

@ -0,0 +1,294 @@
From dace9f785fca6cc802b2fb7f11a5ee4fab896432 Mon Sep 17 00:00:00 2001
From: Bram Moolenaar <Bram@vim.org>
Date: Mon, 28 Dec 2020 15:07:45 +0100
Subject: [PATCH] patch 8.2.2235: build failure with some Ruby versions
Problem: Build failure with some Ruby versions.
Solution: Adjust the code for Ruby 3.0. (Ozaki Kiichi, closes #7564)
---
src/if_ruby.c | 143 ++++++++++++++++++++++++++++++++++++----------------------
1 file changed, 89 insertions(+), 54 deletions(-)
diff --git a/src/if_ruby.c b/src/if_ruby.c
index 906a902..d21a655 100644
--- a/src/if_ruby.c
+++ b/src/if_ruby.c
@@ -32,8 +32,9 @@
# define RUBYEXTERN extern
#endif
-#if defined(DYNAMIC_RUBY) && RUBY_VERSION >= 24
-# define USE_RUBY_INTEGER
+// suggested by Ariya Mizutani
+#if (_MSC_VER == 1200)
+# undef _WIN32_WINNT
#endif
#ifdef DYNAMIC_RUBY
@@ -42,6 +43,10 @@
* definition. This function use these variables. But we want function to
* use dll_* variables.
*/
+# if RUBY_VERSION >= 24
+# define USE_RUBY_INTEGER
+# endif
+
# define rb_cFalseClass (*dll_rb_cFalseClass)
# define rb_cFixnum (*dll_rb_cFixnum)
# if defined(USE_RUBY_INTEGER)
@@ -54,6 +59,7 @@
# define rb_cString (*dll_rb_cString)
# define rb_cSymbol (*dll_rb_cSymbol)
# define rb_cTrueClass (*dll_rb_cTrueClass)
+
# if RUBY_VERSION >= 18
/*
* On ver 1.8, all Ruby functions are exported with "__declspec(dllimport)"
@@ -64,40 +70,41 @@
# define RUBY_EXPORT
# endif
-#endif // ifdef DYNAMIC_RUBY
-
-// suggested by Ariya Mizutani
-#if (_MSC_VER == 1200)
-# undef _WIN32_WINNT
-#endif
-
-#if defined(DYNAMIC_RUBY) && RUBY_VERSION >= 19
+# 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
-#endif
+# define rb_num2long rb_num2long_stub
+# define rb_int2big rb_int2big_stub
-#if defined(DYNAMIC_RUBY) && RUBY_VERSION >= 19 \
- && VIM_SIZEOF_INT < VIM_SIZEOF_LONG
+# 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
-#endif
+# define rb_fix2int rb_fix2int_stub
+# define rb_num2int rb_num2int_stub
+# endif
+# endif
-#if defined(DYNAMIC_RUBY) && RUBY_VERSION == 21
+# 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
-#endif
-#if defined(DYNAMIC_RUBY) && RUBY_VERSION >= 22
-# define rb_gc_writebarrier_unprotect rb_gc_writebarrier_unprotect_stub
-#endif
+# define rb_gc_writebarrier_unprotect_promoted rb_gc_writebarrier_unprotect_promoted_stub
+# endif
-#if defined(DYNAMIC_RUBY) && RUBY_VERSION >= 26
-# define rb_ary_detransient rb_ary_detransient_stub
-#endif
+# if RUBY_VERSION >= 22
+# define rb_gc_writebarrier_unprotect rb_gc_writebarrier_unprotect_stub
+# endif
+
+# if RUBY_VERSION >= 26
+# 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
+# endif
+
+#endif // ifdef DYNAMIC_RUBY
#include <ruby.h>
#if RUBY_VERSION >= 19
@@ -212,7 +219,9 @@ static int ruby_convert_to_vim_value(VALUE val, typval_T *rettv);
# define rb_assoc_new dll_rb_assoc_new
# define rb_cObject (*dll_rb_cObject)
# define rb_class_new_instance dll_rb_class_new_instance
-# define rb_check_type dll_rb_check_type
+# if RUBY_VERSION < 30
+# define rb_check_type dll_rb_check_type
+# endif
# ifdef USE_TYPEDDATA
# define rb_check_typeddata dll_rb_check_typeddata
# endif
@@ -263,7 +272,9 @@ static int ruby_convert_to_vim_value(VALUE val, typval_T *rettv);
# define rb_fix2int dll_rb_fix2int
# define rb_num2int dll_rb_num2int
# endif
-# define rb_num2uint dll_rb_num2uint
+# if RUBY_VERSION < 30
+# define rb_num2uint dll_rb_num2uint
+# endif
# endif
# define rb_num2dbl dll_rb_num2dbl
# define rb_lastline_get dll_rb_lastline_get
@@ -481,7 +492,7 @@ static rb_encoding* (*dll_rb_enc_find) (const char*);
static VALUE (*dll_rb_enc_str_new) (const char*, long, rb_encoding*);
static VALUE (*dll_rb_sprintf) (const char*, ...);
static VALUE (*dll_rb_require) (const char*);
-static void* (*ruby_options)(int, char**);
+static void* (*dll_ruby_options)(int, char**);
# endif
# if defined(USE_RGENGC) && USE_RGENGC
@@ -492,32 +503,38 @@ static void (*dll_rb_gc_writebarrier_unprotect)(VALUE obj);
# endif
# endif
+# if RUBY_VERSION >= 30
+NORETURN(static void (*dll_ruby_malloc_size_overflow)(size_t, size_t));
+# endif
+
# if RUBY_VERSION >= 26
void rb_ary_detransient_stub(VALUE x);
# endif
-# if (RUBY_VERSION >= 19) && !defined(PROTO)
-# if RUBY_VERSION >= 22
+// Do not generate a prototype here, VALUE isn't always defined.
+# ifndef PROTO
+# if RUBY_VERSION >= 19
+# if RUBY_VERSION >= 22
long
rb_num2long_stub(VALUE x)
-# else
+# else
SIGNED_VALUE
rb_num2long_stub(VALUE x)
-# endif
+# endif
{
return dll_rb_num2long(x);
}
-# if RUBY_VERSION >= 26
+# if RUBY_VERSION >= 26
VALUE
rb_int2big_stub(intptr_t x)
-# else
+# else
VALUE
rb_int2big_stub(SIGNED_VALUE x)
-# endif
+# endif
{
return dll_rb_int2big(x);
}
-# if (RUBY_VERSION >= 19) && (VIM_SIZEOF_INT < VIM_SIZEOF_LONG)
+# if VIM_SIZEOF_INT < VIM_SIZEOF_LONG
long
rb_fix2int_stub(VALUE x)
{
@@ -528,50 +545,65 @@ rb_num2int_stub(VALUE x)
{
return dll_rb_num2int(x);
}
-# endif
-# if RUBY_VERSION >= 20
+# endif
+# if RUBY_VERSION >= 20
VALUE
rb_float_new_in_heap(double d)
{
return dll_rb_float_new(d);
}
-# if RUBY_VERSION >= 22
+# if RUBY_VERSION >= 22
unsigned long
rb_num2ulong(VALUE x)
-# else
+# else
VALUE
rb_num2ulong(VALUE x)
-# endif
+# endif
{
return (long)RSHIFT((SIGNED_VALUE)(x),1);
}
+# endif
# endif
-# endif
-
- // Do not generate a prototype here, VALUE isn't always defined.
-# if defined(USE_RGENGC) && USE_RGENGC && !defined(PROTO)
-# if RUBY_VERSION == 21
+# if defined(USE_RGENGC) && USE_RGENGC
+# if RUBY_VERSION == 21
void
rb_gc_writebarrier_unprotect_promoted_stub(VALUE obj)
{
dll_rb_gc_writebarrier_unprotect_promoted(obj);
}
-# else
+# else
void
rb_gc_writebarrier_unprotect_stub(VALUE obj)
{
dll_rb_gc_writebarrier_unprotect(obj);
}
+# endif
# endif
-# endif
-
-# if RUBY_VERSION >= 26
+# if RUBY_VERSION >= 26
void
rb_ary_detransient_stub(VALUE x)
{
dll_rb_ary_detransient(x);
}
-# endif
+# endif
+# if RUBY_VERSION >= 30
+ void
+rb_check_type_stub(VALUE obj, int t)
+{
+ dll_rb_check_type(obj, t);
+}
+ unsigned long
+rb_num2uint_stub(VALUE x)
+{
+ return dll_rb_num2uint(x);
+}
+ void
+ruby_malloc_size_overflow_stub(size_t x, size_t y)
+{
+ dll_ruby_malloc_size_overflow(x, y);
+}
+# endif
+# endif // ifndef PROTO
static HINSTANCE hinstRuby = NULL; // Instance of ruby.dll
@@ -728,6 +760,9 @@ static struct
{"rb_gc_writebarrier_unprotect", (RUBY_PROC*)&dll_rb_gc_writebarrier_unprotect},
# endif
# endif
+# if RUBY_VERSION >= 30
+ {"ruby_malloc_size_overflow", (RUBY_PROC*)&dll_ruby_malloc_size_overflow},
+# endif
{"", NULL},
};
@@ -1823,7 +1858,7 @@ convert_hash2dict(VALUE key, VALUE val, VALUE arg)
dict_T *d = (dict_T *)arg;
dictitem_T *di;
- di = dictitem_alloc((char_u *)RSTRING_PTR(RSTRING(rb_obj_as_string(key))));
+ di = dictitem_alloc((char_u *)RSTRING_PTR(rb_obj_as_string(key)));
if (di == NULL || ruby_convert_to_vim_value(val, &di->di_tv) != OK
|| dict_add(d, di) != OK)
{
--
2.13.7

View File

@ -0,0 +1,121 @@
From d5a986f460019a924627d79350552f446505cffb Mon Sep 17 00:00:00 2001
From: Bram Moolenaar <Bram@vim.org>
Date: Sun, 6 Dec 2020 21:11:31 +0100
Subject: [PATCH] patch 8.2.2104: build problem with Ruby 2.7
Problem: Build problem with Ruby 2.7.
Solution: Adjust function declarations. (Ozaki Kiichi, closes #7430)
---
src/auto/configure | 3 +--
src/configure.ac | 3 +--
src/if_ruby.c | 28 ++++++++++++++++++++--------
3 files changed, 22 insertions(+), 12 deletions(-)
diff --git a/src/auto/configure b/src/auto/configure
index c50f4bc..9a0c1e6 100755
--- a/src/auto/configure
+++ b/src/auto/configure
@@ -7590,8 +7590,7 @@ $as_echo "$rubyhdrdir" >&6; }
librubyarg=`$vi_cv_path_ruby -r rbconfig -e "print $ruby_rbconfig.expand($ruby_rbconfig::CONFIG['LIBRUBYARG'])"`
librubya=`$vi_cv_path_ruby -r rbconfig -e "print $ruby_rbconfig.expand($ruby_rbconfig::CONFIG['LIBRUBY_A'])"`
rubylibdir=`$vi_cv_path_ruby -r rbconfig -e "print $ruby_rbconfig.expand($ruby_rbconfig::CONFIG['libdir'])"`
- if test -f "$rubylibdir/$librubya"; then
- librubyarg="$librubyarg"
+ if test -f "$rubylibdir/$librubya" || expr "$librubyarg" : "-lruby"; then
RUBY_LIBS="$RUBY_LIBS -L$rubylibdir"
elif test "$librubyarg" = "libruby.a"; then
librubyarg="-lruby"
diff --git a/src/configure.ac b/src/configure.ac
index f0e8371..e796d0e 100644
--- a/src/configure.ac
+++ b/src/configure.ac
@@ -1932,8 +1932,7 @@ if test "$enable_rubyinterp" = "yes" -o "$enable_rubyinterp" = "dynamic"; then
librubyarg=`$vi_cv_path_ruby -r rbconfig -e "print $ruby_rbconfig.expand($ruby_rbconfig::CONFIG[['LIBRUBYARG']])"`
librubya=`$vi_cv_path_ruby -r rbconfig -e "print $ruby_rbconfig.expand($ruby_rbconfig::CONFIG[['LIBRUBY_A']])"`
rubylibdir=`$vi_cv_path_ruby -r rbconfig -e "print $ruby_rbconfig.expand($ruby_rbconfig::CONFIG[['libdir']])"`
- if test -f "$rubylibdir/$librubya"; then
- librubyarg="$librubyarg"
+ if test -f "$rubylibdir/$librubya" || expr "$librubyarg" : "-lruby"; then
RUBY_LIBS="$RUBY_LIBS -L$rubylibdir"
elif test "$librubyarg" = "libruby.a"; then
dnl required on Mac OS 10.3 where libruby.a doesn't exist
diff --git a/src/if_ruby.c b/src/if_ruby.c
index 68d5582..d0f8acf 100644
--- a/src/if_ruby.c
+++ b/src/if_ruby.c
@@ -1296,13 +1296,19 @@ vim_blob(VALUE self UNUSED, VALUE str)
}
static VALUE
-buffer_s_current(void)
+buffer_s_current(VALUE self UNUSED)
{
return buffer_new(curbuf);
}
static VALUE
-buffer_s_count(void)
+buffer_s_current_getter(ID id UNUSED, VALUE *x UNUSED)
+{
+ return buffer_new(curbuf);
+}
+
+ static VALUE
+buffer_s_count(VALUE self UNUSED)
{
buf_T *b;
int n = 0;
@@ -1562,7 +1568,13 @@ get_win(VALUE obj)
}
static VALUE
-window_s_current(void)
+window_s_current(VALUE self UNUSED)
+{
+ return window_new(curwin);
+}
+
+ static VALUE
+window_s_current_getter(ID id UNUSED, VALUE *x UNUSED)
{
return window_new(curwin);
}
@@ -1572,7 +1584,7 @@ window_s_current(void)
* SegPhault - 03/07/05
*/
static VALUE
-line_s_current(void)
+line_s_current(VALUE self UNUSED)
{
return get_buffer_line(curbuf, curwin->w_cursor.lnum);
}
@@ -1584,13 +1596,13 @@ set_current_line(VALUE self UNUSED, VALUE str)
}
static VALUE
-current_line_number(void)
+current_line_number(VALUE self UNUSED)
{
return INT2FIX((int)curwin->w_cursor.lnum);
}
static VALUE
-window_s_count(void)
+window_s_count(VALUE self UNUSED)
{
win_T *w;
int n = 0;
@@ -1790,8 +1802,8 @@ ruby_vim_init(void)
rb_define_method(cVimWindow, "cursor", window_cursor, 0);
rb_define_method(cVimWindow, "cursor=", window_set_cursor, 1);
- rb_define_virtual_variable("$curbuf", buffer_s_current, 0);
- rb_define_virtual_variable("$curwin", window_s_current, 0);
+ rb_define_virtual_variable("$curbuf", buffer_s_current_getter, 0);
+ rb_define_virtual_variable("$curwin", window_s_current_getter, 0);
}
void
--
2.13.7

View File

@ -0,0 +1,61 @@
From 543467136f001708f4c63376ac5d18adde82db30 Mon Sep 17 00:00:00 2001
From: ichizok <gclient.gaap@gmail.com>
Date: Thu, 27 May 2021 18:05:14 +0200
Subject: [PATCH] patch 8.2.2891: cannot build with Perl 5.34
Problem: Cannot build with Perl 5.34.
Solution: Add Perl_SvTRUE_common(). (Ozaki Kiichi, closes #8266,
closes #8250)
---
src/if_perl.xs | 31 ++++++++++++++++++++++++++++++-
1 file changed, 30 insertions(+), 1 deletion(-)
diff --git a/src/if_perl.xs b/src/if_perl.xs
index 99fc3cb..39daa8e 100644
--- a/src/if_perl.xs
+++ b/src/if_perl.xs
@@ -692,12 +692,41 @@ S_POPMARK(pTHX)
/* perl-5.32 needs Perl_POPMARK */
# if (PERL_REVISION == 5) && (PERL_VERSION >= 32)
# define Perl_POPMARK S_POPMARK
+# endif
+
+/* perl-5.34 needs Perl_SvTRUE_common; used in SvTRUE_nomg_NN */
+# if (PERL_REVISION == 5) && (PERL_VERSION >= 34)
+PERL_STATIC_INLINE bool
+Perl_SvTRUE_common(pTHX_ SV * sv, const bool sv_2bool_is_fallback)
+{
+ if (UNLIKELY(SvIMMORTAL_INTERP(sv)))
+ return SvIMMORTAL_TRUE(sv);
+
+ if (! SvOK(sv))
+ return FALSE;
+
+ if (SvPOK(sv))
+ return SvPVXtrue(sv);
+
+ if (SvIOK(sv))
+ return SvIVX(sv) != 0; /* casts to bool */
+
+ if (SvROK(sv) && !(SvOBJECT(SvRV(sv)) && HvAMAGIC(SvSTASH(SvRV(sv)))))
+ return TRUE;
+
+ if (sv_2bool_is_fallback)
+ return sv_2bool_nomg(sv);
+
+ return isGV_with_GP(sv);
+}
+# endif
/* perl-5.32 needs Perl_SvTRUE */
+# if (PERL_REVISION == 5) && (PERL_VERSION >= 32)
PERL_STATIC_INLINE bool
Perl_SvTRUE(pTHX_ SV *sv) {
if (!LIKELY(sv))
- return FALSE;
+ return FALSE;
SvGETMAGIC(sv);
return SvTRUE_nomg_NN(sv);
}
--
2.27.0

View File

@ -0,0 +1,48 @@
From 895a7a472d2eb4413e63cdad3213cb1ef1633458 Mon Sep 17 00:00:00 2001
From: Bram Moolenaar <Bram@vim.org>
Date: Thu, 10 Sep 2020 21:36:11 +0200
Subject: [PATCH] patch 8.2.1655: cannot build with Strawberry Perl 5.32.0
Problem: Cannot build with Strawberry Perl 5.32.0.
Solution: Use Perl_sv_2pvbyte_flags. (closes #6921)
---
src/if_perl.xs | 9 +++++++++
1 file changed, 9 insertions(+)
diff --git a/src/if_perl.xs b/src/if_perl.xs
index 2049509..9f59d39 100644
--- a/src/if_perl.xs
+++ b/src/if_perl.xs
@@ -236,6 +236,9 @@ typedef int perl_key;
# else
# define Perl_sv_2pv dll_Perl_sv_2pv
# endif
+# if (PERL_REVISION == 5) && (PERL_VERSION >= 32)
+# define Perl_sv_2pvbyte_flags dll_Perl_sv_2pvbyte_flags
+# endif
# define Perl_sv_2pvbyte dll_Perl_sv_2pvbyte
# define Perl_sv_bless dll_Perl_sv_bless
# if (PERL_REVISION == 5) && (PERL_VERSION >= 8)
@@ -390,6 +393,9 @@ static char* (*Perl_sv_2pv_nolen)(pTHX_ SV*);
static char* (*Perl_sv_2pv)(pTHX_ SV*, STRLEN*);
# endif
static char* (*Perl_sv_2pvbyte)(pTHX_ SV*, STRLEN*);
+# if (PERL_REVISION == 5) && (PERL_VERSION >= 32)
+static char* (*Perl_sv_2pvbyte_flags)(pTHX_ SV*, STRLEN*, I32);
+# endif
static SV* (*Perl_sv_bless)(pTHX_ SV*, HV*);
# if (PERL_REVISION == 5) && (PERL_VERSION >= 8)
static void (*Perl_sv_catpvn_flags)(pTHX_ SV* , const char*, STRLEN, I32);
@@ -546,6 +552,9 @@ static struct {
{"Perl_sv_2pv", (PERL_PROC*)&Perl_sv_2pv},
# endif
{"Perl_sv_2pvbyte", (PERL_PROC*)&Perl_sv_2pvbyte},
+# if (PERL_REVISION == 5) && (PERL_VERSION >= 32)
+ {"Perl_sv_2pvbyte_flags", (PERL_PROC*)&Perl_sv_2pvbyte_flags},
+# endif
# ifdef PERL589_OR_LATER
{"Perl_sv_2iv_flags", (PERL_PROC*)&Perl_sv_2iv_flags},
{"Perl_newXS_flags", (PERL_PROC*)&Perl_newXS_flags},
--
2.13.7

View File

@ -0,0 +1,57 @@
From 9d20daffc296b9eb901fb14bdd83620ea55d440a Mon Sep 17 00:00:00 2001
From: Bram Moolenaar <Bram@vim.org>
Date: Mon, 1 Feb 2021 19:31:47 +0100
Subject: [PATCH] patch 8.2.2448: compilation error with Ruby 3.0
Problem: Compilation error with Ruby 3.0.
Solution: Adjust #ifdefs and declaration. (Ken Takata, closes #7761)
---
src/if_ruby.c | 10 +++++++---
1 file changed, 7 insertions(+), 3 deletions(-)
diff --git a/src/if_ruby.c b/src/if_ruby.c
index d21a655..6522d07 100644
--- a/src/if_ruby.c
+++ b/src/if_ruby.c
@@ -416,7 +416,7 @@ static VALUE (*dll_rb_hash_new) (void);
static VALUE (*dll_rb_inspect) (VALUE);
static VALUE (*dll_rb_int2inum) (long);
static ID (*dll_rb_intern) (const char*);
-# if VIM_SIZEOF_INT < VIM_SIZEOF_LONG // 64 bits only
+# if RUBY_VERSION >= 30 || VIM_SIZEOF_INT < VIM_SIZEOF_LONG
static long (*dll_rb_fix2int) (VALUE);
static long (*dll_rb_num2int) (VALUE);
static unsigned long (*dll_rb_num2uint) (VALUE);
@@ -504,7 +504,11 @@ static void (*dll_rb_gc_writebarrier_unprotect)(VALUE obj);
# endif
# if RUBY_VERSION >= 30
+# ifdef _MSC_VER
+static void (*dll_ruby_malloc_size_overflow)(size_t, size_t);
+# else
NORETURN(static void (*dll_ruby_malloc_size_overflow)(size_t, size_t));
+# endif
# endif
# if RUBY_VERSION >= 26
@@ -534,7 +538,7 @@ rb_int2big_stub(SIGNED_VALUE x)
{
return dll_rb_int2big(x);
}
-# if VIM_SIZEOF_INT < VIM_SIZEOF_LONG
+# if RUBY_VERSION >= 30 || VIM_SIZEOF_INT < VIM_SIZEOF_LONG
long
rb_fix2int_stub(VALUE x)
{
@@ -673,7 +677,7 @@ static struct
{"rb_inspect", (RUBY_PROC*)&dll_rb_inspect},
{"rb_int2inum", (RUBY_PROC*)&dll_rb_int2inum},
{"rb_intern", (RUBY_PROC*)&dll_rb_intern},
-# if VIM_SIZEOF_INT < VIM_SIZEOF_LONG // 64 bits only
+# if RUBY_VERSION >= 30 || VIM_SIZEOF_INT < VIM_SIZEOF_LONG
{"rb_fix2int", (RUBY_PROC*)&dll_rb_fix2int},
{"rb_num2int", (RUBY_PROC*)&dll_rb_num2int},
{"rb_num2uint", (RUBY_PROC*)&dll_rb_num2uint},
--
2.13.7

View File

@ -0,0 +1,136 @@
From ee1b93169d21896e5401a54a5189c9465abb7bc9 Mon Sep 17 00:00:00 2001
From: Bram Moolenaar <Bram@vim.org>
Date: Thu, 16 Jul 2020 22:15:53 +0200
Subject: [PATCH] patch 8.2.1225: linker errors when building with dynamic
Python 3.9
Problem: Linker errors when building with dynamic Python 3.9.
Solution: Add #defined items. (closes #6461)
---
src/if_python3.c | 40 +++++++++++++++++++++++++++++++++++++---
1 file changed, 37 insertions(+), 3 deletions(-)
diff --git a/src/if_python3.c b/src/if_python3.c
index 68da288..45dc308 100644
--- a/src/if_python3.c
+++ b/src/if_python3.c
@@ -203,6 +203,9 @@ typedef PySliceObject PySliceObject_T;
# define PySys_GetObject py3_PySys_GetObject
# define PySys_SetArgv py3_PySys_SetArgv
# define PyType_Ready py3_PyType_Ready
+# if PY_VERSION_HEX >= 0x030900b0
+# define PyType_GetFlags py3_PyType_GetFlags
+# endif
#undef Py_BuildValue
# define Py_BuildValue py3_Py_BuildValue
# define Py_SetPythonHome py3_Py_SetPythonHome
@@ -233,6 +236,9 @@ typedef PySliceObject PySliceObject_T;
# define PyBytes_FromString py3_PyBytes_FromString
# undef PyBytes_FromStringAndSize
# define PyBytes_FromStringAndSize py3_PyBytes_FromStringAndSize
+# if defined(Py_DEBUG) || PY_VERSION_HEX >= 0x030900b0
+# define _Py_Dealloc py3__Py_Dealloc
+# endif
# define PyFloat_FromDouble py3_PyFloat_FromDouble
# define PyFloat_AsDouble py3_PyFloat_AsDouble
# define PyObject_GenericGetAttr py3_PyObject_GenericGetAttr
@@ -247,7 +253,6 @@ typedef PySliceObject PySliceObject_T;
# ifdef Py_DEBUG
# define _Py_NegativeRefcount py3__Py_NegativeRefcount
# define _Py_RefTotal (*py3__Py_RefTotal)
-# define _Py_Dealloc py3__Py_Dealloc
# define PyModule_Create2TraceRefs py3_PyModule_Create2TraceRefs
# else
# define PyModule_Create2 py3_PyModule_Create2
@@ -287,6 +292,10 @@ typedef PySliceObject PySliceObject_T;
# define PyObject_NEW(type, typeobj) \
( (type *) PyObject_Init( \
(PyObject *) _PyObject_DebugMalloc( _PyObject_SIZE(typeobj) ), (typeobj)) )
+# elif PY_VERSION_HEX >= 0x030900b0
+# undef PyObject_NEW
+# define PyObject_NEW(type, typeobj) \
+ ((type *)py3__PyObject_New(typeobj))
# endif
/*
@@ -352,6 +361,9 @@ static PyObject* (*py3_PyObject_Repr)(PyObject *);
static PyObject* (*py3_PyObject_GetItem)(PyObject *, PyObject *);
static int (*py3_PyObject_IsTrue)(PyObject *);
static PyObject* (*py3_Py_BuildValue)(char *, ...);
+# if PY_VERSION_HEX >= 0x030900b0
+static int (*py3_PyType_GetFlags)(PyTypeObject *o);
+# endif
static int (*py3_PyType_Ready)(PyTypeObject *type);
static int (*py3_PyDict_SetItemString)(PyObject *dp, char *key, PyObject *item);
static PyObject* (*py3_PyUnicode_FromString)(const char *u);
@@ -396,6 +408,12 @@ static char* (*py3_PyBytes_AsString)(PyObject *bytes);
static int (*py3_PyBytes_AsStringAndSize)(PyObject *bytes, char **buffer, Py_ssize_t *length);
static PyObject* (*py3_PyBytes_FromString)(char *str);
static PyObject* (*py3_PyBytes_FromStringAndSize)(char *str, Py_ssize_t length);
+# if defined(Py_DEBUG) || PY_VERSION_HEX >= 0x030900b0
+static void (*py3__Py_Dealloc)(PyObject *obj);
+# endif
+# if PY_VERSION_HEX >= 0x030900b0
+static PyObject* (*py3__PyObject_New)(PyTypeObject *);
+# endif
static PyObject* (*py3_PyFloat_FromDouble)(double num);
static double (*py3_PyFloat_AsDouble)(PyObject *);
static PyObject* (*py3_PyObject_GenericGetAttr)(PyObject *obj, PyObject *name);
@@ -414,7 +432,6 @@ static void* (*py3_PyCapsule_GetPointer)(PyObject *, char *);
# ifdef Py_DEBUG
static void (*py3__Py_NegativeRefcount)(const char *fname, int lineno, PyObject *op);
static Py_ssize_t* py3__Py_RefTotal;
-static void (*py3__Py_Dealloc)(PyObject *obj);
static PyObject* (*py3_PyModule_Create2TraceRefs)(struct PyModuleDef* module, int module_api_version);
# else
static PyObject* (*py3_PyModule_Create2)(struct PyModuleDef* module, int module_api_version);
@@ -525,6 +542,9 @@ static struct
{"PyObject_IsTrue", (PYTHON_PROC*)&py3_PyObject_IsTrue},
{"PyLong_FromLong", (PYTHON_PROC*)&py3_PyLong_FromLong},
{"PyDict_New", (PYTHON_PROC*)&py3_PyDict_New},
+# if PY_VERSION_HEX >= 0x030900b0
+ {"PyType_GetFlags", (PYTHON_PROC*)&py3_PyType_GetFlags},
+# endif
{"PyType_Ready", (PYTHON_PROC*)&py3_PyType_Ready},
{"PyDict_SetItemString", (PYTHON_PROC*)&py3_PyDict_SetItemString},
{"PyLong_AsLong", (PYTHON_PROC*)&py3_PyLong_AsLong},
@@ -562,6 +582,12 @@ static struct
{"PyBytes_AsStringAndSize", (PYTHON_PROC*)&py3_PyBytes_AsStringAndSize},
{"PyBytes_FromString", (PYTHON_PROC*)&py3_PyBytes_FromString},
{"PyBytes_FromStringAndSize", (PYTHON_PROC*)&py3_PyBytes_FromStringAndSize},
+# if defined(Py_DEBUG) || PY_VERSION_HEX >= 0x030900b0
+ {"_Py_Dealloc", (PYTHON_PROC*)&py3__Py_Dealloc},
+# endif
+# if PY_VERSION_HEX >= 0x030900b0
+ {"_PyObject_New", (PYTHON_PROC*)&py3__PyObject_New},
+# endif
{"PyFloat_FromDouble", (PYTHON_PROC*)&py3_PyFloat_FromDouble},
{"PyFloat_AsDouble", (PYTHON_PROC*)&py3_PyFloat_AsDouble},
{"PyObject_GenericGetAttr", (PYTHON_PROC*)&py3_PyObject_GenericGetAttr},
@@ -578,7 +604,6 @@ static struct
# ifdef Py_DEBUG
{"_Py_NegativeRefcount", (PYTHON_PROC*)&py3__Py_NegativeRefcount},
{"_Py_RefTotal", (PYTHON_PROC*)&py3__Py_RefTotal},
- {"_Py_Dealloc", (PYTHON_PROC*)&py3__Py_Dealloc},
{"PyModule_Create2TraceRefs", (PYTHON_PROC*)&py3_PyModule_Create2TraceRefs},
# else
{"PyModule_Create2", (PYTHON_PROC*)&py3_PyModule_Create2},
@@ -634,6 +659,15 @@ py3__Py_XDECREF(PyObject *op)
# define Py_XDECREF(op) py3__Py_XDECREF(_PyObject_CAST(op))
# endif
+# if PY_VERSION_HEX >= 0x030900b0
+ static inline int
+py3_PyType_HasFeature(PyTypeObject *type, unsigned long feature)
+{
+ return ((PyType_GetFlags(type) & feature) != 0);
+}
+# define PyType_HasFeature(t,f) py3_PyType_HasFeature(t,f)
+# endif
+
/*
* Free python.dll
*/
--
1.8.3.1

View File

@ -0,0 +1,642 @@
From 41a4141ecb36cd871c6e87f6fbc12fa81653b6be Mon Sep 17 00:00:00 2001
From: Bram Moolenaar <Bram@vim.org>
Date: Tue, 7 Jan 2020 21:32:19 +0100
Subject: [PATCH] patch 8.2.0100: macros for Ruby are too complicated
Problem: Macros for Ruby are too complicated.
Solution: Do not use DYNAMIC_RUBY_VER, use RUBY_VERSION. (Ken Takata,
closes #5452)
---
src/Make_cyg_ming.mak | 3 -
src/Make_mvc.mak | 5 +-
src/auto/configure | 2 +-
src/configure.ac | 2 +-
src/if_ruby.c | 164 +++++++++++++++++++++---------------------
5 files changed, 86 insertions(+), 90 deletions(-)
diff --git a/src/Make_cyg_ming.mak b/src/Make_cyg_ming.mak
index 3c878cbfb..f9c795bfe 100644
--- a/src/Make_cyg_ming.mak
+++ b/src/Make_cyg_ming.mak
@@ -569,11 +569,8 @@ ifdef RUBY
CFLAGS += -DFEAT_RUBY $(RUBYINC)
ifeq (yes, $(DYNAMIC_RUBY))
CFLAGS += -DDYNAMIC_RUBY -DDYNAMIC_RUBY_DLL=\"$(RUBY_INSTALL_NAME).dll\"
-CFLAGS += -DDYNAMIC_RUBY_VER=$(RUBY_VER)
endif
- ifeq (no, $(DYNAMIC_RUBY))
CFLAGS += -DRUBY_VERSION=$(RUBY_VER)
- endif
ifneq ($(findstring w64-mingw32,$(CC)),)
# A workaround for MinGW-w64
CFLAGS += -DHAVE_STRUCT_TIMESPEC -DHAVE_STRUCT_TIMEZONE
diff --git a/src/Make_mvc.mak b/src/Make_mvc.mak
index 8694f7496..eb7129614 100644
--- a/src/Make_mvc.mak
+++ b/src/Make_mvc.mak
@@ -1193,10 +1193,11 @@ RUBY_LIB = $(RUBY)\lib\$(RUBY_INSTALL_NAME).lib
# Do we want to load Ruby dynamically?
! if "$(DYNAMIC_RUBY)" == "yes"
! message Ruby DLL will be loaded dynamically
-CFLAGS = $(CFLAGS) -DDYNAMIC_RUBY -DDYNAMIC_RUBY_VER=$(RUBY_VER) \
- -DDYNAMIC_RUBY_DLL=\"$(RUBY_INSTALL_NAME).dll\"
+CFLAGS = $(CFLAGS) -DDYNAMIC_RUBY \
+ -DDYNAMIC_RUBY_DLL=\"$(RUBY_INSTALL_NAME).dll\"
! undef RUBY_LIB
! endif
+CFLAGS = $(CFLAGS) -DRUBY_VERSION=$(RUBY_VER)
!endif # RUBY
#
diff --git a/src/auto/configure b/src/auto/configure
index 993049573..1b5094e97 100755
--- a/src/auto/configure
+++ b/src/auto/configure
@@ -7622,7 +7622,7 @@ $as_echo "$rubyhdrdir" >&6; }
fi
$as_echo "#define DYNAMIC_RUBY 1" >>confdefs.h
- RUBY_CFLAGS="-DDYNAMIC_RUBY_DLL=\\\"$libruby_soname\\\" -DDYNAMIC_RUBY_VER=$rubyversion $RUBY_CFLAGS"
+ RUBY_CFLAGS="-DDYNAMIC_RUBY_DLL=\\\"$libruby_soname\\\" $RUBY_CFLAGS"
RUBY_LIBS=
fi
else
diff --git a/src/configure.ac b/src/configure.ac
index d440a465c..a098da82e 100644
--- a/src/configure.ac
+++ b/src/configure.ac
@@ -1966,7 +1966,7 @@ if test "$enable_rubyinterp" = "yes" -o "$enable_rubyinterp" = "dynamic"; then
libruby_soname=`$vi_cv_path_ruby -r rbconfig -e "puts $ruby_rbconfig::CONFIG[['LIBRUBY_SO']]"`
fi
AC_DEFINE(DYNAMIC_RUBY)
- RUBY_CFLAGS="-DDYNAMIC_RUBY_DLL=\\\"$libruby_soname\\\" -DDYNAMIC_RUBY_VER=$rubyversion $RUBY_CFLAGS"
+ RUBY_CFLAGS="-DDYNAMIC_RUBY_DLL=\\\"$libruby_soname\\\" $RUBY_CFLAGS"
RUBY_LIBS=
fi
else
diff --git a/src/if_ruby.c b/src/if_ruby.c
index 00783c8d7..68d55821f 100644
--- a/src/if_ruby.c
+++ b/src/if_ruby.c
@@ -20,7 +20,7 @@
#include <string.h>
#ifdef _WIN32
-# if !defined(DYNAMIC_RUBY_VER) || (DYNAMIC_RUBY_VER < 18)
+# if !defined(DYNAMIC_RUBY) || (RUBY_VERSION < 18)
# define NT
# endif
# ifndef DYNAMIC_RUBY
@@ -32,7 +32,7 @@
# define RUBYEXTERN extern
#endif
-#if defined(DYNAMIC_RUBY_VER) && DYNAMIC_RUBY_VER >= 24
+#if defined(DYNAMIC_RUBY) && RUBY_VERSION >= 24
# define USE_RUBY_INTEGER
#endif
@@ -47,14 +47,14 @@
# if defined(USE_RUBY_INTEGER)
# define rb_cInteger (*dll_rb_cInteger)
# endif
-# if defined(DYNAMIC_RUBY_VER) && DYNAMIC_RUBY_VER >= 20
+# if RUBY_VERSION >= 20
# define rb_cFloat (*dll_rb_cFloat)
# endif
# define rb_cNilClass (*dll_rb_cNilClass)
# define rb_cString (*dll_rb_cString)
# define rb_cSymbol (*dll_rb_cSymbol)
# define rb_cTrueClass (*dll_rb_cTrueClass)
-# if defined(DYNAMIC_RUBY_VER) && DYNAMIC_RUBY_VER >= 18
+# if RUBY_VERSION >= 18
/*
* On ver 1.8, all Ruby functions are exported with "__declspec(dllimport)"
* in ruby.h. But it causes trouble for these variables, because it is
@@ -71,29 +71,14 @@
# undef _WIN32_WINNT
#endif
-#if (defined(RUBY_VERSION) && RUBY_VERSION >= 19) \
- || (defined(DYNAMIC_RUBY_VER) && DYNAMIC_RUBY_VER >= 19)
-# define RUBY19_OR_LATER 1
-#endif
-
-#if (defined(RUBY_VERSION) && RUBY_VERSION >= 20) \
- || (defined(DYNAMIC_RUBY_VER) && DYNAMIC_RUBY_VER >= 20)
-# define RUBY20_OR_LATER 1
-#endif
-
-#if (defined(RUBY_VERSION) && RUBY_VERSION >= 21) \
- || (defined(DYNAMIC_RUBY_VER) && DYNAMIC_RUBY_VER >= 21)
-# define RUBY21_OR_LATER 1
-#endif
-
-#if defined(DYNAMIC_RUBY_VER) && DYNAMIC_RUBY_VER >= 19
+#if defined(DYNAMIC_RUBY) && 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
#endif
-#if defined(DYNAMIC_RUBY_VER) && DYNAMIC_RUBY_VER >= 19 \
+#if defined(DYNAMIC_RUBY) && RUBY_VERSION >= 19 \
&& 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)
@@ -101,24 +86,24 @@
# define rb_num2int rb_num2int_stub
#endif
-#if defined(DYNAMIC_RUBY_VER) && DYNAMIC_RUBY_VER == 21
+#if defined(DYNAMIC_RUBY) && 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
#endif
-#if defined(DYNAMIC_RUBY_VER) && DYNAMIC_RUBY_VER >= 22
+#if defined(DYNAMIC_RUBY) && RUBY_VERSION >= 22
# define rb_gc_writebarrier_unprotect rb_gc_writebarrier_unprotect_stub
#endif
-#if defined(DYNAMIC_RUBY_VER) && DYNAMIC_RUBY_VER >= 26
+#if defined(DYNAMIC_RUBY) && RUBY_VERSION >= 26
# define rb_ary_detransient rb_ary_detransient_stub
#endif
#include <ruby.h>
-#ifdef RUBY19_OR_LATER
+#if RUBY_VERSION >= 19
# include <ruby/encoding.h>
#endif
-#ifndef RUBY19_OR_LATER
+#if RUBY_VERSION <= 18
# include <st.h> // for ST_STOP and ST_CONTINUE
#endif
@@ -139,7 +124,7 @@
* The old Data_XXX macro family was deprecated on Ruby 2.2.
* Use TypedData_XXX if available.
*/
-#if defined(TypedData_Wrap_Struct) && defined(RUBY20_OR_LATER)
+#if defined(TypedData_Wrap_Struct) && (RUBY_VERSION >= 20)
# define USE_TYPEDDATA 1
#endif
@@ -210,7 +195,7 @@ static void ruby_io_init(void);
static void ruby_vim_init(void);
static int ruby_convert_to_vim_value(VALUE val, typval_T *rettv);
-#if defined(RUBY19_OR_LATER) || defined(RUBY_INIT_STACK)
+#if (RUBY_VERSION >= 19) || defined(RUBY_INIT_STACK)
# if defined(__ia64) && !defined(ruby_init_stack)
# define ruby_init_stack(addr) ruby_init_stack((addr), rb_ia64_bsp())
# endif
@@ -233,7 +218,7 @@ static int ruby_convert_to_vim_value(VALUE val, typval_T *rettv);
# endif
# define rb_class_path dll_rb_class_path
# ifdef USE_TYPEDDATA
-# if defined(DYNAMIC_RUBY_VER) && DYNAMIC_RUBY_VER >= 23
+# if RUBY_VERSION >= 23
# define rb_data_typed_object_wrap dll_rb_data_typed_object_wrap
# else
# define rb_data_typed_object_alloc dll_rb_data_typed_object_alloc
@@ -256,7 +241,7 @@ static int ruby_convert_to_vim_value(VALUE val, typval_T *rettv);
# define rb_eRuntimeError (*dll_rb_eRuntimeError)
# define rb_eStandardError (*dll_rb_eStandardError)
# define rb_eval_string_protect dll_rb_eval_string_protect
-# ifdef RUBY21_OR_LATER
+# if RUBY_VERSION >= 21
# define rb_funcallv dll_rb_funcallv
# else
# define rb_funcall2 dll_rb_funcall2
@@ -274,7 +259,7 @@ static int ruby_convert_to_vim_value(VALUE val, typval_T *rettv);
# define rb_intern dll_rb_intern
# if VIM_SIZEOF_INT < VIM_SIZEOF_LONG // 64 bits only
-# if defined(DYNAMIC_RUBY_VER) && DYNAMIC_RUBY_VER <= 18
+# if RUBY_VERSION <= 18
# define rb_fix2int dll_rb_fix2int
# define rb_num2int dll_rb_num2int
# endif
@@ -285,10 +270,10 @@ static int ruby_convert_to_vim_value(VALUE val, typval_T *rettv);
# define rb_lastline_set dll_rb_lastline_set
# define rb_protect dll_rb_protect
# define rb_load dll_rb_load
-# ifndef RUBY19_OR_LATER
+# if RUBY_VERSION <= 18
# define rb_num2long dll_rb_num2long
# endif
-# if defined(DYNAMIC_RUBY_VER) && DYNAMIC_RUBY_VER <= 19
+# if RUBY_VERSION <= 19
# define rb_num2ulong dll_rb_num2ulong
# endif
# define rb_obj_alloc dll_rb_obj_alloc
@@ -309,7 +294,7 @@ static int ruby_convert_to_vim_value(VALUE val, typval_T *rettv);
# else
# define rb_str_new2 dll_rb_str_new2
# endif
-# if defined(DYNAMIC_RUBY_VER) && DYNAMIC_RUBY_VER >= 18
+# if RUBY_VERSION >= 18
# define rb_string_value dll_rb_string_value
# define rb_string_value_ptr dll_rb_string_value_ptr
# define rb_float_new dll_rb_float_new
@@ -320,7 +305,7 @@ static int ruby_convert_to_vim_value(VALUE val, typval_T *rettv);
# endif
# define rb_ary_new4 dll_rb_ary_new4
# define rb_ary_push dll_rb_ary_push
-# if defined(RUBY19_OR_LATER) || defined(RUBY_INIT_STACK)
+# if (RUBY_VERSION >= 19) || defined(RUBY_INIT_STACK)
# ifdef __ia64
# define rb_ia64_bsp dll_rb_ia64_bsp
# undef ruby_init_stack
@@ -332,7 +317,7 @@ static int ruby_convert_to_vim_value(VALUE val, typval_T *rettv);
# else
# define rb_str2cstr dll_rb_str2cstr
# endif
-# ifdef RUBY19_OR_LATER
+# if RUBY_VERSION >= 19
# define rb_errinfo dll_rb_errinfo
# else
# define ruby_errinfo (*dll_ruby_errinfo)
@@ -340,17 +325,17 @@ static int ruby_convert_to_vim_value(VALUE val, typval_T *rettv);
# define ruby_init dll_ruby_init
# define ruby_init_loadpath dll_ruby_init_loadpath
# ifdef MSWIN
-# ifdef RUBY19_OR_LATER
+# if RUBY_VERSION >= 19
# define ruby_sysinit dll_ruby_sysinit
# else
# define NtInitialize dll_NtInitialize
# endif
-# if defined(DYNAMIC_RUBY_VER) && DYNAMIC_RUBY_VER >= 18
+# if RUBY_VERSION >= 18
# define rb_w32_snprintf dll_rb_w32_snprintf
# endif
# endif
-# ifdef RUBY19_OR_LATER
+# if RUBY_VERSION >= 19
# define ruby_script dll_ruby_script
# define rb_enc_find_index dll_rb_enc_find_index
# define rb_enc_find dll_rb_enc_find
@@ -370,7 +355,7 @@ VALUE *dll_rb_cFixnum;
# if defined(USE_RUBY_INTEGER)
VALUE *dll_rb_cInteger;
# endif
-# if defined(DYNAMIC_RUBY_VER) && DYNAMIC_RUBY_VER >= 20
+# if RUBY_VERSION >= 20
VALUE *dll_rb_cFloat;
# endif
VALUE *dll_rb_cNilClass;
@@ -385,7 +370,7 @@ static void *(*dll_rb_check_typeddata) (VALUE,const rb_data_type_t *);
# endif
static VALUE (*dll_rb_class_path) (VALUE);
# ifdef USE_TYPEDDATA
-# if defined(DYNAMIC_RUBY_VER) && DYNAMIC_RUBY_VER >= 23
+# if RUBY_VERSION >= 23
static VALUE (*dll_rb_data_typed_object_wrap) (VALUE, void*, const rb_data_type_t *);
# else
static VALUE (*dll_rb_data_typed_object_alloc) (VALUE, void*, const rb_data_type_t *);
@@ -408,7 +393,7 @@ static VALUE *dll_rb_eIndexError;
static VALUE *dll_rb_eRuntimeError;
static VALUE *dll_rb_eStandardError;
static VALUE (*dll_rb_eval_string_protect) (const char*, int*);
-# ifdef RUBY21_OR_LATER
+# if RUBY_VERSION >= 21
static VALUE (*dll_rb_funcallv) (VALUE, ID, int, const VALUE*);
# else
static VALUE (*dll_rb_funcall2) (VALUE, ID, int, const VALUE*);
@@ -436,7 +421,7 @@ static VALUE (*dll_rb_obj_alloc) (VALUE);
static VALUE (*dll_rb_obj_as_string) (VALUE);
static VALUE (*dll_rb_obj_id) (VALUE);
static void (*dll_rb_raise) (VALUE, const char*, ...);
-# if defined(DYNAMIC_RUBY_VER) && DYNAMIC_RUBY_VER >= 18
+# if RUBY_VERSION >= 18
static VALUE (*dll_rb_string_value) (volatile VALUE*);
# else
static char *(*dll_rb_str2cstr) (VALUE,int*);
@@ -450,7 +435,7 @@ static VALUE (*dll_rb_str_new_cstr) (const char*);
# else
static VALUE (*dll_rb_str_new2) (const char*);
# endif
-# ifdef RUBY19_OR_LATER
+# if RUBY_VERSION >= 19
static VALUE (*dll_rb_errinfo) (void);
# else
static VALUE *dll_ruby_errinfo;
@@ -458,25 +443,25 @@ static VALUE *dll_ruby_errinfo;
static void (*dll_ruby_init) (void);
static void (*dll_ruby_init_loadpath) (void);
# ifdef MSWIN
-# ifdef RUBY19_OR_LATER
+# if RUBY_VERSION >= 19
static void (*dll_ruby_sysinit) (int*, char***);
# else
static void (*dll_NtInitialize) (int*, char***);
# endif
-# if defined(DYNAMIC_RUBY_VER) && DYNAMIC_RUBY_VER >= 18
+# if RUBY_VERSION >= 18
static int (*dll_rb_w32_snprintf)(char*, size_t, const char*, ...);
# endif
# endif
-# if defined(DYNAMIC_RUBY_VER) && DYNAMIC_RUBY_VER >= 18
+# if RUBY_VERSION >= 18
static char * (*dll_rb_string_value_ptr) (volatile VALUE*);
static VALUE (*dll_rb_float_new) (double);
static VALUE (*dll_rb_ary_new) (void);
static VALUE (*dll_rb_ary_new4) (long n, const VALUE *elts);
static VALUE (*dll_rb_ary_push) (VALUE, VALUE);
-# if DYNAMIC_RUBY_VER >= 26
+# if RUBY_VERSION >= 26
static void (*dll_rb_ary_detransient) (VALUE);
# endif
-# if defined(RUBY19_OR_LATER) || defined(RUBY_INIT_STACK)
+# if (RUBY_VERSION >= 19) || defined(RUBY_INIT_STACK)
# ifdef __ia64
static void * (*dll_rb_ia64_bsp) (void);
static void (*dll_ruby_init_stack)(VALUE*, void*);
@@ -485,11 +470,11 @@ static void (*dll_ruby_init_stack)(VALUE*);
# endif
# endif
# endif
-# ifdef RUBY19_OR_LATER
+# if RUBY_VERSION >= 19
static VALUE (*dll_rb_int2big)(SIGNED_VALUE);
# endif
-# ifdef RUBY19_OR_LATER
+# if RUBY_VERSION >= 19
static void (*dll_ruby_script) (const char*);
static int (*dll_rb_enc_find_index) (const char*);
static rb_encoding* (*dll_rb_enc_find) (const char*);
@@ -500,15 +485,15 @@ static void* (*ruby_options)(int, char**);
# endif
# if defined(USE_RGENGC) && USE_RGENGC
-# if defined(DYNAMIC_RUBY_VER) && DYNAMIC_RUBY_VER == 21
+# if RUBY_VERSION == 21
static void (*dll_rb_gc_writebarrier_unprotect_promoted)(VALUE);
# else
static void (*dll_rb_gc_writebarrier_unprotect)(VALUE obj);
# endif
# endif
-# if defined(RUBY19_OR_LATER) && !defined(PROTO)
-# if defined(DYNAMIC_RUBY_VER) && DYNAMIC_RUBY_VER >= 22
+# if (RUBY_VERSION >= 19) && !defined(PROTO)
+# if RUBY_VERSION >= 22
long
rb_num2long_stub(VALUE x)
# else
@@ -518,7 +503,7 @@ rb_num2long_stub(VALUE x)
{
return dll_rb_num2long(x);
}
-# if defined(DYNAMIC_RUBY_VER) && DYNAMIC_RUBY_VER >= 26
+# if RUBY_VERSION >= 26
VALUE
rb_int2big_stub(intptr_t x)
# else
@@ -528,8 +513,7 @@ rb_int2big_stub(SIGNED_VALUE x)
{
return dll_rb_int2big(x);
}
-# if defined(DYNAMIC_RUBY_VER) && DYNAMIC_RUBY_VER >= 19 \
- && VIM_SIZEOF_INT < VIM_SIZEOF_LONG
+# if (RUBY_VERSION >= 19) && (VIM_SIZEOF_INT < VIM_SIZEOF_LONG)
long
rb_fix2int_stub(VALUE x)
{
@@ -541,13 +525,13 @@ rb_num2int_stub(VALUE x)
return dll_rb_num2int(x);
}
# endif
-# if defined(DYNAMIC_RUBY_VER) && DYNAMIC_RUBY_VER >= 20
+# if RUBY_VERSION >= 20
VALUE
rb_float_new_in_heap(double d)
{
return dll_rb_float_new(d);
}
-# if defined(DYNAMIC_RUBY_VER) && DYNAMIC_RUBY_VER >= 22
+# if RUBY_VERSION >= 22
unsigned long
rb_num2ulong(VALUE x)
# else
@@ -562,7 +546,7 @@ rb_num2ulong(VALUE x)
// Do not generate a prototype here, VALUE isn't always defined.
# if defined(USE_RGENGC) && USE_RGENGC && !defined(PROTO)
-# if defined(DYNAMIC_RUBY_VER) && DYNAMIC_RUBY_VER == 21
+# if RUBY_VERSION == 21
void
rb_gc_writebarrier_unprotect_promoted_stub(VALUE obj)
{
@@ -577,7 +561,7 @@ rb_gc_writebarrier_unprotect_stub(VALUE obj)
# endif
# endif
-# if defined(DYNAMIC_RUBY_VER) && DYNAMIC_RUBY_VER >= 26
+# if RUBY_VERSION >= 26
void
rb_ary_detransient_stub(VALUE x)
{
@@ -603,7 +587,7 @@ static struct
# else
{"rb_cFixnum", (RUBY_PROC*)&dll_rb_cFixnum},
# endif
-# if defined(DYNAMIC_RUBY_VER) && DYNAMIC_RUBY_VER >= 20
+# if RUBY_VERSION >= 20
{"rb_cFloat", (RUBY_PROC*)&dll_rb_cFloat},
# endif
{"rb_cNilClass", (RUBY_PROC*)&dll_rb_cNilClass},
@@ -618,7 +602,7 @@ static struct
# endif
{"rb_class_path", (RUBY_PROC*)&dll_rb_class_path},
# ifdef USE_TYPEDDATA
-# if defined(DYNAMIC_RUBY_VER) && DYNAMIC_RUBY_VER >= 23
+# if RUBY_VERSION >= 23
{"rb_data_typed_object_wrap", (RUBY_PROC*)&dll_rb_data_typed_object_wrap},
# else
{"rb_data_typed_object_alloc", (RUBY_PROC*)&dll_rb_data_typed_object_alloc},
@@ -641,7 +625,7 @@ static struct
{"rb_eRuntimeError", (RUBY_PROC*)&dll_rb_eRuntimeError},
{"rb_eStandardError", (RUBY_PROC*)&dll_rb_eStandardError},
{"rb_eval_string_protect", (RUBY_PROC*)&dll_rb_eval_string_protect},
-# ifdef RUBY21_OR_LATER
+# if RUBY_VERSION >= 21
{"rb_funcallv", (RUBY_PROC*)&dll_rb_funcallv},
# else
{"rb_funcall2", (RUBY_PROC*)&dll_rb_funcall2},
@@ -669,7 +653,7 @@ static struct
{"rb_obj_as_string", (RUBY_PROC*)&dll_rb_obj_as_string},
{"rb_obj_id", (RUBY_PROC*)&dll_rb_obj_id},
{"rb_raise", (RUBY_PROC*)&dll_rb_raise},
-# if defined(DYNAMIC_RUBY_VER) && DYNAMIC_RUBY_VER >= 18
+# if RUBY_VERSION >= 18
{"rb_string_value", (RUBY_PROC*)&dll_rb_string_value},
# else
{"rb_str2cstr", (RUBY_PROC*)&dll_rb_str2cstr},
@@ -682,7 +666,7 @@ static struct
# else
{"rb_str_new2", (RUBY_PROC*)&dll_rb_str_new2},
# endif
-# ifdef RUBY19_OR_LATER
+# if RUBY_VERSION >= 19
{"rb_errinfo", (RUBY_PROC*)&dll_rb_errinfo},
# else
{"ruby_errinfo", (RUBY_PROC*)&dll_ruby_errinfo},
@@ -690,18 +674,18 @@ static struct
{"ruby_init", (RUBY_PROC*)&dll_ruby_init},
{"ruby_init_loadpath", (RUBY_PROC*)&dll_ruby_init_loadpath},
# ifdef MSWIN
-# ifdef RUBY19_OR_LATER
+# if RUBY_VERSION >= 19
{"ruby_sysinit", (RUBY_PROC*)&dll_ruby_sysinit},
# else
{"NtInitialize", (RUBY_PROC*)&dll_NtInitialize},
# endif
-# if defined(DYNAMIC_RUBY_VER) && DYNAMIC_RUBY_VER >= 18
+# if RUBY_VERSION >= 18
{"rb_w32_snprintf", (RUBY_PROC*)&dll_rb_w32_snprintf},
# endif
# endif
-# if defined(DYNAMIC_RUBY_VER) && DYNAMIC_RUBY_VER >= 18
+# if RUBY_VERSION >= 18
{"rb_string_value_ptr", (RUBY_PROC*)&dll_rb_string_value_ptr},
-# if DYNAMIC_RUBY_VER <= 19
+# if RUBY_VERSION <= 19
{"rb_float_new", (RUBY_PROC*)&dll_rb_float_new},
# else
{"rb_float_new_in_heap", (RUBY_PROC*)&dll_rb_float_new},
@@ -713,11 +697,11 @@ static struct
{"rb_ary_new4", (RUBY_PROC*)&dll_rb_ary_new4},
# endif
{"rb_ary_push", (RUBY_PROC*)&dll_rb_ary_push},
-# if DYNAMIC_RUBY_VER >= 26
+# if RUBY_VERSION >= 26
{"rb_ary_detransient", (RUBY_PROC*)&dll_rb_ary_detransient},
# endif
# endif
-# ifdef RUBY19_OR_LATER
+# if RUBY_VERSION >= 19
{"rb_int2big", (RUBY_PROC*)&dll_rb_int2big},
{"ruby_script", (RUBY_PROC*)&dll_ruby_script},
{"rb_enc_find_index", (RUBY_PROC*)&dll_rb_enc_find_index},
@@ -727,14 +711,14 @@ static struct
{"rb_require", (RUBY_PROC*)&dll_rb_require},
{"ruby_options", (RUBY_PROC*)&dll_ruby_options},
# endif
-# if defined(RUBY19_OR_LATER) || defined(RUBY_INIT_STACK)
+# if (RUBY_VERSION >= 19) || defined(RUBY_INIT_STACK)
# ifdef __ia64
{"rb_ia64_bsp", (RUBY_PROC*)&dll_rb_ia64_bsp},
# endif
{"ruby_init_stack", (RUBY_PROC*)&dll_ruby_init_stack},
# endif
# if defined(USE_RGENGC) && USE_RGENGC
-# if defined(DYNAMIC_RUBY_VER) && DYNAMIC_RUBY_VER == 21
+# if RUBY_VERSION == 21
{"rb_gc_writebarrier_unprotect_promoted", (RUBY_PROC*)&dll_rb_gc_writebarrier_unprotect_promoted},
# else
{"rb_gc_writebarrier_unprotect", (RUBY_PROC*)&dll_rb_gc_writebarrier_unprotect},
@@ -837,7 +821,7 @@ ex_ruby(exarg_T *eap)
static VALUE
vim_str2rb_enc_str(const char *s)
{
-#ifdef RUBY19_OR_LATER
+#if RUBY_VERSION >= 19
int isnum;
long lval;
char_u *sval;
@@ -858,7 +842,7 @@ vim_str2rb_enc_str(const char *s)
static VALUE
eval_enc_string_protect(const char *str, int *state)
{
-#ifdef RUBY19_OR_LATER
+#if RUBY_VERSION >= 19
int isnum;
long lval;
char_u *sval;
@@ -982,19 +966,19 @@ ensure_ruby_initialized(void)
int argc = 1;
char *argv[] = {"gvim.exe"};
char **argvp = argv;
-# ifdef RUBY19_OR_LATER
+# if RUBY_VERSION >= 19
ruby_sysinit(&argc, &argvp);
# else
NtInitialize(&argc, &argvp);
# endif
#endif
{
-#if defined(RUBY19_OR_LATER) || defined(RUBY_INIT_STACK)
+#if (RUBY_VERSION >= 19) || defined(RUBY_INIT_STACK)
ruby_init_stack(ruby_stack_start);
#endif
ruby_init();
}
-#ifdef RUBY19_OR_LATER
+#if RUBY_VERSION >= 19
{
int dummy_argc = 2;
char *dummy_argv[] = {"vim-ruby", "-e_=0"};
@@ -1022,7 +1006,7 @@ ensure_ruby_initialized(void)
static void
error_print(int state)
{
-#if !defined(DYNAMIC_RUBY) && !defined(RUBY19_OR_LATER)
+#if !defined(DYNAMIC_RUBY) && (RUBY_VERSION <= 18)
RUBYEXTERN VALUE ruby_errinfo;
#endif
VALUE error;
@@ -1062,7 +1046,7 @@ error_print(int state)
break;
case TAG_RAISE:
case TAG_FATAL:
-#ifdef RUBY19_OR_LATER
+#if RUBY_VERSION >= 19
error = rb_errinfo();
#else
error = ruby_errinfo;
@@ -1087,7 +1071,7 @@ error_print(int state)
}
attr = syn_name2attr((char_u *)"Error");
-# ifdef RUBY21_OR_LATER
+# if RUBY_VERSION >= 21
bt = rb_funcallv(error, rb_intern("backtrace"), 0, 0);
for (i = 0; i < RARRAY_LEN(bt); i++)
msg_attr(RSTRING_PTR(RARRAY_AREF(bt, i)), attr);
@@ -1242,7 +1226,13 @@ static size_t buffer_dsize(const void *buf);
static const rb_data_type_t buffer_type = {
"vim_buffer",
- {0, 0, buffer_dsize, {0, 0}},
+ {0, 0, buffer_dsize,
+# if RUBY_VERSION >= 27
+ 0, 0
+# else
+ {0, 0}
+# endif
+ },
0, 0,
# ifdef RUBY_TYPED_FREE_IMMEDIATELY
0,
@@ -1516,7 +1506,13 @@ static size_t window_dsize(const void *buf);
static const rb_data_type_t window_type = {
"vim_window",
- {0, 0, window_dsize, {0, 0}},
+ {0, 0, window_dsize,
+# if RUBY_VERSION >= 27
+ 0, 0
+# else
+ {0, 0}
+# endif
+ },
0, 0,
# ifdef RUBY_TYPED_FREE_IMMEDIATELY
0,

View File

@ -7,12 +7,12 @@
%{!?_with_netbeans__:%define _with_netbeans__ 1}
%define vimdir vim82
%define python_ver 3.8
%define python_ver %{python3_version}
Name: vim
Epoch: 2
Version: 8.2
Release: 17
Release: 18
Summary: Vim is a highly configurable text editor for efficiently creating and changing any kind of text.
License: Vim and MIT
URL: http://www.vim.org
@ -33,7 +33,6 @@ Patch0010: vim-7.4-releasestring-1318991.patch
Patch0011: vim-8.0-copy-paste.patch
Patch0012: vim-python3-tests.patch
Patch0013: Fix-vim-lua5.4.0-defines+luaL_typeerror-twice.patch
Patch0014: backport-Fix-build-failuers-with-perl-5.32.patch
Patch6000: backport-Configure-does-not-recognize-gcc-10.0-and-later.patch
Patch6001: backport-8.2.2550-signal-stack-size-is-wrong-with-lates.patch
Patch6002: backport-CVE-2021-3770.patch
@ -51,6 +50,18 @@ Patch6013: backport-find-test-fails.patch
Patch6014: backport-no-early-check-if-find-and-sfind-have-an-argument.patch
Patch6015: backport-CVE-2021-3984.patch
Patch6016: backport-CVE-2021-4019.patch
Patch6017: backport-Python-3.9-does-not-define-_Py_DEC_REFTOTAL.patch
Patch6018: backport-linker-errors-when-building-with-dynamic-Python-3.9.patch
Patch6019: backport-PyEval_InitThreads-is-deprecated-in-Python-3.9.patch
Patch6020: backport-build-failure-with-Perl5.32.patch
Patch6021: backport-cannot-build-with-Strawberry-Perl-5.32.0.patch
Patch6022: backport-cannot-build-with-Perl-5.34.patch
Patch6023: backport-macros-for-Ruby-are-too-complicated.patch
Patch6024: backport-build-problem-with-Ruby-2.7.patch
Patch6025: backport-Ruby-missing-function-prototype.patch
Patch6026: backport-build-failure-with-some-Ruby-versions.patch
Patch6027: backport-compilation-error-with-Ruby-3.0.patch
Patch6028: backport-build-failure-with-Ruby-3.0-and-32-bits.patch
Patch9000: bugfix-rm-modify-info-version.patch
@ -439,6 +450,12 @@ popd
%{_mandir}/man1/evim.*
%changelog
* Tue Jan 04 2022 shixuantong<shixuantong@huawei.com> - 2:8.2-18
- Type:bugfix
- ID:NA
- SUG:NA
- DESC:fix build fail
* Tue Dec 07 2021 shixuantong<shixuantong@huawei.com> - 2:8.2-17
- Type:CVE
- ID:CVE-2021-4019