diff options
author | Nathan Sidwell <nathan@codesourcery.com> | 2003-05-14 16:01:20 +0000 |
---|---|---|
committer | Nathan Sidwell <nathan@gcc.gnu.org> | 2003-05-14 16:01:20 +0000 |
commit | 7d63a2fae019a83772ebae65689f4113a0eb4bec (patch) | |
tree | 1253c5f7880fe8708b5e0666b848785f27dcd9cc /gcc/coverage.c | |
parent | 990f4800f2228c94b23362016ddcb11401a8e5d6 (diff) | |
download | gcc-7d63a2fae019a83772ebae65689f4113a0eb4bec.zip gcc-7d63a2fae019a83772ebae65689f4113a0eb4bec.tar.gz gcc-7d63a2fae019a83772ebae65689f4113a0eb4bec.tar.bz2 |
gcov-io.h (gcov_write_bytes, [...]): Remove here.
* gcov-io.h (gcov_write_bytes, gcov_read_bytes): Remove here.
(GCOV_TAG_*) Force type to gcov_unsigned_t.
(GCOV_CHECK, GCOV_CHECK_READING, GCOV_CHECK_WRITING): New.
(struct gcov_var): Remove modified. Add start, length, offset,
overread. Have buffer array for libgcov.
(gcov_sync, gcov_seek): Definitions moved to gcov-io.c.
(gcov_position, gcov_rewrite, gcov_is_eof): Adjust.
* gcov-io.c (gcov_open): Set mode, do not read anything.
(gcov_close): Write final block.
(gcov_write_block, gcov_allocate): New.
(gcov_write_bytes): Make static. Write or allocate buffer.
(gcov_write_unsigned, gcov_write_counter): Buffer can never be
null.
(gcov_write_string): Adjust.
(gcov_write_tag)
(gcov_write_length): Adjust. Flush the block.
(gcov_write_tag_length): Buffer can never be null.
(gcov_read_bytes): Make static. Read in block.
(gcov_sync): Moved here. Adjust.
(gcov_seek): Moved here. Adjust.
* coverage.c (read_counts_file): Adjust.
* gcov-dump.c (print_prefix): Add position parameter.
(flag_dump_positions): New flag.
(options, main, print_usage): Add it.
(dump_file, tag_blocks, tag_arcs, tag_lines, tag_counters,
tag_summary): Adjust.
* gcov.c (read_graph_file, read_count_file): Adjust.
* libgcov.c (gcov_exit): Adjust.
From-SVN: r66805
Diffstat (limited to 'gcc/coverage.c')
-rw-r--r-- | gcc/coverage.c | 24 |
1 files changed, 13 insertions, 11 deletions
diff --git a/gcc/coverage.c b/gcc/coverage.c index 5926a7e..1b537c6 100644 --- a/gcc/coverage.c +++ b/gcc/coverage.c @@ -158,7 +158,9 @@ read_counts_file () unsigned ix; counts_entry_t *summaried = NULL; unsigned seen_summary = 0; - + gcov_unsigned_t tag; + int error = 0; + if (!gcov_open (da_file_name, 1)) return; @@ -187,13 +189,11 @@ read_counts_file () counts_hash = htab_create (10, htab_counts_entry_hash, htab_counts_entry_eq, htab_counts_entry_del); - while (!gcov_is_eof ()) + while ((tag = gcov_read_unsigned ())) { - gcov_unsigned_t tag, length; + gcov_unsigned_t length; gcov_position_t offset; - int error; - tag = gcov_read_unsigned (); length = gcov_read_unsigned (); offset = gcov_position (); if (tag == GCOV_TAG_FUNCTION) @@ -284,14 +284,16 @@ read_counts_file () } gcov_sync (offset, length); if ((error = gcov_is_error ())) - { - warning (error < 0 ? "`%s' has overflowed" : "`%s' is corrupted", - da_file_name); - htab_delete (counts_hash); - break; - } + break; } + if (!gcov_is_eof ()) + { + warning (error < 0 ? "`%s' has overflowed" : "`%s' is corrupted", + da_file_name); + htab_delete (counts_hash); + } + gcov_close (); } |