X-Git-Url: http://nsz.repo.hu/git/?a=blobdiff_plain;f=tools%2Fremove_cpp_comands.perl;h=7597720220cc27bfe142a1944d7bdbb9c842de35;hb=20f31cbacebc66ffc7847b769951d544358259ce;hp=9f0703c6cb61802943d1590908e42a229387050c;hpb=3a54957505decc179c0951298bce7e0361a79462;p=libfirm diff --git a/tools/remove_cpp_comands.perl b/tools/remove_cpp_comands.perl index 9f0703c6c..759772022 100644 --- a/tools/remove_cpp_comands.perl +++ b/tools/remove_cpp_comands.perl @@ -61,12 +61,33 @@ $guardedtypedef = 0; $scndlastline = ""; $lastline = ""; +$eat = 0; +$multiline = 0; + foreach $line (@lines) { - if (($line =~ /^\#/) ) { + if ($line =~ /\#ifdef __cplusplus/) { +# There is extern "C" in firm.h, guarded by #ifdef __cplusplus +# crecoder does not grok the extern "C", so remove thses three lines. + $eat = 2; + } elsif ($eat > 0) { + $eat = $eat -1; + } elsif ($multiline > 0) { + # this line connects a previous one, kill it + if ($line =~ /\\$/) { + $multiline = 1; + } else { + $multiline = 0; + } + } elsif ($line =~ /^\#/) { # eat the line $scndlastline = $lastline; $lastline = $line; + if ($line =~ /\\$/) { + $multiline = 1; + } else { + $multiline = 0; + } } elsif ($openbracket == 1) { print TDF "$line"; if ((index($line, "}") > -1)) { @@ -99,8 +120,6 @@ foreach $line (@lines) { $guardedtypedef = 0; } } - } elsif ($line =~ /extern "C"/) { - print OUT "/* extern C */ {"; } else { print OUT "$line"; $scndlastline = $lastline;