[cfe-dev] ccache and 'unused argument' warning

bruce.r.stephens at gmail.com bruce.r.stephens at gmail.com
Sat Jun 19 10:47:25 PDT 2010


Chris Lattner <clattner-2kanFRK1NckAvxtiuMwx3w at public.gmane.org> writes:

> I have no idea, apparently so?

It supports any compiler that takes a similar command-line to gcc (I
think -E is the important flag).

>From the manual:

   HOW IT WORKS

   The basic idea is to detect when you are compiling exactly the same
   code a 2nd time and use the previously compiled output. You detect
   that it is the same code by forming a hash of:

   * the pre-processor output from running the compiler with -E
   * the command line options
   * the real compilers size and modification time
   * any stderr output generated by the compiler 

   These are hashed using md4 (a strong hash) and a cache file is
   formed based on that hash result. When the same compilation is done
   a second time ccache is able to supply the correct compiler output
   (including all warnings etc) from the cache.

   ccache has been carefully written to always produce exactly the same
   compiler output that you would get without the cache. If you ever
   discover a case where ccache changes the output of your compiler then
   please let me know.

So it works by running the preprocessor to make sure the preprocessed
source hasn't changed.  I have a feeling it might end up just doing the
compile if something's changed, so might end up repeating the
preprocessing.

The assumption seems to be that preprocessing is relatively cheap, which
(IIUC) isn't valid for clang, so perhaps ccache (as it exists now) just
isn't worth using?



More information about the cfe-dev mailing list