]> git.ipfire.org Git - thirdparty/ccache.git/commitdiff
Include info on CCACHE_CPP2 in hash
authorJoel Rosdahl <joel@rosdahl.net>
Fri, 26 Dec 2014 09:07:25 +0000 (10:07 +0100)
committerJoel Rosdahl <joel@rosdahl.net>
Fri, 26 Dec 2014 09:07:25 +0000 (10:07 +0100)
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
ccache.c
test.sh

index 88c3563e52144f2040d9f4857c664090f9489a42..4876b233658daa8b99daf051c7f41cb42cc78ad8 100644 (file)
--- 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
index f0dca22c7fc76b76ba716c3268241b328c6de5ef..7c12174a0f09690a3d82c64a3cb93335a5093743 100644 (file)
--- 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 d0cc531f3b62c2c130cad6c5ccfb976b2fe69d9a..62854cfd60530a246d630d56f8da38d9ac852b83 100755 (executable)
--- 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