alloc-pool.c (hash_descriptor, [...]): Fix -Wc++-compat warnings.

* alloc-pool.c (hash_descriptor, eq_descriptor,
	alloc_pool_descriptor): Fix -Wc++-compat warnings.
	* bitmap.c (hash_descriptor, eq_descriptor, bitmap_descriptor):
	Likewise.
	* ggc-common.c (hash_descriptor, eq_descriptor, hash_ptr, eq_ptr,
	loc_descriptor, ggc_prune_ptr, ggc_free_overhead,
	final_cmp_statistic, cmp_statistic, dump_ggc_loc_statistics):
	Likewise.
	* varray.c (hash_descriptor, eq_descriptor, varray_descriptor):
	Likewise.

From-SVN: r137446
This commit is contained in:
Kaveh R. Ghazi 2008-07-04 00:22:31 +00:00 committed by Kaveh Ghazi
parent 623d958006
commit aebde504ad
5 changed files with 44 additions and 23 deletions

View File

@ -1,3 +1,16 @@
2008-07-03 Kaveh R. Ghazi <ghazi@caip.rutgers.edu>
* alloc-pool.c (hash_descriptor, eq_descriptor,
alloc_pool_descriptor): Fix -Wc++-compat warnings.
* bitmap.c (hash_descriptor, eq_descriptor, bitmap_descriptor):
Likewise.
* ggc-common.c (hash_descriptor, eq_descriptor, hash_ptr, eq_ptr,
loc_descriptor, ggc_prune_ptr, ggc_free_overhead,
final_cmp_statistic, cmp_statistic, dump_ggc_loc_statistics):
Likewise.
* varray.c (hash_descriptor, eq_descriptor, varray_descriptor):
Likewise.
2008-07-03 Eric Botcazou <ebotcazou@adacore.com>
* tree-flow.h (loop_only_exit_p): Declare.

View File

@ -81,13 +81,15 @@ static htab_t alloc_pool_hash;
static hashval_t
hash_descriptor (const void *p)
{
const struct alloc_pool_descriptor *d = p;
const struct alloc_pool_descriptor *const d =
(const struct alloc_pool_descriptor * )p;
return htab_hash_pointer (d->name);
}
static int
eq_descriptor (const void *p1, const void *p2)
{
const struct alloc_pool_descriptor *d = p1;
const struct alloc_pool_descriptor *const d =
(const struct alloc_pool_descriptor *) p1;
return d->name == p2;
}
@ -106,7 +108,7 @@ alloc_pool_descriptor (const char *name)
1);
if (*slot)
return *slot;
*slot = xcalloc (sizeof (**slot), 1);
*slot = XCNEW (struct alloc_pool_descriptor);
(*slot)->name = name;
return *slot;
}

View File

@ -51,7 +51,8 @@ static htab_t bitmap_desc_hash;
static hashval_t
hash_descriptor (const void *p)
{
const struct bitmap_descriptor *const d = p;
const struct bitmap_descriptor *const d =
(const struct bitmap_descriptor *) p;
return htab_hash_pointer (d->file) + d->line;
}
struct loc
@ -63,8 +64,9 @@ struct loc
static int
eq_descriptor (const void *p1, const void *p2)
{
const struct bitmap_descriptor *const d = p1;
const struct loc *const l = p2;
const struct bitmap_descriptor *const d =
(const struct bitmap_descriptor *) p1;
const struct loc *const l = (const struct loc *) p2;
return d->file == l->file && d->function == l->function && d->line == l->line;
}
@ -88,7 +90,7 @@ bitmap_descriptor (const char *file, const char *function, int line)
1);
if (*slot)
return *slot;
*slot = xcalloc (sizeof (**slot), 1);
*slot = XCNEW (struct bitmap_descriptor);
(*slot)->file = file;
(*slot)->function = function;
(*slot)->line = line;

View File

