From: Jarkko Hietaniemi Date: Sat, 8 Jun 2002 01:14:45 +0000 (+0000) Subject: h2ph: more evilness in the form of Linux inline assembler. X-Git-Url: http://git.shadowcat.co.uk/gitweb/gitweb.cgi?a=commitdiff_plain;h=dccff43d435d574843d33f7c32cc7d8d1a628596;p=p5sagit%2Fp5-mst-13.2.git h2ph: more evilness in the form of Linux inline assembler. p4raw-id: //depot/perl@17078 --- diff --git a/utils/h2ph.PL b/utils/h2ph.PL index b0b906d..e99df44 100644 --- a/utils/h2ph.PL +++ b/utils/h2ph.PL @@ -108,7 +108,8 @@ while (defined (my $file = next_file())) { } print OUT "require '_h2ph_pre.ph';\n\n"; - while (defined (local $_ = next_line())) { + + while (defined (local $_ = next_line($file))) { if (s/^\s*\#\s*//) { if (s/^define\s+(\w+)//) { $name = $1; @@ -240,7 +241,7 @@ while (defined (my $file = next_file())) { } } elsif(/^\s*(typedef\s*)?enum\s*(\s+[a-zA-Z_]\w*\s*)?/) { until(/\{[^}]*\}.*;/ || /;/) { - last unless defined ($next = next_line()); + last unless defined ($next = next_line($file)); chomp $next; # drop "#define FOO FOO" in enums $next =~ s/^\s*#\s*define\s+(\w+)\s+\1\s*$//; @@ -404,6 +405,7 @@ sub expr { sub next_line { + my $file = shift; my ($in, $out); my $pre_sub_tri_graphs = 1; @@ -433,6 +435,13 @@ sub next_line } next READ; } + if ($in =~ /^extern inline / && + $^O eq 'linux' && $file =~ m!(?:^|/)asm/[^/]+\.h$!) { + while () { + last if /^}/; + } + next READ; + } if ($in =~ s/\\$//) { # \-newline $out .= ' '; next READ; @@ -458,7 +467,7 @@ sub next_line } elsif ($in =~ s/^([^\'\"\\\/]+)//) { $out .= $1; } else { - die "Cannot parse:\n$in\n"; + die "Cannot parse:\n$in\n"; } }