X-Git-Url: http://nsz.repo.hu/git/?a=blobdiff_plain;f=tools%2Fremove_cpp_comands.perl;h=56a8c2a240892ba8d059792bdd5538dd0b08da55;hb=efcb83f0fa7cca556c18fb914e3092903c55a98f;hp=0e17c1afd2d7a21d775511265866f2d90d504c7b;hpb=be2183c3a0fedd2907948fb065a38b69b403b4e7;p=libfirm diff --git a/tools/remove_cpp_comands.perl b/tools/remove_cpp_comands.perl index 0e17c1afd..56a8c2a24 100644 --- a/tools/remove_cpp_comands.perl +++ b/tools/remove_cpp_comands.perl @@ -44,6 +44,7 @@ print OUT "\n#include \"firm_typedefs.h\"\n\n"; print TDF "#define INLINE\n"; print TDF "#define FILE int *\n"; print TDF "#ifndef MYTYPEDEFS\n#define MYTYPEDEFS\n"; +#print TDF "#undef __cplusplus\n"; print TDF "typedef unsigned long size_t;\n"; #print TDF "typedef enum { false = 0, true = 1 } bool;\n"; geht nicht, false und true JAVA Schluesselwoerter print TDF "typedef int bool;\n"; @@ -60,9 +61,17 @@ $guardedtypedef = 0; $scndlastline = ""; $lastline = ""; +$eat = 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 (($line =~ /^\#/) ) { # eat the line $scndlastline = $lastline; $lastline = $line;