]> git.ipfire.org Git - thirdparty/ccache.git/log
thirdparty/ccache.git
4 years agoClarify naming conventions for enum and enum class values
Joel Rosdahl [Thu, 3 Sep 2020 11:18:12 +0000 (13:18 +0200)] 
Clarify naming conventions for enum and enum class values

4 years agoFix test errors with GCC 4.4
Joel Rosdahl [Wed, 2 Sep 2020 08:53:45 +0000 (10:53 +0200)] 
Fix test errors with GCC 4.4

4 years agoAdd Visual Studio build directory to .gitignore (#650)
Alexander Lanin [Wed, 2 Sep 2020 08:42:52 +0000 (10:42 +0200)] 
Add Visual Studio build directory to .gitignore (#650)

4 years agoSet _FILE_OFFSET_BITS to 64
Joel Rosdahl [Wed, 2 Sep 2020 07:51:54 +0000 (09:51 +0200)] 
Set _FILE_OFFSET_BITS to 64

This allows for operating on large files when compiled in 32-bit mode.

Fixes #649.

4 years agoAdd clang-format off/on for SIZEOF_INT
Joel Rosdahl [Wed, 2 Sep 2020 07:43:48 +0000 (09:43 +0200)] 
Add clang-format off/on for SIZEOF_INT

4 years agoImprove test cases that use objdump
Joel Rosdahl [Tue, 1 Sep 2020 17:48:24 +0000 (19:48 +0200)] 
Improve test cases that use objdump

- Added expect_objdump_contains and expect_objdump_not_contains utility
  functions to the main test framework, making objdump_cmd and grep_cmd
  (renamed to objdump_grep_cmd) internal utility functions.
- Removed strange support for the $HOST_OS_WINDOWS || $HOST_OS_CYGWIN
  case in objdump_grep_cmd. Let’s re-add it later if and when it becomes
  a problem.
- objdump_grep_cmd now greps for literal strings, thus no longer
  interpreting $PWD as a regex.
- Made test cases use expect_objdump_(not_)contains instead of
  “objdump_grep_cmd | grep_cmd”.

4 years agoImprove error message from expect_(not_)contains
Joel Rosdahl [Tue, 1 Sep 2020 15:10:38 +0000 (17:10 +0200)] 
Improve error message from expect_(not_)contains

4 years agoFix debug_prefix_map failure with old objdump versions
Joel Rosdahl [Tue, 1 Sep 2020 14:51:32 +0000 (16:51 +0200)] 
Fix debug_prefix_map failure with old objdump versions

“objdump -g” does not list debug info like the “Multiple
-fdebug-prefix-map” test expects when using objdump 2.20, e.g. on CentOS
6. “objdump -W” does however work, and it seems to work for object files
with compressed .debug_str section as well.

Related to issue #639.

(cherry picked from commit 3a7257ee23ad7985d18e459b6dbb6990b038df17)

4 years agoClean up inode_cache suite probe code
Joel Rosdahl [Mon, 31 Aug 2020 20:06:19 +0000 (22:06 +0200)] 
Clean up inode_cache suite probe code

4 years agoSkip inode_cache tests if temporary_dir is on NFS (#648)
Deepak Yadav [Mon, 31 Aug 2020 20:04:04 +0000 (01:34 +0530)] 
Skip inode_cache tests if temporary_dir is on NFS (#648)

4 years agoMerge address and UB sanitizer (#647)
Alexander Lanin [Mon, 31 Aug 2020 20:01:22 +0000 (22:01 +0200)] 
Merge address and UB sanitizer (#647)

4 years agoImprove handling of ccache version in the source release archive
Joel Rosdahl [Mon, 31 Aug 2020 08:30:38 +0000 (10:30 +0200)] 
Improve handling of ccache version in the source release archive

The version.cpp file is currently generated in the source directory.
This is a bit unclean since generated files are supposed to be put in
the build directory.

Also, when building from a source release archive outside a Git
repository the CMake scripts still try to get the version from Git and
then emit an ugly warning message:

    fatal: not a git repository (or any of the parent directories): .git
    fatal: not a git repository (or any of the parent directories): .git
    CMake Warning at cmake/GenerateVersionFile.cmake:42 (message):
      Running git failed
    Call Stack (most recent call first):
      cmake/GenerateVersionFile.cmake:50 (get_version_from_git)
      CMakeLists.txt:32 (include)

Fix this by including a VERSION file in the source release archive. If
the VERSION file exists, GenerateVersionFile.cmake just uses the version
from the file and doesn’t try to get a version from Git. If the file
doesn’t exist, the version is looked up from Git like before, but it’s a
fatal error if the version cannot be determined.

4 years agoUse GCC for building packages
Joel Rosdahl [Mon, 31 Aug 2020 07:27:10 +0000 (09:27 +0200)] 
Use GCC for building packages

It’s the standard compiler and still generates the fastest code.

4 years agoUse Ninja when building source and binary packages
Joel Rosdahl [Sun, 30 Aug 2020 19:49:47 +0000 (21:49 +0200)] 
Use Ninja when building source and binary packages

Ninja builds with relative paths so that ccache can be used to cache the
build without resorting to setting base_dir.

4 years agoUse proper names for source and binary packages
Joel Rosdahl [Sun, 30 Aug 2020 18:51:26 +0000 (20:51 +0200)] 
Use proper names for source and binary packages

Source package: ccache-$VERSION.tar.xz (and .tar.gz)
Binary package: ccache-$VERSION-$OS-$PROCESSOR.tar.xz (or .zip)

4 years agoGenerate tar.xz binary packages for non-Windows
Joel Rosdahl [Sun, 30 Aug 2020 18:31:23 +0000 (20:31 +0200)] 
Generate tar.xz binary packages for non-Windows

4 years agoGenerate both tar.gz and tar.xz source packages
Joel Rosdahl [Sun, 30 Aug 2020 18:31:02 +0000 (20:31 +0200)] 
Generate both tar.gz and tar.xz source packages

4 years agoRemove superfluous setting of CPACK_CMAKE_GENERATOR
Joel Rosdahl [Sun, 30 Aug 2020 18:30:06 +0000 (20:30 +0200)] 
Remove superfluous setting of CPACK_CMAKE_GENERATOR

Set CMAKE_GENERATOR if a non-default generator is wanted.

4 years agoRemove superfluous setting of CMAKE_DEBUG_POSTFIX
Joel Rosdahl [Sun, 30 Aug 2020 18:28:11 +0000 (20:28 +0200)] 
Remove superfluous setting of CMAKE_DEBUG_POSTFIX

4 years agoReset environment variables before running test suite probe
Joel Rosdahl [Fri, 28 Aug 2020 15:02:25 +0000 (17:02 +0200)] 
Reset environment variables before running test suite probe

This makes it possible to use $CCACHE in a stable way in probe
functions.

4 years agoRefactor Config::default_temporary_dir
Joel Rosdahl [Fri, 28 Aug 2020 06:14:30 +0000 (08:14 +0200)] 
Refactor Config::default_temporary_dir

4 years agoComment out unused parameter name instead of using [[maybe_unused]]
Joel Rosdahl [Thu, 27 Aug 2020 19:38:38 +0000 (21:38 +0200)] 
Comment out unused parameter name instead of using [[maybe_unused]]

I think that it makes the code look cleaner if the parameter is
definitely unused.

4 years agoTreat Clang-Format discrepancies as errors
Joel Rosdahl [Fri, 28 Aug 2020 06:08:33 +0000 (08:08 +0200)] 
Treat Clang-Format discrepancies as errors

If it becomes too tedious for drive-by contributors we’ll disable it
again.

4 years agoFix code formatting
Joel Rosdahl [Fri, 28 Aug 2020 06:07:58 +0000 (08:07 +0200)] 
Fix code formatting

4 years agoSupport building on MSVC (#632)
Rafael Kitover [Thu, 27 Aug 2020 19:23:26 +0000 (19:23 +0000)] 
Support building on MSVC (#632)

With these changes, the project builds with Visual Studio 2019, unit
tests pass and it works correctly with mingw gcc.

NOTE: The very latest version of Visual Studio 2019 is required, because
there was just a necessary fix for template arguments.

Tested building and running unit tests on Windows+MSVC, Windows+MinGW,
Linux and macOS.

- Enable `ZSTD_FROM_INTERNET` by default for MSVC when not using vcpkg
  or conan.

- Add include tests for some standard UNIX headers not available on
  MSVC.

- Add necessary MSVC compiler flags.

- In `Args::from_gcc_atfile()` iterate over the string via `c_str()`
  instead of `cbegin()`, the MSVC string character iterator does not
  include the ending null byte.

- Misc. minor cmake fix-ups.

- Add some headers that are not implicitly included from other headers
  like `<algorithm>`, `<ios>`, `<cstdint>` and `<cstdarg>` in some
  places, gcc does this but MSVC does not.

- Add `std::filesystem` version of `Util::traverse()` when dirent.h is
  not available, which is preferred for performance reasons.

- Add implementations of the following functions that are not available
  in MSVC in Win32Util.cpp: `gettimeofday()`, `localtime_r()`,
  `asprintf()`.

- Add Windows implementation of `getopt_long()` from
  https://www.codeproject.com/Articles/157001/Full-getopt-Port-for-Unicode-and-Multibyte-Microso
  to third_party/win32.

- Add some compatibility typedefs, constants and macros to the `_WIN32`
  section of system.hpp, as well as the prototypes for the functions
  added to Win32Util.cpp.

- Fix up unit tests expecting '/' separated paths to expect paths
  delimited by `DIR_DELIM_CH`.

- Invoke test/run with bash from cmake, necessary on msys2+mingw64, many
  fail, there is more work to do here.

- Set the warning level to `/W4` and silence all the uninteresting
  warning types. Compiles with no warnings now.

- Switch to using standard C++ attributes `[[nodiscard]]` and
  `[[maybe_unused]]` and define macros for gcc for their equivalents.

- `#define DOCTEST_CONFIG_USE_STD_HEADERS` for MSVC only, because it
  requires explicitly including `<ostream>`.

- Add vim files to .gitignore.

Signed-off-by: Rafael Kitover <rkitover@gmail.com>
4 years agoSupport passing level 0 to “ccache -X” to use default level
Joel Rosdahl [Thu, 27 Aug 2020 08:35:59 +0000 (10:35 +0200)] 
Support passing level 0 to “ccache -X” to use default level

4 years agoLet “ccache -X” print before/after statistics
Joel Rosdahl [Thu, 27 Aug 2020 07:30:56 +0000 (09:30 +0200)] 
Let “ccache -X” print before/after statistics

4 years agoImprove layout of “ccache -x” statistics
Joel Rosdahl [Thu, 27 Aug 2020 07:29:43 +0000 (09:29 +0200)] 
Improve layout of “ccache -x” statistics

4 years agoMake Util::format_human_readable_size format kB
Joel Rosdahl [Thu, 27 Aug 2020 07:22:50 +0000 (09:22 +0200)] 
Make Util::format_human_readable_size format kB

4 years agoFix asm compiler detection (#644)
Alexander Lanin [Thu, 27 Aug 2020 19:18:56 +0000 (21:18 +0200)] 
Fix asm compiler detection (#644)

CMake requires ASM to be the last parameter so it can try whether the C compiler can compile asm.
See https://gitlab.kitware.com/cmake/cmake/-/merge_requests/1560/diffs

4 years agoFix override usage (#640)
Alexander Lanin [Thu, 27 Aug 2020 05:11:56 +0000 (07:11 +0200)] 
Fix override usage (#640)

5 years agoUpdate comments, remove references to old global variables (#637)
Thomas Otto [Tue, 25 Aug 2020 20:20:04 +0000 (22:20 +0200)] 
Update comments, remove references to old global variables (#637)

5 years agoUtil::unlink_tmp: Log with correct errno (#636)
Thomas Otto [Tue, 25 Aug 2020 20:19:12 +0000 (22:19 +0200)] 
Util::unlink_tmp: Log with correct errno (#636)

5 years agobuild.yaml: Improve naming of build jobs
Joel Rosdahl [Tue, 25 Aug 2020 17:05:42 +0000 (19:05 +0200)] 
build.yaml: Improve naming of build jobs

5 years agobuild.yaml: Collect testdir from either build or .
Joel Rosdahl [Sun, 23 Aug 2020 18:31:40 +0000 (20:31 +0200)] 
build.yaml: Collect testdir from either build or .

Also fix the name attribute sent to actions/upload-artifact.

5 years agobuild.yaml: Use build type CI by default
Joel Rosdahl [Sun, 23 Aug 2020 18:11:30 +0000 (20:11 +0200)] 
build.yaml: Use build type CI by default

I think that it makes sense to use a ccache binary built in release mode
in CI tests by default since that is what the end user will actually
run. At the same time we want to test assertions in CI, so use the CI
build type which is RelWithDebInfo but without -DNDEBUG. I here assume
that the difference between -O3 (from build type Release) and -O2 (from
build type RelWithDebInfo) is small.

Changed OS to Ubuntu 20.04 for “Linux MinGW 64-bit” since the cross
compiler in Ubuntu 18.04 is buggy.

5 years agoAdd CMake build type “CI” like “RelWithDebInfo” but without -DNDEBUG
Joel Rosdahl [Sun, 23 Aug 2020 18:10:36 +0000 (20:10 +0200)] 
Add CMake build type “CI” like “RelWithDebInfo” but without -DNDEBUG

5 years agoRemove Travis build and related scripts
Joel Rosdahl [Sun, 23 Aug 2020 17:32:37 +0000 (19:32 +0200)] 
Remove Travis build and related scripts

5 years agobuild.yaml: Consistently use extra indentation level for lists
Joel Rosdahl [Sun, 23 Aug 2020 14:24:15 +0000 (16:24 +0200)] 
build.yaml: Consistently use extra indentation level for lists

5 years agobuild.yaml: Add Clang-Format step
Joel Rosdahl [Sun, 23 Aug 2020 14:12:48 +0000 (16:12 +0200)] 
build.yaml: Add Clang-Format step

5 years agobuild.yaml: Pass EXTRA_CMAKE_BUILD_FLAGS to “Build and test” step
Joel Rosdahl [Sat, 22 Aug 2020 18:51:28 +0000 (20:51 +0200)] 
build.yaml: Pass EXTRA_CMAKE_BUILD_FLAGS to “Build and test” step

This will make the “Build documentation” and “Build manpage” step do
what’s intended.

5 years agoRename BUILDEXTRAFLAGS to EXTRA_CMAKE_BUILD_FLAGS
Joel Rosdahl [Sat, 22 Aug 2020 18:50:55 +0000 (20:50 +0200)] 
Rename BUILDEXTRAFLAGS to EXTRA_CMAKE_BUILD_FLAGS

5 years agobuild.yaml: Sort environment variable lists
Joel Rosdahl [Sat, 22 Aug 2020 18:48:29 +0000 (20:48 +0200)] 
build.yaml: Sort environment variable lists

5 years agotest: Apply missing renaming of expect_* functions
Joel Rosdahl [Sat, 22 Aug 2020 18:44:19 +0000 (20:44 +0200)] 
test: Apply missing renaming of expect_* functions

These were missed in 733f98804a4e but the error messages were hidden
then run via CTest.

5 years agobuild.yaml: Don’t use flow style YAML
Joel Rosdahl [Sat, 22 Aug 2020 18:27:26 +0000 (20:27 +0200)] 
build.yaml: Don’t use flow style YAML

5 years agobuild.yaml: Remove redundant “shell: bash” configuration
Joel Rosdahl [Sat, 22 Aug 2020 18:17:28 +0000 (20:17 +0200)] 
build.yaml: Remove redundant “shell: bash” configuration

5 years agobuild.yaml: Produce .tar.xz instead of .zip
Joel Rosdahl [Sat, 22 Aug 2020 18:16:38 +0000 (20:16 +0200)] 
build.yaml: Produce .tar.xz instead of .zip

5 years agobuild.yaml: Correct name of directory with test results
Joel Rosdahl [Sat, 22 Aug 2020 18:12:49 +0000 (20:12 +0200)] 
build.yaml: Correct name of directory with test results

As of d575526c91a8e0167a249760d63510e7de67ed23 the test results are
stored in “testdir/*” instead of “testdir.*”.

5 years agobuild.yaml: Build pull requests for other branches than master too
Joel Rosdahl [Sat, 22 Aug 2020 18:11:15 +0000 (20:11 +0200)] 
build.yaml: Build pull requests for other branches than master too

5 years agobuild.yaml: Tweak whitespace, quotes and capitalization
Joel Rosdahl [Sat, 22 Aug 2020 18:05:14 +0000 (20:05 +0200)] 
build.yaml: Tweak whitespace, quotes and capitalization

5 years agobuild.yaml: Make installation of CUDA actually work
Joel Rosdahl [Fri, 21 Aug 2020 12:16:47 +0000 (14:16 +0200)] 
build.yaml: Make installation of CUDA actually work

5 years agoRename cmake_build.yml to build.yaml
Joel Rosdahl [Sat, 22 Aug 2020 17:58:12 +0000 (19:58 +0200)] 
Rename cmake_build.yml to build.yaml

- Remove “cmake_” prefix since it’s a redundant implementation detail.
- Use “.yaml” instead of “.yml” since that’s the officially recommended
  YAML extension.

5 years agoAdd GitHub actions (#621)
Alexander Lanin [Sat, 22 Aug 2020 17:55:35 +0000 (19:55 +0200)] 
Add GitHub actions (#621)

Co-authored-by: Joel Rosdahl <joel@rosdahl.net>
5 years agoDon’t install cmake-format
Joel Rosdahl [Sat, 22 Aug 2020 13:27:12 +0000 (15:27 +0200)] 
Don’t install cmake-format

The installation has started to fail and we don’t use it anyway.

5 years agoRename FatalError class to Fatal
Joel Rosdahl [Wed, 19 Aug 2020 05:26:23 +0000 (07:26 +0200)] 
Rename FatalError class to Fatal

This makes the naming more consistent with the other exception classes
(Error and Failure).

5 years agoRename CCachePackConfig.cmake to CcachePackConfig.cmake
Joel Rosdahl [Wed, 19 Aug 2020 05:19:10 +0000 (07:19 +0200)] 
Rename CCachePackConfig.cmake to CcachePackConfig.cmake

It’s Ccache, not CCache.

5 years agotest: Improve names of expect_* functions
Joel Rosdahl [Wed, 19 Aug 2020 05:18:33 +0000 (07:18 +0200)] 
test: Improve names of expect_* functions

5 years agoREADME.md: Fix and improve links to installation instructions
Joel Rosdahl [Wed, 12 Aug 2020 18:12:12 +0000 (20:12 +0200)] 
README.md: Fix and improve links to installation instructions

Closes #633.

5 years agoAdd new absolute_paths_in_stderr (CCACHE_ABSSTDERR) feature
Joel Rosdahl [Tue, 11 Aug 2020 19:05:15 +0000 (21:05 +0200)] 
Add new absolute_paths_in_stderr (CCACHE_ABSSTDERR) feature

Motivation for the feature: When using the “Unix Makefiles” generator
with CMake, the compiler is executed in a different CWD than the “make”
command. This works well since absolute paths are passed to the
compiler. But combined with ccache’s base_dir feature the paths in
compiler error or warning messages will be incorrect since they will be
relative to the CWD of the compiler, not the CWD where the user or IDE
ran “make”. absolute_paths_in_stderr helps with this problem by
rewriting relative paths to absolute paths in the compiler’s stderr
output so that the user or IDE will see valid paths.

5 years agoUtil::send_to_stderr: Refactor to take Context parameter
Joel Rosdahl [Tue, 11 Aug 2020 18:47:48 +0000 (20:47 +0200)] 
Util::send_to_stderr: Refactor to take Context parameter

5 years agoMake testdir/failed symlink correct
Joel Rosdahl [Tue, 11 Aug 2020 18:45:53 +0000 (20:45 +0200)] 
Make testdir/failed symlink correct

Regression in d575526c91a8.

5 years agoAvoid reading outside input in expand_environment_variables
Joel Rosdahl [Sun, 9 Aug 2020 20:24:24 +0000 (22:24 +0200)] 
Avoid reading outside input in expand_environment_variables

The edge case of an input “$” without a following variable name was not
ported correctly in ab3c68b266d0d2d24c46dd1ef32e74e35ec388d6.

5 years agoUse XDG base directories by default
Joel Rosdahl [Sat, 8 Aug 2020 18:41:18 +0000 (20:41 +0200)] 
Use XDG base directories by default

ccache will now follow the XDG Base Directory Specification
(https://specifications.freedesktop.org/basedir-spec/) by default so
that:

- the cache directory is $XDG_CACHE_HOME/ccache (or $HOME/.cache/ccache
  if XDG_CACHE_HOME is not set), and
- the (primary) configuration file is
  $XDG_CONFIG_HOME/ccache/ccache.conf (or
  $HOME/.config/ccache/ccache.conf if XDG_CONFIG_HOME is not set).

On macOS, the fallback cache directory is $HOME/Library/Caches/ccache
and the fallback configuration file is
$HOME/Library/Preferences/ccache/ccache.conf. On Windows, the fallback
cache directory is %APPDATA%/ccache and the fallback configuration file
is %APPDATA%/ccache/ccache.conf.

Exceptions:

1. If CCACHE_CONFIGPATH is set, use that path for the configuration
   file.
2. If CCACHE_DIR is set (or ccache_dir in the secondary configuration),
   use that path for the cache directory and $CCACHE_DIR/ccache.conf for
   the configuration file.
3. If the legacy $HOME/.ccache directory exists, use that cache
   directory and $HOME/.ccache/ccache.conf for the configuration file.

Closes #191.

5 years agoUpgrade to fmt 7.0.3
Joel Rosdahl [Fri, 7 Aug 2020 13:54:36 +0000 (15:54 +0200)] 
Upgrade to fmt 7.0.3

5 years agoAdd -d/--directory option
Joel Rosdahl [Fri, 7 Aug 2020 12:20:02 +0000 (14:20 +0200)] 
Add -d/--directory option

The option makes subsequent command line options operate on the given
cache directory instead of the default.

5 years agoAdd --checksum-file option for debugging/evaluating checksums
Joel Rosdahl [Thu, 6 Aug 2020 19:32:34 +0000 (21:32 +0200)] 
Add --checksum-file option for debugging/evaluating checksums

5 years agoAdd and use Util::read_fd helper function
Joel Rosdahl [Thu, 6 Aug 2020 19:23:40 +0000 (21:23 +0200)] 
Add and use Util::read_fd helper function

5 years agoRemove unused typedefs
Joel Rosdahl [Thu, 6 Aug 2020 19:10:29 +0000 (21:10 +0200)] 
Remove unused typedefs

5 years agoPretty-print binary data in .ccache-input-text files
Joel Rosdahl [Thu, 6 Aug 2020 17:15:19 +0000 (19:15 +0200)] 
Pretty-print binary data in .ccache-input-text files

This happens when the i-node cache is enabled.

5 years agoUpgrade to zstd 1.4.5
Joel Rosdahl [Wed, 8 Jul 2020 13:36:37 +0000 (15:36 +0200)] 
Upgrade to zstd 1.4.5

Fixes #631.

5 years agoUse nullptr instead of NULL
Joel Rosdahl [Thu, 6 Aug 2020 14:59:57 +0000 (16:59 +0200)] 
Use nullptr instead of NULL

5 years agoRemove superfluous include of cstdint/stdint.h
Joel Rosdahl [Thu, 6 Aug 2020 14:57:01 +0000 (16:57 +0200)] 
Remove superfluous include of cstdint/stdint.h

It’s included implicitly by cinttypes.

5 years agoImprove name of add_extra_arg function
Joel Rosdahl [Thu, 6 Aug 2020 14:53:29 +0000 (16:53 +0200)] 
Improve name of add_extra_arg function

5 years agoUpgrade to BLAKE3 0.3.6
Joel Rosdahl [Thu, 6 Aug 2020 14:48:07 +0000 (16:48 +0200)] 
Upgrade to BLAKE3 0.3.6

5 years agoImprove building via Docker
Joel Rosdahl [Thu, 6 Aug 2020 14:21:52 +0000 (16:21 +0200)] 
Improve building via Docker

- Simplified names (e.g. ubuntu-14-trusty -> ubuntu-14.04,
  debian-9-stretch -> debian-9).
- Enabled debian-9 in misc/test-all-systems since it works.
- Renamed centos to centos-7.
- Added centos-8 and fedora-32.
- Updated dockerfiles/README to match reality after the conversion to
  CMake.
- Cleaned up Dockerfiles.
- Improved misc/test-all-systems.
- Removed unsupported Clang build for alpine-3.4, centos-7 and
  ubuntu-14.04.

5 years agoUpgrade to fmt 7.0.2
Joel Rosdahl [Thu, 6 Aug 2020 13:17:12 +0000 (15:17 +0200)] 
Upgrade to fmt 7.0.2

5 years agocolor_diagnostics test: Fix race conditions on some platforms
Joel Rosdahl [Thu, 6 Aug 2020 08:42:48 +0000 (10:42 +0200)] 
color_diagnostics test: Fix race conditions on some platforms

script(1) returns early on some platforms (leaving a child process
living for a short while) and the output may therefore still be pending.
Work around this by sleeping until the output file has content.

5 years agoCCACHE_PREFIX test: Fix failure for GCC <4.9
Joel Rosdahl [Thu, 6 Aug 2020 07:41:55 +0000 (09:41 +0200)] 
CCACHE_PREFIX test: Fix failure for GCC <4.9

The CCACHE_PREFIX test logs execution of prefixes. After
1c6ccf18c2e04459b1ac76ede4580b3ddcd27bbe (#596) the compiler and
prefixes can be run twice if GCC doesn’t support -fdiagnostics-color and
the test case is not prepared for that. Fix this by letting prefix-a
truncate the log file.

5 years agoci/build: Make it possible to specify CC for tests
Joel Rosdahl [Thu, 6 Aug 2020 07:02:50 +0000 (09:02 +0200)] 
ci/build: Make it possible to specify CC for tests

5 years agoDon’t look up or store tmp stderr files in i-node cache
Joel Rosdahl [Wed, 5 Aug 2020 18:52:25 +0000 (20:52 +0200)] 
Don’t look up or store tmp stderr files in i-node cache

The tmp.cpp_stderr file produced by the preprocessor is looked up and
stored in the i-node cache, which is wasted effort since it’s a
temporary file.

5 years agoDon’t depend on which(1) to detect commands
Joel Rosdahl [Wed, 5 Aug 2020 18:26:53 +0000 (20:26 +0200)] 
Don’t depend on which(1) to detect commands

5 years agoOnly define clone_file when it’s supported
Joel Rosdahl [Wed, 5 Aug 2020 14:00:04 +0000 (16:00 +0200)] 
Only define clone_file when it’s supported

This avoids warnings that the function can be marked [[noreturn]] in the
!FILE_CLONING_SUPPORTED case.

5 years agoImprove Clang modules test suite
Joel Rosdahl [Tue, 4 Aug 2020 19:09:59 +0000 (21:09 +0200)] 
Improve Clang modules test suite

- Backdate modified header so that the test actually tests content and
  not bails out early due to too new header timestamp.
- Verify that modifications to module.modulemap are detected, which is
  key to how the modules support works.

5 years agoRemove unnecessary compiler behavior test in modules test suite
Joel Rosdahl [Tue, 4 Aug 2020 19:07:09 +0000 (21:07 +0200)] 
Remove unnecessary compiler behavior test in modules test suite

The “preprocessor output” test in the modules test suite only tests
compiler behavior, and the string it looks for in the preprocessed
output is different for older and newer Clang versions. It seems like a
kind of a probing call, but I don’t see why we would want to probe the
compiler behavior in this case so I’ll just remove it.

Fixes #601.

5 years agoWork around missing std::is_trivially_copyable in GCC < 5
Joel Rosdahl [Tue, 4 Aug 2020 14:51:25 +0000 (16:51 +0200)] 
Work around missing std::is_trivially_copyable in GCC < 5

5 years agoRetrieve non-const pointer to std::string data without casting
Joel Rosdahl [Tue, 4 Aug 2020 14:32:14 +0000 (16:32 +0200)] 
Retrieve non-const pointer to std::string data without casting

5 years agoReplace failed function with throwing Failure exception explicitly
Joel Rosdahl [Tue, 4 Aug 2020 09:49:24 +0000 (11:49 +0200)] 
Replace failed function with throwing Failure exception explicitly

I think that this improves code readability since it’s more clear what
the code flow is.

5 years agoClean up system.hpp
Joel Rosdahl [Tue, 4 Aug 2020 09:43:55 +0000 (11:43 +0200)] 
Clean up system.hpp

5 years agoClean up ccache.hpp
Joel Rosdahl [Tue, 4 Aug 2020 09:38:21 +0000 (11:38 +0200)] 
Clean up ccache.hpp

5 years agoFix comment to match reality regarding process_preprocessed_file
Joel Rosdahl [Tue, 4 Aug 2020 09:37:46 +0000 (11:37 +0200)] 
Fix comment to match reality regarding process_preprocessed_file

5 years agoLet Error constructor forward arguments to fmt::format
Joel Rosdahl [Mon, 3 Aug 2020 19:07:32 +0000 (21:07 +0200)] 
Let Error constructor forward arguments to fmt::format

5 years agoReplace fatal function with throwing FatalError exception explicitly
Joel Rosdahl [Mon, 3 Aug 2020 18:03:13 +0000 (20:03 +0200)] 
Replace fatal function with throwing FatalError exception explicitly

I think that this improves code readability since it’s more clear what
the code flow is.

5 years agoUse fmt::print instead of (f)printf
Joel Rosdahl [Mon, 3 Aug 2020 14:58:47 +0000 (16:58 +0200)] 
Use fmt::print instead of (f)printf

5 years agoRemove superfluous .c_str() calls
Joel Rosdahl [Mon, 3 Aug 2020 15:00:42 +0000 (17:00 +0200)] 
Remove superfluous .c_str() calls

5 years agoC++-ify path_max
Joel Rosdahl [Mon, 3 Aug 2020 14:58:20 +0000 (16:58 +0200)] 
C++-ify path_max

5 years agoConvert cc_log calls to Logging::log
Joel Rosdahl [Mon, 3 Aug 2020 05:18:19 +0000 (07:18 +0200)] 
Convert cc_log calls to Logging::log

5 years agoC++-ify logging routines
Joel Rosdahl [Mon, 3 Aug 2020 05:04:31 +0000 (07:04 +0200)] 
C++-ify logging routines

- Simplified and C++-ified logging code.
- Added Logging::log and Logging::bulk_log functions corresponding to
  the old cc_log and cc_bulklog functions. The new functions pass their
  arguments to fmt::format.
- Replacements:
  * init_log → Logging::init
  * cc_log → Logging::log
  * cc_bulklog → Logging::bulk_log
  * cc_log_argv → Logging::log plus Util::format_argv_for_logging
  * cc_dump_debug_log_buffer -> Logging::dump_log
- A legacy cc_log implementation is still available so that logging can
  be converted gradually to the new functionality.

5 years agoAdd missing “Util::” test case prefix
Joel Rosdahl [Sat, 1 Aug 2020 07:34:10 +0000 (09:34 +0200)] 
Add missing “Util::” test case prefix

5 years agoMove logging.cpp’s print_command to Util
Joel Rosdahl [Sat, 1 Aug 2020 07:33:45 +0000 (09:33 +0200)] 
Move logging.cpp’s print_command to Util

5 years agoLet CCACHE_UMASK apply only to files/directories in the cache directory
Joel Rosdahl [Sat, 1 Aug 2020 14:39:11 +0000 (16:39 +0200)] 
Let CCACHE_UMASK apply only to files/directories in the cache directory

Ever since the CCACHE_UMASK setting was added in
75dd382407a36b3ebab36bb1027eb43a07498bec it has applied to all files
created by ccache, including files such as the object files and
executables created when ccache is called for linking. This was
presumably the easy thing to do, but it affects the observable output
from the compiler. There are also two related bugs:

1. CCACHE_UMASK is not used when creating the initial configuration file.
2. CCACHE_UMASK is used when creating the log file.

Fix this by:

- saving the original umask in Context,
- introducing a UmaskScope class,
- using UmaskScope objects to set the original umask when calling the
  compiler and when copying result files from the cache, and
- setting the umask after creating the log file but before creating the
  initial configuration file.

Closes #628.