diff options
author | crowl <crowl@138bc75d-0d04-0410-961f-82ee72b054a4> | 2012-10-25 21:45:28 +0000 |
---|---|---|
committer | crowl <crowl@138bc75d-0d04-0410-961f-82ee72b054a4> | 2012-10-25 21:45:28 +0000 |
commit | c580da876e6aea7485467ca8e3d19377ecba4fc7 (patch) | |
tree | 723cd03031244c4befb8e0f3f168067dec16d361 /gcc/coverage.c | |
parent | 2e8d2f3202c34da752b421f1f78edff2325503e9 (diff) | |
download | gcc-c580da876e6aea7485467ca8e3d19377ecba4fc7.tar.gz |
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: svn+ssh://gcc.gnu.org/svn/gcc/trunk@192823 138bc75d-0d04-0410-961f-82ee72b054a4
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 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); |