}
if (enable_direct && strncmp(argv[i], "-Wp,", 4) == 0) {
- if (strncmp(argv[i], "-Wp,-MD,", 8) == 0) {
+ if (strncmp(argv[i], "-Wp,-MD,", 8) == 0
+ && !strchr(argv[i] + 8, ',')) {
generating_dependencies = 1;
dependency_filename_specified = 1;
output_dep = make_relative_path(
x_strdup(argv[i] + 8));
- } else if (strncmp(argv[i], "-Wp,-MMD,", 9) == 0) {
+ } else if (strncmp(argv[i], "-Wp,-MMD,", 9) == 0
+ && !strchr(argv[i] + 9, ',')) {
generating_dependencies = 1;
dependency_filename_specified = 1;
output_dep = make_relative_path(
x_strdup(argv[i] + 9));
} else if (enable_direct) {
+ /*
+ * -Wp, can be used to pass too hard options to
+ * the preprocessor. Hence, disable direct
+ * mode.
+ */
cc_log("Unsupported compiler option for direct mode: %s",
argv[i]);
enable_direct = 0;
race condition)
* the unifier is enabled (the environment variable *CCACHE_UNIFY* is set)
* a compiler option unsupported by the direct mode is used
+** Currently, *-Wp,_X_* options are not supported, except if _X_ is
+ *-MD,_path_* or *-MMD,_path_*.
THE PREPROCESSOR MODE
rm -f other.d
+ ##################################################################
+ # Check that -Wp,-MD,file.d,-P disables direct mode.
+ testname="-Wp,-MD,file.d,-P"
+ $CCACHE -z >/dev/null
+ $CCACHE $COMPILER -c -Wp,-MD,/dev/null,-P test.c
+ checkstat 'cache hit (direct)' 0
+ checkstat 'cache hit (preprocessed)' 0
+ checkstat 'cache miss' 1
+
+ $CCACHE $COMPILER -c -Wp,-MD,/dev/null,-P test.c
+ checkstat 'cache hit (direct)' 0
+ checkstat 'cache hit (preprocessed)' 1
+ checkstat 'cache miss' 1
+
+ ##################################################################
+ # Check that -Wp,-MMD,file.d,-P disables direct mode.
+ testname="-Wp,-MDD,file.d,-P"
+ $CCACHE -z >/dev/null
+ $CCACHE $COMPILER -c -Wp,-MMD,/dev/null,-P test.c
+ checkstat 'cache hit (direct)' 0
+ checkstat 'cache hit (preprocessed)' 0
+ checkstat 'cache miss' 1
+
+ $CCACHE $COMPILER -c -Wp,-MMD,/dev/null,-P test.c
+ checkstat 'cache hit (direct)' 0
+ checkstat 'cache hit (preprocessed)' 1
+ checkstat 'cache miss' 1
+
##################################################################
# Test some header modifications to get multiple objects in the manifest.
testname="several objects"