Change 33743 by davem@davem-pigeon on 2008/04/25 02:39:50
Allow the 'smart match in void context' warning into 5.10.1,
as we're going to break smart-matching backcompat anyway...
Integrate:
[ 32876]
Subject: Re: grep and smart match should warn in void context
From: Michael G Schwern <schwern@pobox.com>
Date: Sun, 23 Dec 2007 11:56:08 -0800
Message-ID: <476EBD58.9050505@pobox.com>
[ 32888]
Let's remove the grep in void context warning.
Affected files ...
... //depot/maint-5.10/perl/op.c#8 integrate
... //depot/maint-5.10/perl/t/lib/warnings/op#2 integrate
Differences ...
==== //depot/maint-5.10/perl/op.c#8 (text) ====
Index: perl/op.c
--- perl/op.c#7~33726~ 2008-04-22 08:18:16.000000000 -0700
+++ perl/op.c 2008-04-24 19:39:50.000000000 -0700
@@ -940,6 +940,7 @@
case OP_GVSV:
case OP_WANTARRAY:
case OP_GV:
+ case OP_SMARTMATCH:
case OP_PADSV:
case OP_PADAV:
case OP_PADHV:
@@ -1007,6 +1008,7 @@
case OP_PROTOTYPE:
func_ops:
if (!(o->op_private & (OPpLVAL_INTRO|OPpOUR_INTRO)))
+ /* Otherwise it's "Useless use of grep iterator" */
useless = OP_DESC(o);
break;
==== //depot/maint-5.10/perl/t/lib/warnings/op#2 (text) ====
Index: perl/t/lib/warnings/op
--- perl/t/lib/warnings/op#1~32694~ 2007-12-22 01:23:09.000000000 -0800
+++ perl/t/lib/warnings/op 2008-04-24 19:39:50.000000000 -0700
@@ -211,6 +211,8 @@
eval { getpwnam 1 }; # OP_GPWNAM
eval { getpwuid 1 }; # OP_GPWUID
prototype "foo"; # OP_PROTOTYPE
+$a ~~ $b; # OP_SMARTMATCH
+$a <=> $b; # OP_NCMP
EXPECT
Useless use of repeat (x) in void context at - line 3.
Useless use of wantarray in void context at - line 5.
@@ -250,6 +252,8 @@
Useless use of getpwnam in void context at - line 52.
Useless use of getpwuid in void context at - line 53.
Useless use of subroutine prototype in void context at - line 54.
+Useless use of smart match in void context at - line 55.
+Useless use of numeric comparison (<=>) in void context at - line 56.
########
# op.c
use warnings 'void' ; close STDIN ;
End of Patch.