[5.004_61 PATCH] Make incompatible changes to RE engine NOW
[p5sagit/p5-mst-13.2.git] / op.c
diff --git a/op.c b/op.c
index fec6705..907e975 100644 (file)
--- a/op.c
+++ b/op.c
@@ -1400,7 +1400,7 @@ my(OP *o)
        for (kid = cLISTOPo->op_first; kid; kid = kid->op_sibling)
            my(kid);
     } else if (type == OP_UNDEF) {
-       return op;
+       return o;
     } else if (type != OP_PADSV &&
             type != OP_PADAV &&
             type != OP_PADHV &&
@@ -3332,7 +3332,10 @@ newSUB(I32 floor, OP *o, OP *proto, OP *block)
            if (curstack == sortstack && sortcop == CvSTART(cv))
                croak("Can't redefine active sort subroutine %s", name);
            const_sv = cv_const_sv(cv);
-           if (const_sv || dowarn) {
+           if (const_sv || dowarn && !(CvGV(cv) && GvSTASH(CvGV(cv))
+                                       && HvNAME(GvSTASH(CvGV(cv)))
+                                       && strEQ(HvNAME(GvSTASH(CvGV(cv))),
+                                                "autouse"))) {
                line_t oldline = curcop->cop_line;
                curcop->cop_line = copline;
                warn(const_sv ? "Constant subroutine %s redefined"
@@ -3527,7 +3530,9 @@ newXS(char *name, void (*subaddr) (CV *), char *filename)
        }
        else if (CvROOT(cv) || CvXSUB(cv) || GvASSUMECV(gv)) {
            /* already defined (or promised) */
-           if (dowarn) {
+           if (dowarn && !(CvGV(cv) && GvSTASH(CvGV(cv))
+                           && HvNAME(GvSTASH(CvGV(cv)))
+                           && strEQ(HvNAME(GvSTASH(CvGV(cv))), "autouse"))) {
                line_t oldline = curcop->cop_line;
                curcop->cop_line = copline;
                warn("Subroutine %s redefined",name);
@@ -3965,17 +3970,16 @@ ck_rvconst(register OP *o)
          "Can't use bareword (\"%s\") as %s ref while \"strict refs\" in use",
                      name, badthing);
        }
-       kid->op_type = OP_GV;
+       /*
+        * This is a little tricky.  We only want to add the symbol if we
+        * didn't add it in the lexer.  Otherwise we get duplicate strict
+        * warnings.  But if we didn't add it in the lexer, we must at
+        * least pretend like we wanted to add it even if it existed before,
+        * or we get possible typo warnings.  OPpCONST_ENTERED says
+        * whether the lexer already added THIS instance of this symbol.
+        */
        iscv = (o->op_type == OP_RV2CV) * 2;
-       for (gv = 0; !gv; iscv++) {
-           /*
-            * This is a little tricky.  We only want to add the symbol if we
-            * didn't add it in the lexer.  Otherwise we get duplicate strict
-            * warnings.  But if we didn't add it in the lexer, we must at
-            * least pretend like we wanted to add it even if it existed before,
-            * or we get possible typo warnings.  OPpCONST_ENTERED says
-            * whether the lexer already added THIS instance of this symbol.
-            */
+       do {
            gv = gv_fetchpv(name,
                iscv | !(kid->op_private & OPpCONST_ENTERED),
                iscv
@@ -3987,9 +3991,12 @@ ck_rvconst(register OP *o)
                            : o->op_type == OP_RV2HV
                                ? SVt_PVHV
                                : SVt_PVGV);
+       } while (!gv && !(kid->op_private & OPpCONST_ENTERED) && !iscv++);
+       if (gv) {
+           kid->op_type = OP_GV;
+           SvREFCNT_dec(kid->op_sv);
+           kid->op_sv = SvREFCNT_inc(gv);
        }
-       SvREFCNT_dec(kid->op_sv);
-       kid->op_sv = SvREFCNT_inc(gv);
     }
     return o;
 }
@@ -4254,7 +4261,7 @@ ck_index(OP *o)
     if (o->op_flags & OPf_KIDS) {
        OP *kid = cLISTOPo->op_first->op_sibling;       /* get past pushmark */
        if (kid && kid->op_type == OP_CONST)
-           fbm_compile(((SVOP*)kid)->op_sv);
+           fbm_compile(((SVOP*)kid)->op_sv, 0);
     }
     return ck_fun(o);
 }
@@ -4741,7 +4748,7 @@ peep(register OP *o)
            goto nothin;
        case OP_NULL:
            if (o->op_targ == OP_NEXTSTATE || o->op_targ == OP_DBSTATE)
-               curcop = ((COP*)op);
+               curcop = ((COP*)o);
            goto nothin;
        case OP_SCALAR:
        case OP_LINESEQ: