]> git.ipfire.org Git - thirdparty/ccache.git/log
thirdparty/ccache.git
3 years agofeat: Support masquerading as a compiler via copy or hard link
Joel Rosdahl [Fri, 10 Jun 2022 14:17:03 +0000 (16:17 +0200)] 
feat: Support masquerading as a compiler via copy or hard link

Setting up ccache to masquerade as a compiler has always meant using
symbolic links, but there is no technical reason why that has to be the
case. This commit adds support for masquerading via a copy or hard link
of the ccache executable as well. This is mostly useful on platforms or
file systems where symbolic links are not supported.

3 years agofeat: Set CCACHE_DISABLE when calling compiler
Joel Rosdahl [Fri, 10 Jun 2022 14:12:27 +0000 (16:12 +0200)] 
feat: Set CCACHE_DISABLE when calling compiler

If ccache for some reason executes a compiler that in turn calls ccache
then ccache will be run twice (and will potentially store two different
result in the cache since the compiler identications differ), which is
not very useful. This could for instance happen if the compiler is a
wrapper script that in turn calls "ccache $compiler ...".

Improve this by setting CCACHE_DISABLE when executing the compiler. Any
subsequent ccache invocations will then fall back to running the real
compiler.

3 years agofix: Add and use Util::{get,set}_umask functions
Joel Rosdahl [Wed, 8 Jun 2022 18:15:23 +0000 (20:15 +0200)] 
fix: Add and use Util::{get,set}_umask functions

Using

    mode_t mask = umask(0);
    umask(mask);

to retrieve the current umask isn't thread-safe. This messed up file
permissions when recompressing the cache.

Fix this by caching the last set value and always using
Util::{get,set}_umask to get and set the umask.

3 years agofix: Retain mtime/atime for recompressed files
Joel Rosdahl [Wed, 8 Jun 2022 15:29:22 +0000 (17:29 +0200)] 
fix: Retain mtime/atime for recompressed files

3 years agoenhance: Add util::set_timestamps function for setting mtime/atime
Joel Rosdahl [Wed, 8 Jun 2022 12:04:55 +0000 (14:04 +0200)] 
enhance: Add util::set_timestamps function for setting mtime/atime

3 years agoci: Bump Clang-Tidy job to Clang-Tidy 12
Joel Rosdahl [Wed, 8 Jun 2022 13:54:04 +0000 (15:54 +0200)] 
ci: Bump Clang-Tidy job to Clang-Tidy 12

3 years agobuild: Make it possible to opt out of probing for fastest linker
Joel Rosdahl [Wed, 8 Jun 2022 13:53:29 +0000 (15:53 +0200)] 
build: Make it possible to opt out of probing for fastest linker

3 years agochore: Align arguments in misc/test-all-systems
Joel Rosdahl [Wed, 8 Jun 2022 13:18:30 +0000 (15:18 +0200)] 
chore: Align arguments in misc/test-all-systems

3 years agoci: Use Ubuntu 20.04 for standard jobs
Joel Rosdahl [Wed, 8 Jun 2022 13:18:13 +0000 (15:18 +0200)] 
ci: Use Ubuntu 20.04 for standard jobs

3 years agoci: Remove unsupported platforms
Joel Rosdahl [Wed, 8 Jun 2022 13:16:37 +0000 (15:16 +0200)] 
ci: Remove unsupported platforms

3 years agoci: Bump CUDA job to Ubuntu 20.04
Joel Rosdahl [Wed, 8 Jun 2022 13:08:47 +0000 (15:08 +0200)] 
ci: Bump CUDA job to Ubuntu 20.04

3 years agorefactor: Extract option parsing code from process_arg
Joel Rosdahl [Wed, 8 Jun 2022 08:04:28 +0000 (10:04 +0200)] 
refactor: Extract option parsing code from process_arg

