aboutsummaryrefslogtreecommitdiff
path: root/gcc/coverage.c
diff options
context:
space:
mode:
authorLawrence Crowl <crowl@google.com>2012-10-25 21:45:28 +0000
committerLawrence Crowl <crowl@google.com>2012-10-25 21:45:28 +0000
commit64bb8645f133d7992db9e673214ed5bb32573d27 (patch)
tree723cd03031244c4befb8e0f3f168067dec16d361 /gcc/coverage.c
parente40a7f4f1c01e8b6768ff2184800e95e8b2d2332 (diff)
Change hash_table to support a comparator type different from the
value type stored in the hash table. The 'find' functions now may take a different type from the value type. This requires introducing a second typedef into the Descriptor conceptual type. Change the Descriptor concept to use typedefs value_type and compare_type instead of T. Change all users to match. Add usage documentation to hash-table.h. Tested on x86-64. Index: gcc/ChangeLog 2012-10-25 Lawrence Crowl <crowl@google.com> * hash-table.h: Add usage documentation. (template struct typed_free_remove): Clarify documentation. Rename template parameter. (struct typed_noop_remove): Likewise. (descriptor concept): Change typedef T to value_type. Add typedef compare_type. Use more precise template parameter name, Descriptor instead of Descr. Update users to match. (struct hash_table): Change 'find' parameters to use compare_type instead of the value type. git-svn-id: https://gcc.gnu.org/svn/gcc/trunk@192823 138bc75d-0d04-0410-961f-82ee72b054a4
Diffstat (limited to 'gcc/coverage.c')
-rw-r--r--gcc/coverage.c17
1 files changed, 9 insertions, 8 deletions
diff --git a/gcc/coverage.c b/gcc/coverage.c
index f9b12e8b6f6..b634c821396 100644
--- a/gcc/coverage.c
+++ b/gcc/coverage.c
@@ -79,10 +79,11 @@ typedef struct counts_entry
struct gcov_ctr_summary summary;
/* hash_table support. */
- typedef counts_entry T;
- static inline hashval_t hash (const counts_entry *);
- static int equal (const counts_entry *, const counts_entry *);
- static void remove (counts_entry *);
+ typedef counts_entry value_type;
+ typedef counts_entry compare_type;
+ static inline hashval_t hash (const value_type *);
+ static int equal (const value_type *, const compare_type *);
+ static void remove (value_type *);
} counts_entry_t;
static GTY(()) struct coverage_data *functions_head = 0;
@@ -150,20 +151,20 @@ get_gcov_unsigned_t (void)
}
inline hashval_t
-counts_entry::hash (const counts_entry_t *entry)
+counts_entry::hash (const value_type *entry)
{
return entry->ident * GCOV_COUNTERS + entry->ctr;
}
inline int
-counts_entry::equal (const counts_entry_t *entry1,
- const counts_entry_t *entry2)
+counts_entry::equal (const value_type *entry1,
+ const compare_type *entry2)
{
return entry1->ident == entry2->ident && entry1->ctr == entry2->ctr;
}
inline void
-counts_entry::remove (counts_entry_t *entry)
+counts_entry::remove (value_type *entry)
{
free (entry->counts);
free (entry);