[ccache] preprocessing with -P

Giulio Eulisse giulio.eulisse at cern.ch
Wed Dec 3 13:17:05 GMT 2003

Dear friends,
first of all, thanks a lot for ccache, it is really a great utility!
I've produced a little patch which allows to get object file from cache,
if the only change is the include path (but not the include itself).
Stripping -I from the hashing is not enough: you have to run the
preprocessor with -P option, otherwise you will get the full include
path in the preprocessed source, making the stripping useless.
If you find it a good idea, please include it (at least as an option!)
in your sourcetree, so I can avoid to use a patched one. If you think it
is not a good idea, please discuss why, as I'm really very interested in
your opinion about it.

Anyway, here it is:

diff -u -r1.91 ccache.c
--- ccache.c    28 Sep 2003 04:47:59 -0000      1.91
+++ ccache.c    3 Dec 2003 13:05:42 -0000
@@ -355,9 +355,10 @@
        if (!direct_i_file) {
                /* run cpp on the input file to obtain the .i */
                args_add(args, "-E");
+               args_add(args, "-P");
                args_add(args, input_file);
                status = execute(args->argv, path_stdout, path_stderr);
-               args_pop(args, 2);
+               args_pop(args, 3);
        } else {
                /* we are compiling a .i or .ii file - that means we
                   can skip the cpp stage and directly form the


More information about the ccache mailing list