diff options
author | Marcus Holland-Moritz <mhx-perl@gmx.net> | 2008-10-11 16:13:12 +0000 |
---|---|---|
committer | Marcus Holland-Moritz <mhx-perl@gmx.net> | 2008-10-11 16:13:12 +0000 |
commit | be4f373d52665c10481b8bb9351422b96274c44c (patch) | |
tree | 7976c5911abd1567ab03f0f3065d78bd6dfc6062 | |
parent | 6e654618055194991b39907dc47c36d18381f582 (diff) | |
download | perl-be4f373d52665c10481b8bb9351422b96274c44c.tar.gz |
Make sure expand-macro.pl also works for macros in headers
that are not included by perl.h (like regcomp.h).
p4raw-id: //depot/perl@34473
-rw-r--r-- | Porting/expand-macro.pl | 9 |
1 files changed, 5 insertions, 4 deletions
diff --git a/Porting/expand-macro.pl b/Porting/expand-macro.pl index 472b789a32..87f369fc43 100644 --- a/Porting/expand-macro.pl +++ b/Porting/expand-macro.pl @@ -44,7 +44,7 @@ if (!@ARGV) { my $args = ''; -my $found_macro; +my $header; while (<>) { next unless /^#\s*define\s+$macro\b/; my ($def_args) = /^#\s*define\s+$macro\(([^)]*)\)/; @@ -54,17 +54,18 @@ while (<>) { my $argname = "A0"; $args = '(' . join (', ', map {$argname++} 1..@args) . ')'; } - $found_macro++; + $header = $ARGV; last; } -die "$macro not found\n" unless $found_macro; +die "$macro not found\n" unless defined $header; open my $out, '>', $trysource or die "Can't open $trysource: $!"; print $out <<"EOF"; #include "EXTERN.h" #include "perl.h" -#line 3 "$sentinel" +#include "$header" +#line 4 "$sentinel" $macro$args EOF |