query reg. gcc
Ian Lance Taylor
ian@airs.com
Thu Dec 23 19:06:00 GMT 2004
Shachindra Sharma <shachin@gmail.com> writes:
> Is there any existing
> option in GCC to cache files like a.h when its read the first time
> because there is a high probability of this file getting used later in
> the same compile sequentially.
Other than precompiled headers, no.
I'm not even sure the question makes sense. What sort of caching do
you have in mind? If you mean: caching the file contents, then the
operating system buffer cache will do that reasonably well, and, in
any case, reading the header file will only be a small fraction of the
time required to compile the code found in the header file. If you
mean: caching the results of compiling the file, then that is what
precompiled headers do.
> Since we have already compiled this
> file once cant the compiler ensure that the paths of the files and
> compiled form of the header is persistent for the compile being done
> through the same rules (i.e) the same makefile over a subdirectory.
Sure. That is exactly what precompiled headers do: save the compiled
form of the header.
It sounds like you would like gcc to be able to support multiple
precompiled headers in a single compilation. There are many
complexities which would be involved, as different header files can
interact in a number of ways. In general, I agree that that would be
a useful feature if it is in fact possible. However, this feature
does not exist, and it would be difficult to add it. I don't know of
anybody working on such a project.
Ian
More information about the Gcc
mailing list