]> git.ipfire.org Git - thirdparty/ccache.git/log
thirdparty/ccache.git
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.

5 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.

5 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

5 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

5 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

5 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.

5 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.

5 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

5 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

5 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

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

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

5 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.

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

5 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

5 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)

5 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.

5 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.

5 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.

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

5 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.

5 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.

5 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

5 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).

5 years agoImprove config.h comments
Joel Rosdahl [Mon, 9 Nov 2020 18:33:38 +0000 (19:33 +0100)] 
Improve config.h comments

5 years agoSay “define” instead of “define to 1” in config.h
Joel Rosdahl [Mon, 9 Nov 2020 18:30:23 +0000 (19:30 +0100)] 
Say “define” instead of “define to 1” in config.h

Since any defined value is OK for the macros in config.h, let’s not say
that the value needs to be 1.

5 years agoImprove safety of fallback after failed -fdiagnostics-color probe
Joel Rosdahl [Mon, 9 Nov 2020 07:02:40 +0000 (08:02 +0100)] 
Improve safety of fallback after failed -fdiagnostics-color probe

5 years agoAdd possibility of overriding compiler type guess
Joel Rosdahl [Sat, 7 Nov 2020 19:25:10 +0000 (20:25 +0100)] 
Add possibility of overriding compiler type guess

This commit adds a new compiler_type (CCACHE_COMPILERTYPE) configuration
option which makes it possible to force a compiler type, for instance
from a compiler wrapper script not named like a known compiler.

As mentioned in #718.

5 years agoRename GuessedCompiler to CompilerType
Joel Rosdahl [Sat, 7 Nov 2020 18:20:48 +0000 (19:20 +0100)] 
Rename GuessedCompiler to CompilerType

5 years agoFollow symlinks when guessing compiler
Joel Rosdahl [Thu, 5 Nov 2020 20:02:50 +0000 (21:02 +0100)] 
Follow symlinks when guessing compiler

This makes ccache able to guess compiler type “GCC” for a common symlink
chain like this:

    /usr/bin/cc -> /etc/alternatives/cc -> /usr/bin/gcc
    -> gcc-9 -> x86_64-linux-gnu-gcc-9

Closes #718.

5 years agotest: Don’t wait forever for output from script(1)
Joel Rosdahl [Sat, 7 Nov 2020 18:53:23 +0000 (19:53 +0100)] 
test: Don’t wait forever for output from script(1)

5 years agoDon’t add a duplicate manifest entry when recaching
Joel Rosdahl [Sat, 7 Nov 2020 18:07:26 +0000 (19:07 +0100)] 
Don’t add a duplicate manifest entry when recaching

5 years agoRemove superfluous Config::set_limit_multiple method
Joel Rosdahl [Thu, 5 Nov 2020 20:26:50 +0000 (21:26 +0100)] 
Remove superfluous Config::set_limit_multiple method

5 years agoAdd comment about -fcolor-diagnostics and assembler language
Joel Rosdahl [Thu, 5 Nov 2020 12:39:16 +0000 (13:39 +0100)] 
Add comment about -fcolor-diagnostics and assembler language

5 years agoUpgrade to doctest 2.4.1
Joel Rosdahl [Wed, 4 Nov 2020 20:40:37 +0000 (21:40 +0100)] 
Upgrade to doctest 2.4.1

Version 2.4.1 includes the changes in #708 for making doctest buildable
with Clang 3.4.

5 years agoAdd Ubuntu 18.04 Dockerfile
Joel Rosdahl [Wed, 4 Nov 2020 20:40:18 +0000 (21:40 +0100)] 
Add Ubuntu 18.04 Dockerfile

5 years agoAdd docbook-{xml,xsl} packages to Ubuntu environments
Joel Rosdahl [Wed, 4 Nov 2020 20:21:41 +0000 (21:21 +0100)] 
Add docbook-{xml,xsl} packages to Ubuntu environments

Without docbook-xml and docbook-xsl, xsltproc (run by a2x to create the
ccache.1 man page) fetches stuff from the Internet, making man page
generation very slow.

5 years agoRemove now unused Args::contains method
Joel Rosdahl [Wed, 4 Nov 2020 06:28:43 +0000 (07:28 +0100)] 
Remove now unused Args::contains method

It was removed when refactoring 50e8d229.

