]> git.ipfire.org Git - thirdparty/ccache.git/commitdiff
Add support for -MF=arg as understood by EDG-based compilers
authorJoel Rosdahl <joel@rosdahl.net>
Thu, 3 Oct 2019 18:40:06 +0000 (20:40 +0200)
committerJoel Rosdahl <joel@rosdahl.net>
Thu, 3 Oct 2019 18:57:47 +0000 (20:57 +0200)
Closes #460.

(cherry picked from commit d5ff95277932936ed6b3dc1b674562a8682f8aef)

doc/NEWS.adoc
src/ccache.cpp
unittest/test_argument_processing.cpp

index 9f22e7e726eaece0a94dac52b096df53993fe559..52d0b8ad87f7928de08d54d71f11ca8cdb01981e 100644 (file)
@@ -38,6 +38,13 @@ ccache 3.7.5
 ------------
 Release date: TBD
 
+New features
+~~~~~~~~~~~~
+
+- Added support for `-MF=arg` (with an extra equal sign) as understood by
+  EDG-based compilers.
+
+
 Bug fixes
 ~~~~~~~~~
 
index ba26a934f2bf961fa3b1d4590f09fe34149bf2da..f5834204f47ae1f5cef26a87a8d54f665382dfb7 100644 (file)
@@ -2683,8 +2683,11 @@ cc_process_args(struct args* args,
         arg = argv[i + 1];
         i++;
       } else {
-        // -MFarg
+        // -MFarg or -MF=arg (EDG-based compilers)
         arg = &argv[i][3];
+        if (arg[0] == '=') {
+          ++arg;
+        }
       }
       output_dep = make_relative_path(x_strdup(arg));
       // Keep the format of the args the same.
index 70818993c109fff6a02e5187cce16ae31aef85a9..24f4cb2193c3abfb7dbe660e470614486d02f5b9 100644 (file)
@@ -203,6 +203,21 @@ TEST(MQ_flag_should_be_added_for_non_standard_obj_extension)
   args_free(orig);
 }
 
+TEST(equal_sign_after_MF_should_be_removed)
+{
+  struct args* orig = args_init_from_string("cc -c -MF=path foo.c -o foo.o");
+  struct args* exp_cpp = args_init_from_string("cc -MFpath");
+  struct args* exp_cc = args_init_from_string("cc -c");
+  struct args *act_cpp = NULL, *act_cc = NULL;
+  create_file("foo.c", "");
+
+  CHECK(cc_process_args(orig, &act_cpp, NULL, &act_cc));
+  CHECK_ARGS_EQ_FREE12(exp_cpp, act_cpp);
+  CHECK_ARGS_EQ_FREE12(exp_cc, act_cc);
+
+  args_free(orig);
+}
+
 TEST(sysroot_should_be_rewritten_if_basedir_is_used)
 {
   extern char* current_working_dir;