mirror of
https://github.com/reactos/ccache.git
synced 2024-12-04 17:56:21 +00:00
Allow preprocessed hits even when using PCH
This commit is contained in:
parent
16c2076733
commit
1d5e983325
19
ccache.c
19
ccache.c
@ -877,7 +877,8 @@ calculate_object_hash(struct args *args, struct mdfour *hash, int direct_mode)
|
||||
to the hash. The theory is that these arguments will change
|
||||
the output of -E if they are going to have any effect at
|
||||
all. For precompiled headers this might not be the case. */
|
||||
if (!direct_mode && !output_is_precompiled_header) {
|
||||
if (!direct_mode && !output_is_precompiled_header
|
||||
&& !using_precompiled_header) {
|
||||
if (compopt_affects_cpp(args->argv[i])) {
|
||||
i++;
|
||||
continue;
|
||||
@ -1830,10 +1831,6 @@ ccache(int argc, char *argv[])
|
||||
/* Add object to manifest later. */
|
||||
put_object_in_manifest = true;
|
||||
}
|
||||
} else if (using_precompiled_header) {
|
||||
cc_log("Direct mode must be enabled when using a precompiled header");
|
||||
stats_update(STATS_CANTUSEPCH);
|
||||
failed();
|
||||
}
|
||||
|
||||
/*
|
||||
@ -1873,16 +1870,8 @@ ccache(int argc, char *argv[])
|
||||
put_object_in_manifest = true;
|
||||
}
|
||||
|
||||
if (using_precompiled_header) {
|
||||
/*
|
||||
* We must avoid a preprocessed hit when using a PCH. Otherwise, we would
|
||||
* get a false hit if the PCH has changed (but the rest of the source has
|
||||
* not) since the preprocessed output doesn't include the PCH content.
|
||||
*/
|
||||
} else {
|
||||
/* if we can return from cache at this point then do */
|
||||
from_cache(FROMCACHE_CPP_MODE, put_object_in_manifest);
|
||||
}
|
||||
/* if we can return from cache at this point then do */
|
||||
from_cache(FROMCACHE_CPP_MODE, put_object_in_manifest);
|
||||
|
||||
if (getenv("CCACHE_READONLY")) {
|
||||
cc_log("Read-only mode; running real compiler");
|
||||
|
33
test.sh
33
test.sh
@ -1669,14 +1669,6 @@ EOF
|
||||
rm -f pch.h
|
||||
backdate pch.h.gch
|
||||
|
||||
testname="preprocessor mode"
|
||||
$CCACHE -Cz >/dev/null
|
||||
CCACHE_NODIRECT=1 CCACHE_SLOPPINESS=time_macros $CCACHE $COMPILER -c -fpch-preprocess pch.c
|
||||
checkstat 'cache hit (direct)' 0
|
||||
checkstat 'cache hit (preprocessed)' 0
|
||||
checkstat 'cache miss' 0
|
||||
checkstat "can't use precompiled header" 1
|
||||
|
||||
testname="no -fpch-preprocess, #include"
|
||||
$CCACHE -Cz >/dev/null
|
||||
$CCACHE $COMPILER -c pch.c 2>/dev/null
|
||||
@ -1731,10 +1723,31 @@ EOF
|
||||
backdate pch.h.gch
|
||||
CCACHE_SLOPPINESS=time_macros $CCACHE $COMPILER -c -fpch-preprocess pch.c
|
||||
checkstat 'cache hit (direct)' 1
|
||||
# Shouldnt' get a preprocessed hit since the preprocessed output doesn't
|
||||
# include the PCH header:
|
||||
checkstat 'cache hit (preprocessed)' 0
|
||||
checkstat 'cache miss' 2
|
||||
|
||||
testname="preprocessor mode"
|
||||
$CCACHE -Cz >/dev/null
|
||||
CCACHE_NODIRECT=1 CCACHE_SLOPPINESS=time_macros $CCACHE $COMPILER -c -fpch-preprocess pch.c
|
||||
checkstat 'cache hit (direct)' 0
|
||||
checkstat 'cache hit (preprocessed)' 0
|
||||
checkstat 'cache miss' 1
|
||||
CCACHE_NODIRECT=1 CCACHE_SLOPPINESS=time_macros $CCACHE $COMPILER -c -fpch-preprocess pch.c
|
||||
checkstat 'cache hit (direct)' 0
|
||||
checkstat 'cache hit (preprocessed)' 1
|
||||
checkstat 'cache miss' 1
|
||||
|
||||
testname="preprocessor mode, file changed"
|
||||
echo "updated" >>pch.h.gch # GCC seems to cope with this...
|
||||
backdate pch.h.gch
|
||||
CCACHE_NODIRECT=1 CCACHE_SLOPPINESS=time_macros $CCACHE $COMPILER -c -fpch-preprocess pch.c
|
||||
checkstat 'cache hit (direct)' 0
|
||||
checkstat 'cache hit (preprocessed)' 1
|
||||
checkstat 'cache miss' 2
|
||||
CCACHE_NODIRECT=1 CCACHE_SLOPPINESS=time_macros $CCACHE $COMPILER -c -fpch-preprocess pch.c
|
||||
checkstat 'cache hit (direct)' 0
|
||||
checkstat 'cache hit (preprocessed)' 2
|
||||
checkstat 'cache miss' 2
|
||||
}
|
||||
|
||||
######################################################################
|
||||
|
Loading…
Reference in New Issue
Block a user