static hashval_t
hash_statistics_hash (const void *p)
{
- statistics_counter_t *c = (statistics_counter_t *)p;
+ const statistics_counter_t *const c = (const statistics_counter_t *)p;
return htab_hash_string (c->id) + c->val;
}
static int
hash_statistics_eq (const void *p, const void *q)
{
- statistics_counter_t *c1 = (statistics_counter_t *)p;
- statistics_counter_t *c2 = (statistics_counter_t *)q;
+ const statistics_counter_t *const c1 = (const statistics_counter_t *)p;
+ const statistics_counter_t *const c2 = (const statistics_counter_t *)q;
return c1->val == c2->val && strcmp (c1->id, c2->id) == 0;
}
static void
hash_statistics_free (void *p)
{
- free ((void *)((statistics_counter_t *)p)->id);
+ free (CONST_CAST(char *, ((statistics_counter_t *)p)->id));
free (p);
}
static htab_t
curr_statistics_hash (void)
{
- unsigned idx = current_pass->static_pass_number;
+ unsigned idx;
+
+ gcc_assert (current_pass->static_pass_number >= 0);
+ idx = current_pass->static_pass_number;
if (idx < nr_statistics_hashes
&& statistics_hashes[idx] != NULL)
if (idx >= nr_statistics_hashes)
{
- statistics_hashes = xrealloc (statistics_hashes,
- (idx + 1) * sizeof (htab_t));
+ statistics_hashes = XRESIZEVEC (struct htab *, statistics_hashes, idx+1);
memset (statistics_hashes + nr_statistics_hashes, 0,
(idx + 1 - nr_statistics_hashes) * sizeof (htab_t));
nr_statistics_hashes = idx + 1;
|| incr == 0)
return;
- counter = lookup_or_add_counter (curr_statistics_hash (), id, 0, false);
- gcc_assert (!counter->histogram_p);
- counter->count += incr;
+ if (current_pass->static_pass_number != -1)
+ {
+ counter = lookup_or_add_counter (curr_statistics_hash (), id, 0, false);
+ gcc_assert (!counter->histogram_p);
+ counter->count += incr;
+ }
if (!statistics_dump_file
|| !(statistics_dump_flags & TDF_DETAILS))