continue;
}
if (str_startswith(argv[i], "-MQ") || str_startswith(argv[i], "-MT")) {
+ dependency_target_specified = true;
args_add(dep_args, argv[i]);
if (strlen(argv[i]) == 3) {
/* -MQ arg or -MT arg */
}
args_add(dep_args, argv[i + 1]);
i++;
- /*
- * Yes, that's right. It's strange, but apparently, GCC behaves
- * differently for -MT arg and -MTarg (and similar for -MQ): in the
- * latter case, but not in the former, an implicit dependency for the
- * object file is added to the dependency file.
- */
- dependency_target_specified = true;
}
continue;
}
/*
- * Copyright (C) 2010-2011 Joel Rosdahl
+ * Copyright (C) 2010-2012 Joel Rosdahl
*
* This program is free software; you can redistribute it and/or modify it
* under the terms of the GNU General Public License as published by the Free
args_free(orig);
}
-TEST(MQ_flag_with_immediate_argument_should_add_MQobj)
+TEST(MQ_flag_with_immediate_argument_should_not_add_MQobj)
{
struct args *orig = args_init_from_string(
"gcc -c -MD -MP -MFfoo.d -MQfoo.d foo.c");
struct args *exp_cpp = args_init_from_string(
- "gcc -c -MD -MP -MFfoo.d -MQfoo.d -MQ foo.o");
+ "gcc -c -MD -MP -MFfoo.d -MQfoo.d");
struct args *exp_cc = args_init_from_string(
"gcc -c");
struct args *act_cpp = NULL, *act_cc = NULL;
args_free(orig);
}
-TEST(MT_flag_with_immediate_argument_should_add_MQobj)
+TEST(MT_flag_with_immediate_argument_should_not_add_MQobj)
{
struct args *orig = args_init_from_string(
"gcc -c -MD -MP -MFfoo.d -MTfoo.d foo.c");
struct args *exp_cpp = args_init_from_string(
- "gcc -c -MD -MP -MFfoo.d -MTfoo.d -MQ foo.o");
+ "gcc -c -MD -MP -MFfoo.d -MTfoo.d");
struct args *exp_cc = args_init_from_string(
"gcc -c");
struct args *act_cpp = NULL, *act_cc = NULL;