From patchwork Wed Feb 2 14:41:48 2011 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Diego Novillo X-Patchwork-Id: 81459 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Received: from sourceware.org (server1.sourceware.org [209.132.180.131]) by ozlabs.org (Postfix) with SMTP id 43FFBB70E9 for ; Thu, 3 Feb 2011 01:42:02 +1100 (EST) Received: (qmail 7952 invoked by alias); 2 Feb 2011 14:42:00 -0000 Received: (qmail 7944 invoked by uid 22791); 2 Feb 2011 14:41:59 -0000 X-SWARE-Spam-Status: No, hits=-0.4 required=5.0 tests=AWL, BAYES_00, DKIM_SIGNED, DKIM_VALID, DKIM_VALID_AU, MEDICAL_SUBJECT, RCVD_IN_DNSWL_LOW, SPF_HELO_PASS, T_RP_MATCHES_RCVD X-Spam-Check-By: sourceware.org Received: from smtp-out.google.com (HELO smtp-out.google.com) (74.125.121.67) by sourceware.org (qpsmtpd/0.43rc1) with ESMTP; Wed, 02 Feb 2011 14:41:52 +0000 Received: from hpaq5.eem.corp.google.com (hpaq5.eem.corp.google.com [172.25.149.5]) by smtp-out.google.com with ESMTP id p12EfnnT024259 for ; Wed, 2 Feb 2011 06:41:49 -0800 Received: from iwn6 (iwn6.prod.google.com [10.241.68.70]) by hpaq5.eem.corp.google.com with ESMTP id p12EfQ0I020759 (version=TLSv1/SSLv3 cipher=RC4-MD5 bits=128 verify=NOT) for ; Wed, 2 Feb 2011 06:41:48 -0800 Received: by iwn6 with SMTP id 6so16312iwn.7 for ; Wed, 02 Feb 2011 06:41:48 -0800 (PST) MIME-Version: 1.0 Received: by 10.42.166.3 with SMTP id m3mr255293icy.36.1296657708016; Wed, 02 Feb 2011 06:41:48 -0800 (PST) Reply-To: dnovillo@google.com, gcc-patches@gcc.gnu.org, simonb@google.com, reply@codereview.appspotmail.com X-Google-Appengine-App-Id: codereview Message-ID: <90e6ba6e8cd214e717049b4da60b@google.com> Date: Wed, 02 Feb 2011 14:41:48 +0000 Subject: [google] Work around build system bug in handling of -MD (issue3981053) From: dnovillo@google.com To: gcc-patches@gcc.gnu.org, simonb@google.com Cc: reply@codereview.appspotmail.com X-System-Of-Record: true X-IsSubscribed: yes Mailing-List: contact gcc-patches-help@gcc.gnu.org; run by ezmlm Precedence: bulk List-Id: List-Unsubscribe: List-Archive: List-Post: List-Help: Sender: gcc-patches-owner@gcc.gnu.org Delivered-To: mailing list gcc-patches@gcc.gnu.org Reviewers: gcc-patches_gcc.gnu.org, simonb_google.com, Description: Google's build system has always assumed that -MD always produces output. This is an outstanding bug that for now is easier to work around with this hack. Tested on x86_64. Committed on google/integration. 2011-02-02 Diego Novillo * c-family/c-opts.c (c_common_finish): Emit deps even if the file has syntax errors. diff --git a/gcc/c-family/c-opts.c b/gcc/c-family/c-opts.c index befd644..e116921 100644 --- a/gcc/c-family/c-opts.c +++ b/gcc/c-family/c-opts.c @@ -1093,7 +1093,11 @@ c_common_finish (void) FILE *deps_stream = NULL; /* Don't write the deps file if there are errors. */ - if (cpp_opts->deps.style != DEPS_NONE && !seen_error ()) + /* FIXME. We are emitting the deps file even if there were errors. + This is a temporary workaround to avoid confusing Google's build + system. It assumes that deps files are always emitted even + in the presence of errors. */ + if (cpp_opts->deps.style != DEPS_NONE /*&& !seen_error ()*/) { /* If -M or -MM was seen without -MF, default output to the output stream. */ Please review this at http://codereview.appspot.com/3981053/ Affected files: M gcc/c-family/c-opts.c Index: gcc/c-family/c-opts.c diff --git a/gcc/c-family/c-opts.c b/gcc/c-family/c-opts.c index befd64498a4bc87400a8d5e4d2001512f6ac2154..e11692116fecac0842809d820049bd6c08f81e4e 100644 --- a/gcc/c-family/c-opts.c +++ b/gcc/c-family/c-opts.c @@ -1093,7 +1093,11 @@ c_common_finish (void) FILE *deps_stream = NULL; /* Don't write the deps file if there are errors. */ - if (cpp_opts->deps.style != DEPS_NONE && !seen_error ()) + /* FIXME. We are emitting the deps file even if there were errors. + This is a temporary workaround to avoid confusing Google's build + system. It assumes that deps files are always emitted even + in the presence of errors. */ + if (cpp_opts->deps.style != DEPS_NONE /*&& !seen_error ()*/) { /* If -M or -MM was seen without -MF, default output to the output stream. */