summaryrefslogtreecommitdiff
path: root/op.c
diff options
context:
space:
mode:
authorChip Salzenberg <chip@pobox.com>1998-03-03 04:39:49 +0000
committerGurusamy Sarathy <gsar@cpan.org>1998-03-03 04:39:49 +0000
commit93233ece75d8fe98a77377e72c4d6004c5ea8691 (patch)
treed9de53b8b818671b4e52497a2397cde5a6e8950e /op.c
parent2c4aebbdec0f7c22369f4986d7cad0139e4dd272 (diff)
downloadperl-93233ece75d8fe98a77377e72c4d6004c5ea8691.tar.gz
[win32] merge problematic maintpatch to op.c
#77: "Eliminate double warnings under C<package;>" Files: gv.c op.c toke.c p4raw-id: //depot/win32/perl@641
Diffstat (limited to 'op.c')
-rw-r--r--op.c26
1 files changed, 14 insertions, 12 deletions
diff --git a/op.c b/op.c
index fec670524a..b07c9ae310 100644
--- a/op.c
+++ b/op.c
@@ -3965,17 +3965,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 +3986,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;
}