From: Gurusamy Sarathy Date: Mon, 24 May 1999 23:55:53 +0000 (+0000) Subject: fix bogus line numbers for void context warnings X-Git-Url: http://git.shadowcat.co.uk/gitweb/gitweb.cgi?a=commitdiff_plain;h=2ebea0a13aa2cfad039eedf2ae4b124fbb89d415;p=p5sagit%2Fp5-mst-13.2.git fix bogus line numbers for void context warnings (change#2548 was overeager) p4raw-link: @2548 on //depot/cfgperl: 68c734842396ee490e3f1243c6050bbadc602253 p4raw-id: //depot/perl@3464 --- diff --git a/op.c b/op.c index 488766b..fa286f8 100644 --- a/op.c +++ b/op.c @@ -886,10 +886,19 @@ scalarvoid(OP *o) OP *kid; char* useless = 0; SV* sv; + U8 want; + + if (o->op_type == OP_NEXTSTATE || o->op_type == OP_DBSTATE || + (o->op_type == OP_NULL && + (o->op_targ == OP_NEXTSTATE || o->op_targ == OP_DBSTATE))) + { + dTHR; + PL_curcop = (COP*)o; /* for warning below */ + } /* assumes no premature commitment */ - U8 want = o->op_flags & OPf_WANT; - if (!o || (want && want != OPf_WANT_SCALAR) || PL_error_count + want = o->op_flags & OPf_WANT; + if ((want && want != OPf_WANT_SCALAR) || PL_error_count || o->op_type == OP_RETURN) return o; @@ -989,11 +998,6 @@ scalarvoid(OP *o) useless = "a variable"; break; - case OP_NEXTSTATE: - case OP_DBSTATE: - WITH_THR(PL_curcop = ((COP*)o)); /* for warning below */ - break; - case OP_CONST: sv = cSVOPo->op_sv; if (cSVOPo->op_private & OPpCONST_STRICT) @@ -1034,11 +1038,11 @@ scalarvoid(OP *o) break; case OP_NULL: - if (o->op_targ == OP_NEXTSTATE || o->op_targ == OP_DBSTATE) - WITH_THR(PL_curcop = ((COP*)o)); /* for warning below */ if (o->op_flags & OPf_STACKED) break; /* FALL THROUGH */ + case OP_NEXTSTATE: + case OP_DBSTATE: case OP_ENTERTRY: case OP_ENTER: case OP_SCALAR: