]> git.ipfire.org Git - thirdparty/gcc.git/commitdiff
Backport r247371
authorMartin Liska <mliska@suse.cz>
Thu, 22 Jun 2017 11:26:58 +0000 (13:26 +0200)
committerMartin Liska <marxin@gcc.gnu.org>
Thu, 22 Jun 2017 11:26:58 +0000 (11:26 +0000)
2017-06-22  Martin Liska  <mliska@suse.cz>

Backport from mainline
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.

From-SVN: r249528

gcc/ChangeLog
gcc/coverage.c
gcc/coverage.h
gcc/toplev.c

index e92edd5653b75bc56acb9cdad0c1ea5ff16453b1..e4f023f03c014f6a2c54a606da1bf0f68eb9aab7 100644 (file)
@@ -1,3 +1,13 @@
+2017-06-22  Martin Liska  <mliska@suse.cz>
+
+       Backport from mainline
+       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.
+
 2017-06-09  David S. Miller  <davem@davemloft.net>
 
        PR target/80968
index 661e44113241e63e11d3e8cbb8b67b6837079d5d..200c8633e543a18dd6446f5fcdeddc793be3d261 100644 (file)
@@ -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.  */
 
index bac242fd5a4295cee551ae9d6f29b07084d31e65..0ce4a46a3bae574ca1475ad5a9ddbdab5527c6de 100644 (file)
@@ -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.  */
index c565ea4797e383ddafbdd2504f23e3ed77447606..17d051210267b3dee94fddde12f1cc7aad89bbe1 100644 (file)
@@ -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 ();