This is the mail archive of the
gcc@gcc.gnu.org
mailing list for the GCC project.
Re: Faster compilation speed
Noel Yap wrote:-
> I stand corrected. (I'm assuming gcc doesn't do this
> in cases where the header guard might have side
> effects or if there's a matching #else for the
> #ifndef).
Correct. Header guards with side effects hardly exist
I think. We recognize #ifndef and #if !defined with
optional parentheses. Comments and whitespace do not
affect the optimization. Headers with #else, #elif
at the top level, and with anything outside the guards,
or with a header guard that comes from a macro expansion
are not optimized this way.
> Do you think precompiled headers would help build
> speed across several compiles since it would be
> another source to eliminate repeated file opens?
I don't think repeated file opens are high on the list
of time eaters, particularly because of the optimization
I mentioned. Tokenization and parsing probably take
much longer.
Neil.