]> git.ipfire.org Git - thirdparty/gcc.git/commitdiff
* alloc-pool.c (hash_descriptor, eq_descriptor,
authorghazi <ghazi@138bc75d-0d04-0410-961f-82ee72b054a4>
Fri, 4 Jul 2008 00:22:31 +0000 (00:22 +0000)
committerghazi <ghazi@138bc75d-0d04-0410-961f-82ee72b054a4>
Fri, 4 Jul 2008 00:22:31 +0000 (00:22 +0000)
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.

git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@137446 138bc75d-0d04-0410-961f-82ee72b054a4

gcc/ChangeLog
gcc/alloc-pool.c
gcc/bitmap.c
gcc/ggc-common.c
gcc/varray.c

index 42f0b325cc72928ce11ac3547fe4307f6d7d522d..dd3ece4d710050ac3e8cf31c031cd40c439f5ab7 100644 (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.
index b22869fe787e8a5bd205fd1920659da83572bd84..7f0dc8ce7d2009005f0e2d57826faa1a10afe812 100644 (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;
 }
index 4fabdc915d23610cc41a4e53d9276cea27866b30..5e841e067a5e5fd2b8da5b2cdefbdfdf7a2069f5 100644 (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;
index a01fa3f0b011e0d18b417923c80661f28fe5ac32..d1022a1da85ef20e8726ba5052c497a2c5e37aa9 100644 (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");
index 45330397e0eaf5035a24dfd61f8872e54d908a06..6464a816652e288a8a6954195d08bdf141208a8c 100644 (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;
 }