Joel Rosdahl [Fri, 20 Feb 2015 19:32:33 +0000 (20:32 +0100)]
Fix comment scanning bug in hash_source_code_string
hash_source_code_string tries to ignore __DATE__/__TIME strings in
comments, but fails to parse code that contains character literal of a
double quote. This could result in false cache hits when the source code
happens to contain '"' followed by " /*" or " //" (with variations).
The fix is to do like it's already done in ccache 3.2: Don't try to be
overly clever about __DATE__/__TIME__, just check for those strings
anywhere in the source code string.
Joel Rosdahl [Fri, 26 Dec 2014 09:07:25 +0000 (10:07 +0100)]
Include info on CCACHE_CPP2 in hash
Made hash of cached result created with and without CCACHE_CPP2 different.
This makes it possible to rebuild with CCACHE_CPP2 set without having to
clear the cache to get new results.
It turned out to be a bad idea to use mkstemp for temporary files that are
renamed into files to save in the cache since mkstemp creates the file with
permissions 0600.
Joel Rosdahl [Sat, 8 Nov 2014 15:53:34 +0000 (16:53 +0100)]
Do not rely on pids being unique
Based on a patch by Mike Frysinger <vapier@gentoo.org>:
"Linux supports creating pid namespaces cheaply and running processes
inside of them. When you try to share a single cache among multiple such
runs, the fact that the code relies on pid numbers as globally unique
values quickly fails. Instead, switch to standard mkstemp to generate temp
files for us."
Joel Rosdahl [Sat, 16 Aug 2014 12:22:04 +0000 (14:22 +0200)]
Require CCACHE_SLOPPINESS=pch_defines when creating precompiled header
708d9110a103bd49437be7bff1e82697fff68d0b introduced the requirement of
sloppy pch_defines for using a PCH, but it's the act of creating (and
storing in the cache) a PCH that needs to be opt-in.
Joel Rosdahl [Wed, 8 Jan 2014 20:13:22 +0000 (21:13 +0100)]
Require CCACHE_SLOPPINESS=pch_defines,time_macros opt-in to enable PCH handling
The background is that since ccache runs the preprocessor on the header to
be precompiled, the preprocessor removes #defines and ccache then hashes
the output, which means that changes in #defines are not detected even
though the resulting .gch file will have different behavior.
Andrew Stubbs [Mon, 10 Sep 2012 13:57:23 +0000 (14:57 +0100)]
Fix bug testing with ecryptfs
The test script assumes that zero-length files take up zero disk space,
that the block size is 4k, and that the disk usage will be the file size
rounded up to the nearest block size. Unfortunately these were not true for
ecryptfs.
Additionally, running the test.sh from another directory did not work due
to a bad location assumption in another test.
Alfred Landrum [Fri, 7 Sep 2012 18:39:26 +0000 (20:39 +0200)]
Handle EAGAIN during copy_fd
In util.c, write may return EAGAIN if the file descriptor is a full pipe.
Currently, if this occurs, the log message "ccache: FATAL: Failed to copy fd"
is printed and ccache exits. We've seen this locally when the recorded stderr
output was exceptionally large due to many compilation warnings.
Joel Rosdahl [Sun, 8 Jan 2012 09:40:17 +0000 (10:40 +0100)]
Revert GCC bug compatibility for -MTarg and -MQarg
The bug addressed by commit 8c3039d676d71564e98d50f1ca8ba029d1efa46c has
been fixed in a recent GCC version. Since ccache currently can't change
behavior depending on compiler version, we have to choose the least
troublesome behavior.
Joel Rosdahl [Sun, 17 Apr 2011 15:55:14 +0000 (17:55 +0200)]
Be bug compatible with GCC for -MTarg and -MQarg
It's strange, but apparently, GCC behaves differently for -MT arg and
-MTarg (and similar for -MQ): in the latter case, but not in the former,
an implicit dependency for the object file is added to the dependency file.