diff options
author | Joel Rosdahl <joel@rosdahl.net> | 2019-05-01 14:51:45 +0200 |
---|---|---|
committer | Joel Rosdahl <joel@rosdahl.net> | 2019-05-01 14:51:45 +0200 |
commit | eb26a87e8630f4ef78fe3c07fcd180c05c188f1a (patch) | |
tree | 83638f5d95f5ee95fd3e6068ceff3ac5507301e7 | |
parent | 0ea7e381d4a0ac41c1de728675f89cea0093b8cb (diff) | |
download | ccache-eb26a87e8630f4ef78fe3c07fcd180c05c188f1a.tar.gz |
Improve fix in #400 to handle more cases
The dependency file name can come from e.g. DEPENDENCIES_OUTPUT as well,
so hash information about a /dev/null .d file after the argument
processing loop instead.
-rw-r--r-- | src/ccache.c | 9 | ||||
-rw-r--r-- | test/suites/direct_gcc.bash | 13 |
2 files changed, 19 insertions, 3 deletions
diff --git a/src/ccache.c b/src/ccache.c index 2d2a96eb..251783ac 100644 --- a/src/ccache.c +++ b/src/ccache.c @@ -2049,9 +2049,6 @@ calculate_object_hash(struct args *args, struct hash *hash, int direct_mode) // Next argument is dependency name, so skip it. i++; } - } else { - // Hash that we don't have a .d file. - hash_string(hash, output_dep); } continue; } @@ -2112,6 +2109,12 @@ calculate_object_hash(struct args *args, struct hash *hash, int direct_mode) } } + // Make results with dependency file /dev/null different from those without + // it. + if (generating_dependencies && str_eq(output_dep, "/dev/null")) { + hash_delimiter(hash, "/dev/null dependency file"); + } + if (!found_ccbin && str_eq(actual_language, "cuda")) { hash_nvcc_host_compiler(hash, NULL, NULL); } diff --git a/test/suites/direct_gcc.bash b/test/suites/direct_gcc.bash index 4eb9bf6b..ad5b490d 100644 --- a/test/suites/direct_gcc.bash +++ b/test/suites/direct_gcc.bash @@ -139,4 +139,17 @@ SUITE_direct_gcc() { expect_stat 'cache miss' 1 expect_equal_files different_name.d expected_sunpro_dependencies_target.d expect_equal_object_files reference_test.o test.o + + # ------------------------------------------------------------------------- + TEST "DEPENDENCIES_OUTPUT environment variable set to /dev/null" + + DEPENDENCIES_OUTPUT="/dev/null" $CCACHE_COMPILE -c test.c + expect_stat 'cache hit (direct)' 0 + expect_stat 'cache hit (preprocessed)' 0 + expect_stat 'cache miss' 1 + + DEPENDENCIES_OUTPUT="other.d" $CCACHE_COMPILE -c test.c + expect_stat 'cache hit (direct)' 0 + expect_stat 'cache hit (preprocessed)' 0 + expect_stat 'cache miss' 2 } |