]> 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:40:06 +0000 (20:40 +0200)
Closes #460.

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

index ae195180a003b2c7b96f3352631b349dbb0307c0..3e180232eb30ee8c055802349901a34703d9ccc5 100644 (file)
@@ -5,6 +5,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 b9f1e479a76e85e87e6651cb8e3aded9b3516077..533a5de77526427d7e334bd5a47c1e4615325615 100644 (file)
@@ -2830,8 +2830,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 b6c7476a857b83f2ded4579d01c5904d9a20f4e7..6eceb78bca7a033794d5be5af888db6fc14f2536 100644 (file)
@@ -188,6 +188,21 @@ TEST(MQ_flag_should_not_be_added_for_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(MQ_flag_should_be_added_for_non_standard_obj_extension)
 {
        struct args *orig = args_init_from_string("cc -c -MD foo.c -o foo.obj");