aboutsummaryrefslogtreecommitdiff
path: root/gcc/coverage.c
diff options
context:
space:
mode:
authorNathan Sidwell <nathan@codesourcery.com>2003-07-09 12:12:29 +0000
committerNathan Sidwell <nathan@gcc.gnu.org>2003-07-09 12:12:29 +0000
commit160e2e4f2361da06d8cd73afea7b527b29d4c6a7 (patch)
tree5a33b5396c3ed82380adfbc9d86b6c3c8ad3bb59 /gcc/coverage.c
parent83599948cd3ebd43bccc33de73edda68cb48d354 (diff)
downloadgcc-160e2e4f2361da06d8cd73afea7b527b29d4c6a7.zip
gcc-160e2e4f2361da06d8cd73afea7b527b29d4c6a7.tar.gz
gcc-160e2e4f2361da06d8cd73afea7b527b29d4c6a7.tar.bz2
gcov-io.h: Update documentation.
* gcov-io.h: Update documentation. (GCOV_GRAPH_SUFFIX, GCOV_GRAPH_MAGIC): Rename to GCOV_NOTE_SUFFIX, GCOV_NOTE_MAGIC. (GCOV_DATA_SUFFIX, GCOV_NOTE_SUFFIX): Update. (GCOV_DATA_MAGIC, GCOV_NOTE_MAGIC): Make non-palindromic. (struct gcov_var): Change buffer's type. Add endian flag. (gcov_open): Remove mode in libgcov. (gcov_magic): Prototype. * gcov-io.c (from_file): New. (gcov_open): Clear endian flag. (gcov_magic): New. (gcov_write_bytes, gcov_read_bytes): Return gcov_unsigned_t pointers. (gcov_write_unsigned, gcov_write_counter, gcov_write_string, gcov_write_tag, gcov_write_length, gcov_write_tag_length): Update. (gcov_read_unsigned, gcov_read_counter, gcov_read_string): Update. * gcov-iov.c (main): Correct cast. * coverage.c (read_counts_file): Use gcov_magic. Remove endianness conversion. (gcov_begin_output): Use GCOV_NOTE_MAGIC. (coverage_init): Use GCOV_NOTE_SUFFIX. * libgcov.c (gcov_version_mismatch): Remove endianness conversion. Rename to gcov_version, and return flag. (gcov_exit): Use gcov_version. (__gcov_init): Use gcov_version. * Makefile.in (coverageexts): Update. * gcov.c (print_version): Remove endianness conversion. (create_file_names): Use GCOV_NOTE_SUFFIX. (read_graph_file): Use gcov_magic. (read_count_file): Likewise. * gcov-dump.c (dump_file): Remove endianness conversion, use gcov_magic. From-SVN: r69137
Diffstat (limited to 'gcc/coverage.c')
-rw-r--r--gcc/coverage.c21
1 files changed, 7 insertions, 14 deletions
diff --git a/gcc/coverage.c b/gcc/coverage.c
index 4a00332..0bc7a26 100644
--- a/gcc/coverage.c
+++ b/gcc/coverage.c
@@ -150,8 +150,7 @@ static void
read_counts_file (void)
{
gcov_unsigned_t fn_ident = 0;
- gcov_unsigned_t version, checksum = -1;
- unsigned ix;
+ gcov_unsigned_t checksum = -1;
counts_entry_t *summaried = NULL;
unsigned seen_summary = 0;
gcov_unsigned_t tag;
@@ -160,24 +159,18 @@ read_counts_file (void)
if (!gcov_open (da_file_name, 1))
return;
- if (gcov_read_unsigned () != GCOV_DATA_MAGIC)
+ if (!gcov_magic (gcov_read_unsigned (), GCOV_DATA_MAGIC))
{
warning ("`%s' is not a gcov data file", da_file_name);
gcov_close ();
return;
}
- else if ((version = gcov_read_unsigned ()) != GCOV_VERSION)
+ else if ((tag = gcov_read_unsigned ()) != GCOV_VERSION)
{
- char v[4], e[4];
gcov_unsigned_t required = GCOV_VERSION;
- for (ix = 4; ix--; required >>= 8, version >>= 8)
- {
- v[ix] = version;
- e[ix] = required;
- }
warning ("`%s' is version `%.4s', expected version `%.4s'",
- da_file_name, v, e);
+ da_file_name, (const char *)&tag, (const char *)&required);
gcov_close ();
return;
}
@@ -446,7 +439,7 @@ coverage_begin_output (void)
error ("cannot open %s", bbg_file_name);
else
{
- gcov_write_unsigned (GCOV_GRAPH_MAGIC);
+ gcov_write_unsigned (GCOV_NOTE_MAGIC);
gcov_write_unsigned (GCOV_VERSION);
gcov_write_unsigned (local_tick);
}
@@ -897,9 +890,9 @@ coverage_init (const char *filename)
strcat (da_file_name, GCOV_DATA_SUFFIX);
/* Name of bbg file. */
- bbg_file_name = (char *) xmalloc (len + strlen (GCOV_GRAPH_SUFFIX) + 1);
+ bbg_file_name = (char *) xmalloc (len + strlen (GCOV_NOTE_SUFFIX) + 1);
strcpy (bbg_file_name, filename);
- strcat (bbg_file_name, GCOV_GRAPH_SUFFIX);
+ strcat (bbg_file_name, GCOV_NOTE_SUFFIX);
read_counts_file ();
}