simonr
July 2nd, 2002, 05:15 AM
Hi,
We are currently looking at ways to speed up compilation time. We use precompiled headers already to good effect. My questions are:
1) We seem to have noticed using pragmas that the preprocessor parses files even though they are protected by previously defined include guards. As far as we can see this means it is doing a lot of unnecessary work. Is this correct and can we stop it.?
e.g. if we have a header file afile.h that is included by multiple cpp files in a library, when compiling the library the pragma message pops up for each file that include the header...
#ifndef _AFILE_H
#define _AFILE_H
#pragma message("Parsing after include guard")
This presumably means it parses sub-included files too. If we can stop it it should speed us up.
2) We are careful to avoid unnecessary includes, especially in header files, but in a big evolving project quite a few still slip though the net. Is there an automated way of detected and stripping out uneeded #includes?
Thanks,
Simon
We are currently looking at ways to speed up compilation time. We use precompiled headers already to good effect. My questions are:
1) We seem to have noticed using pragmas that the preprocessor parses files even though they are protected by previously defined include guards. As far as we can see this means it is doing a lot of unnecessary work. Is this correct and can we stop it.?
e.g. if we have a header file afile.h that is included by multiple cpp files in a library, when compiling the library the pragma message pops up for each file that include the header...
#ifndef _AFILE_H
#define _AFILE_H
#pragma message("Parsing after include guard")
This presumably means it parses sub-included files too. If we can stop it it should speed us up.
2) We are careful to avoid unnecessary includes, especially in header files, but in a big evolving project quite a few still slip though the net. Is there an automated way of detected and stripping out uneeded #includes?
Thanks,
Simon