This is a live mirror of the Perl 5 development currently hosted at https://github.com/perl/perl5
Fix FEATURE_${NAME}_IS_ENABLED macro for default features
authorDagfinn Ilmari Mannsåker <ilmari@ilmari.org>
Thu, 14 Nov 2019 12:12:07 +0000 (12:12 +0000)
committerDagfinn Ilmari Mannsåker <ilmari@ilmari.org>
Thu, 14 Nov 2019 12:22:13 +0000 (12:22 +0000)
Commit 9f601cf3bbfa6be3e2ab3468e77a7b79c80ff5cf changed feature checks
from using a hash lookup to a bitmap check, but the macro definition
for enabled-by-default had the wrong macro name for the mask check,
and had `\L` instead of `\U` for the bit macro.  Change them all to
use the already-uppercase `$NAME` variable.

We don't actually have any default-enabled features since array_base
was removed, but in converting TonyC's 'noindirect' feature into a
default-enabled 'indirect' feature, I got bitten by this.

regen/feature.pl

index bbea427..1fcebb3 100755 (executable)
@@ -312,44 +312,44 @@ for (
     my $NAME = uc $name;
     if ($last && $first eq 'DEFAULT') { #  '>= DEFAULT' warns
        print $h <<EOI;
-#define FEATURE_$NAME\_IS_ENABLED \\
+#define FEATURE_${NAME}_IS_ENABLED \\
     ( \\
        CURRENT_FEATURE_BUNDLE <= FEATURE_BUNDLE_$last \\
      || (CURRENT_FEATURE_BUNDLE == FEATURE_BUNDLE_CUSTOM && \\
-        FEATURE_ENABLED_MASK(FEATURE_\L$name\E_BIT)) \\
+        FEATURE_IS_ENABLED_MASK(FEATURE_${NAME}_BIT)) \\
     )
 
 EOI
     }
     elsif ($last) {
        print $h <<EOH3;
-#define FEATURE_$NAME\_IS_ENABLED \\
+#define FEATURE_${NAME}_IS_ENABLED \\
     ( \\
        (CURRENT_FEATURE_BUNDLE >= FEATURE_BUNDLE_$first && \\
         CURRENT_FEATURE_BUNDLE <= FEATURE_BUNDLE_$last) \\
      || (CURRENT_FEATURE_BUNDLE == FEATURE_BUNDLE_CUSTOM && \\
-        FEATURE_IS_ENABLED_MASK(FEATURE_\U$name\E_BIT)) \\
+        FEATURE_IS_ENABLED_MASK(FEATURE_${NAME}_BIT)) \\
     )
 
 EOH3
     }
     elsif ($first) {
        print $h <<EOH4;
-#define FEATURE_$NAME\_IS_ENABLED \\
+#define FEATURE_${NAME}_IS_ENABLED \\
     ( \\
        CURRENT_FEATURE_BUNDLE == FEATURE_BUNDLE_$first \\
      || (CURRENT_FEATURE_BUNDLE == FEATURE_BUNDLE_CUSTOM && \\
-        FEATURE_IS_ENABLED_MASK(FEATURE_\U$name\E_BIT)) \\
+        FEATURE_IS_ENABLED_MASK(FEATURE_${NAME}_BIT)) \\
     )
 
 EOH4
     }
     else {
        print $h <<EOH5;
-#define FEATURE_$NAME\_IS_ENABLED \\
+#define FEATURE_${NAME}_IS_ENABLED \\
     ( \\
        CURRENT_FEATURE_BUNDLE == FEATURE_BUNDLE_CUSTOM && \\
-        FEATURE_IS_ENABLED_MASK(FEATURE_\U$name\E_BIT) \\
+        FEATURE_IS_ENABLED_MASK(FEATURE_${NAME}_BIT) \\
     )
 
 EOH5