From patchwork Thu Jan 26 20:32:44 2012 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Diego Novillo X-Patchwork-Id: 138034 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 46A82B6F68 for ; Fri, 27 Jan 2012 07:33:03 +1100 (EST) Comment: DKIM? See http://www.dkim.org DKIM-Signature: v=1; a=rsa-sha1; c=relaxed/relaxed; d=gcc.gnu.org; s=default; x=1328214784; h=Comment: DomainKey-Signature:Received:Received:Received:Received:Received: Received:Received:Received:Received:To:Subject:Message-Id:Date: From:Mailing-List:Precedence:List-Id:List-Unsubscribe: List-Archive:List-Post:List-Help:Sender:Delivered-To; bh=hcf5uWr /MBfgoq6W3w+aSOdsCAE=; b=Jg+/5uHkWvhdgSMD+2ShxaBcVntK8P21RbTZl4m yuxE51QEU6MKMmRYcwZTFZZhoTTGjsAiR3o7sfQDwuIUlbsk3HJyKKLQhuNVTXiR /fU5xa4PmsGlUDgvyuRh8wfhvPVJSu+DU8W6gAZp3//MakmSG0fWKJWd3cVqqBdF hljo= Comment: DomainKeys? See http://antispam.yahoo.com/domainkeys DomainKey-Signature: a=rsa-sha1; q=dns; c=nofws; s=default; d=gcc.gnu.org; h=Received:Received:X-SWARE-Spam-Status:X-Spam-Check-By:Received:Received:Received:Received:Received:Received:Received:To:Subject:Message-Id:Date:From:X-IsSubscribed:Mailing-List:Precedence:List-Id:List-Unsubscribe:List-Archive:List-Post:List-Help:Sender:Delivered-To; b=pAwy74Wo04lu95gVKxN3un180VQIlRa3u+SlXE8ohkjPiTSF0+DWZRLW4lJf1m bqdR0ubndPDGIcUEuqxlR3w61YBwn1h5e5cevmwxFv34SsFnIHRp7OuGSC5wk+OD drQWKZYZ2344moptk6zo7ne3pBnWsKhyqpevhE5RBDLvw=; Received: (qmail 14061 invoked by alias); 26 Jan 2012 20:33:00 -0000 Received: (qmail 14053 invoked by uid 22791); 26 Jan 2012 20:33:00 -0000 X-SWARE-Spam-Status: No, hits=-2.5 required=5.0 tests=AWL, BAYES_00, DKIM_SIGNED, DKIM_VALID, DKIM_VALID_AU, RCVD_IN_DNSWL_LOW, T_RP_MATCHES_RCVD X-Spam-Check-By: sourceware.org Received: from mail-ee0-f73.google.com (HELO mail-ee0-f73.google.com) (74.125.83.73) by sourceware.org (qpsmtpd/0.43rc1) with ESMTP; Thu, 26 Jan 2012 20:32:47 +0000 Received: by eekb57 with SMTP id b57so57987eek.2 for ; Thu, 26 Jan 2012 12:32:46 -0800 (PST) Received: by 10.14.10.28 with SMTP id 28mr833852eeu.7.1327609966277; Thu, 26 Jan 2012 12:32:46 -0800 (PST) Received: by 10.14.10.28 with SMTP id 28mr833839eeu.7.1327609966155; Thu, 26 Jan 2012 12:32:46 -0800 (PST) Received: from hpza9.eem.corp.google.com ([74.125.121.33]) by gmr-mx.google.com with ESMTPS id u2si3539240eeb.2.2012.01.26.12.32.46 (version=TLSv1/SSLv3 cipher=AES128-SHA); Thu, 26 Jan 2012 12:32:46 -0800 (PST) Received: from tobiano.tor.corp.google.com (tobiano.tor.corp.google.com [172.29.41.6]) by hpza9.eem.corp.google.com (Postfix) with ESMTP id F04485C0050; Thu, 26 Jan 2012 12:32:45 -0800 (PST) Received: by tobiano.tor.corp.google.com (Postfix, from userid 54752) id 10A4AAE1D4; Thu, 26 Jan 2012 15:32:44 -0500 (EST) To: reply@codereview.appspotmail.com, crowl@google.com, gcc-patches@gcc.gnu.org Subject: [pph] Disable PPH generation if there are errors (issue5580043) Message-Id: <20120126203245.10A4AAE1D4@tobiano.tor.corp.google.com> Date: Thu, 26 Jan 2012 15:32:44 -0500 (EST) From: dnovillo@google.com (Diego Novillo) 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 A small fixlet to deal with files that have errors in them. When we are about to generate PPH output, we check if there have been errors emitted for the file. If so, we disable PPH generation. Testing this, I found that we were not clearing pph_out_stream when disabling PPH. Fixed. 2012-01-26 Diego Novillo * pph-core.c (pph_stream_close_1): Add a newline to fprintf call. (pph_finish): If there were errors during compilation, disable PPH generation. * pph-out.c (pph_disable_output): Also set pph_out_stream to NULL. --- This patch is available for review at http://codereview.appspot.com/5580043 diff --git a/gcc/cp/pph-core.c b/gcc/cp/pph-core.c index a9a8bc2..3f958de 100644 --- a/gcc/cp/pph-core.c +++ b/gcc/cp/pph-core.c @@ -1190,7 +1190,7 @@ pph_stream_close_1 (pph_stream *stream, bool flush_p) if (stream->write_p && !flush_p) { if (flag_pph_tracer >= 1) - fprintf (pph_logfile, "PPH: Removing %s", stream->name); + fprintf (pph_logfile, "PPH: Removing %s\n", stream->name); unlink (stream->name); } @@ -1423,6 +1423,10 @@ pph_streamer_finish (void) void pph_finish (void) { + /* If we found errors during compilation, disable PPH generation. */ + if (errorcount || sorrycount) + pph_disable_output (); + /* Finalize the streamer. */ pph_streamer_finish (); diff --git a/gcc/cp/pph-out.c b/gcc/cp/pph-out.c index f7839d2..69530aa 100644 --- a/gcc/cp/pph-out.c +++ b/gcc/cp/pph-out.c @@ -2847,6 +2847,7 @@ pph_disable_output (void) pph_stream_close_no_flush (pph_out_stream); pph_out_file = NULL; + pph_out_stream = NULL; } #include "gt-cp-pph-out.h"