changeset 24705:5fbb271b35e0 v8.2.2891

patch 8.2.2891: cannot build with Perl 5.34 Commit: https://github.com/vim/vim/commit/543467136f001708f4c63376ac5d18adde82db30 Author: ichizok <gclient.gaap@gmail.com> Date: Thu May 27 18:05:14 2021 +0200 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 https://github.com/vim/vim/issues/8266, closes #8250)
author Bram Moolenaar <Bram@vim.org>
date Thu, 27 May 2021 18:15:04 +0200
parents 86dd80c3ee32
children 4f9856292860
files src/if_perl.xs src/version.c
diffstat 2 files changed, 32 insertions(+), 1 deletions(-) [+]
line wrap: on
line diff
--- a/src/if_perl.xs
+++ b/src/if_perl.xs
@@ -700,12 +700,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);
 }
--- a/src/version.c
+++ b/src/version.c
@@ -751,6 +751,8 @@ static char *(features[]) =
 static int included_patches[] =
 {   /* Add new patch number below this line */
 /**/
+    2891,
+/**/
     2890,
 /**/
     2889,