X-Git-Url: http://git.shadowcat.co.uk/gitweb/gitweb.cgi?a=blobdiff_plain;f=pp_ctl.c;h=87e399afa9090ce5237feef22efdc37f12b80c5d;hb=9f6ab4074f86da83f9650997df3135d1f2daf062;hp=467f268eefc33665f40d0b39ac83d9fd0b3f67b2;hpb=84df6dbaac5dcce30923bafc61c52f3ffa1b669b;p=p5sagit%2Fp5-mst-13.2.git diff --git a/pp_ctl.c b/pp_ctl.c index 467f268..87e399a 100644 --- a/pp_ctl.c +++ b/pp_ctl.c @@ -357,8 +357,8 @@ PP(pp_formline) sv = *++MARK; else { sv = &PL_sv_no; - if (PL_dowarn) - warn("Not enough format arguments"); + if (ckWARN(WARN_SYNTAX)) + warner(WARN_SYNTAX, "Not enough format arguments"); } break; @@ -979,20 +979,24 @@ dopoptolabel(char *label) cx = &cxstack[i]; switch (cx->cx_type) { case CXt_SUBST: - if (PL_dowarn) - warn("Exiting substitution via %s", op_name[PL_op->op_type]); + if (ckWARN(WARN_UNSAFE)) + warner(WARN_UNSAFE, "Exiting substitution via %s", + op_name[PL_op->op_type]); break; case CXt_SUB: - if (PL_dowarn) - warn("Exiting subroutine via %s", op_name[PL_op->op_type]); + if (ckWARN(WARN_UNSAFE)) + warner(WARN_UNSAFE, "Exiting subroutine via %s", + op_name[PL_op->op_type]); break; case CXt_EVAL: - if (PL_dowarn) - warn("Exiting eval via %s", op_name[PL_op->op_type]); + if (ckWARN(WARN_UNSAFE)) + warner(WARN_UNSAFE, "Exiting eval via %s", + op_name[PL_op->op_type]); break; case CXt_NULL: - if (PL_dowarn) - warn("Exiting pseudo-block via %s", op_name[PL_op->op_type]); + if (ckWARN(WARN_UNSAFE)) + warner(WARN_UNSAFE, "Exiting pseudo-block via %s", + op_name[PL_op->op_type]); return -1; case CXt_LOOP: if (!cx->blk_loop.label || @@ -1095,20 +1099,24 @@ dopoptoloop(I32 startingblock) cx = &cxstack[i]; switch (cx->cx_type) { case CXt_SUBST: - if (PL_dowarn) - warn("Exiting substitution via %s", op_name[PL_op->op_type]); + if (ckWARN(WARN_UNSAFE)) + warner(WARN_UNSAFE, "Exiting substitution via %s", + op_name[PL_op->op_type]); break; case CXt_SUB: - if (PL_dowarn) - warn("Exiting subroutine via %s", op_name[PL_op->op_type]); + if (ckWARN(WARN_UNSAFE)) + warner(WARN_UNSAFE, "Exiting subroutine via %s", + op_name[PL_op->op_type]); break; case CXt_EVAL: - if (PL_dowarn) - warn("Exiting eval via %s", op_name[PL_op->op_type]); + if (ckWARN(WARN_UNSAFE)) + warner(WARN_UNSAFE, "Exiting eval via %s", + op_name[PL_op->op_type]); break; case CXt_NULL: - if (PL_dowarn) - warn("Exiting pseudo-block via %s", op_name[PL_op->op_type]); + if (ckWARN(WARN_UNSAFE)) + warner(WARN_UNSAFE, "Exiting pseudo-block via %s", + op_name[PL_op->op_type]); return -1; case CXt_LOOP: DEBUG_l( deb("(Found loop #%ld)\n", (long)i)); @@ -1866,10 +1874,21 @@ PP(pp_goto) I32 items = 0; I32 oldsave; + retry: if (!CvROOT(cv) && !CvXSUB(cv)) { - if (CvGV(cv)) { - SV *tmpstr = sv_newmortal(); - gv_efullname3(tmpstr, CvGV(cv), Nullch); + GV *gv = CvGV(cv); + GV *autogv; + if (gv) { + SV *tmpstr; + /* autoloaded stub? */ + if (cv != GvCV(gv) && (cv = GvCV(gv))) + goto retry; + autogv = gv_autoload4(GvSTASH(gv), GvNAME(gv), + GvNAMELEN(gv), FALSE); + if (autogv && (cv = GvCV(autogv))) + goto retry; + tmpstr = sv_newmortal(); + gv_efullname3(tmpstr, gv, Nullch); DIE("Goto undefined subroutine &%s",SvPVX(tmpstr)); } DIE("Goto undefined subroutine"); @@ -1966,7 +1985,7 @@ PP(pp_goto) if (CvDEPTH(cv) < 2) (void)SvREFCNT_inc(cv); else { /* save temporaries on recursion? */ - if (CvDEPTH(cv) == 100 && PL_dowarn) + if (CvDEPTH(cv) == 100 && ckWARN(WARN_RECURSION)) sub_crush_depth(cv); if (CvDEPTH(cv) > AvFILLp(padlist)) { AV *newpad = newAV(); @@ -2361,20 +2380,20 @@ sv_compile_2op(SV *sv, OP** startop, char *code, AV** avp) PL_hints = 0; PL_op = &dummy; - PL_op->op_type = 0; /* Avoid uninit warning. */ + PL_op->op_type = OP_ENTEREVAL; PL_op->op_flags = 0; /* Avoid uninit warning. */ PUSHBLOCK(cx, CXt_EVAL, SP); PUSHEVAL(cx, 0, PL_compiling.cop_filegv); rop = doeval(G_SCALAR, startop); - POPBLOCK(cx,PL_curpm); POPEVAL(cx); + POPBLOCK(cx,PL_curpm); (*startop)->op_type = OP_NULL; (*startop)->op_ppaddr = ppaddr[OP_NULL]; lex_end(); *avp = (AV*)SvREFCNT_inc(PL_comppad); LEAVE; - if (curcop = &PL_compiling) + if (PL_curcop == &PL_compiling) PL_compiling.op_private = PL_hints; #ifdef OP_IN_REGISTER op = PL_opsave; @@ -2666,6 +2685,8 @@ PP(pp_require) RETPUSHUNDEF; } + else + SETERRNO(0, SS$_NORMAL); /* Assume success here to prevent recursive requirement. */ (void)hv_store(GvHVn(PL_incgv), name, strlen(name), @@ -2684,6 +2705,9 @@ PP(pp_require) SAVEFREEPV(name); SAVEHINTS(); PL_hints = 0; + SAVEPPTR(PL_compiling.cop_warnings); + PL_compiling.cop_warnings = ((PL_dowarn & G_WARN_ALL_ON) ? WARN_ALL + : WARN_NONE); /* switch to eval mode */ @@ -2691,6 +2715,7 @@ PP(pp_require) PUSHBLOCK(cx, CXt_EVAL, SP); PUSHEVAL(cx, name, PL_compiling.cop_filegv); + SAVEI16(PL_compiling.cop_line); PL_compiling.cop_line = 0; PUTBACK; @@ -2744,6 +2769,12 @@ PP(pp_entereval) SAVEDELETE(PL_defstash, safestr, strlen(safestr)); SAVEHINTS(); PL_hints = PL_op->op_targ; + SAVEPPTR(compiling.cop_warnings); + if (PL_compiling.cop_warnings != WARN_ALL + && PL_compiling.cop_warnings != WARN_NONE){ + PL_compiling.cop_warnings = newSVsv(PL_compiling.cop_warnings) ; + SAVEFREESV(PL_compiling.cop_warnings) ; + } push_return(PL_op->op_next); PUSHBLOCK(cx, CXt_EVAL, SP);