Skip to content

Commit

Permalink
Merge 96f2357 into 2723cea
Browse files Browse the repository at this point in the history
  • Loading branch information
rjbs committed Jun 15, 2021
2 parents 2723cea + 96f2357 commit 022c6a6
Show file tree
Hide file tree
Showing 5 changed files with 27 additions and 29 deletions.
29 changes: 17 additions & 12 deletions feature.h
Expand Up @@ -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 \
Expand All @@ -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)) \
)
Expand All @@ -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)) \
)
Expand All @@ -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)) \
)
Expand All @@ -97,22 +98,23 @@

#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)) \
)

#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)) \
)
Expand All @@ -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)) \
)
Expand All @@ -140,15 +142,15 @@
#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)) \
)

#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)) \
)
Expand All @@ -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)) \
)
Expand Down Expand Up @@ -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 :
Expand Down
2 changes: 2 additions & 0 deletions lib/B/Deparse-core.t
Expand Up @@ -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 {
Expand All @@ -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";
}

Expand Down
8 changes: 4 additions & 4 deletions lib/feature.pm
Expand Up @@ -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)],
);
Expand All @@ -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,
Expand All @@ -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.
Expand Down Expand Up @@ -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
Expand Down
4 changes: 3 additions & 1 deletion regen/feature.pl
Expand Up @@ -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 ],
Expand All @@ -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 );
Expand Down
13 changes: 1 addition & 12 deletions t/run/switches.t
Expand Up @@ -12,7 +12,7 @@ BEGIN {

BEGIN { require "./test.pl"; require "./loc_tools.pl"; }

plan(tests => 137);
plan(tests => 135);

use Config;

Expand Down Expand Up @@ -687,17 +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 => [ '-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',
Expand Down

0 comments on commit 022c6a6

Please sign in to comment.