summaryrefslogtreecommitdiff
path: root/gcc/gcov.c
diff options
context:
space:
mode:
authornathan <nathan@138bc75d-0d04-0410-961f-82ee72b054a4>2003-07-06 14:51:48 +0000
committernathan <nathan@138bc75d-0d04-0410-961f-82ee72b054a4>2003-07-06 14:51:48 +0000
commit42fa384f7f1d12e02987b17d2650e2136b38fa00 (patch)
treea94f984308aa02ce879de7afc0672f6a1d92a100 /gcc/gcov.c
parentb80f1d67f4ed212faa54034bed77dec05afdad97 (diff)
downloadgcc-42fa384f7f1d12e02987b17d2650e2136b38fa00.tar.gz
* gcov-io.h: Add a local time stamp.
(struct gcov_info): Add stamp field. (gcov_truncate): New. * coverage.c (read_counts_file): Skip the stamp. (coverage_begin_output): Write the stamp. (build_gcov_info): Declare and init the stamp. (coverage_finish): Only unlink data file, if stamp is zero. * gcov-dump.c (dump_file): Dump the stamp. * gcov.c (bbg_stamp): New. (release_structures): Clear bbg_stamp. (read_graph_file): Read stamp. (read_count_file): Check stamp. * libgcov.c (gcov_exit): Check stamp and truncate if needed. git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@69006 138bc75d-0d04-0410-961f-82ee72b054a4
Diffstat (limited to 'gcc/gcov.c')
-rw-r--r--gcc/gcov.c13
1 files changed, 12 insertions, 1 deletions
diff --git a/gcc/gcov.c b/gcc/gcov.c
index c671599c886..c8fc6ad5d31 100644
--- a/gcc/gcov.c
+++ b/gcc/gcov.c
@@ -269,6 +269,9 @@ static time_t bbg_file_time;
static char *bbg_file_name;
+/* Stamp of the bbg file */
+static unsigned bbg_stamp;
+
/* Name and file pointer of the input file for the arc count data. */
static char *da_file_name;
@@ -583,6 +586,7 @@ release_structures ()
free (da_file_name);
da_file_name = bbg_file_name = NULL;
bbg_file_time = 0;
+ bbg_stamp = 0;
while ((src = sources))
{
@@ -740,7 +744,8 @@ read_graph_file ()
fnotice (stderr, "%s:version `%.4s', prefer `%.4s'\n",
bbg_file_name, v, e);
}
-
+ bbg_stamp = gcov_read_unsigned ();
+
while ((tag = gcov_read_unsigned ()))
{
unsigned length = gcov_read_unsigned ();
@@ -1008,6 +1013,12 @@ read_count_file ()
fnotice (stderr, "%s:version `%.4s', prefer version `%.4s'\n",
da_file_name, v, e);
}
+ tag = gcov_read_unsigned ();
+ if (tag != bbg_stamp)
+ {
+ fnotice (stderr, "%s:stamp mismatch with graph file\n", da_file_name);
+ goto cleanup;
+ }
while ((tag = gcov_read_unsigned ()))
{