Tor Arne Vestbø [Thu, 15 Jun 2017 12:40:16 +0000 (14:40 +0200)]
Don't use cache when building precompiled header with changed deps
If one of the included files in a precompiled header is touched,
changing only its mtime, clang will produce a fatal error when the
precompiled header is then used:
file 'foo.h' has been modified since the precompiled header 'foo.pch' was built
We need to take this into account when producing precompiled headers,
so that we don't pick out stale objects from the cache. This works
fine for direct mode, but in preprocess mode we don't have enough
information to decide if the object is still valid, so we skip the
cache entirely in that mode.
Alexey Tourbin [Sat, 18 Feb 2017 13:29:53 +0000 (16:29 +0300)]
Fixed the check for empty object file vs diagnostics
The test for diagnostic file currently interferes with the check for
empty object file. Since the check for diagnostic file is much more
similar to the check for dependency file, I put it there.
The whole code seems to be a thinko. For a hit, neither ctime
nor mtime should be greater than or equal to time_of_compilation.
The code only seems to work because time_of_compilation is 0
at this stage (i.e. has not been initialized).
While at it, I also introduce an optimization: when sizes do
not match, it's a good chance to bail out early; there is no
point in further hashing the file.
The feature introduced in #92 changes the order of debug options,
leading to bugs like #149. It would be possible to add more logic to
handle special cases like -gsplit-dwarf, but for now I'll just back out
the patch and keep ccache ignorant about debug options.
Joel Rosdahl [Sun, 5 Feb 2017 20:51:28 +0000 (21:51 +0100)]
Include names of include files in the hash again
This is essentially a revert of 5908e656 and 9cffdc65 (a partial fix of
the problem). The idea of pull request #88 ("preprocessor mode: enable
using identical header in different paths") did not work out well in
practice since it broke handling of dependency files. See the new "-MMD
for different ..." test cases which fail without the revert.
Joel Rosdahl [Wed, 28 Sep 2016 20:17:16 +0000 (22:17 +0200)]
Disable direct mode for "-Wp," with multiple preprocessor options
This fixes a regression in ccache 3.2.8/3.3.1 (commit 026ba6b9): ccache
could get confused when using the compiler option -Wp, to pass multiple
options to the preprocessor, resulting in missing dependency files from
direct mode cache hits.
Joel Rosdahl [Tue, 27 Sep 2016 21:20:36 +0000 (23:20 +0200)]
Hash source path when generating dependencies to avoid false positive
5908e656ef2a6493b42159acff4b1f490016d055 introduced a regression: If a
source file is compiled in directory A and an identical source file in
directory B results in a preprocessed hit, then the dependency file from
the first compilation will be overwritten by the second compilation.
Since the source path is part of the dependency file, an incorrect
dependency file will be retrieved from the cache when recompiling the
source in directory A.
The solution is to include the source path part in the object hash if a
dependency file is being generated.
Joel Rosdahl [Wed, 7 Sep 2016 18:46:18 +0000 (20:46 +0200)]
Only pass -Wp,-MT and similar to the preprocessor
This fixes an issue when compiler option -Wp,-MT,path is used instead of
-MT path (and similar for -MF, -MP and -MQ) and run_second_cpp
(CCACHE_CPP2) is enabled.
Anders Björklund [Thu, 21 Jul 2016 12:08:54 +0000 (14:08 +0200)]
Including trailing quote and cpp flags in the hash
When looking for which headers are system headers ("3")
in the commit 219783844c63d37c26f771c1471f3fe2943f9a88,
we skipped hashing the quote and flags... Restore that.
Shouldn't make any major difference, but changes the hash.
Joel Rosdahl [Wed, 27 Jul 2016 18:49:00 +0000 (20:49 +0200)]
Let run_second_cpp default to true
ccache has since day 1 (OK, actually day 13: 5f6f5010) relied on the
fact that GCC and similar enough compilers are able to compile their own
preprocessed output with the same outcome as if they compiled the real
source code directly.
However, newer versions of GCC no longer quite work this way since they
perform an increasing amount of diagnostics analysis only if the source
code is compiled directly. The same goes for Clang. It's impossible for
ccache to work around this changed behavior in a good way.
Joel Rosdahl [Mon, 25 Jul 2016 15:58:37 +0000 (17:58 +0200)]
test: Various improvements and cleanups that were long needed
* Made all test cases isolated, not reusing test state from previous
tests.
* Introduced per-suite detection whether suite should be run or skipped.
* Only run base_tests with and without CCACHE_CPP2.
* Moved CCACHE_HARDLINK, CCACHE_NLEVELS, CCACHE_EXTRAFILES,
CCACHE_IGNOREHEADERS, CCACHE_PREFIX, ccache symlinks and "buggy CPP"
tests into base_tests instead of having test suites of their own.
* Split conditional tests (depending on compiler and/or OS) into
separate test suites.
* Removed -fprofile-generate and -fprofile-use tests since they don't
test any functionality.
* Made various cleanups that were long needed.
Joel Rosdahl [Sat, 23 Jul 2016 20:44:12 +0000 (22:44 +0200)]
Disable i586-mingw32msvc build for now
The i586-mingw32msvc build fails since e527cccb because
i586-mingw32msvc-gcc is based on GCC 4.2 which apparently is too old to
have good enough C99 support.
More specifically, it doesn't build since the compiler emits a "C99
inline functions are not supported; using GNU89" warning, and we use
-Werror.