]> git.ipfire.org Git - thirdparty/gcc.git/commitdiff
Backport r247371
authorMartin Liska <mliska@suse.cz>
Thu, 22 Jun 2017 11:16:39 +0000 (13:16 +0200)
committerMartin Liska <marxin@gcc.gnu.org>
Thu, 22 Jun 2017 11:16:39 +0000 (11:16 +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: r249515

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

index f45acbc5a78ebef5db9582842116f05559ab3cf4..3ecffefb36fed7218fa656208e377fe48b696f63 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-22  Martin Liska  <mliska@suse.cz>
 
        Backport from mainline
index b1fce7d0e7a462ef94c8973aab2bc43f5113bd0d..7ee37aa2955891cda8fda0bc450d360a6ffa5be5 100644 (file)
@@ -725,6 +725,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 39e48ce38f5c5ba47ade2bbf5b4fe02ca6343b2c..e0ff0fb08c349ae31192734e9502b40469fd6ca9 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 59604e56195bc180b95da9095e444f396816ad6b..3d4137b7c7b91490e63c3e0620058bd6f65b47c9 100644 (file)
@@ -1926,6 +1926,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 ();