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 [Wed, 19 Nov 2014 20:23:20 +0000 (21:23 +0100)]
Pass -fdiagnostics-color=auto to the compiler even if stderr is redirected
This fixes a problem when e.g. a configure test probes if the compiler
(wrapped via ccache) supports -fdiagnostics-color=auto. If ccache discards
the option since configure redirects stderr, then configure will
erroneously think that the compiler supports the option and the build will
fail later on (if stderr refers to a TTY).
Joel Rosdahl [Sat, 15 Nov 2014 12:50:49 +0000 (13:50 +0100)]
Improve execute() to take FDs instead of filenames
This means that execute() no longer needs to recreate the temporary
stdout/stderr files needlessly.
Note: ccache will no longer build on win32 after this change, but I don't
know what needs to be done to win32execute(). I leave that to those who
know.
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.
Luboš Luňák [Fri, 29 Nov 2013 11:14:03 +0000 (12:14 +0100)]
support compiler color diagnostics if possible
Clang and GCC (starting with 4.9) support color output if possible,
but since ccache redirects stderr to a file, they detect the output
is not a terminal and do not enable colors. Try to detect if colors
would be used and force colors explicitly.
Caveats:
- Compiles with and without colors are considered different from each
other (so they are "duplicated").
- GCC decided to roll its own name for the option, so it's necessary
to guess which compiler is actually used.
Joel Rosdahl [Sun, 8 Jun 2014 15:29:44 +0000 (17:29 +0200)]
Create destination file and then copy into cache instead of the opposite
This simplifies the code so that there is no special case kicking in when
using --serialize-diagnostics (which requires the "-o" option to refer to
the destination instead of a temporary file in the cache).
Joel Rosdahl [Wed, 14 May 2014 20:03:53 +0000 (22:03 +0200)]
Merge branch 'maint'
* maint:
Fix clang build warning "shift count >= width of type"
Clean up stale files in internal tempdir once an hour
Add signal handler to clean up temporary files at unexpected program exit
Don't needlessly allocate empty counter_updates data in stats_flush()
Joel Rosdahl [Tue, 15 Apr 2014 20:31:21 +0000 (22:31 +0200)]
Merge branch 'maint'
* maint:
manifest file_info fix
Clean up dead code flagged by cppcheck and clang-analyzer
Mark fatal() with __attribute__((noreturn)) to please clang-analyzer
Fix bug in common_dir_prefix_length
Joel Rosdahl [Wed, 8 Jan 2014 20:28:40 +0000 (21:28 +0100)]
Merge branch 'maint'
* maint:
Require CCACHE_SLOPPINESS=pch_defines,time_macros opt-in to enable PCH handling
doc: Mention that --ccache-skip currently does not mean "skip hashing option"
Don't hash compiler option -fdebug-prefix-map=
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.
Joel Rosdahl [Thu, 8 Aug 2013 20:47:43 +0000 (22:47 +0200)]
Merge branch 'maint'
* maint:
Bail out on option -gsplit-dwarf which produces multiple output files
Treat zero length object files as invalid
Fix path canonicalization in make_relative_path when path doesn't exist
Handle some dirname() special cases as expected
Correct make_relative_path comment