From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 25456 invoked by alias); 28 Apr 2017 09:31:35 -0000 Mailing-List: contact gcc-patches-help@gcc.gnu.org; run by ezmlm Precedence: bulk List-Id: List-Archive: List-Post: List-Help: Sender: gcc-patches-owner@gcc.gnu.org Received: (qmail 25424 invoked by uid 89); 28 Apr 2017 09:31:34 -0000 Authentication-Results: sourceware.org; auth=none X-Virus-Found: No X-Spam-SWARE-Status: No, score=-26.9 required=5.0 tests=BAYES_00,GIT_PATCH_0,GIT_PATCH_1,GIT_PATCH_2,GIT_PATCH_3,SPF_PASS autolearn=ham version=3.3.2 spammy= X-HELO: mx1.suse.de Received: from mx2.suse.de (HELO mx1.suse.de) (195.135.220.15) by sourceware.org (qpsmtpd/0.93/v0.84-503-g423c35a) with ESMTP; Fri, 28 Apr 2017 09:31:33 +0000 Received: from relay1.suse.de (charybdis-ext.suse.de [195.135.220.254]) by mx1.suse.de (Postfix) with ESMTP id 44524AC3B for ; Fri, 28 Apr 2017 09:31:33 +0000 (UTC) Resent-From: =?UTF-8?Q?Martin_Li=c5=a1ka?= Resent-To: GCC Patches Resent-Date: Fri, 28 Apr 2017 11:31:32 +0200 Resent-Message-ID: Resent-User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:45.0) Gecko/20100101 Thunderbird/45.8.0 Message-Id: <9145bca369337a88f2402cd1a521145287f90300.1493371589.git.mliska@suse.cz> In-Reply-To: References: From: marxin Date: Fri, 28 Apr 2017 09:31:00 -0000 Subject: [PATCH 2/8] Remove .gcno file when compilation does not success (PR driver/56469). To: gcc-patches@gcc.gnu.org Cc: hubicka@ucw.cz, nathan@acm.org X-IsSubscribed: yes X-SW-Source: 2017-04/txt/msg01457.txt.bz2 gcc/ChangeLog: 2017-04-19 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. --- gcc/coverage.c | 12 ++++++++++++ gcc/coverage.h | 1 + gcc/toplev.c | 3 +++ 3 files changed, 16 insertions(+) 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 (); -- 2.12.2