From: Nicholas Clark Date: Mon, 13 Apr 2009 09:51:20 +0000 (+0100) Subject: A perl-version portable fix for B coping with CVf_LOCKED being removed in 5.11. X-Git-Url: http://git.shadowcat.co.uk/gitweb/gitweb.cgi?a=commitdiff_plain;h=aa381260d040715959bedd55abd0e5e3686174bd;p=p5sagit%2Fp5-mst-13.2.git A perl-version portable fix for B coping with CVf_LOCKED being removed in 5.11. --- diff --git a/ext/B/B/Deparse.pm b/ext/B/B/Deparse.pm index 8509057..9ba2442 100644 --- a/ext/B/B/Deparse.pm +++ b/ext/B/B/Deparse.pm @@ -20,12 +20,19 @@ use B qw(class main_root main_start main_cv svref_2object opnumber perlstring CVf_METHOD CVf_LVALUE PMf_KEEP PMf_GLOBAL PMf_CONTINUE PMf_EVAL PMf_ONCE PMf_MULTILINE PMf_SINGLELINE PMf_FOLD PMf_EXTENDED), - ($] < 5.009 ? 'PMf_SKIPWHITE' : 'RXf_SKIPWHITE'); -$VERSION = 0.88; + ($] < 5.009 ? 'PMf_SKIPWHITE' : 'RXf_SKIPWHITE'), + ($] < 5.011 ? 'CVf_LOCKED' : ()); +$VERSION = 0.89; use strict; use vars qw/$AUTOLOAD/; use warnings (); +BEGIN { + # Easiest way to keep this code portable between 5.12.x and 5.10.x looks to + # be to fake up a dummy CVf_LOCKED that will never actually be true. + *CVf_LOCKED = sub () {0} unless defined &CVf_LOCKED; +} + # Changes between 0.50 and 0.51: # - fixed nulled leave with live enter in sort { } # - fixed reference constants (\"str") @@ -865,9 +872,10 @@ Carp::confess("SPECIAL in deparse_sub") if $cv->isa("B::SPECIAL"); if ($cv->FLAGS & SVf_POK) { $proto = "(". $cv->PV . ") "; } - if ($cv->CvFLAGS & (CVf_METHOD|CVf_LVALUE)) { + if ($cv->CvFLAGS & (CVf_METHOD|CVf_LOCKED|CVf_LVALUE)) { $proto .= ": "; $proto .= "lvalue " if $cv->CvFLAGS & CVf_LVALUE; + $proto .= "locked " if $cv->CvFLAGS & CVf_LOCKED; $proto .= "method " if $cv->CvFLAGS & CVf_METHOD; } diff --git a/ext/B/defsubs_h.PL b/ext/B/defsubs_h.PL index fa8aff0..684ca26 100644 --- a/ext/B/defsubs_h.PL +++ b/ext/B/defsubs_h.PL @@ -67,6 +67,11 @@ if ($] >= 5.009) { doconst(AVf_REAL); } +if ($] < 5.011) { + # Constant not present after 5.10.x + doconst(CVf_LOCKED); +} + foreach my $tuple (['op.h'],['cop.h'],['regexp.h','RXf_']) { my $file = $tuple->[0]; diff --git a/ext/B/t/concise-xs.t b/ext/B/t/concise-xs.t index 3c51f82..b849af5 100644 --- a/ext/B/t/concise-xs.t +++ b/ext/B/t/concise-xs.t @@ -173,7 +173,9 @@ my $testpkgs = { PMf_MULTILINE PMf_ONCE PMf_SINGLELINE POSTFIX SVf_FAKE SVf_IOK SVf_NOK SVf_POK SVf_ROK SVpad_OUR SVs_RMG SVs_SMG SWAP_CHILDREN OPpPAD_STATE - /, $] > 5.009 ? ('RXf_SKIPWHITE') : ('PMf_SKIPWHITE')], + /, $] > 5.009 ? ('RXf_SKIPWHITE') : ('PMf_SKIPWHITE'), + 'CVf_LOCKED', # This ends up as a constant, pre or post 5.10 + ], }, POSIX => { dflt => 'constant', # all but 252/589