public inbox for gcc-patches@gcc.gnu.org
 help / color / mirror / Atom feed
* [gcc-in-cxx] FYI: fix 2 bitmap-related c++ errors
@ 2008-10-05 17:58 Tom Tromey
  2008-10-05 18:18 ` Richard Guenther
  0 siblings, 1 reply; 3+ messages in thread
From: Tom Tromey @ 2008-10-05 17:58 UTC (permalink / raw)
  To: Gcc Patch List

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;
   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.  */

^ permalink raw reply	[flat|nested] 3+ messages in thread

* Re: [gcc-in-cxx] FYI: fix 2 bitmap-related c++ errors
  2008-10-05 17:58 [gcc-in-cxx] FYI: fix 2 bitmap-related c++ errors Tom Tromey
@ 2008-10-05 18:18 ` Richard Guenther
  2008-10-05 18:57   ` Tom Tromey
  0 siblings, 1 reply; 3+ messages in thread
From: Richard Guenther @ 2008-10-05 18:18 UTC (permalink / raw)
  To: Tom Tromey; +Cc: Gcc Patch List

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.  */
>

^ permalink raw reply	[flat|nested] 3+ messages in thread

* Re: [gcc-in-cxx] FYI: fix 2 bitmap-related c++ errors
  2008-10-05 18:18 ` Richard Guenther
@ 2008-10-05 18:57   ` Tom Tromey
  0 siblings, 0 replies; 3+ messages in thread
From: Tom Tromey @ 2008-10-05 18:57 UTC (permalink / raw)
  To: Richard Guenther; +Cc: Gcc Patch List

Richard> Certainly you only need one cast, not two.  Likewise below.

Oops, what was I thinking?
I'm committing the appended.

Tom

ChangeLog:
2008-10-05  Tom Tromey  <tromey@redhat.com>

	* bitmap.c (bitmap_obstack_alloc_stat): Remove extra cast.
	(bitmap_obstack_free): Likewise.

Index: bitmap.c
===================================================================
--- bitmap.c	(revision 140890)
+++ bitmap.c	(working copy)
@@ -356,7 +356,7 @@
     bit_obstack = &bitmap_default_obstack;
   map = bit_obstack->heads;
   if (map)
-    bit_obstack->heads = (bitmap_head_def *) (void *) map->first;
+    bit_obstack->heads = (bitmap_head_def *) map->first;
   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 = (bitmap_element *) (void *) map->obstack->heads;
+      map->first = (bitmap_element *) map->obstack->heads;
 #ifdef GATHER_STATISTICS
       register_overhead (map, -((int)sizeof (bitmap_head)));
 #endif

^ permalink raw reply	[flat|nested] 3+ messages in thread

end of thread, other threads:[~2008-10-05 18:18 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2008-10-05 17:58 [gcc-in-cxx] FYI: fix 2 bitmap-related c++ errors Tom Tromey
2008-10-05 18:18 ` Richard Guenther
2008-10-05 18:57   ` Tom Tromey

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).