This is the mail archive of the
gcc-patches@gcc.gnu.org
mailing list for the GCC project.
Remove coverage count files
- From: Nathan Sidwell <nathan at codesourcery dot com>
- To: gcc-patches at gcc dot gnu dot org
- Cc: mark at codesourcery dot com
- Date: Thu, 08 Aug 2002 11:12:12 +0100
- Subject: Remove coverage count files
- Organization: Codesourcery LLC
Hi,
this patch removes the .da file whenever new .bb and .bbg files are
created. Thus you cannot get mismatched versions of these files.
I did consider simoly removing the .da file on every compilation, but
think that might be too rude.
tested on i686-pc-linux-gnu. ok?
nathan
--
Dr Nathan Sidwell :: http://www.codesourcery.com :: CodeSourcery LLC
'But that's a lie.' - 'Yes it is. What's your point?'
nathan@codesourcery.com : http://www.cs.bris.ac.uk/~nathan/ : nathan@acm.org
2002-08-08 Nathan Sidwell <nathan@codesourcery.com>
* profile.c (da_file_name): New static var.
(init_branch_prob): Initialize it.
(end_branch_prob): Remove da file.
Index: profile.c
===================================================================
RCS file: /cvs/gcc/gcc/gcc/profile.c,v
retrieving revision 1.96
diff -c -3 -p -r1.96 profile.c
*** profile.c 4 Aug 2002 16:21:01 -0000 1.96
--- profile.c 8 Aug 2002 09:48:22 -0000
*************** static FILE *bbg_file;
*** 127,132 ****
--- 127,133 ----
/* Name and file pointer of the input file for the arc count data. */
static FILE *da_file;
+ static char *da_file_name;
/* Pointer of the output file for the basic block/line number map. */
static FILE *bb_file;
*************** void
*** 1185,1196 ****
init_branch_prob (filename)
const char *filename;
{
! long len;
int i;
if (flag_test_coverage)
{
- int len = strlen (filename);
char *data_file, *bbg_file_name;
/* Open an output file for the basic block/line number map. */
--- 1186,1196 ----
init_branch_prob (filename)
const char *filename;
{
! int len = strlen (filename);
int i;
if (flag_test_coverage)
{
char *data_file, *bbg_file_name;
/* Open an output file for the basic block/line number map. */
*************** init_branch_prob (filename)
*** 1212,1226 ****
last_bb_file_name = 0;
}
if (flag_branch_probabilities)
{
! char *da_file_name;
!
! len = strlen (filename);
! da_file_name = (char *) alloca (len + 4);
! strcpy (da_file_name, filename);
! strcat (da_file_name, ".da");
! if ((da_file = fopen (da_file_name, "rb")) == 0)
warning ("file %s not found, execution counts assumed to be zero",
da_file_name);
}
--- 1212,1225 ----
last_bb_file_name = 0;
}
+ da_file_name = (char *) xmalloc (len + 4);
+ strcpy (da_file_name, filename);
+ strcat (da_file_name, ".da");
+
if (flag_branch_probabilities)
{
! da_file = fopen (da_file_name, "rb");
! if (!da_file)
warning ("file %s not found, execution counts assumed to be zero",
da_file_name);
}
*************** end_branch_prob ()
*** 1251,1256 ****
--- 1250,1256 ----
{
fclose (bb_file);
fclose (bbg_file);
+ unlink (da_file_name);
}
if (flag_branch_probabilities && da_file)