public inbox for gcc-patches@gcc.gnu.org
 help / color / mirror / Atom feed
* [pph] Disable PPH generation if there are errors (issue5580043)
@ 2012-01-26 20:33 Diego Novillo
  0 siblings, 0 replies; only message in thread
From: Diego Novillo @ 2012-01-26 20:33 UTC (permalink / raw)
  To: reply, crowl, gcc-patches


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  <dnovillo@google.com>

	* 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.

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"

--
This patch is available for review at http://codereview.appspot.com/5580043

^ permalink raw reply	[flat|nested] only message in thread

only message in thread, other threads:[~2012-01-26 20:33 UTC | newest]

Thread overview: (only message) (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2012-01-26 20:33 [pph] Disable PPH generation if there are errors (issue5580043) Diego Novillo

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).