[ccache] direct mode

Ian Norton inorton at gmail.com
Fri Oct 18 03:54:09 MDT 2013

Hello All,

I have a question about direct mode, it follows on from an old thread
I've seen in the archives:


I'll quote inline and follow on.

Joel Rosdahl wrote:
> tridge wrote:
> > Also, does the hashtable used for included_files preserve the
> > ordering? (the order of includes is also vital). Or do you rely on the
> > hash of the file that does the #include changing for that?

> The hashtable is unordered, and yes, I rely on the hash of the input
> file to keep track of the ordering, and also of course on the include
> file hashes. For a given manifest, the source file (and therefore the
> order of the first level of include files) is known since the manifest
> is looked up given the hash of the input file (and some more
> information), and all other levels of include files are taken
> care of using the same kind of reasoning. In other words, if the
> include file order changes in some file, then the hash of that file
> changes too, which leads to a cache miss. Which include files the
> preprocessor reads is of course also a function of compiler options
> like -I, but that is handled by also hashing those options when
> computing the hash in direct mode. Do you see any potential problem
> here?

I realise I'm probably missing something, but how does direct mode
handle the case where
the command line args have not changed, and nor have the source file
or previously used headers *but* a header file has been added to a
folder on one of the -I paths? eg:

#include "test.h"

void hello(void);

gcc -I inc2 -I inc1 -c hello.c

later, someone makes a new file:

int hello(void);

The same command line and original inputs would result in a different file.

How does direct mode cover this case ( all our common input data has
not changed )

Many Thanks, ccache is fantastic btw!


More information about the ccache mailing list