3 years agobump: Upgrade to cpp-httplib 0.10.8
Joel Rosdahl [Tue, 7 Jun 2022 18:11:29 +0000 (20:11 +0200)] 
bump: Upgrade to cpp-httplib 0.10.8

3 years agofix: Use correct umask when populating primary cache from secondary
Joel Rosdahl [Tue, 7 Jun 2022 14:53:44 +0000 (16:53 +0200)] 
fix: Use correct umask when populating primary cache from secondary

Util::get_umask retrieves the process's umask and caches it to avoid
some system calls. This doesn't interact well now when using UmaskScope
to change umask temporarily since Util::get_umask then only sometimes
returns the correct value. This leads to the incorrect umask being used
when writing cache entries to the primary storage for secondary storage
hits.

Fix this by not caching the umask system call.

Closes #1087.

3 years agofix: Create temporary file with cpp extension instead of hard linking
Joel Rosdahl [Tue, 7 Jun 2022 13:12:03 +0000 (15:12 +0200)] 
fix: Create temporary file with cpp extension instead of hard linking

[1] added a suitable file extension to the temporary file used for
capturing the preprocessed output by creating a hard link. This fails
when the temporary directory is on a file system that doesn't support
hard links.

Fix this by making it possible to pass a suffix to TemporaryFile and
passing the proper cpp suffix for the tmp stdout file instead of
creating a hard link as an alias.

[1]: 4da9f2b474b7ee39cd54ab4261f90936f3c944ec

Closes #1079.

3 years agoRevert "fix: Fall back to copying temporary preprocessed output file"
Joel Rosdahl [Tue, 7 Jun 2022 12:40:08 +0000 (14:40 +0200)] 
Revert "fix: Fall back to copying temporary preprocessed output file"

This reverts commit cbedccc9fa30f8958dc3e7fbdf900a952f63d5ad since the
fix doesn't work.

The hard link in question is used in get_result_key_from_cpp to create
an alias of file that captures stdout from the preprocessor, where the
alias has the correct cpp extension. It can't just be a copy since
do_execute writes to the original name. See #1079.

