C/C++/ObjC sourcecode unifier

Joern Rennecke amylaar@cambridge.redhat.com
Tue Apr 10 13:56:00 GMT 2001


> 1) replace all sequences of \n, space, tab, i.e.:
>    "\n\n     tab tab \n\n   space" with a single \n

// It's not a good idea to replace the spaces here with newlines.
> 
> 2) remove all preprocessor lines, i.e. everything that follows a '#'
>    ( do not expand macros, just remove all preprocessor stuff )

Removeing #defines and #pragmas alters the program profoundly.

> 3) remove all C and C++ style comments
> 
> 4) don't destroy strings even when they contain multiple spaces like
>    "fooo     bar", and don't destroy the stupid multi line strings like
> "i am a multiline
> string
> hey it's a stupid feature but it exists"
> 
> 5) in general, do not change anything that will lead to a different .o file
>    after compilation with debug options turned off.

You'd also have to watch out for the __LINE__ macro then - when you add or
delete newlines, or delete the #<lineno> directives, you change what this
macro expands to.



More information about the Gcc mailing list