On 2011-07-23 15:09, Shentino wrote: > Does ccache take macro switches into account when it preprocesses?
ccache takes all switches into account in the first step (called the direct mode), but if that doesn't result in a cache hit, it then ignores -D and similar switches in the second step when using the preprocessor, under the assumption that such switches will change the preprocessor output if they have any effect at all. See http://ccache.samba.org/manual.html#_how_ccache_works for a more detailed description. > For example, -DRANDOM_MACRO 's side effect is purely to introduce said macro > during preprocessing but beyond that has no effect on actual compilation. > > Yet I have a source file that doesn't define such a macro, and it doesn't > get cached. However, the compiler generates the same object file with or > without it. It's expected to get a "cache hit (preprocessed)" if you add a -DRANDOM_MACRO that isn't used by the source (and you previously have compiled the same thing without the switch, of course). If you get a cache miss, then ccache detects something else. You can probably find out what by setting CCACHE_LOGFILE=ccache.log and reading the resulting log file. You can read more on http://ccache.samba.org/manual.html#_troubleshooting. -- Joel _______________________________________________ ccache mailing list ccache@lists.samba.org https://lists.samba.org/mailman/listinfo/ccache