In perl.git, the branch blead has been updated

<http://perl5.git.perl.org/perl.git/commitdiff/d03b2e8de0dca01b243f4faca34f89e7030bfbb0?hp=ace3ad0f8709a7fde3c8e2a6249bb3f3fb7c7b16>

- Log -----------------------------------------------------------------
commit d03b2e8de0dca01b243f4faca34f89e7030bfbb0
Author: Father Chrysostomos <[email protected]>
Date:   Fri Jul 29 10:44:01 2016 -0700

    t/lib/warnings/pp_pack: Redundant tests
    
    This commit:
    
    commit 533367d84727b326a81c972a3555d6a7847a4558
    Author: Jarkko Hietaniemi <[email protected]>
    Date:   Sun Jun 24 22:24:49 2001 +0000
    
        Move the pack warnings to their own file, as pointed
        out by Spider.
    
    copied several tests into pp_pack which have nothing to do with pack.  Most 
of them were still in pp, and were thus redundant.  The ‘Use of uninitialized 
value $a in scalar dereference’ test was removed from pp, but I see now that 
there is a nearly identical test elsewhere in pp, added by this commit:
    
    commit 3b434eb14b7fab4ed6941403c71b683066ab60a2
    Author: Rafael Garcia-Suarez <[email protected]>
    Date:   Tue Sep 18 00:48:05 2001 +0200
    
        new tests
        Message-Id: <20010917224805.C11744@rafael>

M       t/lib/warnings/pp_pack

commit b199a398054415071c9c89df8919653221399fb6
Author: Father Chrysostomos <[email protected]>
Date:   Fri Jul 29 10:41:18 2016 -0700

    Avoid emitting pack("p",...) warning erroneously
    
    A value may legitimately be marked SvTEMP even when it is not about
    to be freed.

M       pp_pack.c
M       t/lib/warnings/pp_pack
-----------------------------------------------------------------------

Summary of changes:
 pp_pack.c              |  3 ++-
 t/lib/warnings/pp_pack | 26 +++-----------------------
 2 files changed, 5 insertions(+), 24 deletions(-)

diff --git a/pp_pack.c b/pp_pack.c
index 891d2e2..40c3100 100644
--- a/pp_pack.c
+++ b/pp_pack.c
@@ -3042,7 +3042,8 @@ S_pack_rec(pTHX_ SV *cat, tempsym_t* symptr, SV 
**beglist, SV **endlist )
                     * of pack() (and all copies of the result) are
                     * gone.
                     */
-                   if ((SvTEMP(fromstr) || (SvPADTMP(fromstr) &&
+                   if (((SvTEMP(fromstr) && SvREFCNT(fromstr) == 1)
+                        || (SvPADTMP(fromstr) &&
                             !SvREADONLY(fromstr)))) {
                        Perl_ck_warner(aTHX_ packWARN(WARN_PACK),
                                       "Attempt to pack pointer to temporary 
value");
diff --git a/t/lib/warnings/pp_pack b/t/lib/warnings/pp_pack
index 62ae3a9..29ab0ac 100644
--- a/t/lib/warnings/pp_pack
+++ b/t/lib/warnings/pp_pack
@@ -21,38 +21,18 @@ EXPECT
 Invalid type ',' in unpack at - line 4.
 Invalid type ',' in pack at - line 5.
 ########
-# pp.c
-use warnings 'uninitialized' ;
-my $a = undef ; 
-my $b = $$a;
-no warnings 'uninitialized' ;
-my $c = $$a;
-EXPECT
-Use of uninitialized value $a in scalar dereference at - line 4.
-########
 # pp_pack.c
 use warnings 'pack' ;
 sub foo { my $a = "a"; return $a . $a++ . $a++ }
 my $a = pack("p", &foo) ;
+@a = "foo";
+sub bar { pop @{\@_}, pack "p", $a[0] } # This should *not* warn, even
+bar(@a);                                # though $a[0] is SvTEMP.
 no warnings 'pack' ;
 my $b = pack("p", &foo) ;
 EXPECT
 Attempt to pack pointer to temporary value at - line 4.
 ########
-# pp.c
-use warnings 'misc' ;
-bless \[], "" ;
-no warnings 'misc' ;
-bless \[], "" ;
-EXPECT
-Explicit blessing to '' (assuming package main) at - line 3.
-########
-# pp.c
-use utf8 ;
-$_ = "\x80  \xff" ;
-reverse ;
-EXPECT
-########
 # pp_pack.c
 use warnings 'pack' ;
 print unpack("C", pack("C",   -1)), "\n",

--
Perl5 Master Repository

Reply via email to