This is the mail archive of the
gcc-patches@gcc.gnu.org
mailing list for the GCC project.
Re: [gcc-in-cxx] FYI: fix 2 bitmap-related c++ errors
- From: "Richard Guenther" <richard dot guenther at gmail dot com>
- To: "Tom Tromey" <tromey at redhat dot com>
- Cc: "Gcc Patch List" <gcc-patches at gcc dot gnu dot org>
- Date: Sun, 5 Oct 2008 20:02:33 +0200
- Subject: Re: [gcc-in-cxx] FYI: fix 2 bitmap-related c++ errors
- References: <m3d4ifc4g6.fsf@fleche.redhat.com>
On Sun, Oct 5, 2008 at 7:55 PM, Tom Tromey <tromey@redhat.com> wrote:
> I'm checking this in on the gcc-in-cxx branch.
>
> This fixes a couple bitmap-related errors coming from the C++
> compiler. Both are just missing casts. The dominance.c change is a
> little weird, due to the assignment embedded in BITMAP_FREE.
>
> Nearly all the remaining compilation problems have to do with
> conversions between int and enum.
>
> Tom
>
> ChangeLog:
> 2008-10-05 Tom Tromey <tromey@redhat.com>
>
> * dominance.c (iterate_fix_dominators): Cast argument to
> BITMAP_FREE.
> * bitmap.c (bitmap_obstack_alloc_stat): Add cast.
> (bitmap_obstack_free): Likewise.
>
> Index: bitmap.c
> ===================================================================
> --- bitmap.c (revision 140884)
> +++ bitmap.c (working copy)
> @@ -1,6 +1,6 @@
> /* Functions to support general ended bitmaps.
> Copyright (C) 1997, 1998, 1999, 2000, 2001, 2003, 2004, 2005,
> - 2006, 2007 Free Software Foundation, Inc.
> + 2006, 2007, 2008 Free Software Foundation, Inc.
>
> This file is part of GCC.
>
> @@ -356,7 +356,7 @@
> bit_obstack = &bitmap_default_obstack;
> map = bit_obstack->heads;
> if (map)
> - bit_obstack->heads = (void *)map->first;
> + bit_obstack->heads = (bitmap_head_def *) (void *) map->first;
Certainly you only need one cast, not two. Likewise below.
Richard
> else
> map = XOBNEW (&bit_obstack->obstack, bitmap_head);
> bitmap_initialize_stat (map, bit_obstack PASS_MEM_STAT);
> @@ -391,7 +391,7 @@
> if (map)
> {
> bitmap_clear (map);
> - map->first = (void *)map->obstack->heads;
> + map->first = (bitmap_element *) (void *) map->obstack->heads;
> #ifdef GATHER_STATISTICS
> register_overhead (map, -((int)sizeof (bitmap_head)));
> #endif
> Index: dominance.c
> ===================================================================
> --- dominance.c (revision 140884)
> +++ dominance.c (working copy)
> @@ -1321,7 +1321,12 @@
> }
> }
> for (y = 0; y < g->n_vertices; y++)
> - BITMAP_FREE (g->vertices[y].data);
> + {
> + /* Strange contortions for C++ compilation. */
> + bitmap b = (bitmap) g->vertices[y].data;
> + BITMAP_FREE (b);
> + g->vertices[y].data = NULL;
> + }
> pointer_map_destroy (map);
>
> /* Find the dominator tree of G. */
>