5 years agoDisable some tests on ancient Clang versions (#693)
Alexander Lanin [Wed, 4 Nov 2020 06:33:08 +0000 (07:33 +0100)] 
Disable some tests on ancient Clang versions (#693)

Co-authored-by: Joel Rosdahl <joel@rosdahl.net>
5 years agoDocument the relation between CCACHE_DIR and -d/--directory
Joel Rosdahl [Tue, 3 Nov 2020 20:25:06 +0000 (21:25 +0100)] 
Document the relation between CCACHE_DIR and -d/--directory

Closes #717.

5 years agodoc: Fix incorrect reference and bad markup
Joel Rosdahl [Tue, 3 Nov 2020 20:16:32 +0000 (21:16 +0100)] 
doc: Fix incorrect reference and bad markup

5 years agoFall back to version "unknown" when Git is not installed (#706)
Alexander Lanin [Tue, 3 Nov 2020 20:13:56 +0000 (21:13 +0100)] 
Fall back to version "unknown" when Git is not installed (#706)

Co-authored-by: Joel Rosdahl <joel@rosdahl.net>
5 years agoRetain given color diagnostics options when forcing colored output
Joel Rosdahl [Mon, 2 Nov 2020 21:09:56 +0000 (22:09 +0100)] 
Retain given color diagnostics options when forcing colored output

ccache currently filters out both -fdiagnostics-color and
-fcolor-diagnostics options when adding -fdiagnostics-color (GCC) or
-fcolor-diagnostics (Clang) to force colored output. The idea in #224
was that only -fdiagnostics-color options should be filtered out when
the compiler is GCC, but -fcolor-diagnostics is also removed, something
which was missed in the code review. This has the unintended side effect
that “ccache gcc -fcolor-diagnostics -c example.c” works since ccache in
effect removes -fcolor-diagnostics in the actual call to the compiler.

The bug can fixed by removing only the compiler-specific options when
forcing colored output, but a more robust method would be to retain all
color diagnostics options as is but exclude them from the input hash.
This commit makes that change and also simplifies the logic for color
diagnostics option handling.

Fixes #711.

5 years agoAdd Args::contains method
Joel Rosdahl [Mon, 2 Nov 2020 21:07:45 +0000 (22:07 +0100)] 
Add Args::contains method

5 years agoAdd Args::erase_last method
Joel Rosdahl [Mon, 2 Nov 2020 06:50:13 +0000 (07:50 +0100)] 
Add Args::erase_last method

5 years agoTweak color_diagnostics.bash code style
Joel Rosdahl [Fri, 30 Oct 2020 13:59:08 +0000 (14:59 +0100)] 
Tweak color_diagnostics.bash code style

5 years agoMinGW: Fix static linkage with libgcc and libstdc++ and make it optional (#712)
Orgad Shaneh [Fri, 30 Oct 2020 09:57:35 +0000 (11:57 +0200)] 
MinGW: Fix static linkage with libgcc and libstdc++ and make it optional (#712)

There is no reason to enable it by default. Looks like it was done for
enabling it to run with wine.

5 years agoDisable some AVX features on old Apple clang versions (#704)
Erik Flodin [Fri, 30 Oct 2020 09:41:58 +0000 (10:41 +0100)] 
Disable some AVX features on old Apple clang versions (#704)

Disable avx2 and avx512 support on some apple clang versions as the compile
fails even though the compiler seems to accept the -m flags that are used to
enable the feature.

See issue #689.

5 years agoClean up CMakeLists.txt
Joel Rosdahl [Fri, 30 Oct 2020 09:28:11 +0000 (10:28 +0100)] 
Clean up CMakeLists.txt

5 years agoBuild and install man page by default (#705)
Erik Flodin [Fri, 30 Oct 2020 09:23:08 +0000 (10:23 +0100)] 
Build and install man page by default (#705)

Fixes #684.

5 years agoRestore original umask after finalize_at_exit
Joel Rosdahl [Wed, 28 Oct 2020 20:26:42 +0000 (21:26 +0100)] 
Restore original umask after finalize_at_exit

If umask (CCACHE_UMASK) has been configured, ccache restores the
original umask before executing external programs so that the configured
umask is only used for files created by ccache itself. After a
refactoring of how flushing of statistics is done
(dd8f65aa5589709ca55bbb782050424a0010e8b8), the original umask is
restored before calling finalize_at_exit. If ccache hasn’t created a
result file (i.e., the result is not a cache miss, for example when
called for linking), finalize_stats_and_trigger_cleanup (called by
finalize_at_exit) chooses a random stats file and implicitly also
creates any missing cache directories. Such cache directories will
therefore be created without applying the configured umask.

Fix this by restoring the original mask after calling finalize_at_exit.

Fixes #710.

5 years agoCI: List all configurations explicitly (#690)
Alexander Lanin [Mon, 26 Oct 2020 21:06:10 +0000 (22:06 +0100)] 
CI: List all configurations explicitly (#690)

5 years agoTweak formulations and fix spelling in CMakeLists.txt
Joel Rosdahl [Fri, 23 Oct 2020 13:40:07 +0000 (15:40 +0200)] 
Tweak formulations and fix spelling in CMakeLists.txt

5 years agoTweak code style
Joel Rosdahl [Fri, 23 Oct 2020 13:13:55 +0000 (15:13 +0200)] 
Tweak code style

5 years agoDetect errors in fmt::format format strings at compile time
Joel Rosdahl [Thu, 22 Oct 2020 17:30:41 +0000 (19:30 +0200)] 
Detect errors in fmt::format format strings at compile time

See also 4413d842e23c6fa52ec411951a4ab442f42227de.

5 years agoDetect errors in fmt::print format strings at compile time
Joel Rosdahl [Thu, 22 Oct 2020 17:12:51 +0000 (19:12 +0200)] 
Detect errors in fmt::print format strings at compile time

See also 4413d842e23c6fa52ec411951a4ab442f42227de.