summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJoel Rosdahl <joel@rosdahl.net>2016-09-28 22:17:16 +0200
committerJoel Rosdahl <joel@rosdahl.net>2016-09-28 22:17:16 +0200
commit3ba2ca78f9bad5b432b3ebe7095bd8bffbdf8a30 (patch)
tree7648335d9c0a14dc0068697f39f86a74c554ef54
parentde911861b060faa990f3005baf70afe5eb9662a1 (diff)
downloadccache-3ba2ca78f9bad5b432b3ebe7095bd8bffbdf8a30.tar.gz
Disable direct mode for "-Wp," with multiple preprocessor options
This fixes a regression in ccache 3.2.8/3.3.1 (commit 026ba6b9): ccache could get confused when using the compiler option -Wp, to pass multiple options to the preprocessor, resulting in missing dependency files from direct mode cache hits. Closes #133.
-rw-r--r--NEWS.txt10
-rw-r--r--ccache.c12
2 files changed, 19 insertions, 3 deletions
diff --git a/NEWS.txt b/NEWS.txt
index 57451a49..00b4c202 100644
--- a/NEWS.txt
+++ b/NEWS.txt
@@ -1,6 +1,16 @@
ccache news
===========
+Unreleased 3.2.9
+----------------
+
+Bug fixes
+~~~~~~~~~
+
+- Fixed a regression in ccache 3.2.8: ccache could get confused when using the
+ compiler option `-Wp,` to pass multiple options to the preprocessor,
+ resulting in missing dependency files from direct mode cache hits.
+
ccache 3.2.8
------------
diff --git a/ccache.c b/ccache.c
index 5635cc15..ddbc822e 100644
--- a/ccache.c
+++ b/ccache.c
@@ -2249,9 +2249,15 @@ cc_process_args(struct args *args, struct args **preprocessor_args,
output_dep = make_relative_path(x_strdup(argv[i] + 9));
args_add(dep_args, argv[i]);
continue;
- } else if (str_startswith(argv[i], "-Wp,-M")) {
- /* -MF, -MP, -MQ, -MT, etc. TODO: Make argument to MF/MQ/MT
- * relative. */
+ } else if (str_eq(argv[i], "-Wp,-MP")
+ || (strlen(argv[i]) > 8
+ && str_startswith(argv[i], "-Wp,-M")
+ && argv[i][7] == ','
+ && (argv[i][6] == 'F'
+ || argv[i][6] == 'Q'
+ || argv[i][6] == 'T')
+ && !strchr(argv[i] + 8, ','))) {
+ /* TODO: Make argument to MF/MQ/MT relative. */
args_add(dep_args, argv[i]);
continue;
} else if (conf->direct_mode) {