summaryrefslogtreecommitdiff
path: root/gcc/gcov-dump.c
diff options
context:
space:
mode:
authornathan <nathan@138bc75d-0d04-0410-961f-82ee72b054a4>2003-07-09 12:12:29 +0000
committernathan <nathan@138bc75d-0d04-0410-961f-82ee72b054a4>2003-07-09 12:12:29 +0000
commitb4d48d675e7a3d7a30834741f83259da59c7cf82 (patch)
tree5a33b5396c3ed82380adfbc9d86b6c3c8ad3bb59 /gcc/gcov-dump.c
parentc19ee4768fdbc75f735832504f6ddd4ddcdf3b17 (diff)
downloadgcc-b4d48d675e7a3d7a30834741f83259da59c7cf82.tar.gz
* 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. git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@69137 138bc75d-0d04-0410-961f-82ee72b054a4
Diffstat (limited to 'gcc/gcov-dump.c')
-rw-r--r--gcc/gcov-dump.c33
1 files changed, 16 insertions, 17 deletions
diff --git a/gcc/gcov-dump.c b/gcc/gcov-dump.c
index 67a34dcfff7..f6902a119e8 100644
--- a/gcc/gcov-dump.c
+++ b/gcc/gcov-dump.c
@@ -155,33 +155,32 @@ dump_file (const char *filename)
/* magic */
{
unsigned magic = gcov_read_unsigned ();
- unsigned version = gcov_read_unsigned ();
+ unsigned version;
const char *type = NULL;
- char e[4], v[4], m[4];
- unsigned expected = GCOV_VERSION;
- unsigned ix;
- int different = version != GCOV_VERSION;
-
- if (magic == GCOV_DATA_MAGIC)
+ int endianness = 0;
+
+ if ((endianness = gcov_magic (magic, GCOV_DATA_MAGIC)))
type = "data";
- else if (magic == GCOV_GRAPH_MAGIC)
- type = "graph";
+ else if ((endianness = gcov_magic (magic, GCOV_NOTE_MAGIC)))
+ type = "note";
else
{
printf ("%s:not a gcov file\n", filename);
gcov_close ();
return;
}
- for (ix = 4; ix--; expected >>= 8, version >>= 8, magic >>= 8)
+ version = gcov_read_unsigned ();
+
+ printf ("%s:%s:magic `%.4s':version `%.4s'%s\n", filename, type,
+ (const char *)&magic, (const char *)&version,
+ endianness < 0 ? " (swapped endianness)" : "");
+ if (version != GCOV_VERSION)
{
- e[ix] = expected;
- v[ix] = version;
- m[ix] = magic;
+ unsigned expected = GCOV_VERSION;
+
+ printf ("%s:warning:current version is `%.4s'\n", filename,
+ (const char *)expected);
}
-
- printf ("%s:%s:magic `%.4s':version `%.4s'\n", filename, type, m, v);
- if (different)
- printf ("%s:warning:current version is `%.4s'\n", filename, e);
}
/* stamp */