Joel Rosdahl [Wed, 20 May 2020 19:26:35 +0000 (21:26 +0200)]
Handle all Intel “-xCODE” compiler options correctly
“CODE” in the Intel compiler’s “-xCODE” option for specifying processor
features seems to always start with an uppercase letter, and since GCC’s
language specifications always are lowercase we can just treat uppercase
codes as an ordinary compiler argument.
Joel Rosdahl [Tue, 19 May 2020 18:37:19 +0000 (20:37 +0200)]
Improve temp file handling
- Use Util::create_temp_fd instead of legacy create_tmp_fd.
- Use Context::register_pending_tmp_file instead of unlinking
explicitly.
- Simplified output of merged stderr from preprocessor and compiler.
Joel Rosdahl [Mon, 18 May 2020 06:26:14 +0000 (08:26 +0200)]
Refactor signal handling and process exit code
* Added a SignalHandler class which encapsulates parts related to signal
handling.
* Moved data referenced by the exit functions to Context (compiler PID,
pending temporary files and pending debug log files).
* Let the Context destructor do what the exitfn functionality used to
do.
* Removed the now superfluous exitfn functionality.
Joel Rosdahl [Wed, 13 May 2020 16:43:47 +0000 (18:43 +0200)]
Merge catch2_tests into unittest’s main
The Catch2 runner was previously compiled separately since it’s slow to
compile, but after the removal of the old test framework there should be
little reason to modify unittest/main.cpp often.
Olle Liljenzin [Sun, 3 May 2020 12:11:29 +0000 (14:11 +0200)]
Don't depend on how echo interprets backslash escapes (#588)
The escape sequence '\n' should be translated to a new line character
when printed to version.cpp. Default mode might be implementation
dependent. At least in Fedora /usr/bin/echo defaults to -E. On the
other hand older versions might not support the -e option that enables
backslash escapes where it is not default.
Split the command into two, one for each output line, which should
produce same output on all platforms.
Joel Rosdahl [Thu, 30 Apr 2020 06:29:31 +0000 (08:29 +0200)]
Improve handling of profiling options
Handling of -fprofile-{generate,use}[=path] was implemented in PR #2
(2011). ccache has since then gained support for Clang, which is not
GCC-compatible for -fprofile-{generate,use}[=path]. Furthermore, GCC 9
changed the semantics of -fprofile-{generate,use}=path, making it
incompatible with ccache’s original implementation.
One crucial problem with the implementation is that there is no error
handling when the expected profiling data file cannot be found. This
means that there will be false positives cache hits for Clang and GCC
9+.
Fix this by:
* Checking for different profiling data file locations to handle
different compilers and versions.
* Bailing out if no profiling data file can be found.
Also:
* Implemented support for Clang’s -fprofile-instr-{generate,use}[=path]
options.
* Implemented support for -fauto-profile[=path].
* Removed the conversion of absolute path to the profile directory. 91a2954e says that the directory is rewritten to increase the hit
rate, but I don’t understand how that could be the case.
* Added tests for the profiling options. Exception:
-fauto-profile[=path], since that would require running the perf tool.
AFS sort of supports hardlinks, but not really - you can only hardlink
within directories, not across them. This means that the hardlink test
suite probe will pass, but ccache is unable to create hardlinks to its
cache directory and the test suite will fail. Modify
SUITE_hardlink_PROBE() to use a cross-directory hardlink to correctly
detect this case.
Co-authored-by: Alexander Lanin <alex@lanin.de> Co-authored-by: Joel Rosdahl <joel@rosdahl.net>
Alexander Lanin [Tue, 21 Apr 2020 18:41:48 +0000 (20:41 +0200)]
Diverse CMake preparations (#580)
* Prepare gitignore for builds in subdirectory
* Ignore to be generated Version.cpp
* Move travis to buildenv as it's just another image
* Move install_cuda out of .travis as it's not travis specific
* Prepare docker images for C++ and CMake
* Update authors + add script to do so
* Fix required C compiler
* Fix some formatting issues with clang-format 10