This is the mail archive of the
mailing list for the GCC project.
Re: Faster compilation speed
Noel Yap wrote:-
> At first, I think all that's really needed is a cpp
> option, say --preprocess-includes, that just goes
> through and preprocesses the #include directives (eg
> it doesn't preprocess #define's, #if's, ...).
Heh, if only life were this easy. If you actually think about what CPP
does, you'd realize this is a no-go. Two immediate issues:
1) #include can take a macro as argument
2) #include can appear in preprocessor conditional blocks. You
only know whether they are processed if you know the correct value
of the #if. This often depends on macro expansions, and correct
processing of prior includes. Of course, #defines appear in
conditional blocks too, so this is kind of important to get right.
There are no easy shortcuts here: to preprocess something properly,
you have to do *everything* the preprocessor does "normally". There
are no shortcuts, not even trivial ones.
We *do* do too many stats and opens though; when I get time I'll post
my ideas about this.