summaryrefslogtreecommitdiff
path: root/op.c
diff options
context:
space:
mode:
authorGurusamy Sarathy <gsar@cpan.org>1999-05-24 23:55:53 +0000
committerGurusamy Sarathy <gsar@cpan.org>1999-05-24 23:55:53 +0000
commit2ebea0a13aa2cfad039eedf2ae4b124fbb89d415 (patch)
tree353909fc53c0c8071444ac369a9e57faad603ebf /op.c
parent0b024f3176964b92d73e2032c14ea27f1cae55b7 (diff)
downloadperl-2ebea0a13aa2cfad039eedf2ae4b124fbb89d415.tar.gz
fix bogus line numbers for void context warnings
(change#2548 was overeager) p4raw-link: @2548 on //depot/cfgperl: 68c734842396ee490e3f1243c6050bbadc602253 p4raw-id: //depot/perl@3464
Diffstat (limited to 'op.c')
-rw-r--r--op.c22
1 files changed, 13 insertions, 9 deletions
diff --git a/op.c b/op.c
index 488766b2e2..fa286f841a 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: