aboutsummaryrefslogtreecommitdiffstats
path: root/scripts/enum-extract.pl
diff options
context:
space:
mode:
authorRob Norris <[email protected]>2024-08-24 21:24:59 +1000
committerBrian Behlendorf <[email protected]>2024-09-18 11:23:50 -0700
commitec48dd09760d363a715e5c274a82e7cf8415023f (patch)
treeddf81259b57f05e0eab46441ef57a12b541e9f29 /scripts/enum-extract.pl
parent8d9cb04ea8a1ca408befd0708691e1631d9f3129 (diff)
config: remove ZFS_GLOBAL_ZONE_PAGE_STATE and ZFS_ENUM_* generation
Sponsored-by: https://despairlabs.com/sponsor/ Reviewed-by: Brian Behlendorf <[email protected]> Reviewed-by: Tony Hutter <[email protected]> Reviewed-by: Tino Reichardt <[email protected]> Signed-off-by: Rob Norris <[email protected]> Closes #16479
Diffstat (limited to 'scripts/enum-extract.pl')
-rwxr-xr-xscripts/enum-extract.pl58
1 files changed, 0 insertions, 58 deletions
diff --git a/scripts/enum-extract.pl b/scripts/enum-extract.pl
deleted file mode 100755
index 5dc2e3455..000000000
--- a/scripts/enum-extract.pl
+++ /dev/null
@@ -1,58 +0,0 @@
-#!/usr/bin/env perl
-
-my $usage = <<EOT;
-usage: config-enum enum [file ...]
-
-Returns the elements from an enum declaration.
-
-"Best effort": we're not building an entire C interpreter here!
-EOT
-
-use warnings;
-use strict;
-use Getopt::Std;
-
-my %opts;
-
-if (!getopts("", \%opts) || @ARGV < 1) {
- print $usage;
- exit 2;
-}
-
-my $enum = shift;
-
-my $in_enum = 0;
-
-while (<>) {
- # comments
- s/\/\*.*\*\///;
- if (m/\/\*/) {
- while ($_ .= <>) {
- last if s/\/\*.*\*\///s;
- }
- }
-
- # preprocessor stuff
- next if /^#/;
-
- # find our enum
- $in_enum = 1 if s/^\s*enum\s+${enum}(?:\s|$)//;
- next unless $in_enum;
-
- # remove explicit values
- s/\s*=[^,]+,/,/g;
-
- # extract each identifier
- while (m/\b([a-z_][a-z0-9_]*)\b/ig) {
- print $1, "\n";
- }
-
- #
- # don't exit: there may be multiple versions of the same enum, e.g.
- # inside different #ifdef blocks. Let's explicitly return all of
- # them and let external tooling deal with it.
- #
- $in_enum = 0 if m/}\s*;/;
-}
-
-exit 0;