diff options
author | Father Chrysostomos <sprout@cpan.org> | 2016-05-20 14:30:14 -0700 |
---|---|---|
committer | Father Chrysostomos <sprout@cpan.org> | 2016-05-20 15:59:58 -0700 |
commit | db629560b69530994e144a9d538421f72ec29483 (patch) | |
tree | bea0ae385bfc7a34ee6815833920d04ddb3b93fc | |
parent | c2c360591864547f4210a9df74e0064cff39a11b (diff) | |
download | perl-db629560b69530994e144a9d538421f72ec29483.tar.gz |
Give feature.pm the concept of no-op features
-rw-r--r-- | feature.h | 12 | ||||
-rw-r--r-- | lib/B/Deparse.t | 10 | ||||
-rw-r--r-- | lib/feature.pm | 11 | ||||
-rwxr-xr-x | regen/feature.pl | 11 |
4 files changed, 20 insertions, 24 deletions
@@ -76,12 +76,6 @@ FEATURE_IS_ENABLED("evalbytes")) \ ) -#define FEATURE_POSTDEREF_IS_ENABLED \ - ( \ - CURRENT_FEATURE_BUNDLE == FEATURE_BUNDLE_CUSTOM && \ - FEATURE_IS_ENABLED("postderef") \ - ) - #define FEATURE_ARYBASE_IS_ENABLED \ ( \ CURRENT_FEATURE_BUNDLE <= FEATURE_BUNDLE_511 \ @@ -109,12 +103,6 @@ FEATURE_IS_ENABLED("refaliasing") \ ) -#define FEATURE_LEXSUBS_IS_ENABLED \ - ( \ - CURRENT_FEATURE_BUNDLE == FEATURE_BUNDLE_CUSTOM && \ - FEATURE_IS_ENABLED("lexsubs") \ - ) - #define FEATURE_POSTDEREF_QQ_IS_ENABLED \ ( \ CURRENT_FEATURE_BUNDLE == FEATURE_BUNDLE_523 \ diff --git a/lib/B/Deparse.t b/lib/B/Deparse.t index 19db4040bc..fe13aae2a8 100644 --- a/lib/B/Deparse.t +++ b/lib/B/Deparse.t @@ -1941,12 +1941,11 @@ my($a, $b, $c) = @_; #### # SKIP ?$] < 5.017004 && "lexical subs not implemented on this Perl version" # lexical subroutine -use feature 'lexical_subs'; +# CONTEXT use feature 'lexical_subs'; no warnings "experimental::lexical_subs"; my sub f {} print f(); >>>> -use feature 'lexical_subs'; BEGIN {${^WARNING_BITS} = "\x54\x55\x55\x55\x55\x55\x55\x55\x55\x55\x55\x55\x55\x54\x55\x55\x55\x15"} my sub f { BEGIN {${^WARNING_BITS} = "\x54\x55\x55\x55\x55\x55\x55\x55\x55\x55\x55\x55\x55\x54\x55\x55\x15"} @@ -1957,20 +1956,17 @@ print f(); #### # SKIP ?$] < 5.017004 && "lexical subs not implemented on this Perl version" # lexical "state" subroutine -use feature 'state', 'lexical_subs'; +# CONTEXT use feature 'state', 'lexical_subs'; no warnings 'experimental::lexical_subs'; state sub f {} print f(); >>>> -use feature 'lexical_subs'; BEGIN {${^WARNING_BITS} = "\x54\x55\x55\x55\x55\x55\x55\x55\x55\x55\x55\x55\x55\x54\x55\x55\x55\x15"} -CORE::state sub f { +state sub f { BEGIN {${^WARNING_BITS} = "\x54\x55\x55\x55\x55\x55\x55\x55\x55\x55\x55\x55\x55\x54\x55\x55\x15"} - use feature 'state'; } BEGIN {${^WARNING_BITS} = "\x54\x55\x55\x55\x55\x55\x55\x55\x55\x55\x55\x55\x55\x54\x55\x55\x15"} -use feature 'state'; print f(); #### # SKIP ?$] < 5.017004 && "lexical subs not implemented on this Perl version" diff --git a/lib/feature.pm b/lib/feature.pm index f197f48e26..caa7326ba9 100644 --- a/lib/feature.pm +++ b/lib/feature.pm @@ -14,12 +14,10 @@ our %feature = ( switch => 'feature_switch', bitwise => 'feature_bitwise', evalbytes => 'feature_evalbytes', - postderef => 'feature_postderef', array_base => 'feature_arybase', signatures => 'feature_signatures', current_sub => 'feature___SUB__', refaliasing => 'feature_refaliasing', - lexical_subs => 'feature_lexsubs', postderef_qq => 'feature_postderef_qq', unicode_eval => 'feature_unieval', unicode_strings => 'feature_unicode', @@ -30,7 +28,7 @@ our %feature_bundle = ( "5.11" => [qw(array_base say state switch unicode_strings)], "5.15" => [qw(current_sub evalbytes fc say state switch unicode_eval unicode_strings)], "5.23" => [qw(current_sub evalbytes fc postderef_qq say state switch unicode_eval unicode_strings)], - "all" => [qw(array_base bitwise current_sub evalbytes fc lexical_subs postderef postderef_qq refaliasing say signatures state switch unicode_eval unicode_strings)], + "all" => [qw(array_base bitwise current_sub evalbytes fc postderef_qq refaliasing say signatures state switch unicode_eval unicode_strings)], "default" => [qw(array_base)], ); @@ -48,6 +46,10 @@ $feature_bundle{"5.24"} = $feature_bundle{"5.23"}; $feature_bundle{"5.25"} = $feature_bundle{"5.23"}; $feature_bundle{"5.26"} = $feature_bundle{"5.23"}; $feature_bundle{"5.9.5"} = $feature_bundle{"5.10"}; +my %noops = ( + postderef => 1, + lexical_subs => 1, +); our $hint_shift = 26; our $hint_mask = 0x1c000000; @@ -497,6 +499,9 @@ sub __common { next; } if (!exists $feature{$name}) { + if (exists $noops{$name}) { + next; + } unknown_feature($name); } if ($import) { diff --git a/regen/feature.pl b/regen/feature.pl index 0672ff6cc5..e8ececeb9a 100755 --- a/regen/feature.pl +++ b/regen/feature.pl @@ -27,11 +27,9 @@ my %feature = ( switch => 'switch', bitwise => 'bitwise', evalbytes => 'evalbytes', - postderef => 'postderef', array_base => 'arybase', current_sub => '__SUB__', refaliasing => 'refaliasing', - lexical_subs => 'lexsubs', postderef_qq => 'postderef_qq', unicode_eval => 'unieval', unicode_strings => 'unicode', @@ -65,6 +63,8 @@ my %feature_bundle = ( evalbytes current_sub fc postderef_qq)], ); +my @noops = qw( postderef lexical_subs ); + ########################################################################### # More data generated from the above @@ -186,6 +186,10 @@ for (sort keys %Aliases) { qq'\$feature_bundle{"$_"} = \$feature_bundle{"$Aliases{$_}"};\n'; }; +print $pm "my \%noops = (\n"; +print $pm " $_ => 1,\n", for @noops; +print $pm ");\n"; + print $pm <<EOPM; our \$hint_shift = $HintShift; @@ -778,6 +782,9 @@ sub __common { next; } if (!exists $feature{$name}) { + if (exists $noops{$name}) { + next; + } unknown_feature($name); } if ($import) { |