@ -791,7 +791,7 @@ static htab_t loc_hash;
static hashval_t
hash_descriptor (const void *p)
{
const struct loc_descriptor *const d = p;
const struct loc_descriptor *const d = (const struct loc_descriptor *) p;
return htab_hash_pointer (d->function) | d->line;
}
@ -799,8 +799,8 @@ hash_descriptor (const void *p)
static int
eq_descriptor (const void *p1, const void *p2)
{
const struct loc_descriptor *const d = p1;
const struct loc_descriptor *const d2 = p2;
const struct loc_descriptor *const d = (const struct loc_descriptor *) p1;
const struct loc_descriptor *const d2 = (const struct loc_descriptor *) p2;
return (d->file == d2->file && d->line == d2->line
&& d->function == d2->function);
@ -819,7 +819,7 @@ struct ptr_hash_entry
static hashval_t
hash_ptr (const void *p)
{
const struct ptr_hash_entry *const d = p;
const struct ptr_hash_entry *const d = (const struct ptr_hash_entry *) p;
return htab_hash_pointer (d->ptr);
}
@ -827,7 +827,7 @@ hash_ptr (const void *p)
static int
eq_ptr (const void *p1, const void *p2)
{
const struct ptr_hash_entry *const p = p1;
const struct ptr_hash_entry *const p = (const struct ptr_hash_entry *) p1;
return (p->ptr == p2);
}
@ -848,7 +848,7 @@ loc_descriptor (const char *name, int line, const char *function)
slot = (struct loc_descriptor **) htab_find_slot (loc_hash, &loc, 1);
if (*slot)
return *slot;
*slot = xcalloc (sizeof (**slot), 1);
*slot = XCNEW (struct loc_descriptor);
(*slot)->file = name;
(*slot)->line = line;
(*slot)->function = function;
@ -883,7 +883,7 @@ ggc_record_overhead (size_t allocated, size_t overhead, void *ptr,
static int
ggc_prune_ptr (void **slot, void *b ATTRIBUTE_UNUSED)
{
struct ptr_hash_entry *p = *slot;
struct ptr_hash_entry *p = (struct ptr_hash_entry *) *slot;
if (!ggc_marked_p (p->ptr))
{
p->loc->collected += p->size;
@ -907,7 +907,7 @@ ggc_free_overhead (void *ptr)
{
PTR *slot = htab_find_slot_with_hash (ptr_hash, ptr, htab_hash_pointer (ptr),
NO_INSERT);
struct ptr_hash_entry *p = *slot;
struct ptr_hash_entry *p = (struct ptr_hash_entry *) *slot;
p->loc->freed += p->size;
htab_clear_slot (ptr_hash, slot);
free (p);
@ -917,8 +917,10 @@ ggc_free_overhead (void *ptr)
static int
final_cmp_statistic (const void *loc1, const void *loc2)
{
struct loc_descriptor *l1 = *(struct loc_descriptor **) loc1;
struct loc_descriptor *l2 = *(struct loc_descriptor **) loc2;
const struct loc_descriptor *const l1 =
*(const struct loc_descriptor *const *) loc1;
const struct loc_descriptor *const l2 =
*(const struct loc_descriptor *const *) loc2;
long diff;
diff = ((long)(l1->allocated + l1->overhead - l1->freed) -
(l2->allocated + l2->overhead - l2->freed));
@ -929,8 +931,10 @@ final_cmp_statistic (const void *loc1, const void *loc2)
static int
cmp_statistic (const void *loc1, const void *loc2)
{
struct loc_descriptor *l1 = *(struct loc_descriptor **) loc1;
struct loc_descriptor *l2 = *(struct loc_descriptor **) loc2;
const struct loc_descriptor *const l1 =
*(const struct loc_descriptor *const *) loc1;
const struct loc_descriptor *const l2 =
*(const struct loc_descriptor *const *) loc2;
long diff;
diff = ((long)(l1->allocated + l1->overhead - l1->freed - l1->collected) -
@ -967,7 +971,7 @@ dump_ggc_loc_statistics (bool final ATTRIBUTE_UNUSED)
ggc_force_collect = true;
ggc_collect ();
loc_array = xcalloc (sizeof (*loc_array), loc_hash->n_elements);
loc_array = XCNEWVEC (struct loc_descriptor *, loc_hash->n_elements);
fprintf (stderr, "-------------------------------------------------------\n");
fprintf (stderr, "\n%-48s %10s %10s %10s %10s %10s\n",
"source location", "Garbage", "Freed", "Leak", "Overhead", "Times");

View File

@ -49,13 +49,13 @@ static htab_t varray_hash;
static hashval_t
hash_descriptor (const void *p)
{
const struct varray_descriptor *d = p;
const struct varray_descriptor *d = (const struct varray_descriptor *) p;
return htab_hash_pointer (d->name);
}
static int
eq_descriptor (const void *p1, const void *p2)
{
const struct varray_descriptor *d = p1;
const struct varray_descriptor *d = (const struct varray_descriptor *) p1;
return d->name == p2;
}
@ -74,7 +74,7 @@ varray_descriptor (const char *name)
1);
if (*slot)
return *slot;
*slot = xcalloc (sizeof (**slot), 1);
*slot = XCNEW (struct varray_descriptor);
(*slot)->name = name;
return *slot;
}