Change 33309 by [EMAIL PROTECTED] on 2008/02/14 15:14:36

        Make the new warning report undef constants as undef

Affected files ...

... //depot/perl/op.c#988 edit
... //depot/perl/t/lib/warnings/op#37 edit

Differences ...

==== //depot/perl/op.c#988 (text) ====
Index: perl/op.c
--- perl/op.c#987~33308~        2008-02-14 07:05:38.000000000 -0800
+++ perl/op.c   2008-02-14 07:14:36.000000000 -0800
@@ -1075,8 +1075,13 @@
            no_bareword_allowed(o);
        else {
            if (ckWARN(WARN_VOID)) {
-               SV* msv = sv_2mortal(Perl_newSVpvf(aTHX_ "a constant (%"SVf")", 
sv));
-               useless = SvPV_nolen(msv);
+               if (SvOK(sv)) {
+                   SV* msv = sv_2mortal(Perl_newSVpvf(aTHX_
+                               "a constant (%"SVf")", sv));
+                   useless = SvPV_nolen(msv);
+               }
+               else
+                   useless = "a constant (undef)";
                if (o->op_private & OPpCONST_ARYBASE)
                    useless = NULL;
                /* don't warn on optimised away booleans, eg 

==== //depot/perl/t/lib/warnings/op#37 (text) ====
Index: perl/t/lib/warnings/op
--- perl/t/lib/warnings/op#36~33305~    2008-02-14 00:25:29.000000000 -0800
+++ perl/t/lib/warnings/op      2008-02-14 07:14:36.000000000 -0800
@@ -531,8 +531,9 @@
 7 ; # OP_CONST
 "x" . "y"; # optimized to OP_CONST
 2 + 2; # optimized to OP_CONST
-5 || print "bad\n";    # test OPpCONST_SHORTCIRCUIT
 use constant U => undef;
+U;
+5 || print "bad\n";    # test OPpCONST_SHORTCIRCUIT
 print "boo\n" if U;    # test OPpCONST_SHORTCIRCUIT
 $[ = 2; # should not warn
 no warnings 'void' ;
@@ -545,6 +546,7 @@
 Useless use of a constant (7) in void context at - line 4.
 Useless use of a constant (xy) in void context at - line 5.
 Useless use of a constant (4) in void context at - line 6.
+Useless use of a constant (undef) in void context at - line 8.
 ########
 # op.c
 #
End of Patch.

Reply via email to