Sync with the latest MakeMaker snapshot.
[p5sagit/p5-mst-13.2.git] / op.c
diff --git a/op.c b/op.c
index 991a426..020f463 100644 (file)
--- a/op.c
+++ b/op.c
@@ -78,9 +78,9 @@ Perl_Slab_Free(pTHX_ void *op)
     assert( ptr < ( (I32 **) slab + PERL_SLAB_SIZE) );
     assert( *slab > 0 );
     if (--(*slab) == 0) {
-     #ifdef NETWARE
-      #define PerlMemShared PerlMem
-     #endif
+#  ifdef NETWARE
+#    define PerlMemShared PerlMem
+#  endif
        
     PerlMemShared_free(slab);
        if (slab == PL_OpSlab) {
@@ -1823,6 +1823,7 @@ Perl_newPROG(pTHX_ OP *o)
        if (o->op_type == OP_STUB) {
            PL_comppad_name = 0;
            PL_compcv = 0;
+           FreeOp(o);
            return;
        }
        PL_main_root = scope(sawparens(scalarvoid(o)));
@@ -3351,7 +3352,9 @@ S_new_logop(pTHX_ I32 type, I32 flags, OP** firstp, OP** otherp)
            return first;
        }
     }
-    else if (ckWARN(WARN_MISC) && (first->op_flags & OPf_KIDS)) {
+    else if (ckWARN(WARN_MISC) && (first->op_flags & OPf_KIDS) &&
+             type != OP_DOR) /* [#24076] Don't warn for <FH> err FOO. */
+    {
        OP *k1 = ((UNOP*)first)->op_first;
        OP *k2 = k1->op_sibling;
        OPCODE warnop = 0;
@@ -3779,7 +3782,9 @@ Perl_newLOOPEX(pTHX_ I32 type, OP *label)
        op_free(label);
     }
     else {
-       if (label->op_type == OP_ENTERSUB)
+       /* Check whether it's going to be a goto &function */
+       if (label->op_type == OP_ENTERSUB
+               && !(label->op_flags & OPf_STACKED))
            label = newUNOP(OP_REFGEN, 0, mod(label, OP_REFGEN));
        o = newUNOP(type, OPf_STACKED, label);
     }
@@ -3787,8 +3792,6 @@ Perl_newLOOPEX(pTHX_ I32 type, OP *label)
     return o;
 }
 
-static void const_sv_xsub(pTHX_ CV* cv);
-
 /*
 =for apidoc cv_undef
 
@@ -3804,9 +3807,8 @@ void
 Perl_cv_undef(pTHX_ CV *cv)
 {
 #ifdef USE_ITHREADS
-    if (CvFILE(cv) && (!CvXSUB(cv) || CvXSUB(cv) == const_sv_xsub)) {
-       /* for XSUBs CvFILE point directly to static memory; __FILE__ 
-        * except when XSUB was constructed via newCONSTSUB() */
+    if (CvFILE(cv) && !CvXSUB(cv)) {
+       /* for XSUBs CvFILE point directly to static memory; __FILE__ */
        Safefree(CvFILE(cv));
     }
     CvFILE(cv) = 0;
@@ -3868,6 +3870,8 @@ Perl_cv_ckproto(pTHX_ CV *cv, GV *gv, char *p)
     }
 }
 
+static void const_sv_xsub(pTHX_ CV* cv);
+
 /*
 
 =head1 Optree Manipulation Functions
@@ -4210,6 +4214,11 @@ Perl_newATTRSUB(pTHX_ I32 floor, OP *o, OP *proto, OP *attrs, OP *block)
                             mod(scalarseq(block), OP_LEAVESUBLV));
     }
     else {
+       /* This makes sub {}; work as expected.  */
+       if (block->op_type == OP_STUB) {
+           op_free(block);
+           block = newSTATEOP(0, Nullch, 0);
+       }
        CvROOT(cv) = newUNOP(OP_LEAVESUB, 0, scalarseq(block));
     }
     CvROOT(cv)->op_private |= OPpREFCOUNTED;
@@ -5227,8 +5236,7 @@ Perl_ck_fun(pTHX_ OP *o)
                                           
                                      }
                                      if (tmpstr) {
-                                          name = savepv(SvPVX(tmpstr));
-                                          len = strlen(name);
+                                          name = SvPV(tmpstr, len);
                                           sv_2mortal(tmpstr);
                                      }
                                 }
@@ -6256,23 +6264,6 @@ Perl_peep(pTHX_ register OP *o)
            o->op_seq = PL_op_seqmax++;
            break;
 
-       case OP_CONCAT:
-           if (o->op_next && o->op_next->op_type == OP_STRINGIFY) {
-               if (o->op_next->op_private & OPpTARGET_MY) {
-                   if (o->op_flags & OPf_STACKED) /* chained concats */
-                       goto ignore_optimization;
-                   else {
-                       /* assert(PL_opargs[o->op_type] & OA_TARGLEX); */
-                       o->op_targ = o->op_next->op_targ;
-                       o->op_next->op_targ = 0;
-                       o->op_private |= OPpTARGET_MY;
-                   }
-               }
-               op_null(o->op_next);
-           }
-         ignore_optimization:
-           o->op_seq = PL_op_seqmax++;
-           break;
        case OP_STUB:
            if ((o->op_flags & OPf_WANT) != OPf_WANT_LIST) {
                o->op_seq = PL_op_seqmax++;