diff options
author | nathan <nathan@138bc75d-0d04-0410-961f-82ee72b054a4> | 2004-07-29 08:58:59 +0000 |
---|---|---|
committer | nathan <nathan@138bc75d-0d04-0410-961f-82ee72b054a4> | 2004-07-29 08:58:59 +0000 |
commit | 421055caa5d450505d0fbf6a472dace6c3f12f9e (patch) | |
tree | 16726bd91201d3686e4da590f47456b9a7153c9d /gcc/libgcov.c | |
parent | f0376c19272666256dece44da813084d8e78cb5e (diff) | |
download | gcc-421055caa5d450505d0fbf6a472dace6c3f12f9e.tar.gz |
* gcov-io.h: Allow zero tag as EOF indicator.
(gcov_is_eof): Remove.
(gcov_truncate): Remove.
* gcov-io.c (gcov_seek): Always SEEK_SET.
* libgcov.c (gcov_exit): Don't use gcov_truncate. Write explicit
EOF tag.
* coverage.c (read_counts_file): Don't use gcov_is_eof.
* gcov-dump.c (dump_file): Likewise.
* gcov.c (read_graph_file, read_count_file): Likewise.
git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@85291 138bc75d-0d04-0410-961f-82ee72b054a4
Diffstat (limited to 'gcc/libgcov.c')
-rw-r--r-- | gcc/libgcov.c | 39 |
1 files changed, 20 insertions, 19 deletions
diff --git a/gcc/libgcov.c b/gcc/libgcov.c index 0731ed01e5f..49cf3c7004c 100644 --- a/gcc/libgcov.c +++ b/gcc/libgcov.c @@ -164,6 +164,7 @@ gcov_exit (void) int error = 0; gcov_unsigned_t tag, length; gcov_position_t summary_pos = 0; + gcov_position_t eof_pos = 0; memset (&this_object, 0, sizeof (this_object)); memset (&object, 0, sizeof (object)); @@ -218,9 +219,7 @@ gcov_exit (void) { fprintf (stderr, "profiling:%s:Not a gcov data file\n", gi_ptr->filename); - read_fatal:; - gcov_close (); - continue; + goto read_fatal; } length = gcov_read_unsigned (); if (!gcov_version (gi_ptr, length)) @@ -228,12 +227,8 @@ gcov_exit (void) length = gcov_read_unsigned (); if (length != gi_ptr->stamp) - { - /* Read from a different compilation. Overwrite the - file. */ - gcov_truncate (); - goto rewrite; - } + /* Read from a different compilation. Overwrite the file. */ + goto rewrite; /* Merge execution counts for each function. */ for (f_ix = 0; f_ix < gi_ptr->n_functions; f_ix++) @@ -284,12 +279,13 @@ gcov_exit (void) /* Check program & object summary */ while (1) { - gcov_position_t base = gcov_position (); int is_program; + eof_pos = gcov_position (); tag = gcov_read_unsigned (); if (!tag) break; + length = gcov_read_unsigned (); is_program = tag == GCOV_TAG_PROGRAM_SUMMARY; if (length != GCOV_TAG_SUMMARY_LENGTH @@ -300,19 +296,21 @@ gcov_exit (void) goto read_error; if (is_program && program.checksum == gcov_crc32) { - summary_pos = base; + summary_pos = eof_pos; goto rewrite; } } } + goto rewrite; - if (!gcov_is_eof ()) - { - read_error:; - fprintf (stderr, error < 0 ? "profiling:%s:Overflow merging\n" - : "profiling:%s:Error merging\n", gi_ptr->filename); - goto read_fatal; - } + read_error:; + fprintf (stderr, error < 0 ? "profiling:%s:Overflow merging\n" + : "profiling:%s:Error merging\n", gi_ptr->filename); + + read_fatal:; + gcov_close (); + continue; + rewrite:; gcov_rewrite (); if (!summary_pos) @@ -414,8 +412,11 @@ gcov_exit (void) gcov_write_summary (GCOV_TAG_OBJECT_SUMMARY, &object); /* Generate whole program statistics. */ - gcov_seek (summary_pos); + if (eof_pos) + gcov_seek (eof_pos); gcov_write_summary (GCOV_TAG_PROGRAM_SUMMARY, &program); + if (!summary_pos) + gcov_write_unsigned (0); if ((error = gcov_close ())) fprintf (stderr, error < 0 ? "profiling:%s:Overflow writing\n" : |