diff options
author | Nicholas Clark <nick@ccl4.org> | 2011-08-21 15:47:56 +0200 |
---|---|---|
committer | Nicholas Clark <nick@ccl4.org> | 2011-08-25 11:34:37 +0200 |
commit | eacd26c25d4c0f9cd32d5789d729d19023841d45 (patch) | |
tree | 1e461acaf3ea483f8c0c1b156e71a5b5e0e4e669 /regen | |
parent | 321600e11320143624e3eb397de01526d976a1af (diff) | |
download | perl-eacd26c25d4c0f9cd32d5789d729d19023841d45.tar.gz |
In embed.pl, refactor the handling of varargs *_nocontext wrappers.
This is what commit 125218eb5a6d12e7 should have been. :-)
Diffstat (limited to 'regen')
-rwxr-xr-x | regen/embed.pl | 29 |
1 files changed, 17 insertions, 12 deletions
diff --git a/regen/embed.pl b/regen/embed.pl index 681c99cb07..53dcd2c765 100755 --- a/regen/embed.pl +++ b/regen/embed.pl @@ -54,7 +54,6 @@ sub open_print_header { open IN, "embed.fnc" or die $!; my @embed; -my (%has_va, %has_nocontext); while (<IN>) { chomp; @@ -71,11 +70,6 @@ while (<IN>) { } else { @args = split /\s*\|\s*/, $_; - my $func = $args[2]; - if ($func) { - ++$has_va{$func} if $args[-1] =~ /\.\.\./; - ++$has_nocontext{$1} if $func =~ /(.*)_nocontext/; - } } if (@args == 1 && $args[0] !~ /^#\s*(?:if|ifdef|ifndef|else|endif)/) { die "Illegal line $. '$args[0]' in embed.fnc"; @@ -524,6 +518,21 @@ walk_table { "$ret$func($alist)\n"; } $em; +my @nocontext; +{ + my (%has_va, %has_nocontext); + foreach (@embed) { + next unless @$_ > 1; + ++$has_va{$_->[2]} if $_->[-1] =~ /\.\.\./; + ++$has_nocontext{$1} if $_->[2] =~ /(.*)_nocontext/; + } + + @nocontext = sort grep { + $has_nocontext{$_} + && !/printf/ # Not clear to me why these are skipped but they are. + } keys %has_va; +} + print $em <<'END'; /* varargs functions can't be handled with CPP macros. :-( @@ -534,9 +543,7 @@ print $em <<'END'; #if defined(PERL_IMPLICIT_CONTEXT) && !defined(PERL_NO_SHORT_NAMES) END -foreach (sort keys %has_va) { - next unless $has_nocontext{$_}; - next if /printf/; # Not clear to me why these are skipped but they are. +foreach (@nocontext) { print $em hide($_, "Perl_${_}_nocontext", " "); } @@ -549,9 +556,7 @@ print $em <<'END'; /* undefined symbols, point them back at the usual ones */ END -foreach (sort keys %has_va) { - next unless $has_nocontext{$_}; - next if /printf/; # Not clear to me why these are skipped but they are. +foreach (@nocontext) { print $em hide("Perl_${_}_nocontext", "Perl_$_", " "); } |