diff options
author | Karl Williamson <khw@cpan.org> | 2018-01-06 16:09:57 -0700 |
---|---|---|
committer | Karl Williamson <khw@cpan.org> | 2018-01-30 22:12:46 -0700 |
commit | 62a54bb7c432d82a7d9ed3edfbe2b3f9fbb10328 (patch) | |
tree | 627958e90cc38981e7aa3c2e2f68c69a937532fb /regen | |
parent | e7ccfeba8d29d4d19d84789c140c25e22ed14cb9 (diff) | |
download | perl-62a54bb7c432d82a7d9ed3edfbe2b3f9fbb10328.tar.gz |
regen/mk_invlists.pl: Allow multiple files to access
This changes the code so that the symbols defined by this program
can be #define'd in more than one file.
Diffstat (limited to 'regen')
-rw-r--r-- | regen/mk_invlists.pl | 13 |
1 files changed, 10 insertions, 3 deletions
diff --git a/regen/mk_invlists.pl b/regen/mk_invlists.pl index 73632f35fe..32d14c9052 100644 --- a/regen/mk_invlists.pl +++ b/regen/mk_invlists.pl @@ -99,17 +99,21 @@ sub end_file_pound_if { sub switch_pound_if ($$) { my $name = shift; my $new_pound_if = shift; + my @new_pound_if = ref ($new_pound_if) + ? @$new_pound_if + : $new_pound_if; # Switch to new #if given by the 2nd argument. If there is an override # for this, it instead switches to that. The 1st argument is the # static's name, used to look up the overrides if (exists $exceptions_to_where_to_define{$name}) { - $new_pound_if = $exceptions_to_where_to_define{$name}; + @new_pound_if = $exceptions_to_where_to_define{$name}; } + $new_pound_if = join "", @new_pound_if; # Exit current #if if the new one is different from the old - if ($in_file_pound_if + if ( $in_file_pound_if && $in_file_pound_if !~ /$new_pound_if/) { end_file_pound_if; @@ -117,7 +121,10 @@ sub switch_pound_if ($$) { # Enter new #if, if not already in it. if (! $in_file_pound_if) { - $in_file_pound_if = "defined($new_pound_if)"; + foreach my $element (@new_pound_if) { + $element = "defined($element)"; + } + $in_file_pound_if = join " || ", @new_pound_if; print $out_fh "\n#if $in_file_pound_if\n"; } } |