Skip to content
Snippets Groups Projects
Commit 5cec7497 authored by gregor herrmann's avatar gregor herrmann
Browse files

Add patches from CPAN RT to fix compatibility issues with perl 5.32 and 5.33.

Closes: #971969
parent 41ef2886
No related branches found
No related tags found
No related merge requests found
Description: The attached patch fixes the compilation problem with
-DDEBUGGING builds and a parsing problem that started in
v5.33.5-62-gc588171e62
Origin: CPAN RT
Bug: https://rt.cpan.org/Public/Bug/Display.html?id=130156
Author: TONYC@cpan.org
Reviewed-by: gregor herrmann <gregoa@debian.org>
Last-Update: 2021-04-27
--- a/Alias.xs
+++ b/Alias.xs
@@ -2012,7 +2012,11 @@
PL_expect = XSTATE;
tok = yylex();
PL_nexttype[PL_nexttoke++] = tok;
- if (tok == '{') {
+ if (tok == '{'
+#if PERL_COMBI_VERSION >= 5033006
+ || tok == PERLY_BRACE_OPEN
+#endif
+ ) {
PL_nexttype[PL_nexttoke++] = DO;
sv_setpv((SV *) cv, "$");
if ((PERL_COMBI_VERSION >= 5021004) ||
@@ -2039,7 +2043,7 @@
PL_bufend+1-PL_bufptr, char);
*PL_bufptr = ';';
PL_bufend++;
- SvCUR(PL_linestr)++;
+ SvCUR_set(PL_linestr, SvCUR(PL_linestr)+1);
}
}
#if DA_HAVE_LEX_KNOWNEXT
@@ -2068,11 +2072,11 @@
if (len + shift > SvLEN(PL_linestr))
len = SvLEN(PL_linestr) - shift;
Move(s, s + shift, len, char);
- SvCUR(PL_linestr) = len + shift - 1;
+ SvCUR_set(PL_linestr, len + shift - 1);
} else {
STRLEN len = SvCUR(PL_linestr) + shift + 1;
Move(s - shift, s, len, char);
- SvCUR(PL_linestr) += shift;
+ SvCUR_set(PL_linestr, SvCUR(PL_linestr) + shift);
}
*(PL_bufend = s + SvCUR(PL_linestr)) = '\0';
if (start_s < PL_bufptr)
Description: Modifying Data::Alias to return a better leave op tree for
compatibility with 5.32.
.
It works by inserting the OP_ENTER that various things require, and then
nulling it out later.
Origin: CPAN RT
Bug: https://rt.cpan.org/Public/Bug/Display.html?id=130156
Bug-Debian: https://bugs.debian.org/971969
Author: TONYC@cpan.org
Reviewed-by: gregor herrmann <gregoa@debian.org>
Last-Update: 2021-04-27
--- a/Alias.xs
+++ b/Alias.xs
@@ -321,6 +321,7 @@
STATIC OP *da_tag_rv2cv(pTHX) { return NORMAL; }
STATIC OP *da_tag_list(pTHX) { return NORMAL; }
STATIC OP *da_tag_entersub(pTHX) { return NORMAL; }
+STATIC OP *da_tag_enter(pTHX) { return NORMAL; }
STATIC void da_peep(pTHX_ OP *o);
STATIC void da_peep2(pTHX_ OP *o);
@@ -1882,7 +1883,7 @@
STATIC void da_peep2(pTHX_ OP *o) {
OP *k, *lsop, *pmop, *argop, *cvop, *esop;
int useful;
- while (o->op_ppaddr != da_tag_list) {
+ while (o->op_ppaddr != da_tag_list && o->op_ppaddr != da_tag_enter) {
while (OpHAS_SIBLING(o)) {
if ((o->op_flags & OPf_KIDS) && (k = cUNOPo->op_first)){
da_peep2(aTHX_ k);
@@ -1897,6 +1898,10 @@
if (!(o->op_flags & OPf_KIDS) || !(o = cUNOPo->op_first))
return;
}
+ if (o->op_ppaddr == da_tag_enter) {
+ o = OpSIBLING(o);
+ assert(o);
+ }
lsop = o;
useful = lsop->op_private & OPpUSEFUL;
op_null(lsop);
@@ -1916,6 +1921,16 @@
return;
}
esop->op_type = OP_ENTERSUB;
+ if (cLISTOPx(esop)->op_first->op_ppaddr == da_tag_enter) {
+ /* the first is a dummy op we inserted to satisfy Perl_scalar/list.
+ we can't remove it since an op_next points at it, so null it out.
+ */
+ OP *nullop = cLISTOPx(esop)->op_first;
+ assert(nullop->op_type == OP_ENTER);
+ assert(OpSIBLING(nullop));
+ nullop->op_type = OP_NULL;
+ nullop->op_ppaddr = PL_ppaddr[OP_NULL];
+ }
if (cvop->op_flags & OPf_SPECIAL) {
esop->op_ppaddr = DataAlias_pp_copy;
da_peep2(aTHX_ pmop);
@@ -2117,6 +2132,19 @@
OpLASTSIB_set(lsop, esop);
esop->op_type = inside ? OP_SCOPE : OP_LEAVE;
esop->op_ppaddr = da_tag_entersub;
+ if (!inside && !OpHAS_SIBLING(lsop)) {
+ /* esop is now a leave, and Perl_scalar/Perl_list expects at least two children.
+ we insert it in the middle (and null it later) since Perl_scalar()
+ tries to find the last non-(null/state) op *after* the expected enter.
+ */
+ OP *enterop;
+ NewOp(0, enterop, 1, OP);
+ enterop->op_type = OP_ENTER;
+ enterop->op_ppaddr = da_tag_enter;
+ cLISTOPx(esop)->op_first = enterop;
+ OpMORESIB_set(enterop, lsop);
+ OpLASTSIB_set(lsop, esop);
+ }
cLISTOPx(esop)->op_last = lsop;
lsop->op_type = OP_LIST;
lsop->op_targ = 0;
da-parsing-fix.diff
da_add_enter.patch
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment