From 4e72416094ac8758917b5389c6c6c01b53c16475 Mon Sep 17 00:00:00 2001 From: Ricardo Signes Date: Sun, 6 Jun 2021 15:56:23 -0400 Subject: [PATCH 1/4] feature.pm: drop "switch" from latest version bundle --- feature.h | 29 +++++++++++++++++------------ lib/feature.pm | 8 ++++---- regen/feature.pl | 4 +++- 3 files changed, 24 insertions(+), 17 deletions(-) diff --git a/feature.h b/feature.h index 501bc3a3b180..29522eedb5ec 100644 --- a/feature.h +++ b/feature.h @@ -37,6 +37,7 @@ #define FEATURE_BUNDLE_515 3 #define FEATURE_BUNDLE_523 4 #define FEATURE_BUNDLE_527 5 +#define FEATURE_BUNDLE_535 6 #define FEATURE_BUNDLE_CUSTOM (HINT_FEATURE_MASK >> HINT_FEATURE_SHIFT) #define CURRENT_HINTS \ @@ -54,7 +55,7 @@ #define FEATURE_FC_IS_ENABLED \ ( \ (CURRENT_FEATURE_BUNDLE >= FEATURE_BUNDLE_515 && \ - CURRENT_FEATURE_BUNDLE <= FEATURE_BUNDLE_527) \ + CURRENT_FEATURE_BUNDLE <= FEATURE_BUNDLE_535) \ || (CURRENT_FEATURE_BUNDLE == FEATURE_BUNDLE_CUSTOM && \ FEATURE_IS_ENABLED_MASK(FEATURE_FC_BIT)) \ ) @@ -68,7 +69,7 @@ #define FEATURE_SAY_IS_ENABLED \ ( \ (CURRENT_FEATURE_BUNDLE >= FEATURE_BUNDLE_510 && \ - CURRENT_FEATURE_BUNDLE <= FEATURE_BUNDLE_527) \ + CURRENT_FEATURE_BUNDLE <= FEATURE_BUNDLE_535) \ || (CURRENT_FEATURE_BUNDLE == FEATURE_BUNDLE_CUSTOM && \ FEATURE_IS_ENABLED_MASK(FEATURE_SAY_BIT)) \ ) @@ -82,7 +83,7 @@ #define FEATURE_STATE_IS_ENABLED \ ( \ (CURRENT_FEATURE_BUNDLE >= FEATURE_BUNDLE_510 && \ - CURRENT_FEATURE_BUNDLE <= FEATURE_BUNDLE_527) \ + CURRENT_FEATURE_BUNDLE <= FEATURE_BUNDLE_535) \ || (CURRENT_FEATURE_BUNDLE == FEATURE_BUNDLE_CUSTOM && \ FEATURE_IS_ENABLED_MASK(FEATURE_STATE_BIT)) \ ) @@ -97,14 +98,15 @@ #define FEATURE_BITWISE_IS_ENABLED \ ( \ - CURRENT_FEATURE_BUNDLE == FEATURE_BUNDLE_527 \ + (CURRENT_FEATURE_BUNDLE >= FEATURE_BUNDLE_527 && \ + CURRENT_FEATURE_BUNDLE <= FEATURE_BUNDLE_535) \ || (CURRENT_FEATURE_BUNDLE == FEATURE_BUNDLE_CUSTOM && \ FEATURE_IS_ENABLED_MASK(FEATURE_BITWISE_BIT)) \ ) #define FEATURE_INDIRECT_IS_ENABLED \ ( \ - CURRENT_FEATURE_BUNDLE <= FEATURE_BUNDLE_527 \ + CURRENT_FEATURE_BUNDLE <= FEATURE_BUNDLE_535 \ || (CURRENT_FEATURE_BUNDLE == FEATURE_BUNDLE_CUSTOM && \ FEATURE_IS_ENABLED_MASK(FEATURE_INDIRECT_BIT)) \ ) @@ -112,7 +114,7 @@ #define FEATURE_EVALBYTES_IS_ENABLED \ ( \ (CURRENT_FEATURE_BUNDLE >= FEATURE_BUNDLE_515 && \ - CURRENT_FEATURE_BUNDLE <= FEATURE_BUNDLE_527) \ + CURRENT_FEATURE_BUNDLE <= FEATURE_BUNDLE_535) \ || (CURRENT_FEATURE_BUNDLE == FEATURE_BUNDLE_CUSTOM && \ FEATURE_IS_ENABLED_MASK(FEATURE_EVALBYTES_BIT)) \ ) @@ -126,7 +128,7 @@ #define FEATURE___SUB___IS_ENABLED \ ( \ (CURRENT_FEATURE_BUNDLE >= FEATURE_BUNDLE_515 && \ - CURRENT_FEATURE_BUNDLE <= FEATURE_BUNDLE_527) \ + CURRENT_FEATURE_BUNDLE <= FEATURE_BUNDLE_535) \ || (CURRENT_FEATURE_BUNDLE == FEATURE_BUNDLE_CUSTOM && \ FEATURE_IS_ENABLED_MASK(FEATURE___SUB___BIT)) \ ) @@ -140,7 +142,7 @@ #define FEATURE_POSTDEREF_QQ_IS_ENABLED \ ( \ (CURRENT_FEATURE_BUNDLE >= FEATURE_BUNDLE_523 && \ - CURRENT_FEATURE_BUNDLE <= FEATURE_BUNDLE_527) \ + CURRENT_FEATURE_BUNDLE <= FEATURE_BUNDLE_535) \ || (CURRENT_FEATURE_BUNDLE == FEATURE_BUNDLE_CUSTOM && \ FEATURE_IS_ENABLED_MASK(FEATURE_POSTDEREF_QQ_BIT)) \ ) @@ -148,7 +150,7 @@ #define FEATURE_UNIEVAL_IS_ENABLED \ ( \ (CURRENT_FEATURE_BUNDLE >= FEATURE_BUNDLE_515 && \ - CURRENT_FEATURE_BUNDLE <= FEATURE_BUNDLE_527) \ + CURRENT_FEATURE_BUNDLE <= FEATURE_BUNDLE_535) \ || (CURRENT_FEATURE_BUNDLE == FEATURE_BUNDLE_CUSTOM && \ FEATURE_IS_ENABLED_MASK(FEATURE_UNIEVAL_BIT)) \ ) @@ -162,21 +164,21 @@ #define FEATURE_UNICODE_IS_ENABLED \ ( \ (CURRENT_FEATURE_BUNDLE >= FEATURE_BUNDLE_511 && \ - CURRENT_FEATURE_BUNDLE <= FEATURE_BUNDLE_527) \ + CURRENT_FEATURE_BUNDLE <= FEATURE_BUNDLE_535) \ || (CURRENT_FEATURE_BUNDLE == FEATURE_BUNDLE_CUSTOM && \ FEATURE_IS_ENABLED_MASK(FEATURE_UNICODE_BIT)) \ ) #define FEATURE_MULTIDIMENSIONAL_IS_ENABLED \ ( \ - CURRENT_FEATURE_BUNDLE <= FEATURE_BUNDLE_527 \ + CURRENT_FEATURE_BUNDLE <= FEATURE_BUNDLE_535 \ || (CURRENT_FEATURE_BUNDLE == FEATURE_BUNDLE_CUSTOM && \ FEATURE_IS_ENABLED_MASK(FEATURE_MULTIDIMENSIONAL_BIT)) \ ) #define FEATURE_BAREWORD_FILEHANDLES_IS_ENABLED \ ( \ - CURRENT_FEATURE_BUNDLE <= FEATURE_BUNDLE_527 \ + CURRENT_FEATURE_BUNDLE <= FEATURE_BUNDLE_535 \ || (CURRENT_FEATURE_BUNDLE == FEATURE_BUNDLE_CUSTOM && \ FEATURE_IS_ENABLED_MASK(FEATURE_BAREWORD_FILEHANDLES_BIT)) \ ) @@ -204,6 +206,9 @@ S_enable_feature_bundle(pTHX_ SV *ver) SV *comp_ver = sv_newmortal(); PL_hints = (PL_hints &~ HINT_FEATURE_MASK) | ( + (sv_setnv(comp_ver, 5.035), + vcmp(ver, upg_version(comp_ver, FALSE)) >= 0) + ? FEATURE_BUNDLE_535 : (sv_setnv(comp_ver, 5.027), vcmp(ver, upg_version(comp_ver, FALSE)) >= 0) ? FEATURE_BUNDLE_527 : diff --git a/lib/feature.pm b/lib/feature.pm index 9c4179364af0..afaf11211bdb 100644 --- a/lib/feature.pm +++ b/lib/feature.pm @@ -34,6 +34,7 @@ our %feature_bundle = ( "5.15" => [qw(bareword_filehandles current_sub evalbytes fc indirect multidimensional say state switch unicode_eval unicode_strings)], "5.23" => [qw(bareword_filehandles current_sub evalbytes fc indirect multidimensional postderef_qq say state switch unicode_eval unicode_strings)], "5.27" => [qw(bareword_filehandles bitwise current_sub evalbytes fc indirect multidimensional postderef_qq say state switch unicode_eval unicode_strings)], + "5.35" => [qw(bareword_filehandles bitwise current_sub evalbytes fc indirect multidimensional postderef_qq say state unicode_eval unicode_strings)], "all" => [qw(bareword_filehandles bitwise current_sub declared_refs evalbytes fc indirect isa multidimensional postderef_qq refaliasing say signatures state switch try unicode_eval unicode_strings)], "default" => [qw(bareword_filehandles indirect multidimensional)], ); @@ -58,8 +59,7 @@ $feature_bundle{"5.31"} = $feature_bundle{"5.27"}; $feature_bundle{"5.32"} = $feature_bundle{"5.27"}; $feature_bundle{"5.33"} = $feature_bundle{"5.27"}; $feature_bundle{"5.34"} = $feature_bundle{"5.27"}; -$feature_bundle{"5.35"} = $feature_bundle{"5.27"}; -$feature_bundle{"5.36"} = $feature_bundle{"5.27"}; +$feature_bundle{"5.36"} = $feature_bundle{"5.35"}; $feature_bundle{"5.9.5"} = $feature_bundle{"5.10"}; my %noops = ( postderef => 1, @@ -71,7 +71,7 @@ my %removed = ( our $hint_shift = 26; our $hint_mask = 0x3c000000; -our @hint_bundles = qw( default 5.10 5.11 5.15 5.23 5.27 ); +our @hint_bundles = qw( default 5.10 5.11 5.15 5.23 5.27 5.35 ); # This gets set (for now) in $^H as well as in %^H, # for runtime speed of the uc/lc/ucfirst/lcfirst functions. @@ -505,7 +505,7 @@ The following feature bundles are available: :5.36 bareword_filehandles bitwise current_sub evalbytes fc indirect multidimensional - postderef_qq say state switch unicode_eval + postderef_qq say state unicode_eval unicode_strings The C<:default> bundle represents the feature set that is enabled before diff --git a/regen/feature.pl b/regen/feature.pl index e4f8386a0273..a528fe5ba885 100755 --- a/regen/feature.pl +++ b/regen/feature.pl @@ -55,6 +55,7 @@ BEGIN use constant V5_15 => sort ( +V5_11, qw{unicode_eval evalbytes current_sub fc} ); use constant V5_23 => sort ( +V5_15, qw{postderef_qq} ); use constant V5_27 => sort ( +V5_23, qw{bitwise} ); +use constant V5_35 => sort ( grep {; $_ ne 'switch' } +V5_27); my %feature_bundle = ( all => [ sort keys %feature ], @@ -78,7 +79,8 @@ BEGIN "5.29" => [ +V5_27 ], "5.31" => [ +V5_27 ], "5.33" => [ +V5_27 ], - "5.35" => [ +V5_27 ], + # using 5.35 features bundle + "5.35" => [ +V5_35 ], ); my @noops = qw( postderef lexical_subs ); From 0bea726b3cf7d604921a7a18182ab1887aec431b Mon Sep 17 00:00:00 2001 From: Ricardo Signes Date: Sun, 6 Jun 2021 16:06:21 -0400 Subject: [PATCH 2/4] switches.t: stop testing that -E includes switch --- t/run/switches.t | 7 +------ 1 file changed, 1 insertion(+), 6 deletions(-) diff --git a/t/run/switches.t b/t/run/switches.t index aa8d9c5427c9..cd8aec5bb1c6 100644 --- a/t/run/switches.t +++ b/t/run/switches.t @@ -12,7 +12,7 @@ BEGIN { BEGIN { require "./test.pl"; require "./loc_tools.pl"; } -plan(tests => 137); +plan(tests => 136); use Config; @@ -693,11 +693,6 @@ $r = runperl( ); is( $r, "Hello, world!\n", "-E ~~" ); -$r = runperl( - switches => [ '-E', '"no warnings q{experimental::smartmatch}; given(undef) {when(undef) { say q(Hello, world!)"}}'] -); -is( $r, "Hello, world!\n", "-E given" ); - $r = runperl( switches => [ '-nE', q("} END { say q/affe/") ], stdin => 'zomtek', From 8065350face976314a3d85c1fde7cd6c43a26d3e Mon Sep 17 00:00:00 2001 From: Ricardo Signes Date: Sun, 6 Jun 2021 16:07:39 -0400 Subject: [PATCH 3/4] switches.t: stop testing that -E turns on ~~ ~~ is not feature guarded to begin with! I think this test was maybe a mistake, or maybe became obsolete over time. --- t/run/switches.t | 8 +------- 1 file changed, 1 insertion(+), 7 deletions(-) diff --git a/t/run/switches.t b/t/run/switches.t index cd8aec5bb1c6..6546fc6ff0a9 100644 --- a/t/run/switches.t +++ b/t/run/switches.t @@ -12,7 +12,7 @@ BEGIN { BEGIN { require "./test.pl"; require "./loc_tools.pl"; } -plan(tests => 136); +plan(tests => 135); use Config; @@ -687,12 +687,6 @@ $r = runperl( ); is( $r, "Hello, world!\n", "-E say" ); - -$r = runperl( - switches => [ '-E', '"no warnings q{experimental::smartmatch}; undef ~~ undef and say q(Hello, world!)"'] -); -is( $r, "Hello, world!\n", "-E ~~" ); - $r = runperl( switches => [ '-nE', q("} END { say q/affe/") ], stdin => 'zomtek', From 96f235739a6ef28fdc3109e772fc15db6becb052 Mon Sep 17 00:00:00 2001 From: Ricardo Signes Date: Sun, 6 Jun 2021 16:17:53 -0400 Subject: [PATCH 4/4] B::Deparse tests: turn on "switch" to test break() behavior --- lib/B/Deparse-core.t | 2 ++ 1 file changed, 2 insertions(+) diff --git a/lib/B/Deparse-core.t b/lib/B/Deparse-core.t index 9d891a750780..ae2a80068251 100644 --- a/lib/B/Deparse-core.t +++ b/lib/B/Deparse-core.t @@ -87,6 +87,7 @@ sub testit { no strict 'vars'; $code = "sub { state sub $keyword; ${vars}() = $expr }"; $code = "use feature 'isa';\n$code" if $keyword eq "isa"; + $code = "use feature 'switch';\n$code" if $keyword eq "break"; $code_ref = eval $code or die "$@ in $expr"; } else { @@ -96,6 +97,7 @@ sub testit { import subs $keyword; $code = "no strict 'vars'; sub { ${vars}() = $expr }"; $code = "use feature 'isa';\n$code" if $keyword eq "isa"; + $code = "use feature 'switch';\n$code" if $keyword eq "break"; $code_ref = eval $code or die "$@ in $expr"; }