summaryrefslogtreecommitdiff
path: root/op.c
diff options
context:
space:
mode:
authorMichael G. Schwern <schwern@pobox.com>2007-12-23 03:56:08 -0800
committerRafael Garcia-Suarez <rgarciasuarez@gmail.com>2008-01-06 17:14:22 +0000
commit74295f0bd81452f77ee575c561ad4d9e83dca07d (patch)
tree4b70988f26b7bf40927509cbcec2cf2503e6eacf /op.c
parente846cbe53fd65a133ee59961dd2b0d9ae211552a (diff)
downloadperl-74295f0bd81452f77ee575c561ad4d9e83dca07d.tar.gz
Re: grep and smart match should warn in void context
Message-ID: <476EBD58.9050505@pobox.com> p4raw-id: //depot/perl@32876
Diffstat (limited to 'op.c')
-rw-r--r--op.c6
1 files changed, 5 insertions, 1 deletions
diff --git a/op.c b/op.c
index 93a8bfd91f..212ecddc99 100644
--- a/op.c
+++ b/op.c
@@ -941,6 +941,7 @@ Perl_scalarvoid(pTHX_ OP *o)
case OP_GVSV:
case OP_WANTARRAY:
case OP_GV:
+ case OP_SMARTMATCH:
case OP_PADSV:
case OP_PADAV:
case OP_PADHV:
@@ -969,6 +970,7 @@ Perl_scalarvoid(pTHX_ OP *o)
case OP_ANONLIST:
case OP_ANONHASH:
case OP_SORT:
+ case OP_GREPWHILE:
case OP_REVERSE:
case OP_RANGE:
case OP_FLIP:
@@ -1008,7 +1010,9 @@ Perl_scalarvoid(pTHX_ OP *o)
case OP_PROTOTYPE:
func_ops:
if (!(o->op_private & (OPpLVAL_INTRO|OPpOUR_INTRO)))
- useless = OP_DESC(o);
+ /* Otherwise it's "Useless use of grep iterator" */
+ useless = (o->op_type == OP_GREPWHILE) ? "grep"
+ : OP_DESC(o);
break;
case OP_NOT: