[ccache] direct mode

Joel Rosdahl joel at rosdahl.net
Sun Oct 20 03:18:06 MDT 2013


> bug?

Yes, see the discussion on
http://www.mail-archive.com/ccache@lists.samba.org/msg00920.html.

By the way: I'm still torn on what to do, but I'm leaning towards keeping
direct mode on by default (documenting the behavior, of course).

-- Joel


On 18 October 2013 12: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
> _______________________________________________
> ccache mailing list
> ccache at lists.samba.org
> https://lists.samba.org/mailman/listinfo/ccache
>


More information about the ccache mailing list