aboutsummaryrefslogtreecommitdiff
path: root/gcc/libgcov.c
diff options
context:
space:
mode:
authorNathan Sidwell <nathan@codesourcery.com>2003-07-10 14:13:01 +0000
committerNathan Sidwell <nathan@codesourcery.com>2003-07-10 14:13:01 +0000
commita321077c7d783b15766ddc278907c02d2a3e23b1 (patch)
tree370e3a67dfb6cf6b6c2c94b4725e0c59b2c58223 /gcc/libgcov.c
parentbfcc8039628fb9a8ed615b2dfdf5256bc7119827 (diff)
* gcov-io.h: Update documentation.
(GCOV_UNSIGNED2STRING): New. (GCOV_TAG_FUNCTION_LENGTH, GCOV_TAG_BLOCKS_LENGTH, GCOV_TAG_ARCS_LENGTH, GCOV_TAG_COUNTER_LENGTH, GCOV_TAG_SUMMARY_LENGTH): Adjust. (GCOV_TAG_BLOCKS_NUM, GCOV_TAG_ARCS_NUM, GCOV_TAG_COUNTER_NUM): New. (GCOV_BLOCK_SIZE): Number of words. (gcov_var): Adjust buffer type. * gcov-io.c (gcov_write_bytes, gcov_read_bytes): Rename to ... (gcov_write_words, gcov_read_words): ... here. Take a 4-byte word count, not byte count. (gcov_open): Adjust overread init. (gcov_allocate, gcov_write_unsigned, gcov_write_counter, gcov_write_string, gcov_write_tag, gcov_write_length, gcov_write_tag_length): Adjust. (gcov_read_unsigned, gcov_read_counter, gcov_read_string): Adjust. (gcov_sync, gcov_seek): Adjust. * gcov-dump.c (print_usage): Show gcc version only. (dump_file): Use GCOV_UNSIGNED2STRING. (tag_blocks, tag_arcs, tag_counters): Use GCOV_TAG_*_NUM macros. * gcov.c (print_version): Show gcc version only. (read_graph_file): Use GCOV_UNSIGNED2STRING. Use GCOV_TAG_*_NUM macros. (read_count_file): Use GCOV_UNSIGNED2STRING. Use GCOV_TAG_COUNTER_LENGTH. * coverage.c (read_counts_file): Use GCOV_UNSIGNED2STRING. Use GCOV_TAG_COUNTER_NUM. * libgcov.c (gcov_version): Use GCOV_UNSIGNED2STRING. (__gcov_merge_single, __gcov_merge_delta): Use GCOV_CHECK. git-svn-id: https://gcc.gnu.org/svn/gcc/trunk@69188 138bc75d-0d04-0410-961f-82ee72b054a4
Diffstat (limited to 'gcc/libgcov.c')
-rw-r--r--gcc/libgcov.c38
1 files changed, 20 insertions, 18 deletions
diff --git a/gcc/libgcov.c b/gcc/libgcov.c
index 826617f14b4..140ab05bf1c 100644
--- a/gcc/libgcov.c
+++ b/gcc/libgcov.c
@@ -94,13 +94,16 @@ static gcov_unsigned_t gcov_crc32;
static int
gcov_version (struct gcov_info *ptr, gcov_unsigned_t version)
{
- gcov_unsigned_t expected = GCOV_VERSION;
-
if (version != GCOV_VERSION)
{
+ char v[4], e[4];
+
+ GCOV_UNSIGNED2STRING (v, version);
+ GCOV_UNSIGNED2STRING (e, GCOV_VERSION);
+
fprintf (stderr,
"profiling:%s:Version mismatch - expected %.4s got %.4s\n",
- ptr->filename, (const char *)&expected, (const char *)&version);
+ ptr->filename, e, v);
return 0;
}
return 1;
@@ -478,10 +481,12 @@ __gcov_merge_add (gcov_type *counters, unsigned n_counters)
#endif /* L_gcov_merge_add */
#ifdef L_gcov_merge_single
-/* The profile merging function for choosing the most common value. It is given
- an array COUNTERS of N_COUNTERS old counters and it reads the same number
- of counters from the gcov file. The counters are split into 3-tuples
- where the members of the tuple have meanings:
+/* The profile merging function for choosing the most common value.
+ It is given an array COUNTERS of N_COUNTERS old counters and it
+ reads the same number of counters from the gcov file. The counters
+ are split into 3-tuples where the members of the tuple have
+ meanings:
+
-- the stored candidate on the most common value of the measured entity
-- counter
-- total number of evaluations of the value */
@@ -491,9 +496,7 @@ __gcov_merge_single (gcov_type *counters, unsigned n_counters)
unsigned i, n_measures;
gcov_type value, counter, all;
- if (n_counters % 3)
- abort ();
-
+ GCOV_CHECK (!(n_counters % 3));
n_measures = n_counters / 3;
for (i = 0; i < n_measures; i++, counters += 3)
{
@@ -516,11 +519,12 @@ __gcov_merge_single (gcov_type *counters, unsigned n_counters)
#endif /* L_gcov_merge_single */
#ifdef L_gcov_merge_delta
-/* The profile merging function for choosing the most common difference between
- two consecutive evaluations of the value. It is given an array COUNTERS of
- N_COUNTERS old counters and it reads the same number of counters from the
- gcov file. The counters are split into 4-tuples where the members of the
- tuple have meanings:
+/* The profile merging function for choosing the most common
+ difference between two consecutive evaluations of the value. It is
+ given an array COUNTERS of N_COUNTERS old counters and it reads the
+ same number of counters from the gcov file. The counters are split
+ into 4-tuples where the members of the tuple have meanings:
+
-- the last value of the measured entity
-- the stored candidate on the most common difference
-- counter
@@ -531,9 +535,7 @@ __gcov_merge_delta (gcov_type *counters, unsigned n_counters)
unsigned i, n_measures;
gcov_type last, value, counter, all;
- if (n_counters % 4)
- abort ();
-
+ GCOV_CHECK (!(n_counters % 4));
n_measures = n_counters / 4;
for (i = 0; i < n_measures; i++, counters += 4)
{