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;
/* 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();
}
/*
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");
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
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
}
######################################################################