From 41d9f24c7b7fad7f2c5c4c805d80516446bd3ffa Mon Sep 17 00:00:00 2001 From: Joel Rosdahl Date: Sun, 8 Jan 2012 10:40:17 +0100 Subject: [PATCH] Revert GCC bug compatibility for -MTarg and -MQarg 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 | 8 +------- test/test_argument_processing.c | 10 +++++----- 2 files changed, 6 insertions(+), 12 deletions(-) diff --git a/ccache.c b/ccache.c index 915138af0..b26591719 100644 --- 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; } diff --git a/test/test_argument_processing.c b/test/test_argument_processing.c index e6de579dc..94e46f4ff 100644 --- a/test/test_argument_processing.c +++ b/test/test_argument_processing.c @@ -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; -- 2.47.2