Correct stupidities in 4c3ac4b
authorFather Chrysostomos <sprout@cpan.org>
Thu, 7 Apr 2011 05:03:33 +0000 (22:03 -0700)
committerFather Chrysostomos <sprout@cpan.org>
Thu, 7 Apr 2011 05:03:51 +0000 (22:03 -0700)
Allocating an extra SV for rare edge cases...er...only needs to be
done in those rare edge cases.

Uninitialized warnings are only supposed to be enabled when they are.

pp_hot.c
t/lib/warnings/9uninit

index 3d46287..06b837b 100644 (file)
--- a/pp_hot.c
+++ b/pp_hot.c
@@ -501,10 +501,13 @@ PP(pp_add)
     svl = TOPm1s;
 
     useleft = USE_LEFT(svl);
-    if(useleft && svr == svl) {
+    if(useleft && svr == svl && SvGMAGICAL(svl)) {
        /* Print the uninitialized warning now, so it includes the vari-
           able name. */
-       if (!SvOK(svl)) report_uninit(svl), useleft = 0;
+       if (!SvOK(svl)) {
+           if (ckWARN(WARN_UNINITIALIZED)) report_uninit(svl);
+           useleft = 0;
+       }
        /* Non-magical sv_mortalcopy */
        svl = sv_newmortal();
        sv_setsv_flags(svl, svr, 0);
index 33cc2b9..1dcee79 100644 (file)
@@ -694,6 +694,8 @@ sub FETCH { undef }
 
 tie my $m1, "";
 my $v = $m1 + $m1;
+no warnings;
+$v = $m1 + $m1;
 EXPECT
 Use of uninitialized value $m1 in addition (+) at - line 6.
 Use of uninitialized value $m1 in addition (+) at - line 6.