From 93961e27b132c6f17027fe030f89c91c7d33b801 Mon Sep 17 00:00:00 2001 From: Tony Cook Date: Thu, 18 Jul 2024 15:39:14 +1000 Subject: [PATCH] switch removal: remove the feature from feature.pm --- feature.h | 26 +++--------------- lib/B/Deparse.t | 4 +-- lib/feature.pm | 61 ++++++++++++++++--------------------------- regen/feature.pl | 25 +++++------------- t/lib/feature/api | 2 +- t/lib/feature/removed | 9 +++++++ 6 files changed, 44 insertions(+), 83 deletions(-) diff --git a/feature.h b/feature.h index 9883bf7c43b7..a7c0b0568c94 100644 --- a/feature.h +++ b/feature.h @@ -30,10 +30,9 @@ #define FEATURE_SAY_BIT 0x8000 #define FEATURE_SIGNATURES_BIT 0x10000 #define FEATURE_STATE_BIT 0x20000 -#define FEATURE_SWITCH_BIT 0x40000 -#define FEATURE_TRY_BIT 0x80000 -#define FEATURE_UNIEVAL_BIT 0x100000 -#define FEATURE_UNICODE_BIT 0x200000 +#define FEATURE_TRY_BIT 0x40000 +#define FEATURE_UNIEVAL_BIT 0x80000 +#define FEATURE_UNICODE_BIT 0x100000 #define FEATURE_BUNDLE_DEFAULT 0 #define FEATURE_BUNDLE_510 1 @@ -114,14 +113,6 @@ FEATURE_IS_ENABLED_MASK(FEATURE_STATE_BIT)) \ ) -#define FEATURE_SWITCH_IS_ENABLED \ - ( \ - (CURRENT_FEATURE_BUNDLE >= FEATURE_BUNDLE_510 && \ - CURRENT_FEATURE_BUNDLE <= FEATURE_BUNDLE_527) \ - || (CURRENT_FEATURE_BUNDLE == FEATURE_BUNDLE_CUSTOM && \ - FEATURE_IS_ENABLED_MASK(FEATURE_SWITCH_BIT)) \ - ) - #define FEATURE_BITWISE_IS_ENABLED \ ( \ (CURRENT_FEATURE_BUNDLE >= FEATURE_BUNDLE_527 && \ @@ -409,11 +400,6 @@ S_magic_sethint_feature(pTHX_ SV *keysv, const char *keypv, STRLEN keylen, mask = FEATURE_STATE_BIT; break; } - else if (keylen == sizeof("feature_switch")-1 - && memcmp(subf+1, "witch", keylen - sizeof("feature_")) == 0) { - mask = FEATURE_SWITCH_BIT; - break; - } return; case 't': @@ -567,12 +553,6 @@ PL_feature_bits[] = { STRLENs("feature_state"), FEATURE_STATE_BIT }, - { - /* feature switch */ - "feature_switch", - STRLENs("feature_switch"), - FEATURE_SWITCH_BIT - }, { /* feature try */ "feature_try", diff --git a/lib/B/Deparse.t b/lib/B/Deparse.t index 3ed279a57770..d5e5ae9e0a3c 100644 --- a/lib/B/Deparse.t +++ b/lib/B/Deparse.t @@ -965,7 +965,7 @@ say 'foo'; use feature ':5.10'; say 'foo'; >>>> -use feature 'say', 'state', 'switch'; +use feature 'say', 'state'; say 'foo'; #### # SKIP ?$] < 5.010 && "say not implemented on this Perl version" @@ -1010,7 +1010,7 @@ __SUB__; use feature ':5.15'; __SUB__; >>>> -use feature 'current_sub', 'evalbytes', 'fc', 'say', 'state', 'switch', 'unicode_strings', 'unicode_eval'; +use feature 'current_sub', 'evalbytes', 'fc', 'say', 'state', 'unicode_strings', 'unicode_eval'; __SUB__; #### # SKIP ?$] < 5.015 && "__SUB__ not implemented on this Perl version" diff --git a/lib/feature.pm b/lib/feature.pm index 404cdf94d060..cf0531845d13 100644 --- a/lib/feature.pm +++ b/lib/feature.pm @@ -4,7 +4,7 @@ # Any changes made here will be lost! package feature; -our $VERSION = '1.90'; +our $VERSION = '1.91'; our %feature = ( fc => 'feature_fc', @@ -14,7 +14,6 @@ our %feature = ( class => 'feature_class', defer => 'feature_defer', state => 'feature_state', - switch => 'feature_switch', bitwise => 'feature_bitwise', indirect => 'feature_indirect', evalbytes => 'feature_evalbytes', @@ -32,15 +31,15 @@ our %feature = ( ); our %feature_bundle = ( - "5.10" => [qw(bareword_filehandles indirect multidimensional say state switch)], - "5.11" => [qw(bareword_filehandles indirect multidimensional say state switch unicode_strings)], - "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.10" => [qw(bareword_filehandles indirect multidimensional say state)], + "5.11" => [qw(bareword_filehandles indirect multidimensional say state unicode_strings)], + "5.15" => [qw(bareword_filehandles current_sub evalbytes fc indirect multidimensional say state unicode_eval unicode_strings)], + "5.23" => [qw(bareword_filehandles current_sub evalbytes fc indirect multidimensional postderef_qq say state unicode_eval unicode_strings)], + "5.27" => [qw(bareword_filehandles bitwise current_sub evalbytes fc indirect multidimensional postderef_qq say state unicode_eval unicode_strings)], "5.35" => [qw(bareword_filehandles bitwise current_sub evalbytes fc isa postderef_qq say signatures state unicode_eval unicode_strings)], "5.37" => [qw(bitwise current_sub evalbytes fc isa module_true postderef_qq say signatures state unicode_eval unicode_strings)], "5.39" => [qw(bitwise current_sub evalbytes fc isa module_true postderef_qq say signatures state try unicode_eval unicode_strings)], - "all" => [qw(bareword_filehandles bitwise class current_sub declared_refs defer evalbytes extra_paired_delimiters fc indirect isa module_true multidimensional postderef_qq refaliasing say signatures state switch try unicode_eval unicode_strings)], + "all" => [qw(bareword_filehandles bitwise class current_sub declared_refs defer evalbytes extra_paired_delimiters fc indirect isa module_true multidimensional postderef_qq refaliasing say signatures state try unicode_eval unicode_strings)], "default" => [qw(bareword_filehandles indirect multidimensional)], ); @@ -76,6 +75,7 @@ my %noops = ( ); my %removed = ( array_base => 1, + switch => 1, ); our $hint_shift = 26; @@ -175,21 +175,10 @@ This feature is available starting with Perl 5.10. =head2 The 'switch' feature -B: This feature is still experimental and the implementation may -change or be removed in future versions of Perl. For this reason, Perl will -warn when you use the feature, unless you have explicitly disabled the warning: - - no warnings "experimental::smartmatch"; - -C tells the compiler to enable the Raku +C told the compiler to enable the Raku given/when construct. -See L for details. - -This feature is available starting with Perl 5.10. -It is deprecated starting with Perl 5.38, and using -C, C or smartmatch will throw a warning. -It will be removed in Perl 5.42. +This feature was removed in Perl 5.42. =head2 The 'unicode_strings' feature @@ -533,60 +522,56 @@ The following feature bundles are available: bareword_filehandles :5.10 bareword_filehandles indirect - multidimensional say state switch + multidimensional say state :5.12 bareword_filehandles indirect - multidimensional say state switch - unicode_strings + multidimensional say state unicode_strings :5.14 bareword_filehandles indirect - multidimensional say state switch - unicode_strings + multidimensional say state unicode_strings :5.16 bareword_filehandles current_sub evalbytes fc indirect multidimensional say state - switch unicode_eval unicode_strings + unicode_eval unicode_strings :5.18 bareword_filehandles current_sub evalbytes fc indirect multidimensional say state - switch unicode_eval unicode_strings + unicode_eval unicode_strings :5.20 bareword_filehandles current_sub evalbytes fc indirect multidimensional say state - switch unicode_eval unicode_strings + unicode_eval unicode_strings :5.22 bareword_filehandles current_sub evalbytes fc indirect multidimensional say state - switch unicode_eval unicode_strings + unicode_eval unicode_strings :5.24 bareword_filehandles current_sub evalbytes fc indirect multidimensional postderef_qq - say state switch unicode_eval - unicode_strings + say state unicode_eval unicode_strings :5.26 bareword_filehandles current_sub evalbytes fc indirect multidimensional postderef_qq - say state switch unicode_eval - unicode_strings + say state unicode_eval unicode_strings :5.28 bareword_filehandles bitwise current_sub evalbytes fc indirect multidimensional - postderef_qq say state switch unicode_eval + postderef_qq say state unicode_eval unicode_strings :5.30 bareword_filehandles bitwise current_sub evalbytes fc indirect multidimensional - postderef_qq say state switch unicode_eval + postderef_qq say state unicode_eval unicode_strings :5.32 bareword_filehandles bitwise current_sub evalbytes fc indirect multidimensional - postderef_qq say state switch unicode_eval + postderef_qq say state unicode_eval unicode_strings :5.34 bareword_filehandles bitwise current_sub evalbytes fc indirect multidimensional - postderef_qq say state switch unicode_eval + postderef_qq say state unicode_eval unicode_strings :5.36 bareword_filehandles bitwise current_sub diff --git a/regen/feature.pl b/regen/feature.pl index 0ee41f2559d2..40f74f34d1f9 100755 --- a/regen/feature.pl +++ b/regen/feature.pl @@ -26,7 +26,6 @@ BEGIN my %feature = ( say => 'say', state => 'state', - switch => 'switch', bitwise => 'bitwise', evalbytes => 'evalbytes', current_sub => '__SUB__', @@ -55,14 +54,13 @@ BEGIN # 5.odd implies the next 5.even, but an explicit 5.even can override it. # features bundles -use constant V5_9_5 => sort qw{say state switch indirect multidimensional bareword_filehandles}; +use constant V5_9_5 => sort qw{say state indirect multidimensional bareword_filehandles}; use constant V5_11 => sort ( +V5_9_5, qw{unicode_strings} ); 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' - && $_ ne 'indirect' +use constant V5_35 => sort grep {; $_ ne 'indirect' && $_ ne 'multidimensional' } +V5_27, qw{isa signatures}; use constant V5_37 => sort grep {; $_ ne 'bareword_filehandles' } +V5_35, qw{module_true}; @@ -106,7 +104,7 @@ BEGIN ); my @noops = qw( postderef lexical_subs ); -my @removed = qw( array_base ); +my @removed = qw( array_base switch ); ########################################################################### @@ -544,7 +542,7 @@ sub longest { __END__ package feature; -our $VERSION = '1.90'; +our $VERSION = '1.91'; FEATURES @@ -636,21 +634,10 @@ =head2 The 'state' feature =head2 The 'switch' feature -B: This feature is still experimental and the implementation may -change or be removed in future versions of Perl. For this reason, Perl will -warn when you use the feature, unless you have explicitly disabled the warning: - - no warnings "experimental::smartmatch"; - -C tells the compiler to enable the Raku +C told the compiler to enable the Raku given/when construct. -See L for details. - -This feature is available starting with Perl 5.10. -It is deprecated starting with Perl 5.38, and using -C, C or smartmatch will throw a warning. -It will be removed in Perl 5.42. +This feature was removed in Perl 5.42. =head2 The 'unicode_strings' feature diff --git a/t/lib/feature/api b/t/lib/feature/api index d31a8c6c6d68..5ad798dd7aa5 100644 --- a/t/lib/feature/api +++ b/t/lib/feature/api @@ -20,7 +20,7 @@ EXPECT default: bareword_filehandles indirect multidimensional unicode_strings is not enabled bundle: default -5.12: bareword_filehandles indirect multidimensional say state switch unicode_strings +5.12: bareword_filehandles indirect multidimensional say state unicode_strings unicode_strings is enabled bundle: 5.11 ######## diff --git a/t/lib/feature/removed b/t/lib/feature/removed index f2805eecd86a..a3320019ce47 100644 --- a/t/lib/feature/removed +++ b/t/lib/feature/removed @@ -8,3 +8,12 @@ OPTIONS regex ######## no feature "array_base"; EXPECT +######## +# NAME switch feature removed +use feature "switch"; +EXPECT +OPTIONS regex +^Feature "switch" is not supported by Perl [v0-9.]+ at - line 1. +######## +no feature "switch"; +EXPECT