From d2786183f35efe33c2230c68c70b1a911e89f89e Mon Sep 17 00:00:00 2001 From: Joel Rosdahl Date: Fri, 26 Dec 2014 10:07:25 +0100 Subject: [PATCH] Include info on CCACHE_CPP2 in hash Made hash of cached result created with and without CCACHE_CPP2 different. This makes it possible to rebuild with CCACHE_CPP2 set without having to clear the cache to get new results. --- NEWS.txt | 11 +++++++++++ ccache.c | 2 ++ test.sh | 17 +++++++++++------ 3 files changed, 24 insertions(+), 6 deletions(-) diff --git a/NEWS.txt b/NEWS.txt index 88c3563e5..4876b2336 100644 --- a/NEWS.txt +++ b/NEWS.txt @@ -2,6 +2,17 @@ ccache news =========== +Unreleased +---------- + +Bug fixes +~~~~~~~~~ + +- Made hash of cached result created with and without `CCACHE_CPP2` different. + This makes it possible to rebuild with `CCACHE_CPP2` set without having to + clear the cache to get new results. + + ccache 3.1.10 ------------- Release date: 2014-10-19 diff --git a/ccache.c b/ccache.c index f0dca22c7..7c12174a0 100644 --- a/ccache.c +++ b/ccache.c @@ -878,6 +878,8 @@ get_object_name_from_cpp(struct args *args, struct mdfour *hash) */ cpp_stderr = path_stderr; } else { + hash_delimiter(hash, "runsecondcpp"); + hash_string(hash, "false"); free(path_stderr); } diff --git a/test.sh b/test.sh index d0cc531f3..62854cfd6 100755 --- a/test.sh +++ b/test.sh @@ -245,10 +245,10 @@ base_tests() { checkstat 'cache hit (preprocessed)' 5 checkstat 'cache miss' 4 - # strictly speaking should be 3 - RECACHE causes a double counting! + # strictly speaking should be 4 - RECACHE causes a double counting! checkstat 'files in cache' 4 $CCACHE -c > /dev/null - checkstat 'files in cache' 3 + checkstat 'files in cache' 4 testname="CCACHE_HASHDIR" CCACHE_HASHDIR=1 $CCACHE_COMPILE -c test1.c -O -O @@ -258,7 +258,7 @@ base_tests() { CCACHE_HASHDIR=1 $CCACHE_COMPILE -c test1.c -O -O checkstat 'cache hit (preprocessed)' 6 checkstat 'cache miss' 5 - checkstat 'files in cache' 4 + checkstat 'files in cache' 5 testname="comments" echo '/* a silly comment */' > test1-comment.c @@ -286,7 +286,7 @@ base_tests() { done checkstat 'cache hit (preprocessed)' 8 checkstat 'cache miss' 37 - checkstat 'files in cache' 36 + checkstat 'files in cache' 37 $CCACHE -C >/dev/null @@ -344,9 +344,15 @@ base_tests() { CCACHE_CPP2=1 $CCACHE_COMPILE -c -finput-charset=latin1 latin1.c checkstat 'cache hit (preprocessed)' 14 checkstat 'cache miss' 40 - $CCACHE_COMPILE -c -finput-charset=latin1 latin1.c + CCACHE_CPP2=1 $CCACHE_COMPILE -c -finput-charset=latin1 latin1.c checkstat 'cache hit (preprocessed)' 15 checkstat 'cache miss' 40 + $CCACHE_COMPILE -c -finput-charset=latin1 latin1.c + checkstat 'cache hit (preprocessed)' 15 + checkstat 'cache miss' 41 + $CCACHE_COMPILE -c -finput-charset=latin1 latin1.c + checkstat 'cache hit (preprocessed)' 16 + checkstat 'cache miss' 41 fi fi @@ -1892,7 +1898,6 @@ all_suites=" base link !win32 hardlink -cpp2 nlevels4 nlevels1 basedir !win32 -- 2.47.2