]> git.ipfire.org Git - thirdparty/ccache.git/log
thirdparty/ccache.git
4 years agoImprove speed of compiler launcher command in UseCcache.cmake
Joel Rosdahl [Sat, 30 Jan 2021 18:17:33 +0000 (19:17 +0100)] 
Improve speed of compiler launcher command in UseCcache.cmake

I noticed that the overhead of “cmake -E env” is around 9 ms on my
system. This means that ccache direct mode hits on average have become
twice as slow when building ccache itself on my system.

Improve this by using the standard “env” program if available. Its
overhead is around 1 ms.

4 years agoUse snake case for CMake variable names
Joel Rosdahl [Sat, 30 Jan 2021 18:15:08 +0000 (19:15 +0100)] 
Use snake case for CMake variable names

4 years agoImprove emoji for questions/discussions in GitHub issue type list
Joel Rosdahl [Sat, 30 Jan 2021 13:36:46 +0000 (14:36 +0100)] 
Improve emoji for questions/discussions in GitHub issue type list

4 years agoUpdate authors
Joel Rosdahl [Sat, 30 Jan 2021 12:52:30 +0000 (13:52 +0100)] 
Update authors

4 years agoAdd Ka Ho Ng to .mailmap
Joel Rosdahl [Sat, 30 Jan 2021 12:51:24 +0000 (13:51 +0100)] 
Add Ka Ho Ng to .mailmap

