summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorGurusamy Sarathy <gsar@cpan.org>2000-01-14 01:27:13 +0000
committerGurusamy Sarathy <gsar@cpan.org>2000-01-14 01:27:13 +0000
commit192587c2153e5b0fa4ed545cdd3fa7fef8fc0d8b (patch)
tree23c4d17163d0c727b113962137cc49dcb7697c9c
parent9740c8380c47f3138ea60459cef1e748515e656d (diff)
downloadperl-192587c2153e5b0fa4ed545cdd3fa7fef8fc0d8b.tar.gz
avoid spurious "Useless use of variable" warning on C<our $foo;>
p4raw-id: //depot/perl@4800
-rw-r--r--dump.c2
-rw-r--r--op.c3
-rw-r--r--op.h4
3 files changed, 7 insertions, 2 deletions
diff --git a/dump.c b/dump.c
index b8eaa54ed9..c10ac1abc7 100644
--- a/dump.c
+++ b/dump.c
@@ -485,6 +485,8 @@ Perl_do_op_dump(pTHX_ I32 level, PerlIO *file, OP *o)
else {
if (o->op_private & HINT_STRICT_REFS)
sv_catpv(tmpsv, ",STRICT_REFS");
+ if (o->op_private & OPpOUR_INTRO)
+ sv_catpv(tmpsv, ",OUR_INTRO");
}
}
else if (o->op_type == OP_CONST) {
diff --git a/op.c b/op.c
index 805aeaac8e..3c92fefe91 100644
--- a/op.c
+++ b/op.c
@@ -1074,7 +1074,7 @@ Perl_scalarvoid(pTHX_ OP *o)
case OP_RV2SV:
case OP_RV2AV:
case OP_RV2HV:
- if (!(o->op_private & OPpLVAL_INTRO) &&
+ if (!(o->op_private & (OPpLVAL_INTRO|OPpOUR_INTRO)) &&
(!o->op_sibling || o->op_sibling->op_type != OP_READLINE))
useless = "a variable";
break;
@@ -1830,6 +1830,7 @@ S_my_kid(pTHX_ OP *o, OP *attrs)
} else if (type == OP_RV2SV || /* "our" declaration */
type == OP_RV2AV ||
type == OP_RV2HV) { /* XXX does this let anything illegal in? */
+ o->op_private |= OPpOUR_INTRO;
return o;
} else if (type != OP_PADSV &&
type != OP_PADAV &&
diff --git a/op.h b/op.h
index 5231a4131c..c69d897239 100644
--- a/op.h
+++ b/op.h
@@ -136,7 +136,9 @@ typedef U32 PADOFFSET;
#define OPpEARLY_CV 32 /* foo() called before sub foo was parsed */
/* OP_?ELEM only */
#define OPpLVAL_DEFER 16 /* Defer creation of array/hash elem */
- /* for OP_RV2?V, lower bits carry hints */
+ /* OP_RV2?V only */
+#define OPpOUR_INTRO 16 /* Defer creation of array/hash elem */
+ /* for OP_RV2?V, lower bits carry hints (currently only HINT_STRICT_REFS) */
/* Private for OPs with TARGLEX */
/* (lower bits may carry MAXARG) */