From: Andrew Tridgell Date: Thu, 25 Sep 2003 05:49:50 +0000 (+0200) Subject: make sure we hash the cpp extension to ensure we don't mistake a .i X-Git-Tag: v2.3~9 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=bccd81cefce332b33f5ddbf968c18f68a28888d2;p=thirdparty%2Fccache.git make sure we hash the cpp extension to ensure we don't mistake a .i for a .ii --- diff --git a/ccache.c b/ccache.c index 23d572a20..c4d3f695b 100644 --- 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;iargc;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 aca52d4e8..4ff1e3e96 100755 --- 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