Created attachment 11805 [details]
Test dir contents
Test suite fails when building with gcc 6, Fedora development:
version: gcc (GCC) 6.0.0 20160129 (Red Hat 6.0.0-0.7) Copyright (C) 2016 Free Software Foundation, Inc. This is free software; see the source for copying conditions. There is NO warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
test dir: testdir.15690
starting testsuite base
SUITE: "base", TEST: "-D not hashed" - Expected "cache hit (preprocessed)" to be 14, got 13
cache directory /builddir/build/BUILD/ccache-3.2.4/testdir.15690/.ccache
primary config /builddir/build/BUILD/ccache-3.2.4/testdir.15690/.ccache/ccache.conf
secondary config (readonly) /etc/ccache.conf
cache hit (direct) 0
cache hit (preprocessed) 13
cache miss 40
called for link 2
called for preprocessing 2
multiple source files 1
compiler produced stdout 1
couldn't find the compiler 1
bad compiler arguments 1
unsupported source language 2
unsupported compiler option 1
output to a non-regular file 1
no input file 1
files in cache 3
cache size 12.3 kB
max cache size 5.0 GB
Test data and log file have been left in testdir.15690
Makefile:82: recipe for target 'test' failed
FWIW, comments from the Fedora gcc 6 rebuild summary:
| ccache mis-uses the preprocessor; it should be tweaked to use -fdirectives-only
Reproduced with GCC 6.1.0:
% touch empty.c
% gcc -E empty.c -o nofoo.i
% gcc -E empty.c -DFOO=1 -o foo.i
% gcc -E empty.c -DFOO=1 -DBAR=2 -o foobar.i
% sha1sum nofoo.i foo.i foobar.i
Right, there's a difference between zero -D options and one or several -D options:
% diff -u nofoo.i foo.i
--- nofoo.i 2016-06-09 22:26:07.112737465 +0200
+++ foo.i 2016-06-09 22:26:00.527937097 +0200
@@ -1,7 +1,6 @@
# 1 "empty.c"
# 1 "<built-in>"
# 1 "<command-line>"
-# 31 "<command-line>"
# 1 "/usr/include/stdc-predef.h" 1 3 4
-# 32 "<command-line>" 2
+# 1 "<command-line>" 2
# 1 "empty.c"
% diff -u foo.i foobar.i
OK, so with no -D options, gcc for some reason adds a two "<command-line>" entries but with one or several -D options it only adds one. Looks like the latter behavior also is what GCC 5 does.
I guess we have to teach ccache to ignore "<command-line>" entries or so.
Ville: Or do you think that this is a GCC regression that will be fixed?
> | ccache-3.2.4-1.fc24.src.rpm
> | ccache mis-uses the preprocessor; it should be tweaked to use
I don't think that comment has anything to do with the reported problem since adding -fdirectives-only only makes things worse: then "#define FOO 1" will be added to the preprocessed output, making it completely impossible to get ccache hits for irrelevant -D options (i.e. those that don't affect the outcome).
By the way, I find the choice of words a bit surprising. ccache has used the preprocessor method many years before -fdirectives-only even existed.
Also, ccache can't just be tweaked to use -fdirectives-only since it must work with other compilers that lack -fdirectives-only, for instance older GCC versions.
No idea wrt regression/not, I suggest asking GCC devs.
(And just to clarify, comment 1 was me just forwarding the message here, I don't have competence to have an informed opinion on it.)
(In reply to Ville Skyttä from comment #3)
> (And just to clarify, comment 1 was me just forwarding the message here,
> I don't have competence to have an informed opinion on it.)
Yes, that wasn't unclear. I just took the opportunity to vent some minor frustration. :)
Moved to https://github.com/ccache/ccache/issues/96.