3 years agofix: Fix build for MSVC (#1078)
Florin T [Tue, 7 Jun 2022 09:06:12 +0000 (02:06 -0700)] 
fix: Fix build for MSVC (#1078)

For Windows the order of the includes is important in wincompat.hpp.

3 years agofeat: Fetch/update secondary storage manifest on primary miss (#1065)
bengtj [Tue, 7 Jun 2022 08:53:07 +0000 (10:53 +0200)] 
feat: Fetch/update secondary storage manifest on primary miss (#1065)

3 years agofeat: Generalize STATIC_LINK option + fixes (#1058)
Rafael Kitover [Tue, 7 Jun 2022 07:37:10 +0000 (07:37 +0000)] 
feat: Generalize STATIC_LINK option + fixes (#1058)

3 years agofix: Fall back to compiler when producing assembler listing file
Joel Rosdahl [Mon, 6 Jun 2022 20:23:00 +0000 (22:23 +0200)] 
fix: Fall back to compiler when producing assembler listing file

Ccache currently doesn't store the listing produced by -Wa,...=file, so
fall back to running the real compiler.

See #1083.

3 years agochore: Add debug log for -P + other preprocessor option
Joel Rosdahl [Mon, 6 Jun 2022 20:22:11 +0000 (22:22 +0200)] 
chore: Add debug log for -P + other preprocessor option

3 years agotest(test-all-systems): Enable ccache if available in Docker image
Joel Rosdahl [Mon, 6 Jun 2022 18:35:57 +0000 (20:35 +0200)] 
test(test-all-systems): Enable ccache if available in Docker image

3 years agotest: Add Ubuntu 22.04 Dockerfile
Joel Rosdahl [Sun, 29 May 2022 07:19:53 +0000 (09:19 +0200)] 
test: Add Ubuntu 22.04 Dockerfile

3 years agodocs: Fix typo in help text
Joel Rosdahl [Sun, 29 May 2022 07:17:50 +0000 (09:17 +0200)] 
docs: Fix typo in help text

3 years agoci: Add GCC 11 build on Ubuntu 22.04
Joel Rosdahl [Sat, 28 May 2022 18:33:07 +0000 (20:33 +0200)] 
ci: Add GCC 11 build on Ubuntu 22.04

3 years agofix: Work around problem with GCC in util::ends_with
Joel Rosdahl [Mon, 6 Jun 2022 18:46:09 +0000 (20:46 +0200)] 
fix: Work around problem with GCC in util::ends_with

The util::ends_with implementation is taken directly from the
implementation suggestion in the C++20 standard, but it produces a
stringop-overread warning with GCC 11.2. There's either some subtle
aspect to this that I don't understand or a compiler bug, but let's work
around it by tweaking the implementation.

Closes #1082.

3 years agobump: Upgrade xxh_x86dispatch.c to xxHash 0.8.1
Joel Rosdahl [Sat, 28 May 2022 17:48:20 +0000 (19:48 +0200)] 
bump: Upgrade xxh_x86dispatch.c to xxHash 0.8.1

xxh_x86dispatch.c was by mistake not included in
6eb7eb340bf163b807cb9267935e39fa619dde0b. See #1078.

3 years agofeat: Improve --show-stats
Joel Rosdahl [Wed, 11 May 2022 17:57:50 +0000 (19:57 +0200)] 
feat: Improve --show-stats

- Added percentage for most values.
- All indented values now have their total count equal to the parent
  value.
- Moved presentation of {direct,preprocessed}_cache_{hit,miss}
  counters to a separate "Successful lookups" section.
- Removed "Use the -v/--verbose option for more details." from
  --show-stats output since it's a bit wordy.

3 years agobump: Upgrade to nonstd::expected 0.6.0
Joel Rosdahl [Fri, 27 May 2022 17:54:10 +0000 (19:54 +0200)] 
bump: Upgrade to nonstd::expected 0.6.0

3 years agofix(win32execute): Handle space in paths when using response file (#1080)
Sergey Semushin [Thu, 26 May 2022 16:46:36 +0000 (19:46 +0300)] 
fix(win32execute): Handle space in paths when using response file (#1080)

3 years agofix: Fall back to copying temporary preprocessed output file
Joel Rosdahl [Thu, 26 May 2022 08:25:11 +0000 (10:25 +0200)] 
fix: Fall back to copying temporary preprocessed output file

[1] added a suitable file extension to the temporary file used for
capturing the preprocessed output by creating a hard link. This fails
when the temporary directory is on a file system that doesn't support
hard links.

Fix this by falling back to copying when hard-linking fails.

Closes #1079.

[1]: 4da9f2b474b7ee39cd54ab4261f90936f3c944ec

3 years agoRevert "build: Bump required compiler versions"
Joel Rosdahl [Mon, 23 May 2022 19:48:01 +0000 (21:48 +0200)] 
Revert "build: Bump required compiler versions"

This reverts commit 077e2a6c279755f6521ab78f4a1a049ae6a93990.

Not needed yet.

3 years agofix: Fix and optimize Redis upload script (#1081)
Anders Björklund [Mon, 23 May 2022 19:40:32 +0000 (21:40 +0200)] 
fix: Fix and optimize Redis upload script (#1081)

3 years agobuild: Bump required compiler versions
Joel Rosdahl [Mon, 23 May 2022 19:20:19 +0000 (21:20 +0200)] 
build: Bump required compiler versions

3 years agobuild: Remove now superfluous cmake policy setting
Joel Rosdahl [Mon, 23 May 2022 19:14:42 +0000 (21:14 +0200)] 
build: Remove now superfluous cmake policy setting

CMP0091 defaults to NEW with cmake_minimum_required 3.15 and later.

3 years agotest: Fix test failure when compiler is masquerading old ccache
Joel Rosdahl [Thu, 19 May 2022 19:58:50 +0000 (21:58 +0200)] 
test: Fix test failure when compiler is masquerading old ccache

3 years agochore: Remove no longer needed workaround for older GCCs
Joel Rosdahl [Thu, 19 May 2022 16:02:35 +0000 (18:02 +0200)] 
chore: Remove no longer needed workaround for older GCCs

3 years agobuild: Enable Clang-Tidy modernize-concat-nested-namespaces check
Joel Rosdahl [Wed, 18 May 2022 18:54:49 +0000 (20:54 +0200)] 
build: Enable Clang-Tidy modernize-concat-nested-namespaces check

3 years agobuild: Enable Clang-Tidy performance-no-automatic-move check
Joel Rosdahl [Wed, 18 May 2022 18:53:02 +0000 (20:53 +0200)] 
build: Enable Clang-Tidy performance-no-automatic-move check

3 years agochore: Replace nonstd::string_view with std::string_view
Joel Rosdahl [Tue, 17 May 2022 19:55:48 +0000 (21:55 +0200)] 
chore: Replace nonstd::string_view with std::string_view

3 years agochore: Replace nonstd::optional with std::optional
Joel Rosdahl [Mon, 16 May 2022 19:57:46 +0000 (21:57 +0200)] 
chore: Replace nonstd::optional with std::optional

3 years agobuild: Require C++17 compiler and CMake 3.15
Joel Rosdahl [Mon, 16 May 2022 19:55:41 +0000 (21:55 +0200)] 
build: Require C++17 compiler and CMake 3.15

A C++17-compatible compiler is now readily available on all systems we
target primarily, so it's time to bump to C++17.

Also, we want to use features in CMake 3.15 (see #1069), so bump that
too.

3 years agobuild: Enable static runtime linking for MSVC (#1069)
Cristian Adam [Mon, 23 May 2022 16:18:29 +0000 (18:18 +0200)] 
build: Enable static runtime linking for MSVC (#1069)

3 years agofix: Fix crash with empty include filename in preprocessor output (#1075)
olegsidorkin [Mon, 16 May 2022 19:21:52 +0000 (22:21 +0300)] 
fix: Fix crash with empty include filename in preprocessor output (#1075)

3 years agochore: Update NEWS v4.6.1
Joel Rosdahl [Sat, 14 May 2022 18:36:48 +0000 (20:36 +0200)] 
chore: Update NEWS

3 years agochore: Update authors
Joel Rosdahl [Sat, 14 May 2022 18:41:43 +0000 (20:41 +0200)] 
chore: Update authors

3 years agostyle: Improve names of Args::AtFileFormat values
Joel Rosdahl [Sat, 14 May 2022 18:36:01 +0000 (20:36 +0200)] 
style: Improve names of Args::AtFileFormat values

3 years agoci: Bump to CodeQL action v2
Joel Rosdahl [Sat, 14 May 2022 07:18:24 +0000 (09:18 +0200)] 
ci: Bump to CodeQL action v2

3 years agofix: Support Redis URL without host
Joel Rosdahl [Fri, 13 May 2022 18:46:20 +0000 (20:46 +0200)] 
fix: Support Redis URL without host

3 years agochore: Don’t store unused return value
Joel Rosdahl [Fri, 13 May 2022 18:45:54 +0000 (20:45 +0200)] 
chore: Don’t store unused return value

3 years agochore: Constify core::Manifest::add_result parameter
Joel Rosdahl [Fri, 13 May 2022 18:44:52 +0000 (20:44 +0200)] 
chore: Constify core::Manifest::add_result parameter

3 years agochore: Set version “unknown” instead of empty string if unknown
Joel Rosdahl [Thu, 12 May 2022 18:46:24 +0000 (20:46 +0200)] 
chore: Set version “unknown” instead of empty string if unknown

3 years agofix: Support Git 1.x when determining ccache version
Joel Rosdahl [Thu, 12 May 2022 18:45:53 +0000 (20:45 +0200)] 
fix: Support Git 1.x when determining ccache version

3 years agochore: Prepare for binary patching SYSCONFDIR
Joel Rosdahl [Thu, 12 May 2022 18:21:08 +0000 (20:21 +0200)] 
chore: Prepare for binary patching SYSCONFDIR

3 years agochore: Add Jacob Young to .mailmap
Joel Rosdahl [Wed, 11 May 2022 18:46:41 +0000 (20:46 +0200)] 
chore: Add Jacob Young to .mailmap

3 years agofix: Avoid incorrect error log for Redis write in reshare mode
Joel Rosdahl [Wed, 11 May 2022 18:30:26 +0000 (20:30 +0200)] 
fix: Avoid incorrect error log for Redis write in reshare mode

3 years agochore: Remove anonymous users from AUTHORS
Joel Rosdahl [Mon, 9 May 2022 16:52:30 +0000 (18:52 +0200)] 
chore: Remove anonymous users from AUTHORS

3 years agofix: Correctly represent statistics counters > 1 in log and stats log
Joel Rosdahl [Mon, 9 May 2022 16:43:03 +0000 (18:43 +0200)] 
fix: Correctly represent statistics counters > 1 in log and stats log

3 years agofix: Fix parsing of MSVC response files (#1071)
jacobly0 [Wed, 11 May 2022 18:45:40 +0000 (14:45 -0400)] 
fix: Fix parsing of MSVC response files (#1071)

3 years agodocs: Add warning about base_dir
Joel Rosdahl [Sun, 8 May 2022 14:31:37 +0000 (16:31 +0200)] 
docs: Add warning about base_dir

See #1042.

3 years agochore: Update license for nonstd::expected
Joel Rosdahl [Sun, 8 May 2022 14:14:49 +0000 (16:14 +0200)] 
chore: Update license for nonstd::expected

See #1053.

3 years agorefactor: Simplify Reader::read_int
Joel Rosdahl [Sun, 8 May 2022 14:09:24 +0000 (16:09 +0200)] 
refactor: Simplify Reader::read_int

std::string::operator[](0) is well-defined for empty strings.

3 years agofix: Log expanded secondary storage URL in put/remove
Joel Rosdahl [Sat, 7 May 2022 19:07:28 +0000 (21:07 +0200)] 
fix: Log expanded secondary storage URL in put/remove

3 years agofix: Fix miscompile of nonstd::expected on MSVC v19.22 (#1053)
jacobly0 [Sun, 8 May 2022 14:12:28 +0000 (16:12 +0200)] 
fix: Fix miscompile of nonstd::expected on MSVC v19.22 (#1053)

3 years agofix: Check for short reads in Reader::read_str (#1068)
Gregor Jasny [Sun, 8 May 2022 14:08:43 +0000 (16:08 +0200)] 
fix: Check for short reads in Reader::read_str (#1068)

3 years agofix: Fix "Multiple precompiled headers used" error if /Yu option is used after /Fp...
Alexey Telishev [Sun, 8 May 2022 14:06:05 +0000 (17:06 +0300)] 
fix: Fix "Multiple precompiled headers used" error if /Yu option is used after /Fp (#1059)

3 years agofeat: Make upload-redis output more like other tools (#1070)
Anders Björklund [Sun, 8 May 2022 11:24:44 +0000 (13:24 +0200)] 
feat: Make upload-redis output more like other tools (#1070)

3 years agofix: Improve MSVC /Fp and /Yu options further
Joel Rosdahl [Thu, 5 May 2022 22:01:45 +0000 (00:01 +0200)] 
fix: Improve MSVC /Fp and /Yu options further

Improve 09dea223466e to also handle relative paths to -Fp/-Yu.

3 years agochore: Add knowledge of linker option -z to avoid note in debug log
Joel Rosdahl [Thu, 5 May 2022 19:29:37 +0000 (21:29 +0200)] 
chore: Add knowledge of linker option -z to avoid note in debug log

Closes #1061.

3 years agofix: Handle MSVC /Fp and /Yu options with concatenated path again
Joel Rosdahl [Thu, 5 May 2022 19:20:04 +0000 (21:20 +0200)] 
fix: Handle MSVC /Fp and /Yu options with concatenated path again

Regression in c8fb539523c801bf15591c395c3029b4530a7a2f.

See #1063.

3 years agofeat: Handle -imsvc compiler option (#1055)
jacobly0 [Sun, 1 May 2022 19:24:18 +0000 (21:24 +0200)] 
feat: Handle -imsvc compiler option (#1055)

3 years agobuild: Fix build arguments to clang-cl (#1054)
jacobly0 [Sun, 1 May 2022 19:23:32 +0000 (21:23 +0200)] 
build: Fix build arguments to clang-cl (#1054)

3 years agofix: Fix sporadic test.profiling failures (#1056)
jacobly0 [Sun, 1 May 2022 16:10:56 +0000 (18:10 +0200)] 
fix: Fix sporadic test.profiling failures (#1056)

Using cut, which is always line-based, to remove bytes from a binary file can
cause problems if the binary timestamp field happens to contain a newline
character, which causes test.profiling to fail <1% of the time. Instead use tail
which has a character mode that ignores newlines.

3 years agofix: Isolate inode cache file in tests
Joel Rosdahl [Sun, 1 May 2022 11:15:37 +0000 (13:15 +0200)] 
fix: Isolate inode cache file in tests

All test suites use the default temporary directory location
/run/user/<UID>/ccache-tmp when possible, which means that the inode
cache file is shared between all test suites. This is problematic when
running test suites in parallel since one test suite may run “ccache -C”
(which removes the inode cache file) between two compilations in the
inode_cache suite, thus making the second compilation not behave as
expected, failing the test.

Fix this by putting the temporary directory inside the test-specific
ccache directory instead of using the default global location.

Fixes #1045.

3 years agofeat: Improve inode cache logging
Joel Rosdahl [Sun, 1 May 2022 11:14:19 +0000 (13:14 +0200)] 
feat: Improve inode cache logging

3 years agoci: Fix CUDA installation
Joel Rosdahl [Sat, 30 Apr 2022 20:18:07 +0000 (22:18 +0200)] 
ci: Fix CUDA installation

3 years agofix: Normalize paths to fix basedir option on Windows (#1033)
vvainola [Sat, 30 Apr 2022 20:13:58 +0000 (23:13 +0300)] 
fix: Normalize paths to fix basedir option on Windows (#1033)

Co-authored-by: Joel Rosdahl <joel@rosdahl.net>
3 years agorefactor: Improve absolute path normalization functions
Joel Rosdahl [Wed, 27 Apr 2022 19:15:35 +0000 (21:15 +0200)] 
refactor: Improve absolute path normalization functions

The Util::normalize_absolute_path function only works on the syntactic
level, i.e. the result may not actually resolve to the same filesystem
entry (nor to any file system entry for that matter). It was meant to be
used for paths that don’t necessarily exist yet, such as a future
directory in which to write debug files. It may fail in edge cases with
symlinks in the path in combination with .. segments. If the caller
wants to ensure that the resulting path actually makes sense, it needs
to check if the resulting path points to the same file entry as the
original.

To improve on this, Util::normalize_absolute_path has now been renamed
to Util::normalize_abstract_absolute_path and there is a new
Util::normalize_concrete_absolute_path function which returns the
original path if the normalized result doesn't resolve to the same file
system entry as the original path.

3 years agofix: Make Stat::same_inode_as consider error code
Joel Rosdahl [Tue, 26 Apr 2022 18:54:29 +0000 (20:54 +0200)] 
fix: Make Stat::same_inode_as consider error code

3 years agodocs: Mention default cache locations for Windows and macOS
Joel Rosdahl [Tue, 12 Apr 2022 19:15:05 +0000 (21:15 +0200)] 
docs: Mention default cache locations for Windows and macOS

3 years agofix: Fix static linkage with hiredis on Windows (#1041)
Orgad Shaneh [Tue, 12 Apr 2022 19:29:53 +0000 (22:29 +0300)] 
fix: Fix static linkage with hiredis on Windows (#1041)

3 years agofix: Replace skip_last_empty with IncludeDelimiter (#1046)
Orgad Shaneh [Tue, 12 Apr 2022 19:09:57 +0000 (22:09 +0300)] 
fix: Replace skip_last_empty with IncludeDelimiter (#1046)

3 years agofix: Fix code restructuring mistake in 5a55014f
Joel Rosdahl [Fri, 8 Apr 2022 10:59:40 +0000 (12:59 +0200)] 
fix: Fix code restructuring mistake in 5a55014f

3 years agofix: Fix process_preprocessed_file bug for distcc marker
Joel Rosdahl [Wed, 6 Apr 2022 19:37:04 +0000 (21:37 +0200)] 
fix: Fix process_preprocessed_file bug for distcc marker

2044fea84b86001b2976ecde946d3d6d0e88ec0a (included in ccache 4.6)
removed the special-casing of distcc’s pump in
process_preprocessed_file. That in turn revealed a bug that has been
present since 432d1ca6a6aa51f708124172169073c399fb68d2 (included in
ccache 3.4) but previously only affected compilations with distcc-pump
as the “compiler”: the detection and handling of distcc-pump’s
“__________” messages is broken in two ways:

1. It throws away everything between the last preprocessor directive and
   the “__________” marker. Thus, changes to such sections will not be
   included in the hash.
2. It detects “__________” markers in the middle of lines, not only at
   the beginning of lines.

3 years agostyle: Tweak code style to match conventions
Joel Rosdahl [Tue, 5 Apr 2022 18:15:11 +0000 (20:15 +0200)] 
style: Tweak code style to match conventions

3 years agostyle: Enable some clang-tidy readability checks for unit tests
Joel Rosdahl [Tue, 5 Apr 2022 18:14:03 +0000 (20:14 +0200)] 
style: Enable some clang-tidy readability checks for unit tests

3 years agoMerge pull request #1037 from orgads/cl-strip-lf
Joel Rosdahl [Tue, 5 Apr 2022 17:50:52 +0000 (19:50 +0200)] 
Merge pull request #1037 from orgads/cl-strip-lf

3 years agofix: Do not add redundant newlines for stdout 1037/head
Orgad Shaneh [Fri, 25 Mar 2022 14:27:39 +0000 (17:27 +0300)] 
fix: Do not add redundant newlines for stdout

Tokenizer is used with include_empty, and the output typically ends with
\n.

For each line, tokenizer returns it without the \n, and the function
appends
it. But if the output ends with \n, the tokenizer returns an additional
empty string, and a redundant LF is written to stdout.

Another issue can be if the last line of the original output doesn't end
with \n at all, ccache added it anyway.

It was probably unnoticed until now since gcc has no output at all, while
cl outputs the source file name.

3 years agofeat: Support preserving the delimiters on tokenizer
Orgad Shaneh [Fri, 25 Mar 2022 14:27:39 +0000 (17:27 +0300)] 
feat: Support preserving the delimiters on tokenizer

3 years agotest: Simplify tokenizer tests
Orgad Shaneh [Sun, 27 Mar 2022 12:14:10 +0000 (15:14 +0300)] 
test: Simplify tokenizer tests

3 years agofix: Only use /run/user/<UID>/ccache-tmp if writable
Joel Rosdahl [Sun, 3 Apr 2022 08:50:43 +0000 (10:50 +0200)] 
fix: Only use /run/user/<UID>/ccache-tmp if writable

The fix for #984 addressed a problem when /run/user/0 already exists and
ccache is run with fakeroot. However, it didn’t handle the case when
/run/user/0/ccache-tmp already exists, which will happen for instance if
the real root user has run ccache at least once.

Fix this by using access(2) to verify that the ccache-tmp directory is
writable. Note: Can’t just check the mode bits of the directory since
they appear OK since fakeroot fakes the UID.

Fixes #1044.

3 years agofix: Add ASM and ASM_MASM to project() languages (#1043)
Rafael Kitover [Sun, 3 Apr 2022 07:16:12 +0000 (07:16 +0000)] 
fix: Add ASM and ASM_MASM to project() languages (#1043)

3 years agofix: Improve handling of .gcno files
Joel Rosdahl [Sun, 3 Apr 2022 06:59:46 +0000 (08:59 +0200)] 
fix: Improve handling of .gcno files

When support for caching a compilation with coverage (producing a .gcno
file), the commit[1] made sure to avoid rewriting the input path to
relative with the motivation “also make sure to use the source file
path, since this is in the notes”. However, this seems to be unnecessary
since a relative input file path will be written as is to the .gcno, not
the absolute path. This is the case for at least GCC 4.7+ and Clang
3.6+. Fix this by potentially converting the input path to relative even
when generating coverage.

When investigating the above issue, I noticed that GCC 9+ includes the
current working directory (CWD) in the .gcno file. This means that we
have include the CWD in the hash when compiling with
-ftest-coverage/--coverage in order to replicate what the compiler would
produce. Since this makes it impossible get cache hits when compiling in
different directories, a new gcno_cwd sloppiness has been added for
opting out of hashing the CWD, with the tradeoff of potentially getting
an incorrect directory in the .gcno file.

[1]: 02d3f078bd2495b8db2264ae0b2c692b4c5ba1bd

Fixes #1032.

3 years agorefactor: Sort sloppiness parsing/generation
Joel Rosdahl [Thu, 31 Mar 2022 19:17:32 +0000 (21:17 +0200)] 
refactor: Sort sloppiness parsing/generation

3 years agochore: Disable some clang-tidy checks that don’t contribute much
Joel Rosdahl [Sun, 27 Mar 2022 10:57:24 +0000 (12:57 +0200)] 
chore: Disable some clang-tidy checks that don’t contribute much

3 years agodocs: Add reference to reference build configs (#1031)
vsplesk [Sun, 27 Mar 2022 07:57:54 +0000 (09:57 +0200)] 
docs: Add reference to reference build configs (#1031)

3 years agofix: Bail out on too hard MSVC environment variables CL and _CL_
Joel Rosdahl [Sat, 26 Mar 2022 11:20:32 +0000 (12:20 +0100)] 
fix: Bail out on too hard MSVC environment variables CL and _CL_

To handle the CL and _CL_ variables properly, ccache needs to parse them
according to [1] and then include the compiler options as part of
regular argument processing. Until that is done we have to bail out and
just run the original compiler.

[1]: https://docs.microsoft.com/en-us/cpp/build/reference/cl-environment-variables?view=msvc-170

Fixes #1022.

3 years agofix: Prefer CMake find module for hiredis package
Joel Rosdahl [Sat, 26 Mar 2022 09:28:44 +0000 (10:28 +0100)] 
fix: Prefer CMake find module for hiredis package

3 years agorefactor: Simplify string append in process_arg
Joel Rosdahl [Sat, 26 Mar 2022 09:10:04 +0000 (10:10 +0100)] 
refactor: Simplify string append in process_arg

3 years agochore: Improve error message for read error in from_cache
Joel Rosdahl [Sat, 26 Mar 2022 08:56:29 +0000 (09:56 +0100)] 
chore: Improve error message for read error in from_cache