From 6634bb9d0ed117be3584c9446cc6b05b93e3c773 Mon Sep 17 00:00:00 2001 From: Father Chrysostomos Date: Thu, 22 Dec 2011 22:22:51 -0800 Subject: [PATCH] op.c: Use new feature bundle hints MIME-Version: 1.0 Content-Type: text/plain; charset=utf8 Content-Transfer-Encoding: 8bit Now ‘use v5.22’ and ‘use 5.005’ no longer have to load feature.pm to enable the current feature bundle. All they do is twiddle bits in PL_hints. Since version declarations no longer call feature->unimport, there may be junk left over in %^H (which we leave for speed’s sake), so feature.pm has to delete that junk before enabling features. --- lib/feature.pm | 6 +++++- op.c | 18 ++---------------- regen/feature.pl | 6 +++++- 3 files changed, 12 insertions(+), 18 deletions(-) diff --git a/lib/feature.pm b/lib/feature.pm index c9e188b..75c6666 100644 --- a/lib/feature.pm +++ b/lib/feature.pm @@ -299,7 +299,11 @@ sub import { croak("No features specified"); } if (my $features = current_bundle) { - # Features are enabled implicitly via bundle hints + # Features are enabled implicitly via bundle hints. + + # Delete any keys that may be left over from last time. + delete @^H{ values(%feature) }; + unshift @_, @$features; $^H |= $hint_mask; } diff --git a/op.c b/op.c index 941da4f..d5b039c 100644 --- a/op.c +++ b/op.c @@ -4672,26 +4672,12 @@ Perl_utilize(pTHX_ int aver, I32 floor, OP *version, OP *idop, OP *arg) if (use_version) { HV * const hinthv = GvHV(PL_hintgv); const bool hhoff = !hinthv || !(PL_hints & HINT_LOCALIZE_HH); - SV *importsv; - /* Turn features off */ - ENTER_with_name("load_feature"); - Perl_load_module(aTHX_ - PERL_LOADMOD_DENY, newSVpvs("feature"), NULL, NULL - ); - - /* If we request a version >= 5.9.5, load feature.pm with the + /* Enable the * feature bundle that corresponds to the required version. */ use_version = sv_2mortal(new_version(use_version)); + S_enable_feature_bundle(aTHX_ use_version); - if (vcmp(use_version, - sv_2mortal(upg_version(newSVnv(5.009005), FALSE))) >= 0) { - importsv = vnormal(use_version); - *SvPVX_mutable(importsv) = ':'; - } - else importsv = newSVpvs(":default"); - Perl_load_module(aTHX_ 0, newSVpvs("feature"), NULL, importsv, NULL); - LEAVE_with_name("load_feature"); /* If a version >= 5.11.0 is requested, strictures are on by default! */ if (vcmp(use_version, sv_2mortal(upg_version(newSVnv(5.011000), FALSE))) >= 0) { diff --git a/regen/feature.pl b/regen/feature.pl index 2763d09..cbf4db8 100755 --- a/regen/feature.pl +++ b/regen/feature.pl @@ -567,7 +567,11 @@ sub import { croak("No features specified"); } if (my $features = current_bundle) { - # Features are enabled implicitly via bundle hints + # Features are enabled implicitly via bundle hints. + + # Delete any keys that may be left over from last time. + delete @^H{ values(%feature) }; + unshift @_, @$features; $^H |= $hint_mask; } -- 2.7.4