From bccd81cefce332b33f5ddbf968c18f68a28888d2 Mon Sep 17 00:00:00 2001 From: Andrew Tridgell Date: Thu, 25 Sep 2003 07:49:50 +0200 Subject: [PATCH] make sure we hash the cpp extension to ensure we don't mistake a .i for a .ii --- ccache.c | 9 +++++++-- test.sh | 11 ++++++++++- 2 files changed, 17 insertions(+), 3 deletions(-) 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 -- 2.47.2