summaryrefslogtreecommitdiff
path: root/regen/feature.pl
diff options
context:
space:
mode:
authorFather Chrysostomos <sprout@cpan.org>2012-09-15 22:02:42 -0700
committerFather Chrysostomos <sprout@cpan.org>2012-09-15 22:45:11 -0700
commitebd2568602497a1cca32683caa01bc948f2637f1 (patch)
treef98cc4bf1a7c4521170d6099067cba9c5271eac5 /regen/feature.pl
parent301381dc4c17004a66294b221c6cce2e4e4f1e1f (diff)
downloadperl-ebd2568602497a1cca32683caa01bc948f2637f1.tar.gz
Add experimental lexical_subs feature
Diffstat (limited to 'regen/feature.pl')
-rwxr-xr-xregen/feature.pl28
1 files changed, 25 insertions, 3 deletions
diff --git a/regen/feature.pl b/regen/feature.pl
index 23a899a9ba..cc7034ee15 100755
--- a/regen/feature.pl
+++ b/regen/feature.pl
@@ -28,6 +28,7 @@ my %feature = (
evalbytes => 'evalbytes',
array_base => 'arybase',
current_sub => '__SUB__',
+ lexical_subs => 'lexsubs',
unicode_eval => 'unieval',
unicode_strings => 'unicode',
fc => 'fc',
@@ -51,6 +52,8 @@ my %feature_bundle = (
evalbytes current_sub fc)],
);
+my @experimental = qw( lexical_subs );
+
###########################################################################
# More data generated from the above
@@ -151,7 +154,7 @@ sub longest {
print $pm "our %feature = (\n";
my $width = length longest keys %feature;
-for(sort { length $a <=> length $b } keys %feature) {
+for(sort { length $a <=> length $b || $a cmp $b } keys %feature) {
print $pm " $_" . " "x($width-length)
. " => 'feature_$feature{$_}',\n";
}
@@ -172,6 +175,10 @@ for (sort keys %Aliases) {
qq'\$feature_bundle{"$_"} = \$feature_bundle{"$Aliases{$_}"};\n';
};
+print $pm "my \%experimental = (\n";
+print $pm " $_ => 1,\n", for @experimental;
+print $pm ");\n";
+
print $pm <<EOPM;
our \$hint_shift = $HintShift;
@@ -251,7 +258,7 @@ print $h <<EOL;
EOL
for (
- sort { length $a <=> length $b } keys %feature
+ sort { length $a <=> length $b || $a cmp $b } keys %feature
) {
my($first,$last) =
map { (my $__ = uc) =~ y/.//d; $__ } @{$BundleRanges{$_}};
@@ -280,7 +287,7 @@ EOI
EOH3
}
- else {
+ elsif ($first) {
print $h <<EOH4;
#define FEATURE_$NAME\_IS_ENABLED \\
( \\
@@ -291,6 +298,16 @@ EOH3
EOH4
}
+ else {
+ print $h <<EOH5;
+#define FEATURE_$NAME\_IS_ENABLED \\
+ ( \\
+ CURRENT_FEATURE_BUNDLE == FEATURE_BUNDLE_CUSTOM && \\
+ FEATURE_IS_ENABLED("$name") \\
+ )
+
+EOH5
+ }
}
print $h <<EOH;
@@ -647,6 +664,11 @@ sub __common {
if ($import) {
$^H{$feature{$name}} = 1;
$^H |= $hint_uni8bit if $name eq 'unicode_strings';
+ if ($experimental{$name}) {
+ require warnings;
+ warnings::warnif("experimental:$name",
+ "The $name feature is experimental");
+ }
} else {
delete $^H{$feature{$name}};
$^H &= ~ $hint_uni8bit if $name eq 'unicode_strings';