4 years agoDisable inode cache on OSes without pthread_mutexattr_setpshared() (#791)
Stuart Henderson [Mon, 25 Jan 2021 18:41:54 +0000 (18:41 +0000)] 
Disable inode cache on OSes without pthread_mutexattr_setpshared() (#791)

The inode cache requires pthread_mutexattr_setpshared() and build fails on OSes
with sys/mman.h that do not have this function.

4 years agoCI: Skip homebrew update/cleanup on macOS (#790)
Nicholas Hutchinson [Mon, 25 Jan 2021 18:37:54 +0000 (18:37 +0000)] 
CI: Skip homebrew update/cleanup on macOS (#790)

The auto cleanup step that runs after `brew install` can can often add a
few minutes to each macOS CI run.

4 years agotests: Improve COFF object file comparison (#789)
Nicholas Hutchinson [Mon, 25 Jan 2021 18:37:07 +0000 (18:37 +0000)] 
tests: Improve COFF object file comparison (#789)

Make `is_equal_object_files` more lenient when comparing COFF object
files.

COFF object files contain the original source file name, which was
breaking the cpp1 test. They often contain a timestamp used by the
incremental linker, unless this is explicitly disabled via `/Brepro`
(MSVC) or `-mno-incremental-linker-compatible` (clang).

4 years agoFix fast linker selection for old GCC versions (#788)
Alexander Lanin [Mon, 25 Jan 2021 06:51:10 +0000 (07:51 +0100)] 
Fix fast linker selection for old GCC versions (#788)

4 years agoBlake3 build (#781)
Erik Flodin [Tue, 19 Jan 2021 20:33:25 +0000 (21:33 +0100)] 
Blake3 build (#781)

* Build the blake3 asm files to determine if they are supported

Building the files doesn't take long and gives a better result than just
checking that the assembler accepts a flag.

See also #768.

* Remove no longer used cmake function

* Update BLAKE3 to 3a8204f5f (0.3.7 + minor fixes) and include all MSVC asm files

* Try to improve blake3 on MSVC by using asm version

4 years agoTest suite fixes and improvements for Windows (#780)
Nicholas Hutchinson [Tue, 19 Jan 2021 20:27:00 +0000 (20:27 +0000)] 
Test suite fixes and improvements for Windows (#780)

* Tests: properly handle compiler arguments from CC environment variable

* Tests: don't pass test names directly to printf

In some cases test names would be interpreted as invalid arguments to
`printf` instead of a string to be printed, and this resulted in
confusing output on test failure.

* Tests: enable symlink support on Windows

git-bash's `ln -s` defaults to making a copy instead of making a symlink
for compatibility, but it is possible to ask for native Windows symlink
support instead.

Creating symlinks on Windows requires suitable permissions, or that
"Developer Mode" is enabled. (This is true for the Github Actions
Windows runners.)

* Tests: performance fixes for Windows

On Windows, git-bash's emulation of fork/exec is exteremely slow -- on
my machine it's typically around 30ms to spawn /usr/bin/true from a bash
script compared to 2ms on my macOS machine.

This is really noticeable when running ccache tests. This patch fixes
some of the hot code (i.e. code invoked for every test case) to avoid
spawning external commands or creating as many subshells.

* Tests: get more tests passing on Windows

- account for \r\n line endings in --version test
- skip tests that can never succeed on Windows

4 years agoRefer people to discussions for support
Joel Rosdahl [Tue, 19 Jan 2021 18:54:54 +0000 (19:54 +0100)] 
Refer people to discussions for support

4 years agoAdd emojis to issue types
Joel Rosdahl [Tue, 19 Jan 2021 18:53:22 +0000 (19:53 +0100)] 
Add emojis to issue types

4 years agorefactor: Drop out parameter from get_level_1_files (#779)
Alexander Lanin [Tue, 19 Jan 2021 18:18:52 +0000 (19:18 +0100)] 
refactor: Drop out parameter from get_level_1_files (#779)

4 years agoExtract enums into separate headers (#764)
Alexander Lanin [Tue, 19 Jan 2021 07:38:06 +0000 (08:38 +0100)] 
Extract enums into separate headers (#764)

4 years agoFaster compile times (#759)
Alexander Lanin [Sun, 17 Jan 2021 16:17:11 +0000 (17:17 +0100)] 
Faster compile times (#759)

4 years agoDon’t cache result if a preprocessed header file is too new
Joel Rosdahl [Sun, 17 Jan 2021 12:07:01 +0000 (13:07 +0100)] 
Don’t cache result if a preprocessed header file is too new

Unless sloppiness is set to ignore mtime/ctime, ccache classifies a
newly created header file as “too new” and then skips it in
do_remember_include_file and returns false, which makes
remember_include_file disable the direct mode. This works as intended
for normal header files whose content is included in the preprocessed
output. However, for a preprocessed header file this doesn’t work well
since its content then isn’t included in the hash, which can lead to
false positive cache hits.

Fix this by not caching the result if a preprocessed header file is too
new, i.e. increment the “can’t use preprocessed header” statistics
counter and fall back to just running the compiler.

Closes #774.

4 years agoExtract helper function include_file_too_new
Joel Rosdahl [Sun, 17 Jan 2021 10:07:04 +0000 (11:07 +0100)] 
Extract helper function include_file_too_new

4 years agoMove variable closer to usage in do_remember_include_file
Joel Rosdahl [Sun, 17 Jan 2021 09:27:50 +0000 (10:27 +0100)] 
Move variable closer to usage in do_remember_include_file

4 years agoSupport source code language “cuda”, used by Clang
Joel Rosdahl [Sat, 16 Jan 2021 19:09:03 +0000 (20:09 +0100)] 
Support source code language “cuda”, used by Clang

See also 2728c68bba9f8b4bb5c8812cd1b50402b81ebfd9.

Closes #772.

4 years agoAdd supported_source_extension function
Joel Rosdahl [Sat, 16 Jan 2021 19:05:35 +0000 (20:05 +0100)] 
Add supported_source_extension function

4 years agoRemove trailing spaces
Joel Rosdahl [Sat, 16 Jan 2021 19:05:14 +0000 (20:05 +0100)] 
Remove trailing spaces

4 years agoRemove superfluous file_language member from ArgumentProcessingState
Joel Rosdahl [Sat, 16 Jan 2021 18:09:10 +0000 (19:09 +0100)] 
Remove superfluous file_language member from ArgumentProcessingState

4 years agodoc: Mention that ccache requires the “-c” option
Joel Rosdahl [Sat, 16 Jan 2021 18:08:09 +0000 (19:08 +0100)] 
doc: Mention that ccache requires the “-c” option

4 years agodoc/MANUAL.adoc: Don't use non-ASCII quotes (#761)
Sergei Trofimovich [Mon, 11 Jan 2021 20:17:47 +0000 (20:17 +0000)] 
doc/MANUAL.adoc: Don't use non-ASCII quotes (#761)

Some locales like "LANG=fr_FR.iso885915@euro make" can't
handle UTF-8 single- and double-quotes:

$ LANG=fr_FR.iso885915@euro make
...
asciidoc: FAILED: MANUAL.adoc: line 529: unexpected error:
...
  File "/usr/lib/python3.8/encodings/iso8859_15.py", line 19, in encode
    return codecs.charmap_encode(input,self.errors,encoding_table)[0]
UnicodeEncodeError: 'charmap' codec can't encode character '\u201c'
  in position 54: character maps to <undefined>

To avoid it the patch uses ASCII equivalents of symbols.

The patch is generated as:

$ sed \
    -e 's/\xE2\x80\x99/'\''/g' \
    -e 's/\xE2\x80\x9C/'\`\`'/g' \
    -e 's/\xE2\x80\x9D/'\'\''/g' \
    -i doc/MANUAL.adoc

Reported-by: Christophe PEREZ
Bug: https://bugs.gentoo.org/762814
Signed-off-by: Sergei Trofimovich <slyfox@gentoo.org>
4 years agoFix YAML syntax in codeql-analysis.yaml after #746
Joel Rosdahl [Sun, 10 Jan 2021 21:09:23 +0000 (22:09 +0100)] 
Fix YAML syntax in codeql-analysis.yaml after #746

4 years agoAdd CodeQL (#746)
Alexander Lanin [Sun, 10 Jan 2021 21:07:09 +0000 (22:07 +0100)] 
Add CodeQL (#746)

4 years agoFix Lockfile on Windows when parent directories do not exist (#769)
Nicholas Hutchinson [Sun, 10 Jan 2021 21:05:00 +0000 (21:05 +0000)] 
Fix Lockfile on Windows when parent directories do not exist (#769)

Fix flipped condition test that meant the file lock wouldn't be acquired
if parent directories needed to be created.

4 years agoUse static_cast
Joel Rosdahl [Sun, 10 Jan 2021 20:51:15 +0000 (21:51 +0100)] 
Use static_cast

4 years agoCI: Fix testdir upload file name in case of failed tests (#763)
Alexander Lanin [Sun, 10 Jan 2021 20:44:51 +0000 (21:44 +0100)] 
CI: Fix testdir upload file name in case of failed tests (#763)

4 years agoAlways use 64bit to print time_t (#762)
Khem Raj [Sun, 10 Jan 2021 20:43:47 +0000 (12:43 -0800)] 
Always use 64bit to print time_t (#762)

some 32bit architectures e.g. RISCV32 use 64bit time_t from beginning
which does not fit into long int size on LP32 systems

Signed-off-by: Khem Raj <raj.khem@gmail.com>
4 years agoTweak documentation and code related to SOURCE_DATE_EPOCH
Joel Rosdahl [Sat, 9 Jan 2021 18:52:08 +0000 (19:52 +0100)] 
Tweak documentation and code related to SOURCE_DATE_EPOCH

4 years agoIgnore SOURCE_DATE_EPOCH under time_macros sloppiness (#755)
Azat Khuzhin [Sat, 9 Jan 2021 18:44:30 +0000 (21:44 +0300)] 
Ignore SOURCE_DATE_EPOCH under time_macros sloppiness (#755)

SOURCE_DATE_EPOCH will be passed from debhelpers, by extracting last
entry from d/changelog (or current time if there is entries)
And this will not allow to use cache.

4 years agoFix scanning of headers with Clang-Tidy (#758)
Alexander Lanin [Wed, 6 Jan 2021 20:50:41 +0000 (21:50 +0100)] 
Fix scanning of headers with Clang-Tidy (#758)

By adding . as an include directory, CMake actually took it literally and files
are included from e.g. src/./AtomicFile.h. However in .clang-tidy headers with
an additional slash (headers from subdirectory third_party) are excluded from
reports.

This commit:

- gets rid of include via .
- fixes some warnings
- disables the rest

4 years agoSuppress Clang-Tidy warning about including signal.h
Joel Rosdahl [Wed, 6 Jan 2021 20:29:37 +0000 (21:29 +0100)] 
Suppress Clang-Tidy warning about including signal.h

sigaddset and similar functions are specified by POSIX to be in signal.h
and the C++ csignal header only contains a subset of the signal.h
declarations.

Related to PR #758.

4 years agoImprove header inclusion for SignalHandler
Joel Rosdahl [Wed, 6 Jan 2021 19:23:40 +0000 (20:23 +0100)] 
Improve header inclusion for SignalHandler

4 years agoUpgrade to optional-lite 3.4.0
Joel Rosdahl [Wed, 6 Jan 2021 19:13:38 +0000 (20:13 +0100)] 
Upgrade to optional-lite 3.4.0

4 years agoUpgrade to fmt 7.1.3
Joel Rosdahl [Wed, 6 Jan 2021 19:05:47 +0000 (20:05 +0100)] 
Upgrade to fmt 7.1.3

4 years agoUpgrade to doctest 2.4.4
Joel Rosdahl [Wed, 6 Jan 2021 19:01:34 +0000 (20:01 +0100)] 
Upgrade to doctest 2.4.4

Version 2.4.4 includes the fix in PR #743 for issue #731.

4 years agoUpgrade to zstd 1.4.8
Joel Rosdahl [Wed, 6 Jan 2021 18:59:27 +0000 (19:59 +0100)] 
Upgrade to zstd 1.4.8

4 years agoAdapt to the ccache code style
Joel Rosdahl [Thu, 31 Dec 2020 18:57:26 +0000 (19:57 +0100)] 
Adapt to the ccache code style

4 years agoTweak build.yaml
Joel Rosdahl [Wed, 6 Jan 2021 18:54:53 +0000 (19:54 +0100)] 
Tweak build.yaml

4 years agoCI: Add VS2019 build jobs (#757)
Nicholas Hutchinson [Wed, 6 Jan 2021 18:53:16 +0000 (18:53 +0000)] 
CI: Add VS2019 build jobs (#757)

Add VS2019 build jobs that use clang for the test suite. There are many
test failures on Windows, but these are ignored for now.

Tweak CMake build scripts:
- Fix CI build type handling for MSVC (recognise `/NDEBUG` and not just
  `-DNDEBUG`)
- Fix incorrect warnings-as-errors flag for MSVC
- Suppress an additional conversion warning on MSVC

4 years agoAdd debug_dir setting for specifying a directory for debug files
Joel Rosdahl [Mon, 4 Jan 2021 13:30:32 +0000 (14:30 +0100)] 
Add debug_dir setting for specifying a directory for debug files

This makes it possible to store debug files outside a transient build
directory. As a bonus, it also allows for getting debug files when the
object file is /dev/null.

4 years agoRemove redundant initialization of std::string variables
Joel Rosdahl [Mon, 4 Jan 2021 12:55:13 +0000 (13:55 +0100)] 
Remove redundant initialization of std::string variables

4 years agoMake Util::make_relative_path able to find matches for canonical path (#760)
Joel Rosdahl [Wed, 6 Jan 2021 18:23:03 +0000 (19:23 +0100)] 
Make Util::make_relative_path able to find matches for canonical path (#760)

Scenario:

- /tmp is a symlink to /private/tmp.
- Both apparent and actual CWD is /private/tmp/dir.
- A path (e.g. the object file) on the command line is /tmp/dir/file.o.
- Base directory is set up to match /tmp/dir/file.o.

Ccache then rewrites /tmp/dir/file.o into ../../private/tmp/dir/file.o,
which is correct but not optimal since ./file.o would be a better
relative path. Especially on macOS where, for unknown reasons, the
kernel sometimes disallows opening a file like
../../private/tmp/dir/file.o for writing.

Improve this by letting Util::make_relative_path try to match
real_path(path) against the CWDs and choose the best match.

Closes #724.

4 years agoAdd hint on how to link statically with libzstd
Joel Rosdahl [Wed, 6 Jan 2021 17:49:10 +0000 (18:49 +0100)] 
Add hint on how to link statically with libzstd

As mentioned in #750.

4 years agoConfigure nonstd::string_view to don’t fall back to std::string_view
Joel Rosdahl [Sun, 3 Jan 2021 14:43:50 +0000 (15:43 +0100)] 
Configure nonstd::string_view to don’t fall back to std::string_view

This makes the code base use nonstd::string regardless of the C++ target
version, which avoids some compatibilty issues.

This decision can be revisited in the future when C++17 is the lower
bar.

Closes #749.

4 years agoDon’t capture “this” implicitly
Joel Rosdahl [Sun, 3 Jan 2021 14:33:24 +0000 (15:33 +0100)] 
Don’t capture “this” implicitly

This avoids an “implicit capture of 'this' via '[=]' is deprecated”
warning when building for C++20 and does no harm for earlier versions.

4 years agoFix retrieval of object file when destination is /dev/null
Joel Rosdahl [Sun, 3 Jan 2021 12:39:57 +0000 (13:39 +0100)] 
Fix retrieval of object file when destination is /dev/null

ResultRetriever::on_entry_data assumes that a destination file has been
opened if the entry type is not stderr_output, but that’s incorrect
since on_entry_start doesn’t open a destination file if it’s /dev/null.
An assertion is triggered:

    ccache: ResultRetriever.cpp:129: virtual void
    ResultRetriever::on_entry_data(const uint8_t *, size_t): failed
    assertion: (m_dest_file_type == FileType::stderr_output &&
    !m_dest_fd) || (m_dest_file_type != FileType::stderr_output &&
    m_dest_fd)

Fix this by letting on_entry_data handle the “destination file not
opened” case and correcting the assert.

Fixes #752.

4 years agoImprove log messages and comments related to retrieving results
Joel Rosdahl [Sun, 3 Jan 2021 12:31:15 +0000 (13:31 +0100)] 
Improve log messages and comments related to retrieving results

4 years agoImprove log message when manifest entry already exists
Joel Rosdahl [Sun, 3 Jan 2021 12:04:58 +0000 (13:04 +0100)] 
Improve log message when manifest entry already exists

4 years agoCapitalize log message with inode cache statistics
Joel Rosdahl [Sun, 3 Jan 2021 11:55:00 +0000 (12:55 +0100)] 
Capitalize log message with inode cache statistics

4 years agoDeduce split dwarf filename from object file with zero or multiple dots
Joel Rosdahl [Sun, 3 Jan 2021 10:44:06 +0000 (11:44 +0100)] 
Deduce split dwarf filename from object file with zero or multiple dots

(cherry picked from commit 5bcba58358ef2e88e1cc910583830c6830f6c712)

4 years agoOnly accept -f(no-)color-diagnostics for Clang
Joel Rosdahl [Wed, 30 Dec 2020 20:22:26 +0000 (21:22 +0100)] 
Only accept -f(no-)color-diagnostics for Clang

If a non-Clang compiler gets -f(no-)color-diagnostics then bail out and
just execute the compiler. The reason is that we don't include
-f(no-)color-diagnostics in the hash so there can be a false cache hit
in the following scenario:

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

Closes: #740.
4 years agoRemove obsolete (and now incorrect) fallback replacement of realpath(3)
Joel Rosdahl [Tue, 29 Dec 2020 18:33:54 +0000 (19:33 +0100)] 
Remove obsolete (and now incorrect) fallback replacement of realpath(3)

The fallback replacement of realpath(3) (from 8e918ccc) uses readlink(3)
under the assumption that we’re only interested about symlinks, but
that’s no longer the case: we’re using it for normalization purposes as
well. Let’s just remove it. If it turns out that there still are
non-Windows systems that don’t have realpath(3) and that we care about
we’ll figure out something else.

4 years agoFix Util::dir_name for Windows paths
Joel Rosdahl [Tue, 29 Dec 2020 18:06:17 +0000 (19:06 +0100)] 
Fix Util::dir_name for Windows paths

Util::dir_name does not understand “C:\”-style Windows path so add such
knowledge.

4 years agoAdd simple unit test of Util::make_relative_path
Joel Rosdahl [Mon, 28 Dec 2020 19:46:06 +0000 (20:46 +0100)] 
Add simple unit test of Util::make_relative_path

4 years agoFix running tests on macOS (#756)
Nicholas Hutchinson [Mon, 28 Dec 2020 14:25:12 +0000 (14:25 +0000)] 
Fix running tests on macOS (#756)

Bash tests were not actually being run on the macOS CI agents because
the version of sed installed there does not understand the `-r` flag:

    sed: illegal option -- r
    usage: sed script [-Ealn] [-i extension] [file ...]
           sed [-Ealn] [-i extension] [-e script] ... [-f script_file] ... [file ...]

- use `sed -E` instead of `sed -r` as the latter isn't supported by BSD sed.

- export `SDKROOT` in `test/run`. Otherwise it appears at least some
  some Apple toolchains (e.g. Xcode 10.3) will pick the _latest_ SDK
  installed on the host (e.g.
  `/Library/Developer/CommandLineTools/SDKs/MacOSX10.15.sdk`)
  instead of using the SDK bundled with the toolchain (e.g.
  `/Applications/Xcode_10.3.app/.../MacOSX10.14.sdk`).

  The 10.15 SDK is not compatible with Xcode 10.3:

    ld: unsupported tapi file type '!tapi-tbd' in YAML file
    '/Library/Developer/CommandLineTools/SDKs/MacOSX10.15.sdk/usr/lib/libSystem.tbd'
    for architecture x86_64
    clang: error: linker command failed with exit code 1

4 years agoImprove TemporaryFile implementation for Windows (#736)
Nicholas Hutchinson [Mon, 28 Dec 2020 14:22:40 +0000 (14:22 +0000)] 
Improve TemporaryFile implementation for Windows (#736)

On Windows, multiple ccache process could race each other to create,
rename and delete temporary files, because they would attempt to
generate the same sequence of temporary file names
(`tmp.cpp_stdout.iG2Kb7`, `tmp.cpp_stdout.P1kAlM`,
`tmp.cpp_stdout.FzP5tM`, ...).

This is because ccache used mingw-w64's [implementation of mkstemp][1],
which uses `rand()` to generate temporary file names, and ccache was
never seeding the thread-local PRNG used by `rand()`.

Replace ccache's use of `mkstemp()` on Windows with an implementation
based on OpenBSD. This allows us to sidestep mingw-w64's problematic
implementation, and allows us to build using MSVC again. (MSVC's C
standard library does not provide `mkstemp()`.)

Example errors:

- Some ccache process is in the process of deleting a temporary file:

      ccache: error: Failed to create temporary file for C:\Users\someuser/.ccache/tmp/tmp.cpp_stdout.FzP5tM: Access is denied.

- Some ccache process has destination file open, so it can't be overwritten:

      ccache: error: failed to rename C:\Users\someuser/.ccache/tmp/tmp.cpp_stdout.iG2Kb7 to C:\Users\someuser/.ccache/tmp/tmp.cpp_stdout.iG2Kb7.ii: Access is denied.

- Source file has been deleted by some other ccache process:

      ccache: error: failed to rename C:\Users\someuser/.ccache/tmp/tmp.cpp_stdout.P1kAlM to C:\Users\someuser/.ccache/tmp/tmp.cpp_stdout.P1kAlM.ii: The system cannot find the file specified.

[1]: https://github.com/mirror/mingw-w64/blob/v8.0.0/mingw-w64-crt/misc/mkstemp.c

4 years agoTweak markdown formatting
Joel Rosdahl [Sun, 27 Dec 2020 15:22:39 +0000 (16:22 +0100)] 
Tweak markdown formatting

4 years agoRephrase hint about C-style code left in the code base
Joel Rosdahl [Sun, 27 Dec 2020 15:22:22 +0000 (16:22 +0100)] 
Rephrase hint about C-style code left in the code base

4 years agoRemove “Support” issue template
Joel Rosdahl [Sun, 27 Dec 2020 15:21:37 +0000 (16:21 +0100)] 
Remove “Support” issue template

GitHub Discussions is preferred now.

4 years agoMention GitHub discussions
Joel Rosdahl [Sun, 27 Dec 2020 15:09:14 +0000 (16:09 +0100)] 
Mention GitHub discussions

4 years agoAdd preprocessed file extension to cpp stdout early
Joel Rosdahl [Mon, 21 Dec 2020 18:02:19 +0000 (19:02 +0100)] 
Add preprocessed file extension to cpp stdout early

Unless when compiling a preprocessed file directly, ccache creates a
temporary file to store the output of the preprocessor, registers the
file for removal at program exit, renames the file to one with a .i/.ii
extension and then registers that file for removal as well. This works
by chance in practice as long as mkstemp() returns something with low
probability of being reused, but as discussed in #736 it risks failing
when mkstemp() doesn’t behave that way.

Fix this by creating the new name (with the needed extension) using a
hard link so that the original file will outlive the new file, thus
blocking another ccache process from creating a file with the same name
again. To make the new temporary file outlive the old file, also delete
pending temporary files in LIFO order.

4 years agoAdd Util::hard_link utility function
Joel Rosdahl [Sun, 20 Dec 2020 18:57:42 +0000 (19:57 +0100)] 
Add Util::hard_link utility function

4 years agoGitHub: Ensure apt update is run for all Linux jobs
Nicholas Hutchinson [Sat, 19 Dec 2020 19:52:45 +0000 (19:52 +0000)] 
GitHub: Ensure apt update is run for all Linux jobs

4 years agoAdd missing pragma once (#744)
Erik Flodin [Fri, 11 Dec 2020 18:30:21 +0000 (19:30 +0100)] 
Add missing pragma once (#744)

4 years agoFix building 32bit tests on macOS (#743)
Alexander Lanin [Wed, 9 Dec 2020 20:38:19 +0000 (21:38 +0100)] 
Fix building 32bit tests on macOS (#743)

4 years agoDon’t build with Clang’s -Weverything option
Joel Rosdahl [Wed, 9 Dec 2020 20:01:56 +0000 (21:01 +0100)] 
Don’t build with Clang’s -Weverything option

As discussed in #739.

4 years agoImprove incorrect documentation on what cache_dir does
Joel Rosdahl [Tue, 8 Dec 2020 20:19:19 +0000 (21:19 +0100)] 
Improve incorrect documentation on what cache_dir does

The manual says that cache_dir only takes effect if set by $CCACHE_DIR
or by cache_dir in the secondary (system-wide) configuration file, which
is incorrect. It’s kind of correct for how the primary configuration
file is found, though.

4 years agoImprove SIMD detection (#735)
Erik Flodin [Mon, 7 Dec 2020 18:20:31 +0000 (19:20 +0100)] 
Improve SIMD detection (#735)

* Try to compile code to detect SSE/AVX support. Just checking if the compiler
  supports the flag isn't enough as e.g. Clang on Apple's new ARM silicon seems
  to accept the flag but then fails when building.
* Try to detect and enable BLAKE3's Neon support.
* Improve detection of AVX2 target attribute support and remove the explicit
  compiler version check that hopefully shouldn't be needed.

Fixes #734.

4 years agoFix missing isascii() declaration on FreeBSD (#730)
khng300 [Mon, 7 Dec 2020 07:10:46 +0000 (15:10 +0800)] 
Fix missing isascii() declaration on FreeBSD (#730)

4 years agoImprove mutex handling code structure in InodeCache
Joel Rosdahl [Mon, 7 Dec 2020 06:19:52 +0000 (07:19 +0100)] 
Improve mutex handling code structure in InodeCache

InodeCache’s acquire_bucket and release_bucket functions need to be used
together. There is no problem with this currently, but it’s possible
that one may forget to call release_bucket in some code path in the
future.

Improve this by introducing a single InodeCache::with_bucket function
that makes it impossible to misuse the API. This should also make
thread-safety analysis algorithms, e.g. Clang’s
-Wthread-safety-analysis, happy.

Related to #730.

4 years agoReintroduce dev mode and disable problematic build flags in user mode
Joel Rosdahl [Sat, 5 Dec 2020 18:17:32 +0000 (19:17 +0100)] 
Reintroduce dev mode and disable problematic build flags in user mode

In version 3.x, ccache was in “user mode” when building from release
archive sources and “dev mode” otherwise. In “dev mode”, additional
compiler flags like “-Wextra -Wpedantic -Werror” were added, but they
were not present in “user mode” in order not to break end users’ builds.
This behavior was partially lost in the conversion to CMake.

This commit tries to imitate the previous behavior by introducing a
CCACHE_DEV_MODE CMake variable and only enable potentially problematic
compiler flags when it’s set to ON.

Related to #730.

4 years agoImprove references in the manual
Joel Rosdahl [Sat, 5 Dec 2020 18:04:25 +0000 (19:04 +0100)] 
Improve references in the manual

4 years agoRemove legacy “cheap and nasty” mkstemp replacement
Joel Rosdahl [Thu, 3 Dec 2020 20:46:31 +0000 (21:46 +0100)] 
Remove legacy “cheap and nasty” mkstemp replacement

Hopefully mkstemp is available on all systems we want to support these
days.

As mentioned in #703.

4 years agoImprove documentation of compression levels and -X/--recompress
Joel Rosdahl [Wed, 2 Dec 2020 20:56:05 +0000 (21:56 +0100)] 
Improve documentation of compression levels and -X/--recompress

Related to issue #728.

4 years agoImprove consistency of terms in the manual
Joel Rosdahl [Thu, 26 Nov 2020 21:04:46 +0000 (22:04 +0100)] 
Improve consistency of terms in the manual

4 years agoImprove documentation wording on compiler_check string values
Joel Rosdahl [Thu, 26 Nov 2020 19:52:22 +0000 (20:52 +0100)] 
Improve documentation wording on compiler_check string values

4 years agoEnable Clang 5.0 tests again
Joel Rosdahl [Sun, 22 Nov 2020 20:05:01 +0000 (21:05 +0100)] 
Enable Clang 5.0 tests again

4 years agoMinGW: Default to static linking (#732)
Orgad Shaneh [Sun, 29 Nov 2020 13:15:30 +0000 (15:15 +0200)] 
MinGW: Default to static linking (#732)

The release contains only the executable without the dll dependencies.

It is easier to deploy a single self-contained executable anyway.

Fixes #729.

4 years agoGitHub: Call apt-get update before install (#733)
Orgad Shaneh [Sun, 29 Nov 2020 13:14:18 +0000 (15:14 +0200)] 
GitHub: Call apt-get update before install (#733)

Without update, apt tries to download outdated packages, which possibly
don't exist.

4 years agoAdd missing copyright information to LICENSE.adoc
Joel Rosdahl [Tue, 24 Nov 2020 20:51:27 +0000 (21:51 +0100)] 
Add missing copyright information to LICENSE.adoc

4 years agoUse simple globs in LICENSE.adoc
Joel Rosdahl [Tue, 24 Nov 2020 20:51:03 +0000 (21:51 +0100)] 
Use simple globs in LICENSE.adoc

4 years agoBuild and install HTML documentation by default if possible
Joel Rosdahl [Mon, 23 Nov 2020 19:24:03 +0000 (20:24 +0100)] 
Build and install HTML documentation by default if possible

4 years agoUpdate news v4.1
Joel Rosdahl [Sun, 22 Nov 2020 20:00:22 +0000 (21:00 +0100)] 
Update news

4 years agoUpdate authors
Joel Rosdahl [Sun, 22 Nov 2020 19:11:47 +0000 (20:11 +0100)] 
Update authors

4 years agoFix bug in depfile when output filename includes special characters
Joel Rosdahl [Thu, 19 Nov 2020 20:31:41 +0000 (21:31 +0100)] 
Fix bug in depfile when output filename includes special characters

The rewriting of the dependency file content introduced in 2ab31632 just
replaces the object file part of the dependency file with the raw
filename. This is incorrect if the filename includes special characters
such as space or dollar.

Fix this by escaping the filename properly. Note that newlines are not
treated specially since Make cannot handle them anyway.

See also the similar bug fix for the depend mode (but for parsing
instead of escaping in that case) in 1d2b5bf4.

4 years agoAlign spelling of “nonexistent”
Joel Rosdahl [Thu, 19 Nov 2020 19:47:42 +0000 (20:47 +0100)] 
Align spelling of “nonexistent”

4 years agoExtract code for parsing dependency files into a separate file
Joel Rosdahl [Thu, 19 Nov 2020 19:44:44 +0000 (20:44 +0100)] 
Extract code for parsing dependency files into a separate file

4 years agoFix result_name_from_depfile by parsing depfile in Makefile syntax (#722)
Yoshimasa Niwa [Wed, 18 Nov 2020 20:18:18 +0000 (12:18 -0800)] 
Fix result_name_from_depfile by parsing depfile in Makefile syntax (#722)

4 years agoAdd --config-path option
Joel Rosdahl [Tue, 17 Nov 2020 18:58:37 +0000 (19:58 +0100)] 
Add --config-path option

The option makes subsequent command line options operate on the given
configuration file instead of the default.

Closes #719.

4 years agoMake color_diagnostics and direct test suites work with C++ compilers
Joel Rosdahl [Tue, 17 Nov 2020 18:28:51 +0000 (19:28 +0100)] 
Make color_diagnostics and direct test suites work with C++ compilers

As mentioned in #716.

4 years agoCreate unittest directories in testdir
Joel Rosdahl [Tue, 17 Nov 2020 17:44:58 +0000 (18:44 +0100)] 
Create unittest directories in testdir

See also d575526c91a8e0167a249760d63510e7de67ed23.

4 years agoCache -fsyntax-only result (#685)
Alexander Lanin [Mon, 16 Nov 2020 17:45:44 +0000 (18:45 +0100)] 
Cache -fsyntax-only result (#685)

4 years agoLink with libatomic when needed (#723)
Joel Rosdahl [Thu, 12 Nov 2020 19:40:08 +0000 (20:40 +0100)] 
Link with libatomic when needed (#723)

Linking with libatomic is apparently needed when using <atomic>
functionality with GCC on ARM and PowerPC.

4 years agoBump to Xcode 11.7
Joel Rosdahl [Tue, 10 Nov 2020 18:54:55 +0000 (19:54 +0100)] 
Bump to Xcode 11.7

Xcode 11.0.0 has apparently disappeared from the GitHub build
environment.

4 years agoAdd tip about installing docbook-xml and docbook-xsl on Debian
Joel Rosdahl [Tue, 10 Nov 2020 06:40:07 +0000 (07:40 +0100)] 
Add tip about installing docbook-xml and docbook-xsl on Debian

4 years agoFix conditional compilation of robust mutex code in inode cache
Joel Rosdahl [Mon, 9 Nov 2020 18:35:02 +0000 (19:35 +0100)] 
Fix conditional compilation of robust mutex code in inode cache

213d9883 added code for using a “robust mutex” to be able to recover a
mutex left in an inconsistent state. The code is enabled if the
PTHREAD_MUTEX_ROBUST macro is defined. On all Linux systems I have
tested, PTHREAD_MUTEX_ROBUST is not a macro but an enum value, so the
code is dead.

Fix this by adding a configure-time check whether it’s possible to use
pthread_mutexattr_setrobust(..., PTHREAD_MUTEX_ROBUST).