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

5 years agoRefactor away temp_dir()
Joel Rosdahl [Thu, 14 May 2020 19:50:54 +0000 (21:50 +0200)] 
Refactor away temp_dir()

5 years agoExtract internal tracing stuff to a separate file
Joel Rosdahl [Thu, 14 May 2020 19:12:20 +0000 (21:12 +0200)] 
Extract internal tracing stuff to a separate file

5 years agoRemove unit test comments that are hard to keep up to date
Joel Rosdahl [Wed, 13 May 2020 19:17:05 +0000 (21:17 +0200)] 
Remove unit test comments that are hard to keep up to date

5 years agoRemove now obsolete unittest utils
Joel Rosdahl [Wed, 13 May 2020 16:50:51 +0000 (18:50 +0200)] 
Remove now obsolete unittest utils

5 years agoConvert create_file usage to Util::write_file
Joel Rosdahl [Wed, 13 May 2020 16:50:45 +0000 (18:50 +0200)] 
Convert create_file usage to Util::write_file

5 years agoMerge catch2_tests into unittest’s main
Joel Rosdahl [Wed, 13 May 2020 16:43:47 +0000 (18:43 +0200)] 
Merge catch2_tests into unittest’s main

The Catch2 runner was previously compiled separately since it’s slow to
compile, but after the removal of the old test framework there should be
little reason to modify unittest/main.cpp often.

5 years agoC++-ify argprocessing test suite
Joel Rosdahl [Wed, 13 May 2020 16:19:19 +0000 (18:19 +0200)] 
C++-ify argprocessing test suite

5 years agoRemove last traces of the old unittest framework
Joel Rosdahl [Sun, 10 May 2020 17:43:15 +0000 (19:43 +0200)] 
Remove last traces of the old unittest framework

5 years agoAdd TestContext to test cases that create local files
Joel Rosdahl [Sun, 10 May 2020 17:28:00 +0000 (19:28 +0200)] 
Add TestContext to test cases that create local files

5 years agoImplement TestUtil::TestContext
Joel Rosdahl [Sun, 10 May 2020 07:13:41 +0000 (09:13 +0200)] 
Implement TestUtil::TestContext

5 years agoImplement Util::wipe_path
Joel Rosdahl [Sun, 10 May 2020 07:13:31 +0000 (09:13 +0200)] 
Implement Util::wipe_path

5 years agoUse Util::traverse in Util::clean_up_internal_tempdir
Joel Rosdahl [Sun, 10 May 2020 06:36:47 +0000 (08:36 +0200)] 
Use Util::traverse in Util::clean_up_internal_tempdir

5 years agoUse Util::traverse in Util::get_level_1_files
Joel Rosdahl [Sat, 9 May 2020 20:34:16 +0000 (22:34 +0200)] 
Use Util::traverse in Util::get_level_1_files

5 years agoImplement Util::traverse
Joel Rosdahl [Sat, 9 May 2020 18:56:44 +0000 (20:56 +0200)] 
Implement Util::traverse

5 years agoUse using instead of typedef
Joel Rosdahl [Sat, 9 May 2020 11:17:35 +0000 (13:17 +0200)] 
Use using instead of typedef

5 years agoConvert legacy_util test suite to Catch2
Joel Rosdahl [Fri, 8 May 2020 19:43:27 +0000 (21:43 +0200)] 
Convert legacy_util test suite to Catch2

5 years agoConvert hashutil test suite to Catch2
Joel Rosdahl [Fri, 8 May 2020 19:39:12 +0000 (21:39 +0200)] 
Convert hashutil test suite to Catch2

5 years agoConvert hash test suite to Catch2
Joel Rosdahl [Fri, 8 May 2020 19:36:44 +0000 (21:36 +0200)] 
Convert hash test suite to Catch2

5 years agoConvert compopt test suite to Catch2
Joel Rosdahl [Fri, 8 May 2020 19:32:19 +0000 (21:32 +0200)] 
Convert compopt test suite to Catch2

5 years agoConvert argument_processing test suite to Catch2
Joel Rosdahl [Fri, 8 May 2020 19:31:03 +0000 (21:31 +0200)] 
Convert argument_processing test suite to Catch2

5 years agoRemove obsolete ScopeGuard
Joel Rosdahl [Fri, 8 May 2020 19:26:33 +0000 (21:26 +0200)] 
Remove obsolete ScopeGuard

5 years agoUpgrade string-view-lite to 1.4.0
Joel Rosdahl [Fri, 8 May 2020 18:17:15 +0000 (20:17 +0200)] 
Upgrade string-view-lite to 1.4.0

