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 <dnovi...@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