I have a number of debug statements defined in a program, and I want to be able to make a copy of the source without these statements.
In order to do this I first looked at GCC's -E command line argument, which only runs the preprocessor, however this did far more than I wanted, expanding the included files and adding #line statements.
For example:
#include <stdio.h>
#ifdef DEBUG
#define debug( s ) puts ( s );
#else
#define debug( s )
#endif
int main( int argc, char* argv[] )
{
debug( "Foo" )
puts( "Hello, World!" );
return 0;
}
I'd want this to be processed to:
#include <stdio.h>
int main( int argc, char* argv[] )
{
puts( "Hello, World!" );
return 0;
}
I could then tidy that up with something like astyle and no manual work would be needed to get exactly what I want.
Is there a directive I'm missing for GCC or is there a tool capable of doing this?