From: Martin Liska Date: Thu, 22 Jun 2017 11:26:58 +0000 (+0200) Subject: Backport r247371 X-Git-Tag: releases/gcc-5.5.0~199 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=6f697a822bbf4713e4f8369a7401c70ce1bd4b10;p=thirdparty%2Fgcc.git Backport r247371 2017-06-22 Martin Liska Backport from mainline 2017-04-28 Martin Liska 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 --- diff --git a/gcc/ChangeLog b/gcc/ChangeLog index e92edd5653b7..e4f023f03c01 100644 --- a/gcc/ChangeLog +++ b/gcc/ChangeLog @@ -1,3 +1,13 @@ +2017-06-22 Martin Liska + + Backport from mainline + 2017-04-28 Martin Liska + + 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 PR target/80968 diff --git a/gcc/coverage.c b/gcc/coverage.c index 661e44113241..200c8633e543 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 bac242fd5a42..0ce4a46a3bae 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 c565ea4797e3..17d051210267 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 ();