From b4d48d675e7a3d7a30834741f83259da59c7cf82 Mon Sep 17 00:00:00 2001 From: nathan Date: Wed, 9 Jul 2003 12:12:29 +0000 Subject: * 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 --- gcc/gcov-dump.c | 33 ++++++++++++++++----------------- 1 file changed, 16 insertions(+), 17 deletions(-) (limited to 'gcc/gcov-dump.c') 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 */ -- cgit v1.2.1