Cleanup script for re2c output that removes unreferenced labels (significantly

reducing C compiler warnings).

svn path=/trunk/yasm/; revision=647
0.3
Peter Johnson 23 years ago
parent 5ba3fb01bf
commit 9eedce2b89
  1. 3
      tools/re2c/Makefile.am
  2. 3
      tools/re2c/Makefile.inc
  3. 10
      tools/re2c/cleanup.pl

@ -52,4 +52,5 @@ EXTRA_DIST = \
examples/simple.re \
examples/rexx/README \
examples/rexx/rexx.l \
examples/rexx/scanio.c
examples/rexx/scanio.c \
cleanup.pl

@ -52,4 +52,5 @@ EXTRA_DIST = \
examples/simple.re \
examples/rexx/README \
examples/rexx/rexx.l \
examples/rexx/scanio.c
examples/rexx/scanio.c \
cleanup.pl

@ -0,0 +1,10 @@
#!/usr/bin/perl
my @sourcelines = <>;
my %usedlabel;
for (@sourcelines) {
$usedlabel{"$1:"} = "$1:" if m/goto\s+(yy[0-9]*)\s*;/
}
for (@sourcelines) {
s/^(yy[0-9]*:)/$usedlabel{$1}/;
print;
}
Loading…
Cancel
Save