]> git.ipfire.org Git - thirdparty/ccache.git/commit
Include compiler-only arguments in the hash
authorJoel Rosdahl <joel@rosdahl.net>
Tue, 17 Sep 2019 20:37:57 +0000 (22:37 +0200)
committerJoel Rosdahl <joel@rosdahl.net>
Tue, 17 Sep 2019 20:56:29 +0000 (22:56 +0200)
commit25e73c1f51455dca1cb2d0976bf1f577e717de24
tree3d28e492b3f0687bc9982ce0b06ba05c2e984425
parent4642591a0ccb8394e884d18d7c44370b5c2e2e0f
Include compiler-only arguments in the hash

After 5d8585b5 (#312), arguments that are not considered affecting the
preprocessor output won’t be passed to the preprocessor. -Werror and
-Wno-error are also not passed to the preprocessor so that options not
properly marked as “compiler only” will only trigger warnings, not
errors. This was a workaround for Clang complaining about unused
arguments in the preprocessor step performed by ccache.

However, it also introduced a regression: -Werror and the other options
were excluded from the hash as well. This means that

  cc -c file_with_warnings.c

would be cached by ccache, including the warning message. A later

  cc -Werror -c file_with_warnings.c

call would then be a cache hit, resulting in a compilation warning
instead of an error.

This commit fixes the problem by also including the compiler-only
arguments in the hash.

(cherry picked from commit 6be00a0070d3898fe7201f6db44a9a3c42627bf8)
src/ccache.cpp
src/ccache.hpp
test/suites/base.bash
unittest/test_argument_processing.cpp