]> git.ipfire.org Git - thirdparty/ccache.git/commitdiff
make sure we hash the cpp extension to ensure we don't mistake a .i
authorAndrew Tridgell <tridge@samba.org>
Thu, 25 Sep 2003 05:49:50 +0000 (07:49 +0200)
committerAndrew Tridgell <tridge@samba.org>
Thu, 25 Sep 2003 05:49:50 +0000 (07:49 +0200)
for a .ii

ccache.c
test.sh

index 23d572a205dad98bc18813081f0ab9b58b464c52..c4d3f695b7fa95f116c5d3a694ac2d2ee29b2f72 100644 (file)
--- a/ccache.c
+++ b/ccache.c
@@ -273,6 +273,10 @@ static void find_hash(ARGS *args)
                hash_string(input_file);
        }
 
+       /* we have to hash the extension, as a .i file isn't treated the same
+          by the compiler as a .ii file */
+       hash_string(i_extension);
+
        /* first the arguments */
        for (i=1;i<args->argc;i++) {
                /* some arguments don't contribute to the hash. The
@@ -353,8 +357,9 @@ static void find_hash(ARGS *args)
                status = execute(args->argv, path_stdout, path_stderr);
                args_pop(args, 2);
        } else {
-               /* we are compiling a .i or .ii file - that means we can skip the cpp stage
-                  and directly form the correct i_tmpfile */
+               /* we are compiling a .i or .ii file - that means we
+                  can skip the cpp stage and directly form the
+                  correct i_tmpfile */
                path_stdout = input_file;
                if (create_empty_file(path_stderr) != 0) {
                        stats_update(STATS_ERROR);
diff --git a/test.sh b/test.sh
index aca52d4e8d3c1bdd4b186c25368e61a5f2ac6ed9..4ff1e3e96a404a7c401b3396a7dd0b2b81bed8df 100755 (executable)
--- a/test.sh
+++ b/test.sh
@@ -220,8 +220,17 @@ basetests() {
     $CCACHE_COMPILE -c test1.i
     checkstat 'cache hit' 10
     checkstat 'cache miss' 38
-    
 
+    testname="direct .ii file"
+    mv test1.i test1.ii
+    $CCACHE_COMPILE -c test1.ii
+    checkstat 'cache hit' 10
+    checkstat 'cache miss' 39
+
+    $CCACHE_COMPILE -c test1.ii
+    checkstat 'cache hit' 11
+    checkstat 'cache miss' 39
+    
     testname="zero-stats"
     $CCACHE -z > /dev/null
     checkstat 'cache hit' 0