Patchwork ggc-zone build fixes (was Re: system.h and system header include cleanup)

login
register
mail settings
Submitter Laurynas Biveinis
Date Nov. 30, 2010, 4:13 a.m.
Message ID <4CF479E2.7010604@gmail.com>
Download mbox | patch
Permalink /patch/73524/
State New
Headers show

Comments

Laurynas Biveinis - Nov. 30, 2010, 4:13 a.m.
2010/11/27 Joseph S. Myers <joseph@codesourcery.com>:
>> ggc-zone.c is not compiled unless configured with --with-gc=zone, so
>> would you mind doing 'make ggc-zone.o' to make sure it still builds OK
>> with the change?
>
> It has a pre-existing build failure.

The joys of unused-but-present code.  Joseph, sorry for disturbing you then.  I have
committed the following as obvious, tested by bootstrapping with and without
--with-gc=zone.  I did not bother to test --with-gc=zone --enable-gather-mem-stats
combination.

For the record, my previous suggestion of using make ggc-zone.o to test is wrong at least
due to missing GGC_ZONE define.

Also for the record, for 4.7 I have plans to get rid of one GC implementation, thus
solving this ggc-zone mess.

2010-11-30  Laurynas Biveinis  <laurynas.biveinis@gmail.com>

	* ggc-zone.c (ggc_pch_read): Fix conditional compilation.
	* ggc-none.c (ggc_internal_alloc_zone_stat)
	(ggc_internal_cleared_alloc_zone_stat): New.

Patch

Index: gcc/ggc-zone.c
===================================================================
--- gcc/ggc-zone.c	(revision 167234)
+++ gcc/ggc-zone.c	(working copy)
@@ -2476,7 +2476,7 @@ 

   /* We've just read in a PCH file.  So, every object that used to be
      allocated is now free.  */
-#ifdef 0 && GATHER_STATISTICS
+#ifdef GATHER_STATISTICS
   zone_allocate_marks ();
   ggc_prune_overhead_list ();
   zone_free_marks ();
Index: gcc/ggc-none.c
===================================================================
--- gcc/ggc-none.c	(revision 167234)
+++ gcc/ggc-none.c	(working copy)
@@ -71,3 +71,22 @@ 
 struct alloc_zone rtl_zone;
 struct alloc_zone tree_zone;
 struct alloc_zone tree_id_zone;
+
+#if defined (GGC_ZONE) && !defined (GENERATOR_FILE)
+
+void *
+ggc_internal_alloc_zone_stat (size_t size,
+                              struct alloc_zone * ARG_UNUSED(z) MEM_STAT_DECL)
+{
+    return xmalloc (size);
+}
+
+void *
+ggc_internal_cleared_alloc_zone_stat (size_t size,
+                                      struct alloc_zone * ARG_UNUSED(z)
+                                      MEM_STAT_DECL)
+{
+    return xcalloc (size, 1);
+}
+
+#endif