race condition)
* the unifier is enabled (the configuration setting *unify* is true)
* a compiler option not supported by the direct mode is used:
-** a *-Wp,_X_* compiler option other than *-Wp,-MD,_path_* and
- *-Wp,-MMD,_path_*
+** a *-Wp,_X_* compiler option other than *-Wp,-MD,_path_*,
+ *-Wp,-MMD,_path_* and *-Wp,-D_define_*
** *-Xpreprocessor*
* the string ``\_\_TIME__'' is present in the source code
** Compiler arguments that are hashed in the direct mode but not in the
preprocessor mode have changed (*-I*, *-include*, *-D*, etc) and they didn't
affect the preprocessor output.
-** The compiler option *-Xpreprocessor* or *-Wp,_X_* (except *-Wp,-MD,_path_*
- and *Wp,-MMD,_path_*) is used.
+** The compiler option *-Xpreprocessor* or *-Wp,_X_* (except *-Wp,-MD,_path_*,
+ *-Wp,-MMD,_path_*, and *-Wp,-D_define_*) is used.
** This was the first compilation with a new value of the base directory
setting.
** A modification time of one of the include files is too new (created the same
- Improved parsing of `-g*` options.
+- Made ccache understand `-Wp,-D*` options.
+
Bug fixes
~~~~~~~~~
output_dep = make_relative_path(x_strdup(argv[i] + 9));
args_add(dep_args, argv[i]);
continue;
+ } else if (str_startswith(argv[i], "-Wp,-D")
+ && !strchr(argv[i] + 6, ',')) {
+ /* Treat it like -D */
+ args_add(dep_args, argv[i] + 4);
+ continue;
} else if (conf->direct_mode) {
/*
* -Wp, can be used to pass too hard options to
checkstat 'cache miss' 0
checkstat 'unsupported compiler option' 4
+ ##################################################################
+ # Check that -Wp,-D works
+ testname="-Wp,-D"
+ $CCACHE -Cz >/dev/null
+ $CCACHE_COMPILE -c -Wp,-DFOO test1.c
+ checkstat 'cache hit (direct)' 0
+ checkstat 'cache hit (preprocessed)' 0
+ checkstat 'cache miss' 1
+ $CCACHE_COMPILE -c -DFOO test1.c
+ checkstat 'cache hit (direct)' 0
+ checkstat 'cache hit (preprocessed)' 1
+ checkstat 'cache miss' 1
+ $CCACHE_COMPILE -c -Wp,-DFOO,-P test1.c
+ checkstat 'cache hit (direct)' 0
+ checkstat 'cache hit (preprocessed)' 1
+ checkstat 'cache miss' 2
+
##################################################################
if [ $COMPILER_TYPE_CLANG -eq 1 ]; then
rm -f different_name.d
+ ##################################################################
+ # Check that -Wp,-D works
+ testname="-Wp,-D"
+ $CCACHE -Cz >/dev/null
+ $CCACHE_COMPILE -c -Wp,-DFOO test.c
+ checkstat 'cache hit (direct)' 0
+ checkstat 'cache hit (preprocessed)' 0
+ checkstat 'cache miss' 1
+ $CCACHE_COMPILE -c -DFOO test.c
+ checkstat 'cache hit (direct)' 1
+ checkstat 'cache hit (preprocessed)' 0
+ checkstat 'cache miss' 1
+ $CCACHE_COMPILE -c -Wp,-DFOO,-P test.c
+ checkstat 'cache hit (direct)' 1
+ checkstat 'cache hit (preprocessed)' 0
+ checkstat 'cache miss' 2
+
##################################################################
# Test some header modifications to get multiple objects in the manifest.
testname="several objects"