From 76ecb004cba3fb3613c0c0a155117b2fdf6850b5 Mon Sep 17 00:00:00 2001 From: Nicolas Rochelemagne Date: Tue, 13 Sep 2016 11:16:54 -0600 Subject: [PATCH] Adjust CV::save logic for perl522 #392 This is fixing the compilation of several core tests and introduced only one single regression which unicode sub. SVs_PADSTALE was introduced in perl 5.8.5 --- lib/B/C.pm | 17 ++++++++++++++--- 1 file changed, 14 insertions(+), 3 deletions(-) diff --git a/lib/B/C.pm b/lib/B/C.pm index c7e3b40aa..ccbb76280 100644 --- a/lib/B/C.pm +++ b/lib/B/C.pm @@ -345,6 +345,11 @@ BEGIN { eval q[sub SVt_PVGV() {13}]; eval q[sub CVf_WEAKOUTSIDE() { 0x0 }]; # unused } + if ($] >= 5.008005) { + B->import(qw(SVs_PADSTALE)); # added with 5.8.5 + } else { + eval q[sub SVs_PADSTALE() {0x0}]; # unused + } if ($] >= 5.010) { #require mro; # mro->import(); # not exported: @@ -4210,9 +4215,15 @@ sub B::CV::save { # XXX how is ANON with CONST handled? CONST uses XSUBANY [GH #246] if ($isconst and !is_phase_name($cvname) and - ( ($PERL522 and !($CvFLAGS & (CVf_ANONCONST|CVf_CONST))) - or (!$PERL522 and !($CvFLAGS & CVf_ANON)) ) - ) # skip const magic blocks (Attribute::Handlers) + ( + ( + $PERL522 + and !( $CvFLAGS & SVs_PADSTALE ) + and !( $CvFLAGS & CVf_WEAKOUTSIDE ) + and !( $fullname && $fullname =~ qr{^File::Glob::GLOB} and ( $CvFLAGS & (CVf_ANONCONST|CVf_CONST) ) ) + ) + or (!$PERL522 and !($CvFLAGS & CVf_ANON)) ) + ) # skip const magic blocks (Attribute::Handlers) { my $stash = $gv->STASH; #warn sprintf("$cvstashname\::$cvname 0x%x -> XSUBANY", $CvFLAGS) if $debug{cv};