From d5ff95277932936ed6b3dc1b674562a8682f8aef Mon Sep 17 00:00:00 2001 From: Joel Rosdahl Date: Thu, 3 Oct 2019 20:40:06 +0200 Subject: [PATCH] Add support for -MF=arg as understood by EDG-based compilers Closes #460. --- doc/NEWS.adoc | 7 +++++++ src/ccache.c | 5 ++++- unittest/test_argument_processing.c | 15 +++++++++++++++ 3 files changed, 26 insertions(+), 1 deletion(-) diff --git a/doc/NEWS.adoc b/doc/NEWS.adoc index ae195180a..3e180232e 100644 --- a/doc/NEWS.adoc +++ b/doc/NEWS.adoc @@ -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 ~~~~~~~~~ diff --git a/src/ccache.c b/src/ccache.c index b9f1e479a..533a5de77 100644 --- a/src/ccache.c +++ b/src/ccache.c @@ -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. diff --git a/unittest/test_argument_processing.c b/unittest/test_argument_processing.c index b6c7476a8..6eceb78bc 100644 --- a/unittest/test_argument_processing.c +++ b/unittest/test_argument_processing.c @@ -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"); -- 2.47.3