diff options
author | Lawrence Crowl <crowl@google.com> | 2012-10-25 21:45:28 +0000 |
---|---|---|
committer | Lawrence Crowl <crowl@gcc.gnu.org> | 2012-10-25 21:45:28 +0000 |
commit | 5831a5f0a8393c05a6da99f9a5995ffc7aa6b8ca (patch) | |
tree | 723cd03031244c4befb8e0f3f168067dec16d361 /gcc/coverage.c | |
parent | 2257bc19401e4dfd76f199fa40c0aa6c3bfdc612 (diff) | |
download | gcc-5831a5f0a8393c05a6da99f9a5995ffc7aa6b8ca.zip gcc-5831a5f0a8393c05a6da99f9a5995ffc7aa6b8ca.tar.gz gcc-5831a5f0a8393c05a6da99f9a5995ffc7aa6b8ca.tar.bz2 |
Change hash_table to support a comparator type different from the value type stored in the hash table.
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.
From-SVN: r192823
Diffstat (limited to 'gcc/coverage.c')
-rw-r--r-- | gcc/coverage.c | 17 |
1 files changed, 9 insertions, 8 deletions
diff --git a/gcc/coverage.c b/gcc/coverage.c index f9b12e8..b634c82 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); |