diff options
author | marxin <marxin@138bc75d-0d04-0410-961f-82ee72b054a4> | 2017-04-28 12:50:08 +0000 |
---|---|---|
committer | marxin <marxin@138bc75d-0d04-0410-961f-82ee72b054a4> | 2017-04-28 12:50:08 +0000 |
commit | cc563837851b7b8b6b1e1f6d331212ee6cd54b09 (patch) | |
tree | 8df55b02af0f17c07bd6ef1dbbf9dce00b19f573 | |
parent | 8af8bb9ccfe940efd7aaf52e6b14dbfc4d955a70 (diff) | |
download | gcc-cc563837851b7b8b6b1e1f6d331212ee6cd54b09.tar.gz |
Remove .gcno file when compilation does not success (PR driver/56469).
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.
git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@247371 138bc75d-0d04-0410-961f-82ee72b054a4
-rw-r--r-- | gcc/ChangeLog | 7 | ||||
-rw-r--r-- | gcc/coverage.c | 12 | ||||
-rw-r--r-- | gcc/coverage.h | 1 | ||||
-rw-r--r-- | gcc/toplev.c | 3 |
4 files changed, 23 insertions, 0 deletions
diff --git a/gcc/ChangeLog b/gcc/ChangeLog index 8e21c35c979..2d94f6c827a 100644 --- a/gcc/ChangeLog +++ b/gcc/ChangeLog @@ -1,5 +1,12 @@ 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 * gcov-dump.c (tag_blocks): Just print number of basic blocks. * gcov-io.h (GCOV_TAG_BLOCKS_NUM): Remove unused macro. diff --git a/gcc/coverage.c b/gcc/coverage.c index 0a949c3a9f7..53e379b3295 100644 --- a/gcc/coverage.c +++ b/gcc/coverage.c @@ -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. */ diff --git a/gcc/coverage.h b/gcc/coverage.h index cde6aef1d76..90454c0ecba 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 54a4f05c9a1..f1384fc2fda 100644 --- a/gcc/toplev.c +++ b/gcc/toplev.c @@ -1915,6 +1915,9 @@ finalize (bool no_backend) stack_usage_file = NULL; } + if (seen_error ()) + coverage_remove_note_file (); + if (!no_backend) { statistics_fini (); |