]> git.ipfire.org Git - thirdparty/ccache.git/commitdiff
Disable direct mode for "-Wp," with multiple preprocessor options
authorJoel Rosdahl <joel@rosdahl.net>
Wed, 28 Sep 2016 20:17:16 +0000 (22:17 +0200)
committerJoel Rosdahl <joel@rosdahl.net>
Wed, 28 Sep 2016 20:17:16 +0000 (22:17 +0200)
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.

NEWS.txt
ccache.c

index 57451a490fdae93be98454b137d389358b4292ee..00b4c202b332043d9658a1be9e673473f54f0376 100644 (file)
--- 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
 ------------
index 5635cc15da8929fc976a9583bbbd09c6ec99e447..ddbc822ec61b3113669ad5f71b995cb53c7d818c 100644 (file)
--- 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) {