Debian Codegraph @

xbin/strip-ifdef

raw
1 #!/bin/sh
2
3 # Sample usage strip-ifdef foo.c -Dmips -DATT
4 # will select only code in those ifdefs which are selected by mips and ATT.
5 # includes, and defines will be left intact, as will comments
6
7 cat $1 | sed -e "s:^#include:XX#include:g" -e "s:^#define:XX#define:g" > /tmp/tmpx.c
8 shift 1
9
10 gcc -E -C /tmp/tmpx.c $@ | sed -e "/^#/d" -e "s:XX#:#:g" -e "/^$/d" | cb