Change 27402 by [EMAIL PROTECTED] on 2006/03/07 16:49:58
$[ = 2 should not warn.
Affected files ...
... //depot/perl/op.c#772 edit
... //depot/perl/t/lib/warnings/op#29 edit
Differences ...
==== //depot/perl/op.c#772 (text) ====
Index: perl/op.c
--- perl/op.c#771~27397~ 2006-03-06 15:31:21.000000000 -0800
+++ perl/op.c 2006-03-07 08:49:58.000000000 -0800
@@ -776,6 +776,8 @@
else {
if (ckWARN(WARN_VOID)) {
useless = "a constant";
+ if (o->op_private & OPpCONST_ARYBASE)
+ useless = 0;
/* don't warn on optimised away booleans, eg
* use constant Foo, 5; Foo || print; */
if (cSVOPo->op_private & OPpCONST_SHORTCIRCUIT)
@@ -1035,7 +1037,7 @@
PL_modcount++;
return o;
case OP_CONST:
- if (!(o->op_private & (OPpCONST_ARYBASE)))
+ if (!(o->op_private & OPpCONST_ARYBASE))
goto nomod;
localize = 0;
if (PL_eval_start && PL_eval_start->op_type == OP_CONST) {
@@ -3466,6 +3468,7 @@
PL_eval_start = 0;
else {
o = newSVOP(OP_CONST, 0, newSViv(PL_compiling.cop_arybase));
+ o->op_private |= OPpCONST_ARYBASE;
}
}
return o;
==== //depot/perl/t/lib/warnings/op#29 (text) ====
Index: perl/t/lib/warnings/op
--- perl/t/lib/warnings/op#28~26803~ 2006-01-12 07:40:53.000000000 -0800
+++ perl/t/lib/warnings/op 2006-03-07 08:49:58.000000000 -0800
@@ -528,6 +528,7 @@
5 || print "bad\n"; # test OPpCONST_SHORTCIRCUIT
use constant U => undef;
print "boo\n" if U; # test OPpCONST_SHORTCIRCUIT
+$[ = 2; # should not warn
no warnings 'void' ;
"abc"; # OP_CONST
7 ; # OP_CONST
End of Patch.