]> git.ipfire.org Git - thirdparty/ccache.git/commitdiff
Revert GCC bug compatibility for -MTarg and -MQarg
authorJoel Rosdahl <joel@rosdahl.net>
Sun, 8 Jan 2012 09:40:17 +0000 (10:40 +0100)
committerJoel Rosdahl <joel@rosdahl.net>
Sun, 8 Jan 2012 09:40:17 +0000 (10:40 +0100)
The bug addressed by commit 8c3039d676d71564e98d50f1ca8ba029d1efa46c has
been fixed in a recent GCC version. Since ccache currently can't change
behavior depending on compiler version, we have to choose the least
troublesome behavior.

ccache.c
test/test_argument_processing.c

index 915138af05d97bd791ce1ce06c15162bab56a1e0..b26591719dfcfb59724ad1990b14ff776c62d0c6 100644 (file)
--- a/ccache.c
+++ b/ccache.c
@@ -1428,6 +1428,7 @@ cc_process_args(struct args *orig_args, struct args **preprocessor_args,
                        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 */
@@ -1439,13 +1440,6 @@ cc_process_args(struct args *orig_args, struct args **preprocessor_args,
                                }
                                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;
                }
index e6de579dccfa2ef4b352fe8049394b9089312ba1..94e46f4ffd7c72bd84d0a31deaf4185d469f8530 100644 (file)
@@ -1,5 +1,5 @@
 /*
- * 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
@@ -197,12 +197,12 @@ TEST(MT_flag_without_immediate_argument_should_not_add_MTobj)
        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;
@@ -215,12 +215,12 @@ TEST(MQ_flag_with_immediate_argument_should_add_MQobj)
        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;