diff mbox

Backports to GCC 5.x

Message ID 40588684-e40f-44ca-31f1-0faaecc4c243@suse.cz
State New
Headers show

Commit Message

Martin Liška June 22, 2017, 11:23 a.m. UTC
Hello.

I'm going to install the very same set of patches as for GCC 6.x except first 4 patches
to ipa-visibility.c. These will be more complicated to backport.

Martin
diff mbox

Patch

From 876c4e9ae6d39f046cc58de3c114cd24d618bc5c Mon Sep 17 00:00:00 2001
From: marxin <marxin@138bc75d-0d04-0410-961f-82ee72b054a4>
Date: Fri, 28 Apr 2017 12:50:08 +0000
Subject: [PATCH 01/11] Backport r247371

gcc/ChangeLog:

2017-04-28  Martin Liska  <mliska@suse.cz>

	PR driver/56469
	* coverage.c (coverage_remove_note_file): New function.
	* coverage.h: Declare the function.
	* toplev.c (finalize): Clean if an error has been seen.
---
 gcc/coverage.c | 12 ++++++++++++
 gcc/coverage.h |  1 +
 gcc/toplev.c   |  3 +++
 3 files changed, 16 insertions(+)

diff --git a/gcc/coverage.c b/gcc/coverage.c
index 661e4411324..200c8633e54 100644
--- a/gcc/coverage.c
+++ b/gcc/coverage.c
@@ -767,6 +767,18 @@  coverage_end_function (unsigned lineno_checksum, unsigned cfg_checksum)
     }
 }
 
+/* Remove coverage file if opened.  */
+
+void
+coverage_remove_note_file (void)
+{
+  if (bbg_file_name)
+    {
+      gcov_close ();
+      unlink (bbg_file_name);
+    }
+}
+
 /* Build a coverage variable of TYPE for function FN_DECL.  If COUNTER
    >= 0 it is a counter array, otherwise it is the function structure.  */
 
diff --git a/gcc/coverage.h b/gcc/coverage.h
index bac242fd5a4..0ce4a46a3ba 100644
--- a/gcc/coverage.h
+++ b/gcc/coverage.h
@@ -24,6 +24,7 @@  along with GCC; see the file COPYING3.  If not see
 
 extern void coverage_init (const char *);
 extern void coverage_finish (void);
+extern void coverage_remove_note_file (void);
 
 /* Start outputting coverage information for the current
    function.  */
diff --git a/gcc/toplev.c b/gcc/toplev.c
index c565ea4797e..17d05121026 100644
--- a/gcc/toplev.c
+++ b/gcc/toplev.c
@@ -1999,6 +1999,9 @@  finalize (bool no_backend)
   if (stack_usage_file)
     fclose (stack_usage_file);
 
+  if (seen_error ())
+    coverage_remove_note_file ();
+
   if (!no_backend)
     {
       statistics_fini ();
-- 
2.13.1