doesn't support that. Compile the source code files separately if possible.
* If ``unsupported compiler option'' has been incremented, enable debug logging
and check which option was rejected.
+* If ``preprocessor error'' has been incremented, one possible reason is that
+ precompiled headers are being used. See <<_precompiled_headers,PRECOMPILED
+ HEADERS>> for how to remedy this.
+* If ``can't use precompiled header'' has been incremented, see
+ <<_precompiled_headers,PRECOMPILED HEADERS>>.
Errors when compiling with ccache
/* Whether the output is a precompiled header */
static bool output_is_precompiled_header = false;
+/*
+ * Whether we are using a precompiled header (either via -include or #include).
+ */
+static bool using_precompiled_header = false;
+
/* How long (in microseconds) to wait before breaking a stale lock. */
unsigned lock_staleness_limit = 2000000;
goto out;
}
- if ((found_pch || found_fpch_preprocess)
- && !(sloppiness & SLOPPY_TIME_MACROS)) {
- cc_log("You have to specify \"time_macros\" sloppiness when using"
- " precompiled headers to get direct hits");
- cc_log("Disabling direct mode");
- enable_direct = false;
+ if (found_pch || found_fpch_preprocess) {
+ using_precompiled_header = true;
+ if (!(sloppiness & SLOPPY_TIME_MACROS)) {
+ cc_log("You have to specify \"time_macros\" sloppiness when using"
+ " precompiled headers to get direct hits");
+ cc_log("Disabling direct mode");
+ stats_update(STATS_CANTUSEPCH);
+ result = false;
+ goto out;
+ }
}
if (explicit_language && str_eq(explicit_language, "none")) {
/* 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();
}
/*
STATS_EMPTYOUTPUT = 24,
STATS_BADEXTRAFILE = 25,
STATS_COMPCHECK = 26,
+ STATS_CANTUSEPCH = 27,
STATS_END
};
{ STATS_TOTALSIZE, "cache size ", display_size , FLAG_NOZERO|FLAG_ALWAYS },
{ STATS_MAXFILES, "max files ", NULL, FLAG_NOZERO },
{ STATS_MAXSIZE, "max cache size ", display_size, FLAG_NOZERO },
+ { STATS_CANTUSEPCH, "can't use precompiled header ", NULL, 0 },
{ STATS_NONE, NULL, NULL, 0 }
};
$CCACHE $COMPILER -c -fpch-preprocess pch.c
checkstat 'cache hit (direct)' 0
checkstat 'cache hit (preprocessed)' 0
- checkstat 'cache miss' 1
- $CCACHE $COMPILER -c -fpch-preprocess pch.c
- checkstat 'cache hit (direct)' 0
- checkstat 'cache hit (preprocessed)' 1
- checkstat 'cache miss' 1
+ checkstat 'cache miss' 0
+ checkstat "can't use precompiled header" 1
testname="-fpch-preprocess, sloppy time macros"
$CCACHE -zC >/dev/null