summaryrefslogtreecommitdiff
path: root/regen
diff options
context:
space:
mode:
authorFather Chrysostomos <sprout@cpan.org>2011-12-22 08:34:31 -0800
committerFather Chrysostomos <sprout@cpan.org>2011-12-24 09:25:12 -0800
commit23a52d6b1d16cc250eb1dba0dc48439ff677e635 (patch)
tree1d397797fb89382c996947de68dc514d16d47101 /regen
parenta803b9b45460971b5fd47f0f4f7599cc91e04c7e (diff)
downloadperl-23a52d6b1d16cc250eb1dba0dc48439ff677e635.tar.gz
Parse the feature hint bits & assert their usability
Diffstat (limited to 'regen')
-rw-r--r--regen/feature.pl20
1 files changed, 20 insertions, 0 deletions
diff --git a/regen/feature.pl b/regen/feature.pl
index 3e2057485e..b57a30e342 100644
--- a/regen/feature.pl
+++ b/regen/feature.pl
@@ -116,6 +116,26 @@ while (<DATA>) {
read_only_bottom_close_and_rename($pm);
+open "perl.h", "perl.h" or die "$0 cannot open perl.h: $!";
+perlh: {
+ while (readline "perl.h") {
+ next unless /#define\s+HINT_FEATURE_MASK/;
+ /(0x[A-Fa-f0-9]+)/ or die "No hex number in:\n\n$_\n ";
+ my $hex = $1;
+ my $bits = sprintf "%b", oct $1;
+ $bits =~ /^0*1+0*\z/
+ or die "Non-contiguous bits in $bits (binary for $hex):\n\n$_\n ";
+ my $bits_needed =
+ length sprintf "%b", scalar keys(%feature_bundle) - @same;
+ $bits =~ /1{$bits_needed}/
+ or die "Not enough bits (need $bits_needed)"
+ . " in $bits (binary for $hex):\n\n$_\n";
+ last perlh;
+ }
+ die "No HINT_FEATURE_MASK defined in perl.h";
+}
+close "perl.h";
+
__END__
package feature;