X-Git-Url: http://git.shadowcat.co.uk/gitweb/gitweb.cgi?a=blobdiff_plain;f=embed.pl;h=2ef42aa99465a081ea747f7cb3255bdc77fa55f4;hb=38aa2d1871d776152eb9b958f87dbfa1f4c07399;hp=a88016c493d058029264e35c21b3d6a65720c171;hpb=7827dc6557506f2e7dcb30e9e6559e12e540cbdd;p=p5sagit%2Fp5-mst-13.2.git diff --git a/embed.pl b/embed.pl index a88016c..2ef42aa 100755 --- a/embed.pl +++ b/embed.pl @@ -243,20 +243,27 @@ sub write_protos { $ret; } -# generates global.sym (API export list), and populates %global with global symbols -sub write_global_sym { - my $ret = ""; - if (@_ > 1) { - my ($flags,$retval,$func,@args) = @_; - if ($flags =~ /[AX]/ && $flags !~ /[xm]/ - || $flags =~ /b/) { # public API, so export - $func = "Perl_$func" if $flags =~ /[pbX]/; - $ret = "$func\n"; - } - } - $ret; +# generates global.sym (API export list) +{ + my %seen; + sub write_global_sym { + my $ret = ""; + if (@_ > 1) { + my ($flags,$retval,$func,@args) = @_; + # If a function is defined twice, for example before and after an + # #else, only process the flags on the first instance for global.sym + return $ret if $seen{$func}++; + if ($flags =~ /[AX]/ && $flags !~ /[xm]/ + || $flags =~ /b/) { # public API, so export + $func = "Perl_$func" if $flags =~ /[pbX]/; + $ret = "$func\n"; + } + } + $ret; + } } + our $unflagged_pointers; walk_table(\&write_protos, "proto.h", undef, "/* ex: set ro: */\n"); warn "$unflagged_pointers pointer arguments to clean up\n" if $unflagged_pointers;