]> git.ipfire.org Git - thirdparty/gcc.git/commitdiff
Remove .gcno file when compilation does not success (PR driver/56469).
authorMartin Liska <mliska@suse.cz>
Fri, 28 Apr 2017 12:50:08 +0000 (14:50 +0200)
committerMartin Liska <marxin@gcc.gnu.org>
Fri, 28 Apr 2017 12:50:08 +0000 (12:50 +0000)
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: r247371

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

index 8e21c35c97901a9f3522baf96be17d5acec4f762..2d94f6c827a453878e44a42382278c61cddcddf6 100644 (file)
@@ -1,3 +1,10 @@
+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-04-28  Martin Liska  <mliska@suse.cz>
 
        PR gcov-profile/80031
index 0a949c3a9f7780a185864c48ef1d70c525e19c20..53e379b32957748b702e37ecc1591a45e5d3f728 100644 (file)
@@ -731,6 +731,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 cde6aef1d7620194d660b5ba1a85e6e1e8b932a3..90454c0ecba810b57bbb438cffb8acc6b896ad7e 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 54a4f05c9a1fc967cf3233a70d6489788d196ee9..f1384fc2fdad01d3383e8f141ae22d30cda5ffce 100644 (file)
@@ -1915,6 +1915,9 @@ finalize (bool no_backend)
       stack_usage_file = NULL;
     }
 
+  if (seen_error ())
+    coverage_remove_note_file ();
+
   if (!no_backend)
     {
       statistics_fini ();