[ccache] direct mode

Ian Norton inorton at gmail.com
Fri Oct 18 04:22:25 MDT 2013

I've updated https://bugzilla.samba.org/show_bug.cgi?id=8424.

Perhaps a rename is needed as the title implies it is ubuntu specific
and intermittant?

On 18 October 2013 11:05, Ian Norton <inorton at gmail.com> wrote:
> Ok. I should have tried it before hand.  ccache *doesnt't* notice the
> addition of the new header and still gives me a .o file from the first
> invocation.
> bug?
> On 18 October 2013 10:54, Ian Norton <inorton at gmail.com> wrote:
>> Hello All,
>> I have a question about direct mode, it follows on from an old thread
>> I've seen in the archives:
>> http://www.mail-archive.com/ccache@lists.samba.org/msg00150.html
>> 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:
>> hello.c:
>> #include "test.h"
>> inc1/test.h:
>> void hello(void);
>> gcc -I inc2 -I inc1 -c hello.c
>> later, someone makes a new file:
>> inc2/test.h:
>> 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!
>> Ian

More information about the ccache mailing list