From dd486eb27ce3fc75e02311d3e36d9e10a9f56eee Mon Sep 17 00:00:00 2001 From: Nathan Sidwell Date: Sun, 6 Jul 2003 14:51:48 +0000 Subject: gcov-io.h: Add a local time stamp. * 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. From-SVN: r69006 --- gcc/gcov.c | 13 ++++++++++++- 1 file changed, 12 insertions(+), 1 deletion(-) (limited to 'gcc/gcov.c') diff --git a/gcc/gcov.c b/gcc/gcov.c index c671599..c8fc6ad 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 ())) { -- cgit v1.1