From: Marcus Holland-Moritz Date: Sat, 11 Oct 2008 16:13:12 +0000 (+0000) Subject: Make sure expand-macro.pl also works for macros in headers X-Git-Url: http://git.shadowcat.co.uk/gitweb/gitweb.cgi?a=commitdiff_plain;h=be4f373d52665c10481b8bb9351422b96274c44c;p=p5sagit%2Fp5-mst-13.2.git 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 --- diff --git a/Porting/expand-macro.pl b/Porting/expand-macro.pl index 472b789..87f369f 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