]> git.ipfire.org Git - thirdparty/ccache.git/log
thirdparty/ccache.git
5 years agoExtract copy_raw_file into Util::clone_hard_link_or_copy_file
Joel Rosdahl [Wed, 1 Jul 2020 14:28:28 +0000 (16:28 +0200)] 
Extract copy_raw_file into Util::clone_hard_link_or_copy_file

5 years agoFix Clang-Tidy inconsistent-declaration-parameter-name warning
Joel Rosdahl [Mon, 6 Jul 2020 15:13:06 +0000 (17:13 +0200)] 
Fix Clang-Tidy inconsistent-declaration-parameter-name warning

5 years agoDocument --dump-result
Joel Rosdahl [Sun, 5 Jul 2020 19:34:39 +0000 (21:34 +0200)] 
Document --dump-result

5 years agoAlign command line option list in manual with help text
Joel Rosdahl [Sun, 5 Jul 2020 19:33:47 +0000 (21:33 +0200)] 
Align command line option list in manual with help text

5 years agoTweak ci/build script
Joel Rosdahl [Sun, 5 Jul 2020 19:00:47 +0000 (21:00 +0200)] 
Tweak ci/build script

- Removed redundant “exit 0” command again.
- Removed now obsolete and misleading comments.
- If JOBS is set to the empty string then detect the number of CPUs instead
  of running a limitless number of jobs.

5 years agoUse a known and set TERM variable to stabilize color_diagnostics tests
Joel Rosdahl [Sun, 5 Jul 2020 18:35:05 +0000 (20:35 +0200)] 
Use a known and set TERM variable to stabilize color_diagnostics tests

On some distributions TERM is unset when run via Docker which failed
color_diagnostics tests since ccache doesn’t enable color output if TERM
is unset. Fix this by using a known TERM value.

Fixes #616.

5 years agoSkip “Directory is not hashed if using -gz[=zlib]” tests for GCC 6
Joel Rosdahl [Sun, 5 Jul 2020 18:34:54 +0000 (20:34 +0200)] 
Skip “Directory is not hashed if using -gz[=zlib]” tests for GCC 6

The GCC 6 (tested with GCC 6.3) preprocessor includes the current
working directory in the preprocessed output if run with -gz, which
means that there won’t be cache hits between directories, thus failing
the “Directory is not hashed if using -gz[=zlib]” tests. Fix this by
skipping the test if the preprocessor behaves that way.

Fixes #602.

5 years agoEnable verbose output from “test/run” if VERBOSE is set
Joel Rosdahl [Sun, 5 Jul 2020 17:05:04 +0000 (19:05 +0200)] 
Enable verbose output from “test/run” if VERBOSE is set

5 years agoSort environment variables passed to docker container
Joel Rosdahl [Sun, 5 Jul 2020 17:04:30 +0000 (19:04 +0200)] 
Sort environment variables passed to docker container

5 years agoPass arguments to ci/build to ctest
Joel Rosdahl [Sun, 5 Jul 2020 16:57:24 +0000 (18:57 +0200)] 
Pass arguments to ci/build to ctest

This makes it possible to only run a subset of the tests by for instance
running “build-in-docker <name> -R <test>”.

5 years agoRemove redundant docker image tag suffix
Joel Rosdahl [Sun, 5 Jul 2020 14:45:57 +0000 (16:45 +0200)] 
Remove redundant docker image tag suffix