5 years agoGuess compiler using substring search again
Joel Rosdahl [Fri, 8 May 2020 18:11:53 +0000 (20:11 +0200)] 
Guess compiler using substring search again

Regression in 30c10e8791bd02a8a3b13beeda875adbefa8c7ab.

5 years agoRemove now obsolete from_cstr function
Joel Rosdahl [Fri, 8 May 2020 18:03:25 +0000 (20:03 +0200)] 
Remove now obsolete from_cstr function

5 years agoC++-ify get_result_name_from_cpp
Joel Rosdahl [Fri, 8 May 2020 18:02:31 +0000 (20:02 +0200)] 
C++-ify get_result_name_from_cpp

5 years agoSpeed up check-syntax rule
Joel Rosdahl [Fri, 8 May 2020 05:26:14 +0000 (07:26 +0200)] 
Speed up check-syntax rule

5 years agoFix typo in manifest_get log message
Joel Rosdahl [Fri, 8 May 2020 05:25:48 +0000 (07:25 +0200)] 
Fix typo in manifest_get log message

5 years agoSupport clang options for compiling with sampled profiles (#589)
Olle Liljenzin [Fri, 8 May 2020 17:12:05 +0000 (19:12 +0200)] 
Support clang options for compiling with sampled profiles (#589)

Add support for -fprofile-sample-use and -fprofile-sample-accurate.

5 years agoRemove legacy args API
Joel Rosdahl [Thu, 7 May 2020 17:44:26 +0000 (19:44 +0200)] 
Remove legacy args API

5 years agoRemove last usage of legacy args->argv wrapper
Joel Rosdahl [Thu, 7 May 2020 17:32:53 +0000 (19:32 +0200)] 
Remove last usage of legacy args->argv wrapper

5 years agoRemove last usage of legacy args_strip function
Joel Rosdahl [Thu, 7 May 2020 17:13:46 +0000 (19:13 +0200)] 
Remove last usage of legacy args_strip function

5 years agoRemove last usage of legacy args_set function
Joel Rosdahl [Thu, 7 May 2020 17:12:31 +0000 (19:12 +0200)] 
Remove last usage of legacy args_set function

5 years agoRemove last usage of legacy args_remove_first function
Joel Rosdahl [Thu, 7 May 2020 17:11:44 +0000 (19:11 +0200)] 
Remove last usage of legacy args_remove_first function

5 years agoRemove last usage of legacy args_pop function
Joel Rosdahl [Thu, 7 May 2020 17:00:48 +0000 (19:00 +0200)] 
Remove last usage of legacy args_pop function

5 years agoRemove last usage of legacy args_init_from_string function
Joel Rosdahl [Thu, 7 May 2020 16:58:45 +0000 (18:58 +0200)] 
Remove last usage of legacy args_init_from_string function

5 years agoRemove last usage of legacy args_init_from_gcc_atfile function
Joel Rosdahl [Thu, 7 May 2020 16:57:57 +0000 (18:57 +0200)] 
Remove last usage of legacy args_init_from_gcc_atfile function

5 years agoRemove last usage of legacy args_init function
Joel Rosdahl [Thu, 7 May 2020 16:57:15 +0000 (18:57 +0200)] 
Remove last usage of legacy args_init function

5 years agoRemove last usage of legacy args_extend function
Joel Rosdahl [Thu, 7 May 2020 16:56:07 +0000 (18:56 +0200)] 
Remove last usage of legacy args_extend function

5 years agoRemove last usage of legacy args_add_prefix function
Joel Rosdahl [Thu, 7 May 2020 16:54:45 +0000 (18:54 +0200)] 
Remove last usage of legacy args_add_prefix function

5 years agoRemove last usage of legacy args_add function
Joel Rosdahl [Thu, 7 May 2020 16:53:36 +0000 (18:53 +0200)] 
Remove last usage of legacy args_add function

5 years agoC++-ify process_args
Joel Rosdahl [Thu, 7 May 2020 16:32:10 +0000 (18:32 +0200)] 
C++-ify process_args

5 years agoExtract code for handling dependency environment variables to a function
Joel Rosdahl [Thu, 7 May 2020 16:18:46 +0000 (18:18 +0200)] 
Extract code for handling dependency environment variables to a function

5 years agoC++-ify final parts of process_arg
Joel Rosdahl [Wed, 6 May 2020 19:47:32 +0000 (21:47 +0200)] 
C++-ify final parts of process_arg

5 years agoC++-ify language functions
Joel Rosdahl [Wed, 6 May 2020 19:32:22 +0000 (21:32 +0200)] 
C++-ify language functions

5 years agoC++-ify parts of process_arg
Joel Rosdahl [Wed, 6 May 2020 17:07:40 +0000 (19:07 +0200)] 
C++-ify parts of process_arg

5 years agoC++-ify compopt functions somewhat
Joel Rosdahl [Wed, 6 May 2020 16:29:29 +0000 (18:29 +0200)] 
C++-ify compopt functions somewhat

5 years agoRemove obsolete CHECK_DOUBLE_EQ macro
Joel Rosdahl [Wed, 6 May 2020 11:34:26 +0000 (13:34 +0200)] 
Remove obsolete CHECK_DOUBLE_EQ macro

5 years agoRemove obsolete path_exists function
Joel Rosdahl [Wed, 6 May 2020 11:31:34 +0000 (13:31 +0200)] 
Remove obsolete path_exists function

5 years agoHandle Intel compiler option “-xHost” correctly
Joel Rosdahl [Tue, 5 May 2020 18:31:24 +0000 (20:31 +0200)] 
Handle Intel compiler option “-xHost” correctly

Fixes #587.

5 years agoUse args[i] consistently to refer to the argument in process_arg
Joel Rosdahl [Tue, 5 May 2020 13:02:13 +0000 (15:02 +0200)] 
Use args[i] consistently to refer to the argument in process_arg

A shorter alias is nice but breaks symmetry when code needs to process
args[i + 1], etc.

5 years agoC++-ify -optf/--options-file processing in process_arg
Joel Rosdahl [Tue, 5 May 2020 12:59:06 +0000 (14:59 +0200)] 
C++-ify -optf/--options-file processing in process_arg

This also makes the implementation acually work with multiple option
files delimited by commas.

5 years agoC++-ify parts of process_arg
Joel Rosdahl [Tue, 5 May 2020 12:58:07 +0000 (14:58 +0200)] 
C++-ify parts of process_arg

5 years agoImprove Args::from_gcc_atfile
Joel Rosdahl [Tue, 5 May 2020 12:55:39 +0000 (14:55 +0200)] 
Improve Args::from_gcc_atfile

Scanning for the null character from the string is more efficient.

5 years agoSimplify detect_pch
Joel Rosdahl [Sun, 3 May 2020 07:23:40 +0000 (09:23 +0200)] 
Simplify detect_pch

5 years agoC++-ify detect_pch
Joel Rosdahl [Sat, 2 May 2020 11:18:04 +0000 (13:18 +0200)] 
C++-ify detect_pch

5 years agoC++-ify ArgumentProcessingState members
Joel Rosdahl [Sat, 2 May 2020 11:07:55 +0000 (13:07 +0200)] 
C++-ify ArgumentProcessingState members

5 years agoImprove ordering of ArgumentProcessingState members
Joel Rosdahl [Sat, 2 May 2020 11:05:18 +0000 (13:05 +0200)] 
Improve ordering of ArgumentProcessingState members

5 years agoC++-ify ArgsInfo::debug_prefix_maps
Joel Rosdahl [Sat, 2 May 2020 10:55:57 +0000 (12:55 +0200)] 
C++-ify ArgsInfo::debug_prefix_maps

5 years agoC++-ify ArgsInfo::arch_args
Joel Rosdahl [Sat, 2 May 2020 10:46:39 +0000 (12:46 +0200)] 
C++-ify ArgsInfo::arch_args

5 years agoC++-ify ArgsInfo::sanitize_blacklists
Joel Rosdahl [Sat, 2 May 2020 07:15:53 +0000 (09:15 +0200)] 
C++-ify ArgsInfo::sanitize_blacklists

5 years agoExtract argument processing code to a separate file
Joel Rosdahl [Fri, 1 May 2020 20:45:36 +0000 (22:45 +0200)] 
Extract argument processing code to a separate file

5 years agoFix build error with --enable-tracing
Joel Rosdahl [Mon, 4 May 2020 20:30:03 +0000 (22:30 +0200)] 
Fix build error with --enable-tracing

5 years agoExtract make_relative_path to Util
Joel Rosdahl [Fri, 1 May 2020 20:44:01 +0000 (22:44 +0200)] 
Extract make_relative_path to Util

5 years agoDon’t regenerate version.cpp on every build
Joel Rosdahl [Fri, 1 May 2020 20:50:27 +0000 (22:50 +0200)] 
Don’t regenerate version.cpp on every build

This fixes a problem where version.o will always be out-of-date, thus
triggering a rebuild and relink (regression in 827237fd).

5 years agoAdd Args::empty method
Joel Rosdahl [Fri, 1 May 2020 17:51:49 +0000 (19:51 +0200)] 
Add Args::empty method

5 years agoLet process_args use orig_args from ctx
Joel Rosdahl [Fri, 1 May 2020 17:44:03 +0000 (19:44 +0200)] 
Let process_args use orig_args from ctx

5 years agoDon't depend on how echo interprets backslash escapes (#588)
Olle Liljenzin [Sun, 3 May 2020 12:11:29 +0000 (14:11 +0200)] 
Don't depend on how echo interprets backslash escapes (#588)

The escape sequence '\n' should be translated to a new line character
when printed to version.cpp. Default mode might be implementation
dependent. At least in Fedora /usr/bin/echo defaults to -E. On the
other hand older versions might not support the -e option that enables
backslash escapes where it is not default.

Split the command into two, one for each output line, which should
produce same output on all platforms.

5 years agoFix variable shadowing after d0eb89de
Joel Rosdahl [Fri, 1 May 2020 15:06:10 +0000 (17:06 +0200)] 
Fix variable shadowing after d0eb89de

5 years agoImprove handling of profiling options
Joel Rosdahl [Thu, 30 Apr 2020 06:29:31 +0000 (08:29 +0200)] 
Improve handling of profiling options

Handling of -fprofile-{generate,use}[=path] was implemented in PR #2
(2011). ccache has since then gained support for Clang, which is not
GCC-compatible for -fprofile-{generate,use}[=path]. Furthermore, GCC 9
changed the semantics of -fprofile-{generate,use}=path, making it
incompatible with ccache’s original implementation.

One crucial problem with the implementation is that there is no error
handling when the expected profiling data file cannot be found. This
means that there will be false positives cache hits for Clang and GCC
9+.

Fix this by:

* Checking for different profiling data file locations to handle
  different compilers and versions.
* Bailing out if no profiling data file can be found.

Also:

* Implemented support for Clang’s -fprofile-instr-{generate,use}[=path]
  options.
* Implemented support for -fauto-profile[=path].
* Removed the conversion of absolute path to the profile directory.
  91a2954e says that the directory is rewritten to increase the hit
  rate, but I don’t understand how that could be the case.
* Added tests for the profiling options. Exception:
  -fauto-profile[=path], since that would require running the perf tool.

Fixes #582.

(cherry picked from commit c9fdcef576dd13a2ea2355bcd866b5c561cb1562)

5 years agoWhitelist clang-tidy warning cppcoreguidelines-pro-type-const-cast
Joel Rosdahl [Mon, 27 Apr 2020 16:23:56 +0000 (18:23 +0200)] 
Whitelist clang-tidy warning cppcoreguidelines-pro-type-const-cast

We’re using const_cast for the argument argv to execve(2) which doesn’t
modify the argument.

5 years agoDon’t construct std::string from nullptr
Joel Rosdahl [Mon, 27 Apr 2020 16:14:45 +0000 (18:14 +0200)] 
Don’t construct std::string from nullptr

As suggested by clang-tidy.

5 years agoUse empty() to check for emptiness
Joel Rosdahl [Mon, 27 Apr 2020 16:13:38 +0000 (18:13 +0200)] 
Use empty() to check for emptiness

As suggested by clang-tidy.

5 years agoWork around false positive clang-tidy warning about redundant .c_str()
Joel Rosdahl [Mon, 27 Apr 2020 15:01:57 +0000 (17:01 +0200)] 
Work around false positive clang-tidy warning about redundant .c_str()

5 years agoRemove redundant .c_str() calls
Joel Rosdahl [Mon, 27 Apr 2020 15:01:49 +0000 (17:01 +0200)] 
Remove redundant .c_str() calls

As suggested by clang-tidy.

5 years agoHandle self-assignment in Args::operator=
Joel Rosdahl [Mon, 27 Apr 2020 14:52:13 +0000 (16:52 +0200)] 
Handle self-assignment in Args::operator=

As suggested by clang-tidy.

5 years agoAdd noexcept to Args move constructor/operator=
Joel Rosdahl [Mon, 27 Apr 2020 14:39:02 +0000 (16:39 +0200)] 
Add noexcept to Args move constructor/operator=

As suggested by clang-tidy.

5 years agoClean up version output test
Joel Rosdahl [Sun, 26 Apr 2020 19:39:24 +0000 (21:39 +0200)] 
Clean up version output test

5 years agoMention the “always use curly braces” convention in CONTRIBUTING.md
Joel Rosdahl [Sun, 26 Apr 2020 18:59:44 +0000 (20:59 +0200)] 
Mention the “always use curly braces” convention in CONTRIBUTING.md

5 years agoFix syntax of src/.clang-tidy
Joel Rosdahl [Sun, 26 Apr 2020 18:25:52 +0000 (20:25 +0200)] 
Fix syntax of src/.clang-tidy

5 years agoIndent .sh files with 4 spaces
Joel Rosdahl [Tue, 21 Apr 2020 19:05:05 +0000 (21:05 +0200)] 
Indent .sh files with 4 spaces

5 years agoDisable hardlink testing on AFS (#584)
megatesla [Sun, 26 Apr 2020 18:19:51 +0000 (13:19 -0500)] 
Disable hardlink testing on AFS (#584)

AFS sort of supports hardlinks, but not really - you can only hardlink
within directories, not across them. This means that the hardlink test
suite probe will pass, but ccache is unable to create hardlinks to its
cache directory and the test suite will fail. Modify
SUITE_hardlink_PROBE() to use a cross-directory hardlink to correctly
detect this case.

Co-authored-by: Alexander Lanin <alex@lanin.de>
Co-authored-by: Joel Rosdahl <joel@rosdahl.net>
5 years agoExtract formatting logic from make (#585)
Alexander Lanin [Sun, 26 Apr 2020 18:13:21 +0000 (20:13 +0200)] 
Extract formatting logic from make (#585)

This way it is executable without running configure first.

5 years agoAdd test for human readable version output (#583)
Alexander Lanin [Sun, 26 Apr 2020 18:08:06 +0000 (20:08 +0200)] 
Add test for human readable version output (#583)

5 years agoMake update authors script find Co-authored-by that is not in trailer
Joel Rosdahl [Tue, 21 Apr 2020 18:45:02 +0000 (20:45 +0200)] 
Make update authors script find Co-authored-by that is not in trailer

5 years agoClean up update authors script
Joel Rosdahl [Tue, 21 Apr 2020 18:44:37 +0000 (20:44 +0200)] 
Clean up update authors script

5 years agoDiverse CMake preparations (#580)
Alexander Lanin [Tue, 21 Apr 2020 18:41:48 +0000 (20:41 +0200)] 
Diverse CMake preparations (#580)

* Prepare gitignore for builds in subdirectory
* Ignore to be generated Version.cpp
* Move travis to buildenv as it's just another image
* Move install_cuda out of .travis as it's not travis specific
* Prepare docker images for C++ and CMake
* Update authors + add script to do so
* Fix required C compiler
* Fix some formatting issues with clang-format 10

5 years agoRemove obsolete unittest/test_lockfile.cpp
Joel Rosdahl [Tue, 21 Apr 2020 18:00:11 +0000 (20:00 +0200)] 
Remove obsolete unittest/test_lockfile.cpp

It should have been removed in c181fdd9.

Fixes #581. See also #569.

5 years agoMove calculation of “result/manifest globals” into Context
Joel Rosdahl [Sun, 19 Apr 2020 20:35:32 +0000 (22:35 +0200)] 
Move calculation of “result/manifest globals” into Context

5 years agoMake Context a class instead of a struct
Joel Rosdahl [Sun, 19 Apr 2020 20:21:50 +0000 (22:21 +0200)] 
Make Context a class instead of a struct

I like it better that way.

5 years agoRemove unused #include
Joel Rosdahl [Sun, 19 Apr 2020 19:46:20 +0000 (21:46 +0200)] 
Remove unused #include

5 years agoCall update_manifest_file in do_cache_compilation()
Joel Rosdahl [Sun, 19 Apr 2020 14:51:46 +0000 (16:51 +0200)] 
Call update_manifest_file in do_cache_compilation()

This reduces complexity of from_cache() and to_cache() somewhat.

5 years agoC++-ify Context::result_name
Joel Rosdahl [Sun, 19 Apr 2020 14:47:00 +0000 (16:47 +0200)] 
C++-ify Context::result_name

5 years agoC++-ify Context::ignore_headers
Joel Rosdahl [Sat, 18 Apr 2020 16:32:57 +0000 (18:32 +0200)] 
C++-ify Context::ignore_headers