C/C++/ObjC sourcecode unifier

Erik Thiele erikyyy@erikyyy.de
Tue Apr 10 00:02:00 GMT 2001


hi,

I'd need a very little and fast program (maybe even a sed script, or
just C) which does the following to your C,C++,ObjC sources:

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

2) remove all preprocessor lines, i.e. everything that follows a '#'
   ( do not expand macros, just remove all preprocessor stuff )

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.


example:

input:
------ SNIP
a(b,      c       ,   d)



" ich bin     dreck!


dreck ende   "   foo

kack ('\"',"sepperl
")


------ SNAP

output:
------ SNIP
a(b,
c
,
d)
" ich bin     dreck!


dreck ende   "
foo
kack
('\"',"sepperl
")
------ SNAP


this tool, or just sed script is really needed for my compilercache
project.

http://www.erikyyy.de/compilercache/

it would be used to produce much more cache hits.
the problem is projects like the linux kernel have a central include
file that everybody includes. it's called "config.h" or so. it contains
many many macro definitions. right now the cache uses preprocessor output
to identify if a file has already be compiled. unfortunately reconfiguring
the linux kernel makes blank lines into the config.h file which will lead
to a different preprocessor output (blank lines). the cache won't hit.

therefor i need this unifier script or program that will be run AFTER
the preprocessor. it's output will be the cache index then.

if someone creates this for me she or he will be included in
the AUTHORS file and be responsible for a MAJOR performance increase in the
world of development :)    (what a sentence)

i've heard of people where compilation of their projects on old machines
takes one and a half days. with the compilercache it takes only some hours.
or imagine all the compilerfarms recompiling CVS sources all the time.

the unifier is the last stone in the puzzle. If it is put in, stuff like
kernel compilation won't be a wait anymore.

cu
erik

-- 
Name:  Erik Thiele                                        \\\\
Email: erikyyy@erikyyy.de                                 o `QQ'_
WWW:   http://www.erikyyy.de/                              /   __8
                                                           '  `



More information about the Gcc mailing list