5 years agoRun compilation and tests with multiple threads (#610)
Alexander Lanin [Sun, 5 Jul 2020 19:00:05 +0000 (21:00 +0200)] 
Run compilation and tests with multiple threads (#610)

5 years agoFix color_diagnostics test failure if CCACHE_DIR is set in shell rc file
Joel Rosdahl [Wed, 24 Jun 2020 07:26:23 +0000 (09:26 +0200)] 
Fix color_diagnostics test failure if CCACHE_DIR is set in shell rc file

If the user sets CCACHE_DIR in a shell startup file then that value will
override the one from the test suite, thus making changes in cache
statistics invisible which triggers failures.

5 years agoMake one of the CI jobs build in release mode
Joel Rosdahl [Tue, 23 Jun 2020 20:10:31 +0000 (22:10 +0200)] 
Make one of the CI jobs build in release mode

It seems reasonable to run tests with the real release binary.

5 years agoClean up INSTALL.md
Joel Rosdahl [Tue, 23 Jun 2020 20:03:29 +0000 (22:03 +0200)] 
Clean up INSTALL.md

5 years agoRename producttest to test
Joel Rosdahl [Tue, 23 Jun 2020 19:59:51 +0000 (21:59 +0200)] 
Rename producttest to test

I don’t see a value in the prefix.

5 years agoRename generated Version.cpp to version.cpp
Joel Rosdahl [Tue, 23 Jun 2020 19:57:26 +0000 (21:57 +0200)] 
Rename generated Version.cpp to version.cpp

The convention is to use capitalized filenames for source files that
implement classes and namespaces and lowercase filenames for source
files that do not.

5 years agoClean up scripts related to code formatting
Joel Rosdahl [Sat, 20 Jun 2020 18:49:52 +0000 (20:49 +0200)] 
Clean up scripts related to code formatting

- Simplified scripts.
- Made colored output work again.

5 years agoClean up scripts related to CI and Docker
Joel Rosdahl [Sat, 20 Jun 2020 18:49:35 +0000 (20:49 +0200)] 
Clean up scripts related to CI and Docker

5 years agoImprove naming of scripts
Joel Rosdahl [Sat, 20 Jun 2020 18:00:24 +0000 (20:00 +0200)] 
Improve naming of scripts

- Use kebab case consistently.
- Remove redundant (and exposing an implementation detail) .sh extension
  for executables.

5 years agoClean up build-in-docker script
Joel Rosdahl [Sat, 20 Jun 2020 10:51:57 +0000 (12:51 +0200)] 
Clean up build-in-docker script

5 years agoMove top-level scripts to misc
Joel Rosdahl [Fri, 19 Jun 2020 20:43:27 +0000 (22:43 +0200)] 
Move top-level scripts to misc

This makes the top-level directory less crowded.

5 years agoRename USE_LIBZSTD_FROM_INTERNET to ZSTD_FROM_INTERNET
Joel Rosdahl [Fri, 19 Jun 2020 19:39:30 +0000 (21:39 +0200)] 
Rename USE_LIBZSTD_FROM_INTERNET to ZSTD_FROM_INTERNET

5 years agoSimplify code for hashing include file
Joel Rosdahl [Fri, 19 Jun 2020 19:00:38 +0000 (21:00 +0200)] 
Simplify code for hashing include file

5 years agoBuild InodeCache.cpp only when inode cache is supported
Joel Rosdahl [Fri, 19 Jun 2020 18:52:51 +0000 (20:52 +0200)] 
Build InodeCache.cpp only when inode cache is supported

5 years agoBuild win32compat.cpp only on Windows
Joel Rosdahl [Fri, 19 Jun 2020 18:33:21 +0000 (20:33 +0200)] 
Build win32compat.cpp only on Windows

5 years agoEnable more clang-tidy rules and implement suggestions
Joel Rosdahl [Fri, 19 Jun 2020 17:48:19 +0000 (19:48 +0200)] 
Enable more clang-tidy rules and implement suggestions

5 years agoReduce the set of included headers
Joel Rosdahl [Fri, 19 Jun 2020 17:46:47 +0000 (19:46 +0200)] 
Reduce the set of included headers

5 years agoImplement some suggestions from clang-tidy 10
Joel Rosdahl [Fri, 19 Jun 2020 16:47:23 +0000 (18:47 +0200)] 
Implement some suggestions from clang-tidy 10

5 years agoTweak CMakeLists.txt
Joel Rosdahl [Mon, 22 Jun 2020 20:18:23 +0000 (22:18 +0200)] 
Tweak CMakeLists.txt

5 years agoRemove stale licenses (#613)
Erik Johansson [Tue, 23 Jun 2020 19:42:59 +0000 (21:42 +0200)] 
Remove stale licenses (#613)

The m4 files are no longer used after the switch to cmake in f2341b2.

5 years agoTweak buffer reservation in Util::format_hex
Erik Johansson [Tue, 23 Jun 2020 14:15:19 +0000 (16:15 +0200)] 
Tweak buffer reservation in Util::format_hex

5 years agoDo not report skipped tests as failures on CMake <3.9 (#609)
Alexander Lanin [Mon, 22 Jun 2020 20:14:23 +0000 (22:14 +0200)] 
Do not report skipped tests as failures on CMake <3.9 (#609)

5 years agoReduce number of memory allocations in hashing (#608)
Olle Liljenzin [Mon, 22 Jun 2020 19:57:59 +0000 (21:57 +0200)] 
Reduce number of memory allocations in hashing (#608)

Add hash_buffer_once method for hashing a given text immediately using a
stack allocated hasher. Also skip copying the hasher in hash_result as
blake3 is not modifying the hasher.

5 years agoUpdate contribution guidelines related to clang-format usage
Joel Rosdahl [Mon, 22 Jun 2020 19:54:00 +0000 (21:54 +0200)] 
Update contribution guidelines related to clang-format usage

5 years agoUpdate authors
Joel Rosdahl [Mon, 22 Jun 2020 18:48:46 +0000 (20:48 +0200)] 
Update authors

(cherry picked from commit c7455f6a5385f1c19dc3b6c93cc4b37c0320ec48)

5 years agoUpdate NEWS
Joel Rosdahl [Mon, 22 Jun 2020 13:13:39 +0000 (15:13 +0200)] 
Update NEWS

(cherry picked from commit 6695d6011bc8a91e167da86fb326d54a9d005cde)

5 years agoRemove win32 GetFileNameFromHandle compatibility function
Joel Rosdahl [Sun, 21 Jun 2020 19:29:04 +0000 (21:29 +0200)] 
Remove win32 GetFileNameFromHandle compatibility function

The replacement function seems to be buggy, triggering failures in
x_realpath at least when the unit tests are run in Wine. The real
GetFinalPathNameByHandle function is allegedly supported in Windows
Vista and newer, so let’s just use it.

(cherry picked from commit bd742fbe20493f720ae6af00525fd3a8ee829802)

5 years agoImprove comment of inode cache version and revert to version 1 again
Joel Rosdahl [Thu, 18 Jun 2020 19:46:22 +0000 (21:46 +0200)] 
Improve comment of inode cache version and revert to version 1 again

As noted by Olle Liljenzin, changing the hash algorithm does not require
incrementing the version field, so let’s revert the change I made as
part of 2a0dd8ef.

5 years agoFix numbering of Travis CI jobs
Joel Rosdahl [Thu, 18 Jun 2020 19:13:27 +0000 (21:13 +0200)] 
Fix numbering of Travis CI jobs

The “allow_failures” one are always listed last, so move them last in
.travis.yml as well.

5 years agoLet “ccache --hash-file” perform raw hashing again
Joel Rosdahl [Thu, 18 Jun 2020 18:26:58 +0000 (20:26 +0200)] 
Let “ccache --hash-file” perform raw hashing again

Unintended or not, #577 (213d9883) changed the behavior of “ccache
--hash-file” to use hash_binary_file, which essentially performs
hash(hash(path)) if the i-node cache is enabled, otherwise hash(path).
This means that “ccache --hash-file” behaves differently depending on if
i-node cache is enabled and also that it’s no longer usable for
benchmarking purposes.

Fix this by simply using “hash_file” again.

5 years agoFix bug in hash_binary_file
Joel Rosdahl [Thu, 18 Jun 2020 18:18:37 +0000 (20:18 +0200)] 
Fix bug in hash_binary_file

Introduced in #577 (213d9883).

5 years agoFix location of secondary configuration
Joel Rosdahl [Thu, 18 Jun 2020 16:58:20 +0000 (18:58 +0200)] 
Fix location of secondary configuration

Regression in #573 (f2341b2b).

5 years agoReplace BLAKE2b with BLAKE3 (#519)
Erik Johansson [Thu, 18 Jun 2020 19:12:21 +0000 (21:12 +0200)] 
Replace BLAKE2b with BLAKE3 (#519)

5 years agoAdd missing “#pragma once”
Joel Rosdahl [Thu, 18 Jun 2020 06:04:43 +0000 (08:04 +0200)] 
Add missing “#pragma once”

5 years agoAllow the config file to be a symlink
Joel Rosdahl [Wed, 17 Jun 2020 19:45:07 +0000 (21:45 +0200)] 
Allow the config file to be a symlink

Fixes #607.

(cherry picked from commit 46172c8bc24799ae35cf300b0b5ba765bd40896a)

5 years agoAdd “clang-format off/on” comments for old Clang-Format versions
Joel Rosdahl [Tue, 16 Jun 2020 19:45:57 +0000 (21:45 +0200)] 
Add “clang-format off/on” comments for old Clang-Format versions

5 years agoRename buildenv to dockerfiles to make room for build* directories
Joel Rosdahl [Tue, 16 Jun 2020 19:19:00 +0000 (21:19 +0200)] 
Rename buildenv to dockerfiles to make room for build* directories

5 years agoClean up CMake configuration
Joel Rosdahl [Tue, 16 Jun 2020 19:09:48 +0000 (21:09 +0200)] 
Clean up CMake configuration

5 years agoFormat config.h.in with Clang-Format and fix spelling
Joel Rosdahl [Mon, 15 Jun 2020 19:40:47 +0000 (21:40 +0200)] 
Format config.h.in with Clang-Format and fix spelling

5 years agoImprove INSTALL.md after CMake-ification
Joel Rosdahl [Sun, 14 Jun 2020 19:09:24 +0000 (21:09 +0200)] 
Improve INSTALL.md after CMake-ification

I chose to mention “-DCMAKE_BUILD_TYPE=Release” explicitly since some
end users will clone the repository instead of downloading the release
archive and then the default “Debug” build won’t be a great idea.

5 years agoDon’t update author list when generating documentation
Joel Rosdahl [Sun, 14 Jun 2020 18:59:13 +0000 (20:59 +0200)] 
Don’t update author list when generating documentation

Motivation:

1. The copyright notice in each source file refers to doc/AUTHORS.adoc
   for the list of contributors. If we only update AUTHORS.adoc when
   generating documention then AUTHORS.adoc will become more and more
   out of date until somebody remembers to commit the changes.
2. The list is based on commit authors, but authors may sometimes need
   an entry in .mailmap so there’s manual work involved to sanity check
   the list. It can also happen that some commits or authors may need to
   be excluded.

Therefore I prefer to keep AUTHORS.adoc manually updated at release time
(or occasionally more often) with the help of a script just like before.

5 years agoRemove cmake-format check and support
Joel Rosdahl [Sun, 14 Jun 2020 18:45:23 +0000 (20:45 +0200)] 
Remove cmake-format check and support

Motivation:

1. It’s unsatisfying to have to remember to run “make format” after
   editing CMake files. (Clang-Format has more editor integrations, and
   most importantly there are integrations for my editor of choice.)
2. The output of cmake-format seems to be a bit unstable between
   versions.
3. I don’t like some of cmake-format’s formatting choices. This could be
   potentially be improved, though.

Let’s remove the support for now and maybe revisit later.

5 years agoDocker: add Alpine to new docker setup (#606)
Alexander Lanin [Wed, 17 Jun 2020 06:26:28 +0000 (08:26 +0200)] 
Docker: add Alpine to new docker setup (#606)

5 years agoAdd and use Fd and Finalizer classes
Joel Rosdahl [Mon, 1 Jun 2020 16:36:00 +0000 (18:36 +0200)] 
Add and use Fd and Finalizer classes

5 years agoAdd Digest class, replacing struct digest
Joel Rosdahl [Tue, 21 Apr 2020 17:58:55 +0000 (19:58 +0200)] 
Add Digest class, replacing struct digest

5 years agoFix NEWS entry about switching to CMake
Joel Rosdahl [Sat, 13 Jun 2020 12:50:58 +0000 (14:50 +0200)] 
Fix NEWS entry about switching to CMake

ccache has never used Automake.

5 years agoFix spelling
Joel Rosdahl [Sat, 13 Jun 2020 12:36:32 +0000 (14:36 +0200)] 
Fix spelling

5 years agoPlace temporary test dirs in CMAKE_BINARY_DIR
Joel Rosdahl [Fri, 12 Jun 2020 18:45:47 +0000 (20:45 +0200)] 
Place temporary test dirs in CMAKE_BINARY_DIR

That’s where the developer performs the build so I think that it makes
more sense this way.

5 years agoTell CTest about skipped tests
Joel Rosdahl [Fri, 12 Jun 2020 18:14:53 +0000 (20:14 +0200)] 
Tell CTest about skipped tests

Return code 125 is chosen for familiarity with what “git bisect” uses.

5 years agoSupport NVCC’s “--Werror” option
Joel Rosdahl [Sun, 14 Jun 2020 08:55:29 +0000 (10:55 +0200)] 
Support NVCC’s “--Werror” option

5 years agodoc: Improve wording in “Sharing a cache on NFS”
Joel Rosdahl [Sun, 14 Jun 2020 08:43:47 +0000 (10:43 +0200)] 
doc: Improve wording in “Sharing a cache on NFS”

5 years agoImprove documentation about sharing a cache on NFS (#604)
Deepak Yadav [Sun, 14 Jun 2020 08:37:08 +0000 (14:07 +0530)] 
Improve documentation about sharing a cache on NFS (#604)

5 years agoSwitch to CMake (#573)
Alexander Lanin [Sun, 14 Jun 2020 07:59:00 +0000 (09:59 +0200)] 
Switch to CMake (#573)

Co-authored-by: Cristian Adam <cristian.adam@gmail.com>
Co-authored-by: Joel Rosdahl <joel@rosdahl.net>
5 years agoRequire working script command for the color_diagnostics test suite
Joel Rosdahl [Mon, 8 Jun 2020 20:07:54 +0000 (22:07 +0200)] 
Require working script command for the color_diagnostics test suite

5 years agoportability: Don’t pass “-r” to sed
Joel Rosdahl [Mon, 8 Jun 2020 19:51:32 +0000 (21:51 +0200)] 
portability: Don’t pass “-r” to sed

5 years agoMake hard-linked files read-only for safety
Joel Rosdahl [Sun, 7 Jun 2020 18:47:33 +0000 (20:47 +0200)] 
Make hard-linked files read-only for safety

5 years agoMention in manual that only object files are hard-linked
Joel Rosdahl [Sun, 7 Jun 2020 18:46:04 +0000 (20:46 +0200)] 
Mention in manual that only object files are hard-linked

As implemented in 82ecace9.

5 years agoAdd more tests for dependency file content
Joel Rosdahl [Sun, 7 Jun 2020 18:04:05 +0000 (20:04 +0200)] 
Add more tests for dependency file content

5 years agoRemove redundant #includes
Joel Rosdahl [Sun, 7 Jun 2020 13:57:39 +0000 (15:57 +0200)] 
Remove redundant #includes

5 years agoAlways cache colored diagnostics and strip color codes as appropriate (#596)
Matt Whitlock [Sun, 7 Jun 2020 13:43:33 +0000 (09:43 -0400)] 
Always cache colored diagnostics and strip color codes as appropriate (#596)

5 years agoUpgrade Travis-CI environment to Ubuntu 18.04
Joel Rosdahl [Sat, 6 Jun 2020 18:57:37 +0000 (20:57 +0200)] 
Upgrade Travis-CI environment to Ubuntu 18.04

5 years agoFix variable name
Joel Rosdahl [Mon, 1 Jun 2020 14:56:53 +0000 (16:56 +0200)] 
Fix variable name

5 years agoAdd missing TestContext instantiation
Joel Rosdahl [Mon, 1 Jun 2020 14:56:37 +0000 (16:56 +0200)] 
Add missing TestContext instantiation

5 years agoMention inode cache in NEWS
Joel Rosdahl [Mon, 1 Jun 2020 07:53:24 +0000 (09:53 +0200)] 
Mention inode cache in NEWS

5 years agoImprove inode_cache test suite to not truncate CCACHE_LOGFILE
Joel Rosdahl [Sun, 31 May 2020 10:53:02 +0000 (12:53 +0200)] 
Improve inode_cache test suite to not truncate CCACHE_LOGFILE

5 years agoFix some trivial code style issues
Joel Rosdahl [Sun, 31 May 2020 10:52:44 +0000 (12:52 +0200)] 
Fix some trivial code style issues

5 years agoAdd inode cache for file hashes (#577)
Olle Liljenzin [Sun, 31 May 2020 10:02:12 +0000 (12:02 +0200)] 
Add inode cache for file hashes (#577)

The inode cache is a process shared cache that maps from device, inode,
size, mtime and ctime to saved hash results. The cache is stored
persistently in a single file that is mapped into shared memory by
running processes, allowing computed hash values to be reused both
within and between builds.

The chosen technical solution works for Linux and might work on other POSIX
platforms, but is not meant to be supported on non-POSIX platforms
such as Windows.

Use 'ccache -o inode_cache=true/false' to activate/deactivate the cache.

5 years agoOnly try to hard link object files to/from the cache
Joel Rosdahl [Fri, 29 May 2020 18:43:19 +0000 (20:43 +0200)] 
Only try to hard link object files to/from the cache

The compiler unlinks the destination object file before writing, but it
apparently doesn’t do that for dependency files. This means that
compilation can corrupt a .d file that shares i-node with a cached .d
file when using the hard link mode. Here is a scenario where this can
happen:

1. There is a test.c which includes test.h.
2. When test.c is compiled, the compiler writes test.d which mentions
   test.h and ccache hard links test.d into cache entry 1. test.d and
   cache entry 1's .d file now share i-nodes.
3. The include of test.h is removed from test.c.
4. When test.c is compiled again the compiler overwrites test.d with new
   content without test.h and ccache hard links test.d into cache entry
   2. test.d, cache entry 1 and cache entry 2 now share i-nodes, all of
   which contain the new content without test.h.

Since we can’t be sure how the compiler behaves for other types of files
(.dwo, .cov, etc.), only try to to hard link object files.

Fixes #599.

(cherry picked from commit 443afc179e1de3f050850103a5ba62e3cb5ab398)

5 years agoAdd missing O_TRUNC in copy_file and clone_file
Joel Rosdahl [Fri, 29 May 2020 18:53:22 +0000 (20:53 +0200)] 
Add missing O_TRUNC in copy_file and clone_file

5 years agoMove ThreadPool methods to .cpp file
Joel Rosdahl [Tue, 26 May 2020 19:57:42 +0000 (21:57 +0200)] 
Move ThreadPool methods to .cpp file

5 years agoClean up profiling_clang test suite probing
Joel Rosdahl [Mon, 25 May 2020 19:25:41 +0000 (21:25 +0200)] 
Clean up profiling_clang test suite probing

5 years agoHandle incapability of determining home directory more gracefully
Joel Rosdahl [Sun, 24 May 2020 09:44:50 +0000 (11:44 +0200)] 
Handle incapability of determining home directory more gracefully

5 years agoConvert last usage of putenv
Joel Rosdahl [Sun, 24 May 2020 09:25:06 +0000 (11:25 +0200)] 
Convert last usage of putenv

5 years agoRemove comments with motivation for “clang-format off/on”
Joel Rosdahl [Sun, 24 May 2020 08:47:59 +0000 (10:47 +0200)] 
Remove comments with motivation for “clang-format off/on”

The motivation is available in the Git history.

5 years agoFix capitalization of Clang
Joel Rosdahl [Sun, 24 May 2020 08:47:46 +0000 (10:47 +0200)] 
Fix capitalization of Clang

5 years agoUse STDERR_FILENO/STDOUT_FILENO constants
Joel Rosdahl [Sun, 24 May 2020 08:27:36 +0000 (10:27 +0200)] 
Use STDERR_FILENO/STDOUT_FILENO constants

5 years agoClean up
Joel Rosdahl [Sun, 24 May 2020 08:23:08 +0000 (10:23 +0200)] 
Clean up

5 years agoHandle all Intel “-xCODE” compiler options correctly
Joel Rosdahl [Wed, 20 May 2020 19:26:35 +0000 (21:26 +0200)] 
Handle all Intel “-xCODE” compiler options correctly

“CODE” in the Intel compiler’s “-xCODE” option for specifying processor
features seems to always start with an uppercase letter, and since GCC’s
language specifications always are lowercase we can just treat uppercase
codes as an ordinary compiler argument.

5 years agoImprove temp file handling
Joel Rosdahl [Tue, 19 May 2020 18:37:19 +0000 (20:37 +0200)] 
Improve temp file handling

- Use Util::create_temp_fd instead of legacy create_tmp_fd.
- Use Context::register_pending_tmp_file instead of unlinking
  explicitly.
- Simplified output of merged stderr from preprocessor and compiler.

5 years agoAdd test case for merging stderr from preprocessor and compiler
Joel Rosdahl [Mon, 18 May 2020 18:17:09 +0000 (20:17 +0200)] 
Add test case for merging stderr from preprocessor and compiler

5 years agoUse std::ios_base::openmode as the third Util::write_file parameter
Joel Rosdahl [Mon, 18 May 2020 18:03:24 +0000 (20:03 +0200)] 
Use std::ios_base::openmode as the third Util::write_file parameter

5 years agoRefactor signal handling and process exit code
Joel Rosdahl [Mon, 18 May 2020 06:26:14 +0000 (08:26 +0200)] 
Refactor signal handling and process exit code

* Added a SignalHandler class which encapsulates parts related to signal
  handling.
* Moved data referenced by the exit functions to Context (compiler PID,
  pending temporary files and pending debug log files).
* Let the Context destructor do what the exitfn functionality used to
  do.
* Removed the now superfluous exitfn functionality.

5 years agoC++-ify unlink wrapper functions
Joel Rosdahl [Sat, 16 May 2020 14:17:44 +0000 (16:17 +0200)] 
C++-ify unlink wrapper functions

x_unlink(p)   == 0 -> Util::unlink_safe(p)
x_try_unlink  == 0 -> Util::unlink_safe(p, Util::UnlinkLog::ignore_failure)
tmp_unlink(p) == 0 -> Util::unlink_tmp(p)

5 years agoRevert "Merge catch2_tests into unittest’s main"
Joel Rosdahl [Sat, 16 May 2020 14:06:28 +0000 (16:06 +0200)] 
Revert "Merge catch2_tests into unittest’s main"

This reverts commit 4608eb6d6c41aefb7c5f534166901e051e126115.

Since unittest/main.cpp includes src/Util.hpp it’s still too painful to
compile the Catch2 runner, so let’s keep it separate.

5 years agoUse raw string literals for version and usage texts
Joel Rosdahl [Fri, 15 May 2020 20:14:34 +0000 (22:14 +0200)] 
Use raw string literals for version and usage texts

5 years agoDefault to zstd compression level 1
Joel Rosdahl [Fri, 15 May 2020 19:10:45 +0000 (21:10 +0200)] 
Default to zstd compression level 1

After some experiments my evaluation is that the increased compression
ratio of level 1 is worth the very slight decrease in compression speed.

5 years agoAdd and use win32_error_message function
Joel Rosdahl [Fri, 15 May 2020 19:06:27 +0000 (21:06 +0200)] 
Add and use win32_error_message function

5 years agoRemove overengineered win32 gethostname fallback code
Joel Rosdahl [Fri, 15 May 2020 18:14:36 +0000 (20:14 +0200)] 
Remove overengineered win32 gethostname fallback code

Let’s assume that all systems we reasonably support have access to
gethostname. If not, revisit later.

Regarding the win32 case: Since the replacement code (triggered if
HAVE_GETHOSTNAME isn’t defined) itself uses gethostname, just use
gethostname.

5 years agoAdd unit test for config key tables consistency
Joel Rosdahl [Fri, 15 May 2020 17:30:26 +0000 (19:30 +0200)] 
Add unit test for config key tables consistency