]> git.ipfire.org Git - thirdparty/ccache.git/log
thirdparty/ccache.git
2 years agofix: Use -P -Fi for saving MSVC preprocessor output
Joel Rosdahl [Thu, 25 Aug 2022 19:15:01 +0000 (21:15 +0200)] 
fix: Use -P -Fi for saving MSVC preprocessor output

Even though MSVC supports "-E" and "-c -o" it apparently doesn't support
"-E -o", so [1] broke MSVC.

[1]: 64fc42ca2c5c9fe60ef4f1dc3882edb5f35579d6

Fixes #1146.

2 years agofix: Fix build with musl when using GCC 12 (#1145)
Khem Raj [Thu, 25 Aug 2022 19:36:18 +0000 (12:36 -0700)] 
fix: Fix build with musl when using GCC 12 (#1145)

2 years agofix: Detect PCH for concatenated -include option
Joel Rosdahl [Wed, 24 Aug 2022 17:41:07 +0000 (19:41 +0200)] 
fix: Detect PCH for concatenated -include option

Fixes #1143.

2 years agofix: Avoid narrowing warning for struct statfs f_type field
Joel Rosdahl [Wed, 24 Aug 2022 17:12:32 +0000 (19:12 +0200)] 
fix: Avoid narrowing warning for struct statfs f_type field

As noted in #1142.

2 years agodoc: Touch up config file and cache directory documentation
Joel Rosdahl [Tue, 23 Aug 2022 20:01:44 +0000 (22:01 +0200)] 
doc: Touch up config file and cache directory documentation

2 years agochore: Tweak formatting
Joel Rosdahl [Tue, 23 Aug 2022 19:58:27 +0000 (21:58 +0200)] 
chore: Tweak formatting

2 years agochore: Touch up documentation of Util::make_path
Joel Rosdahl [Tue, 23 Aug 2022 19:58:05 +0000 (21:58 +0200)] 
chore: Touch up documentation of Util::make_path

2 years agobuild: Improve descriptions of installation variables
Joel Rosdahl [Tue, 23 Aug 2022 19:57:21 +0000 (21:57 +0200)] 
build: Improve descriptions of installation variables

2 years agorefactor: Use FMT macro to format exception messages
Joel Rosdahl [Tue, 23 Aug 2022 16:21:57 +0000 (18:21 +0200)] 
refactor: Use FMT macro to format exception messages

Using the FMT macro explicitly makes invalid format message
constructions compile-time errors instead of run-time errors.

2 years agochore: Update NEWS
Joel Rosdahl [Mon, 22 Aug 2022 19:10:07 +0000 (21:10 +0200)] 
chore: Update NEWS

(cherry picked from commit ee6ea5f33dd18710730d22416a91ea1e0178bef2)

2 years agochore: Update authors
Joel Rosdahl [Mon, 22 Aug 2022 19:09:27 +0000 (21:09 +0200)] 
chore: Update authors

(cherry picked from commit b4f0a18f30ba65b9f291fdc820955189b895c896)

2 years agofix: Add missing format argument to error message
Joel Rosdahl [Mon, 22 Aug 2022 18:59:50 +0000 (20:59 +0200)] 
fix: Add missing format argument to error message

2 years agofix: Don't crash in race between file read and cleanup
Joel Rosdahl [Thu, 18 Aug 2022 19:15:39 +0000 (21:15 +0200)] 
fix: Don't crash in race between file read and cleanup

As mentioned in discussion #1102.

Regression in 02dac1f18084c0931aa6b8c1a07e9aedfadb5642.

2 years agofix: Strip .exe from executable name on version output (#1135)
Orgad Shaneh [Thu, 18 Aug 2022 17:19:39 +0000 (20:19 +0300)] 
fix: Strip .exe from executable name on version output (#1135)

2 years agotest: Add version output on failure (#1134)
Orgad Shaneh [Thu, 18 Aug 2022 17:16:35 +0000 (20:16 +0300)] 
test: Add version output on failure (#1134)

2 years agofix: Fix Clang/Windows build (#1132)
Orgad Shaneh [Thu, 18 Aug 2022 17:15:37 +0000 (20:15 +0300)] 
fix: Fix Clang/Windows build (#1132)

2 years agochore: Remove now unused Util::{read_fd,read_file,write_file} functions
Joel Rosdahl [Mon, 15 Aug 2022 19:31:31 +0000 (21:31 +0200)] 
chore: Remove now unused Util::{read_fd,read_file,write_file} functions

2 years agorefactor: Use util::{read_fd,read_file,write_file} functions
Joel Rosdahl [Mon, 15 Aug 2022 19:25:37 +0000 (21:25 +0200)] 
refactor: Use util::{read_fd,read_file,write_file} functions

2 years agorefactor: Use new util::Blob typedef
Joel Rosdahl [Mon, 15 Aug 2022 19:15:53 +0000 (21:15 +0200)] 
refactor: Use new util::Blob typedef

2 years agorefactor: Use util::Blob for binary data in storage API
Joel Rosdahl [Mon, 15 Aug 2022 19:10:39 +0000 (21:10 +0200)] 
refactor: Use util::Blob for binary data in storage API

2 years agoenhance: Add util::{read_fd,read_file,write_file} functions
Joel Rosdahl [Mon, 15 Aug 2022 05:39:24 +0000 (07:39 +0200)] 
enhance: Add util::{read_fd,read_file,write_file} functions

2 years agochore: Improve log message about too many raw file entries
Joel Rosdahl [Tue, 9 Aug 2022 12:44:14 +0000 (14:44 +0200)] 
chore: Improve log message about too many raw file entries

2 years agochore: Touch up {download,upload}-redis scripts
Joel Rosdahl [Tue, 9 Aug 2022 12:48:54 +0000 (14:48 +0200)] 
chore: Touch up {download,upload}-redis scripts

3 years agobump: Upgrade to nonstd::expected 0.6.2
Joel Rosdahl [Sun, 7 Aug 2022 12:35:39 +0000 (14:35 +0200)] 
bump: Upgrade to nonstd::expected 0.6.2

3 years agofeat: Enable inode cache by default
Joel Rosdahl [Fri, 5 Aug 2022 14:42:16 +0000 (16:42 +0200)] 
feat: Enable inode cache by default

See discussion #1086.

3 years agofeat: Improve inode cache robustness
Joel Rosdahl [Fri, 5 Aug 2022 14:39:29 +0000 (16:39 +0200)] 
feat: Improve inode cache robustness

- Only enable the inode cache at compile-time if it's possible to
  determine filesystem type.
- Only use the inode cache at run-time if the filesystem type is known
  to work with the inode cache instead of refusing just on NFS.

3 years agotest: Refactor InodeCache unit tests
Joel Rosdahl [Fri, 5 Aug 2022 13:53:14 +0000 (15:53 +0200)] 
test: Refactor InodeCache unit tests

3 years agoenhance: Add Config::set_temporary_dir
Joel Rosdahl [Fri, 5 Aug 2022 13:52:55 +0000 (15:52 +0200)] 
enhance: Add Config::set_temporary_dir

For usage by unit tests.

3 years agofix: Only enable inode cache if subsecond stat timestamps are available
Joel Rosdahl [Thu, 4 Aug 2022 18:55:19 +0000 (20:55 +0200)] 
fix: Only enable inode cache if subsecond stat timestamps are available

If such fields are not available we risk false positive inode cache
hits.

3 years agochore: Remove unused InodeCache::Key::sloppy_time_macros field
Joel Rosdahl [Thu, 4 Aug 2022 18:21:16 +0000 (20:21 +0200)] 
chore: Remove unused InodeCache::Key::sloppy_time_macros field

3 years agoenhance: Support Stat::{atim,ctim,mtim} on macOS
Joel Rosdahl [Thu, 4 Aug 2022 18:01:40 +0000 (20:01 +0200)] 
enhance: Support Stat::{atim,ctim,mtim} on macOS

3 years agobump: Upgrade to cpp-httplib 0.11.1
Joel Rosdahl [Wed, 3 Aug 2022 19:38:51 +0000 (21:38 +0200)] 
bump: Upgrade to cpp-httplib 0.11.1

3 years agofix: Hash time information on inode cache hit
Joel Rosdahl [Wed, 3 Aug 2022 08:04:03 +0000 (10:04 +0200)] 
fix: Hash time information on inode cache hit

As mentioned in discussion #1086: If the inode cache is enabled,
hash_source_code_file will on an inode cache hit fail to hash time
information if there are temporal macros in the code. This is because
hash_source_code_string (called from hash_source_code_file via
hash_source_code_file_nocache) on an inode cache miss adds time
information to the hash in case one of those macros were found. However,
on an inode cache hit the return value of hash_source_code_file will be
correctly fetched from the cache, but the hash sum will only be updated
with (the hash of) the include file and not the time information.

The fix is to let the inode cache only cache the effects of hashing the
file and checking for macros, not the hashing of time information since
that's volatile.

After the fix:

- The new do_hash_file function performs file hashing and macro
  checking. The inode cache caches this step.
- hash_source_code_file returns a Digest instead of adding data to a
  Hash.
- hash_source_code_file calls do_hash_file and then potentially hashes
  time information. If there are no temporal macros the returned digest
  will be identical to the file hash, otherwise the returned digest will
  be of a hash of file content hash + time information.

This also improves hashes that are stored in the direct mode manifest:
Previously they were always the hash of the file content hash but now
they are just the file content hash in the common case when there is no
__DATE__ or __TIMESTAMP__ macro in the file.

3 years agofix: Hash sanitizeblacklist delimiter correctly
Joel Rosdahl [Tue, 2 Aug 2022 20:18:13 +0000 (22:18 +0200)] 
fix: Hash sanitizeblacklist delimiter correctly

Regression in a502145296044ea32b24e329d75122e777c598e6.

3 years agotest: Ignore clang warning from -fdebug-prefix-map test
Joel Rosdahl [Tue, 2 Aug 2022 19:26:45 +0000 (21:26 +0200)] 
test: Ignore clang warning from -fdebug-prefix-map test

3 years agotest: Only run -ftest-coverage + -fprofile-dir tests for GCC
Joel Rosdahl [Tue, 2 Aug 2022 19:16:09 +0000 (21:16 +0200)] 
test: Only run -ftest-coverage + -fprofile-dir tests for GCC

Clang complains with "warning: argument unused during compilation:
'-fprofile-dir=dir'".

3 years agoenhance: Make Hash::add_debug_text public
Joel Rosdahl [Tue, 2 Aug 2022 13:37:09 +0000 (15:37 +0200)] 
enhance: Make Hash::add_debug_text public

3 years agofix: Always rewrite dependency file if base_dir is used
Joel Rosdahl [Mon, 1 Aug 2022 12:53:52 +0000 (14:53 +0200)] 
fix: Always rewrite dependency file if base_dir is used

[1] added the has_absolute_include_headers variable as a performance
optimization for base_dir/CCACHE_BASEDIR so that the dependency file
only has to be parsed/rewritten when necessary. This is based on the
assumption that if no include file has an absolute path then no rewrite
is needed, but apparently Clang can insert other paths into the
dependency file as well, for instance the asan_blacklist.txt file when
using -fsanitize=address.

Fix this by simply always parsing the dependency file when base_dir is
active.

Fixes #1128.

[1]: 60178b7a8eb8d03b364afb2fb8bd6753924cd9b7

3 years agofix: Handle --hash-file/--checksum-file error properly
Joel Rosdahl [Sat, 30 Jul 2022 10:58:12 +0000 (12:58 +0200)] 
fix: Handle --hash-file/--checksum-file error properly

3 years agofeat: Move Windows config and cache to LOCALAPPDATA (#1124)
Rafael Kitover [Mon, 1 Aug 2022 12:34:16 +0000 (15:34 +0300)] 
feat: Move Windows config and cache to LOCALAPPDATA (#1124)

3 years agofeat: Log configuration file locations
Joel Rosdahl [Fri, 29 Jul 2022 09:42:32 +0000 (11:42 +0200)] 
feat: Log configuration file locations

See #1127.

3 years agochore: Remove redundant include of algorithm header
Joel Rosdahl [Fri, 29 Jul 2022 09:30:59 +0000 (11:30 +0200)] 
chore: Remove redundant include of algorithm header

Closes #1126.

3 years agochore: Remove unused CMake code
Joel Rosdahl [Thu, 28 Jul 2022 19:48:17 +0000 (21:48 +0200)] 
chore: Remove unused CMake code

3 years agofeat: Improve handling of dependency files
Joel Rosdahl [Thu, 28 Jul 2022 08:58:05 +0000 (10:58 +0200)] 
feat: Improve handling of dependency files

- Cache entries are now shared for different -MT/-MQ options. This is
  implemented by (on a cache hit) rewriting the stored dependency file
  data to have the correct dependency target before writing it to the
  destination. Closes #359.
- An intentional side effect of the above is that the correct dependency
  target will be produced even when base_dir/CCACHE_BASEDIR is used -
  the dependency target will still be an absolute path. Fixes #1042.
- Buggy support for GCC-specific environment variables
  DEPENDENCIES_OUTPUT and SUNPRO_DEPENDENCIES has been removed. When one
  of those variables was set, ccache used to store and fetch the content
  just as if -MMD or -MD were used. This is however incorrect since GCC
  *appends* to the destination file instead of (like -MMD/-MD)
  *rewriting* it. Since there is no way for ccache to know what the
  compiler appended to the dependency file, we simply can't support it.
  Reverts #349.

3 years agochore: Improve comment
Joel Rosdahl [Wed, 27 Jul 2022 17:35:54 +0000 (19:35 +0200)] 
chore: Improve comment

3 years agotest: Add support for negative content pattern matching
Joel Rosdahl [Tue, 26 Jul 2022 16:47:08 +0000 (18:47 +0200)] 
test: Add support for negative content pattern matching

3 years agofix: Restore order of cpp and cppstderr sections in input hash
Joel Rosdahl [Fri, 22 Jul 2022 20:35:35 +0000 (22:35 +0200)] 
fix: Restore order of cpp and cppstderr sections in input hash

This retains input hash compatibility with revisions before
64fc42ca2c5c9fe60ef4f1dc3882edb5f35579d6.

3 years agoci: Bump to macOS 11
Joel Rosdahl [Fri, 22 Jul 2022 11:08:21 +0000 (13:08 +0200)] 
ci: Bump to macOS 11

The macOS 10.15 runners are being deprecated.

3 years agofix: Work around Clang bug when outputting to full NFS disk
Joel Rosdahl [Wed, 20 Jul 2022 20:55:56 +0000 (22:55 +0200)] 
fix: Work around Clang bug when outputting to full NFS disk

See <https://github.com/llvm/llvm-project/issues/56499>.

Fixes #1115.

3 years agotest: Remove superfluous period from error message
Joel Rosdahl [Wed, 20 Jul 2022 20:54:45 +0000 (22:54 +0200)] 
test: Remove superfluous period from error message

3 years agotest: Fix printing of error messages with embedded newlines
Joel Rosdahl [Wed, 20 Jul 2022 20:53:25 +0000 (22:53 +0200)] 
test: Fix printing of error messages with embedded newlines

3 years agofeat: Don't remove inode cache file on -C/--clear
Joel Rosdahl [Tue, 19 Jul 2022 13:31:34 +0000 (15:31 +0200)] 
feat: Don't remove inode cache file on -C/--clear

-C/--clear is tied to the cache directory while the inode cache file is
a temporary file. I think it makes more sense to not consider the inode
cache part of the main cache directory.

3 years agofix: Log "bad output file" instead of "cache miss" on output file error
Joel Rosdahl [Tue, 19 Jul 2022 12:24:22 +0000 (14:24 +0200)] 
fix: Log "bad output file" instead of "cache miss" on output file error

3 years agodoc: Tweak install guide
Joel Rosdahl [Tue, 19 Jul 2022 08:34:35 +0000 (10:34 +0200)] 
doc: Tweak install guide

3 years agodoc: Improve install guide (#1121)
Rafael Kitover [Tue, 19 Jul 2022 08:31:04 +0000 (01:31 -0700)] 
doc: Improve install guide (#1121)

3 years agofeat: Download dependencies from the Internet when unavailable (#1112)
Rafael Kitover [Tue, 19 Jul 2022 08:29:27 +0000 (01:29 -0700)] 
feat: Download dependencies from the Internet when unavailable (#1112)

Change the behavior of ZSTD_FROM_INTERNET and HIREDIS_FROM_INTERNET to
always be on and only come into affect when the package is not found on
the system by normal means.

Also use the cmake standard module FetchContent for the
download/checksum/unpack logic.

Signed-off-by: Rafael Kitover <rkitover@gmail.com>
3 years agofix: Avoid false positive cache hits for __asm__(".incbin" " \"file\"")
Joel Rosdahl [Tue, 19 Jul 2022 07:52:00 +0000 (09:52 +0200)] 
fix: Avoid false positive cache hits for __asm__(".incbin" " \"file\"")

Regression in #983.

Fixes #1120.

3 years agofeat: Add download-redis script matching the upload-redis (#1111)
Anders Björklund [Mon, 18 Jul 2022 16:47:28 +0000 (18:47 +0200)] 
feat: Add download-redis script matching the upload-redis (#1111)

3 years agofix(file-storage): Remove duplicate backslash from directory
Joel Rosdahl [Mon, 18 Jul 2022 13:10:46 +0000 (15:10 +0200)] 
fix(file-storage): Remove duplicate backslash from directory

3 years agoci: Add VS2022 and MSBuild to Windows CI runners (#1108)
Rafael Kitover [Mon, 18 Jul 2022 12:42:50 +0000 (05:42 -0700)] 
ci: Add VS2022 and MSBuild to Windows CI runners (#1108)

3 years agofeat(file-storage): Support server name in URL on Windows
Joel Rosdahl [Mon, 18 Jul 2022 12:19:44 +0000 (14:19 +0200)] 
feat(file-storage): Support server name in URL on Windows

3 years agofix: Avoid false success for -fcolor-diagnostics probe with GCC
Joel Rosdahl [Sun, 17 Jul 2022 19:55:06 +0000 (21:55 +0200)] 
fix: Avoid false success for -fcolor-diagnostics probe with GCC

Ccache will produce a false hit in the following scenario, if "cc" is
GCC without being a symlink to "gcc":

  1. ccache cc -c example.c                      # adds a cache entry
  2. ccache cc -c example.c -fcolor-diagnostics  # unexpectedly succeeds

(Most major Linux distributions install cc as a symlink to gcc, and then
the problem doesn't show up since ccache then is able to guess that the
compiler is GCC.)

This bug was introduced by [1] which tried to make yet another tweak of
the color diagnostics guessing/probing by no longer rejecting
-fcolor-diagnostics for an unknown compiler, based on the assumption
that the probing call (speculatively adding -fdiagnostics-color) is only
made when we have guessed a GCC compiler. Unfortunately, this broke the
fix in [2] when the compiler is unknown.

All of this is inherently brittle and I don't see any good way to make
it better with the current compiler guessing approach and adding options
speculatively. The cure is to start doing proper compiler identification
instead (#958). Until that is done, the only reasonable fix is to avoid
doing anything related to color diagnostics flags when the compiler is
unknown. This means that an unknown compiler from now on won't produce
colors when used via ccache even if the compiler actually is GCC or
Clang.

[1]: 97a40af49f56e4be2db5e4318d8131e937bd5598
[2]: 61ce8c44c5b1da0be7a8d10c014f1a85b7967433

Closes #1116.

3 years agofeat: Add support for GCC -fprofile-abs-path option
Joel Rosdahl [Sun, 17 Jul 2022 11:43:22 +0000 (13:43 +0200)] 
feat: Add support for GCC -fprofile-abs-path option

Note: -fprofile-abs-path makes the compiler include absolute paths based
on actual CWD in the .gcno file. We therefore need to include the actual
CWD in the hash in order not to get false positive cache hits. To opt
out of this, set "gcno_cwd" sloppiness.

Closes #1060.

3 years agorefactor: Improve formatting of test_lockfile.cpp
Joel Rosdahl [Fri, 8 Jul 2022 10:53:30 +0000 (12:53 +0200)] 
refactor: Improve formatting of test_lockfile.cpp

3 years agotest: Simplify secondary_redis_unix tests
Joel Rosdahl [Thu, 7 Jul 2022 10:32:57 +0000 (12:32 +0200)] 
test: Simplify secondary_redis_unix tests

3 years agochore: Improve Redis log and exception message
Joel Rosdahl [Thu, 7 Jul 2022 10:32:26 +0000 (12:32 +0200)] 
chore: Improve Redis log and exception message

3 years agorefactor: Simplify Redis URL parameter parsing
Joel Rosdahl [Thu, 7 Jul 2022 10:31:58 +0000 (12:31 +0200)] 
refactor: Simplify Redis URL parameter parsing

3 years agodoc: Improve description of Redis URLs
Joel Rosdahl [Thu, 7 Jul 2022 10:31:19 +0000 (12:31 +0200)] 
doc: Improve description of Redis URLs

3 years agofix: Handle more cases of invalid secondary storage URLs
Joel Rosdahl [Thu, 7 Jul 2022 10:25:57 +0000 (12:25 +0200)] 
fix: Handle more cases of invalid secondary storage URLs

3 years agofeat: Support Redis over unix socket (#1064)
Anders Björklund [Tue, 5 Jul 2022 21:01:01 +0000 (23:01 +0200)] 
feat: Support Redis over unix socket (#1064)

3 years agobuild: Fix FTBFS with not yet released GCC 13
Joel Rosdahl [Tue, 5 Jul 2022 19:42:58 +0000 (21:42 +0200)] 
build: Fix FTBFS with not yet released GCC 13

Reference: https://gcc.gnu.org/gcc-13/porting_to.html#header-dep-changes

Fixes #1105.

3 years agofix: Don't display max size in ccache -s if it's 0 (= unlimited)
Joel Rosdahl [Tue, 5 Jul 2022 19:33:26 +0000 (21:33 +0200)] 
fix: Don't display max size in ccache -s if it's 0 (= unlimited)

3 years agoenhance: Improve lock file implementation
Joel Rosdahl [Tue, 5 Jul 2022 18:04:25 +0000 (20:04 +0200)] 
enhance: Improve lock file implementation

This commit improves brings two improvements to the lock file
implementation:

1. Support for long-lived locks.
2. Support for non-blocking lock acquisition.

There are now two types of lock file classes: ShortLivedLockFile and
LongLivedLockFile. On Windows the implementations are identical. On
other systems, LongLivedLockFile creates a separate "alive file" whose
mtime will be updated regularly by a helper thread until the lock is
released. This makes it possible for another process to wait for the
lock indefinitely but also to know then a lock is stale and can be
broken. The ShortLivedLockFile class works like the lock file class used
to work before: it considers a lock stale after waiting for two seconds
and noticing that the symlink target has not changed during that time.
ShortLivedLockFile is to be used when the lock is expected to be held
for a very short time so that it's a waste of resources to start a
helper thread to keep the lock alive.

On some systems it would be possible to update mtime of the symlink
itself instead of a separate file, but that does not seem to be portable
enough.

Also worth mentioning is that the reason to not use proper fcntl/flock
locks on non-Windows systems is to continue supporting a cache directory
on NFS since file locks on NFS don't have a good track record.

3 years agotest: Add program for manually testing the lock file implementation
Joel Rosdahl [Sun, 3 Jul 2022 09:48:14 +0000 (11:48 +0200)] 
test: Add program for manually testing the lock file implementation

3 years agoenhance: Fall back to utimes(2) if utimensat(2) is unavailable
Joel Rosdahl [Sat, 2 Jul 2022 09:26:28 +0000 (11:26 +0200)] 
enhance: Fall back to utimes(2) if utimensat(2) is unavailable

3 years agofix: Remove AsciiDoc markup from help text of --trim-dir
Joel Rosdahl [Mon, 4 Jul 2022 18:58:02 +0000 (20:58 +0200)] 
fix: Remove AsciiDoc markup from help text of --trim-dir

3 years agofeat: Let -s/--show-stats show cleanups counter with verbosity 2
Joel Rosdahl [Mon, 4 Jul 2022 18:55:55 +0000 (20:55 +0200)] 
feat: Let -s/--show-stats show cleanups counter with verbosity 2

3 years agobump: Upgrade to nonstd::expected 0.6.1
Joel Rosdahl [Wed, 29 Jun 2022 18:12:42 +0000 (20:12 +0200)] 
bump: Upgrade to nonstd::expected 0.6.1

3 years agofeat: Add support for Intel compiler on Windows (#1100)
Daniel Richtmann [Wed, 29 Jun 2022 18:08:31 +0000 (20:08 +0200)] 
feat: Add support for Intel compiler on Windows (#1100)

3 years agorefactor: Remove now unneeded defines of nodiscard and maybe_unused
Joel Rosdahl [Sun, 19 Jun 2022 12:26:19 +0000 (14:26 +0200)] 
refactor: Remove now unneeded defines of nodiscard and maybe_unused

3 years agorefactor: Use [[fallthrough]] attribute
Joel Rosdahl [Sun, 19 Jun 2022 12:24:50 +0000 (14:24 +0200)] 
refactor: Use [[fallthrough]] attribute

3 years agorefactor: Use structured binding declarations
Joel Rosdahl [Sun, 19 Jun 2022 11:52:56 +0000 (13:52 +0200)] 
refactor: Use structured binding declarations

3 years agorefactor: Use uppercase literal suffixes
Joel Rosdahl [Sun, 19 Jun 2022 11:26:11 +0000 (13:26 +0200)] 
refactor: Use uppercase literal suffixes

Clang-Analyzer prefers it that way.

3 years agorefactor: Remove some now unnecessary static_assert messages
Joel Rosdahl [Sun, 19 Jun 2022 08:11:28 +0000 (10:11 +0200)] 
refactor: Remove some now unnecessary static_assert messages

3 years agorefactor: Use std::clamp
Joel Rosdahl [Sun, 19 Jun 2022 08:09:45 +0000 (10:09 +0200)] 
refactor: Use std::clamp

3 years agoci: Run CodeQL on Ubuntu 20.04
Joel Rosdahl [Sun, 19 Jun 2022 19:00:16 +0000 (21:00 +0200)] 
ci: Run CodeQL on Ubuntu 20.04

3 years agofix: Use a cleanup stamp instead of directory timestamp for cleanup
Joel Rosdahl [Sat, 18 Jun 2022 18:08:10 +0000 (20:08 +0200)] 
fix: Use a cleanup stamp instead of directory timestamp for cleanup

In order to know when to clean up the temporary directory, ccache checks
mtime of $CCACHE_DIR and updates it to "now" on cleanup. This doesn't
work well when the configuration file is modified often since that also
updates the same mtime.

Fix this by using a separate cleanup stamp file instead.

3 years agofix: Clean up temporary dir if it's left the default
Joel Rosdahl [Sat, 18 Jun 2022 17:55:02 +0000 (19:55 +0200)] 
fix: Clean up temporary dir if it's left the default

Cleanup of the temporary directory is done if it is $CCACHE_DIR/tmp,
which used to be the default until [1] where the default was changed to
/run/user/$UID/ccache-tmp. Improve this so that cleanup happens if the
temporary directory is equal to the default regardless of the default.

[1]: 213d9883a0c3944749f8512eeb784d8572ad8d91

3 years agobump: Upgrade to doctest 2.4.9
Joel Rosdahl [Sat, 18 Jun 2022 17:11:23 +0000 (19:11 +0200)] 
bump: Upgrade to doctest 2.4.9

3 years agodocs: Mention that mtime is used for LRU cleanup
Joel Rosdahl [Sat, 11 Jun 2022 18:11:50 +0000 (20:11 +0200)] 
docs: Mention that mtime is used for LRU cleanup

Closes #1095.

3 years agochore: Fix typo in comment about MSVC object files
Joel Rosdahl [Sat, 11 Jun 2022 17:50:53 +0000 (19:50 +0200)] 
chore: Fix typo in comment about MSVC object files

3 years agobuild: Fix build with newer MSVC 2022 versions (#1093)
Sergey Semushin [Sat, 11 Jun 2022 17:42:35 +0000 (20:42 +0300)] 
build: Fix build with newer MSVC 2022 versions (#1093)

3 years agofeat: Include timestamp in per-object debug filenames
Joel Rosdahl [Sat, 11 Jun 2022 12:13:02 +0000 (14:13 +0200)] 
feat: Include timestamp in per-object debug filenames

Including a timestamp in the filenames makes it easier to compare two
builds without having to save previous debug files before the second
build. It also makes sure debug files won't be overwritten if an object
file is compiled several times during one build.

3 years agotest: Avoid warning when running inode_cache in isolation
Joel Rosdahl [Sat, 11 Jun 2022 12:06:28 +0000 (14:06 +0200)] 
test: Avoid warning when running inode_cache in isolation

3 years agochore: Fix spelling
Joel Rosdahl [Fri, 10 Jun 2022 18:04:30 +0000 (20:04 +0200)] 
chore: Fix spelling

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