Commit 20c1dc5e by Andreas Jaeger Committed by Andreas Jaeger

ggc.h: Convert to ISO C90 prototypes.

	* ggc.h: Convert to ISO C90 prototypes.
	* ggc-none.c: Likewise.
	* ggc-common.c: Likewise.
	* ggc-page.c: Likewise.
	* ggc-simple.c: Likewise.

From-SVN: r67596
parent 60e9f0d7
2003-06-07 Andreas Jaeger <aj@suse.de> 2003-06-07 Andreas Jaeger <aj@suse.de>
* ggc.h: Convert to ISO C90 prototypes.
* ggc-none.c: Likewise.
* ggc-common.c: Likewise.
* ggc-page.c: Likewise.
* ggc-simple.c: Likewise.
* crtstuff.c: Remove undefined usage of INIT_SECTION_PREAMBLE. * crtstuff.c: Remove undefined usage of INIT_SECTION_PREAMBLE.
* system.h: Poison INIT_SECTION_PREAMBLE. * system.h: Poison INIT_SECTION_PREAMBLE.
......
/* Null garbage collection for the GNU compiler. /* Null garbage collection for the GNU compiler.
Copyright (C) 1998, 1999, 2000 Free Software Foundation, Inc. Copyright (C) 1998, 1999, 2000, 2003
Free Software Foundation, Inc.
This file is part of GCC. This file is part of GCC.
...@@ -29,23 +30,19 @@ ...@@ -29,23 +30,19 @@
#include "ggc.h" #include "ggc.h"
void * void *
ggc_alloc (size) ggc_alloc (size_t size)
size_t size;
{ {
return xmalloc (size); return xmalloc (size);
} }
void * void *
ggc_alloc_cleared (size) ggc_alloc_cleared (size_t size)
size_t size;
{ {
return xcalloc (size, 1); return xcalloc (size, 1);
} }
void * void *
ggc_realloc (x, size) ggc_realloc (void *x, size_t size)
void *x;
size_t size;
{ {
return xrealloc (x, size); return xrealloc (x, size);
} }
/* Simple garbage collection for the GNU compiler. /* Simple garbage collection for the GNU compiler.
Copyright (C) 1998, 1999, 2000, 2001, 2002 Free Software Foundation, Inc. Copyright (C) 1998, 1999, 2000, 2001, 2002, 2003
Free Software Foundation, Inc.
This file is part of GCC. This file is part of GCC.
...@@ -113,25 +114,24 @@ static struct globals ...@@ -113,25 +114,24 @@ static struct globals
/* Local function prototypes. */ /* Local function prototypes. */
static void tree_insert PARAMS ((struct ggc_mem *)); static void tree_insert (struct ggc_mem *);
static int tree_lookup PARAMS ((struct ggc_mem *)); static int tree_lookup (struct ggc_mem *);
static void clear_marks PARAMS ((struct ggc_mem *)); static void clear_marks (struct ggc_mem *);
static void sweep_objs PARAMS ((struct ggc_mem **)); static void sweep_objs (struct ggc_mem **);
static void ggc_pop_context_1 PARAMS ((struct ggc_mem *, int)); static void ggc_pop_context_1 (struct ggc_mem *, int);
/* For use from debugger. */ /* For use from debugger. */
extern void debug_ggc_tree PARAMS ((struct ggc_mem *, int)); extern void debug_ggc_tree (struct ggc_mem *, int);
#ifdef GGC_BALANCE #ifdef GGC_BALANCE
extern void debug_ggc_balance PARAMS ((void)); extern void debug_ggc_balance (void);
#endif #endif
static void tally_leaves PARAMS ((struct ggc_mem *, int, size_t *, size_t *)); static void tally_leaves (struct ggc_mem *, int, size_t *, size_t *);
/* Insert V into the search tree. */ /* Insert V into the search tree. */
static inline void static inline void
tree_insert (v) tree_insert (struct ggc_mem *v)
struct ggc_mem *v;
{ {
size_t v_key = PTR_KEY (v); size_t v_key = PTR_KEY (v);
struct ggc_mem *p, **pp; struct ggc_mem *p, **pp;
...@@ -147,8 +147,7 @@ tree_insert (v) ...@@ -147,8 +147,7 @@ tree_insert (v)
/* Return true if V is in the tree. */ /* Return true if V is in the tree. */
static inline int static inline int
tree_lookup (v) tree_lookup (struct ggc_mem *v)
struct ggc_mem *v;
{ {
size_t v_key = PTR_KEY (v); size_t v_key = PTR_KEY (v);
struct ggc_mem *p = G.root; struct ggc_mem *p = G.root;
...@@ -167,8 +166,7 @@ tree_lookup (v) ...@@ -167,8 +166,7 @@ tree_lookup (v)
/* Alloc SIZE bytes of GC'able memory. If ZERO, clear the memory. */ /* Alloc SIZE bytes of GC'able memory. If ZERO, clear the memory. */
void * void *
ggc_alloc (size) ggc_alloc (size_t size)
size_t size;
{ {
struct ggc_mem *x; struct ggc_mem *x;
...@@ -193,8 +191,7 @@ ggc_alloc (size) ...@@ -193,8 +191,7 @@ ggc_alloc (size)
/* Mark a node. */ /* Mark a node. */
int int
ggc_set_mark (p) ggc_set_mark (const void *p)
const void *p;
{ {
struct ggc_mem *x; struct ggc_mem *x;
...@@ -217,8 +214,7 @@ ggc_set_mark (p) ...@@ -217,8 +214,7 @@ ggc_set_mark (p)
/* Return 1 if P has been marked, zero otherwise. */ /* Return 1 if P has been marked, zero otherwise. */
int int
ggc_marked_p (p) ggc_marked_p (const void *p)
const void *p;
{ {
struct ggc_mem *x; struct ggc_mem *x;
...@@ -234,8 +230,7 @@ ggc_marked_p (p) ...@@ -234,8 +230,7 @@ ggc_marked_p (p)
/* Return the size of the gc-able object P. */ /* Return the size of the gc-able object P. */
size_t size_t
ggc_get_size (p) ggc_get_size (const void *p)
const void *p;
{ {
struct ggc_mem *x struct ggc_mem *x
= (struct ggc_mem *) ((const char *)p - offsetof (struct ggc_mem, u)); = (struct ggc_mem *) ((const char *)p - offsetof (struct ggc_mem, u));
...@@ -245,8 +240,7 @@ ggc_get_size (p) ...@@ -245,8 +240,7 @@ ggc_get_size (p)
/* Unmark all objects. */ /* Unmark all objects. */
static void static void
clear_marks (x) clear_marks (struct ggc_mem *x)
struct ggc_mem *x;
{ {
x->mark = 0; x->mark = 0;
if (x->sub[0]) if (x->sub[0])
...@@ -258,8 +252,7 @@ clear_marks (x) ...@@ -258,8 +252,7 @@ clear_marks (x)
/* Free all objects in the current context that are not marked. */ /* Free all objects in the current context that are not marked. */
static void static void
sweep_objs (root) sweep_objs (struct ggc_mem **root)
struct ggc_mem **root;
{ {
struct ggc_mem *x = *root; struct ggc_mem *x = *root;
if (!x) if (!x)
...@@ -308,7 +301,7 @@ sweep_objs (root) ...@@ -308,7 +301,7 @@ sweep_objs (root)
/* The top level mark-and-sweep routine. */ /* The top level mark-and-sweep routine. */
void void
ggc_collect () ggc_collect (void)
{ {
/* Avoid frequent unnecessary work by skipping collection if the /* Avoid frequent unnecessary work by skipping collection if the
total allocations haven't expanded much since the last total allocations haven't expanded much since the last
...@@ -351,7 +344,7 @@ ggc_collect () ...@@ -351,7 +344,7 @@ ggc_collect ()
/* Called once to initialize the garbage collector. */ /* Called once to initialize the garbage collector. */
void void
init_ggc () init_ggc (void)
{ {
} }
...@@ -359,7 +352,7 @@ init_ggc () ...@@ -359,7 +352,7 @@ init_ggc ()
will not be collected while the new context is active. */ will not be collected while the new context is active. */
void void
ggc_push_context () ggc_push_context (void)
{ {
G.context++; G.context++;
...@@ -373,7 +366,7 @@ ggc_push_context () ...@@ -373,7 +366,7 @@ ggc_push_context ()
will be merged with the old context. */ will be merged with the old context. */
void void
ggc_pop_context () ggc_pop_context (void)
{ {
G.context--; G.context--;
if (G.root) if (G.root)
...@@ -381,9 +374,7 @@ ggc_pop_context () ...@@ -381,9 +374,7 @@ ggc_pop_context ()
} }
static void static void
ggc_pop_context_1 (x, c) ggc_pop_context_1 (struct ggc_mem *x, int c)
struct ggc_mem *x;
int c;
{ {
if (x->context > c) if (x->context > c)
x->context = c; x->context = c;
...@@ -396,9 +387,7 @@ ggc_pop_context_1 (x, c) ...@@ -396,9 +387,7 @@ ggc_pop_context_1 (x, c)
/* Dump a tree. */ /* Dump a tree. */
void void
debug_ggc_tree (p, indent) debug_ggc_tree (struct ggc_mem *p, int indent)
struct ggc_mem *p;
int indent;
{ {
int i; int i;
...@@ -413,7 +402,7 @@ debug_ggc_tree (p, indent) ...@@ -413,7 +402,7 @@ debug_ggc_tree (p, indent)
for (i = 0; i < indent; ++i) for (i = 0; i < indent; ++i)
putc (' ', stderr); putc (' ', stderr);
fprintf (stderr, "%lx %p\n", (unsigned long)PTR_KEY (p), (PTR) p); fprintf (stderr, "%lx %p\n", (unsigned long)PTR_KEY (p), (void *) p);
if (p->sub[1]) if (p->sub[1])
debug_ggc_tree (p->sub[1], indent + 1); debug_ggc_tree (p->sub[1], indent + 1);
...@@ -425,7 +414,7 @@ debug_ggc_tree (p, indent) ...@@ -425,7 +414,7 @@ debug_ggc_tree (p, indent)
#include <math.h> #include <math.h>
void void
debug_ggc_balance () debug_ggc_balance (void)
{ {
size_t nleaf, sumdepth; size_t nleaf, sumdepth;
...@@ -443,11 +432,7 @@ debug_ggc_balance () ...@@ -443,11 +432,7 @@ debug_ggc_balance ()
/* Used by debug_ggc_balance, and also by ggc_print_statistics. */ /* Used by debug_ggc_balance, and also by ggc_print_statistics. */
static void static void
tally_leaves (x, depth, nleaf, sumdepth) tally_leaves (struct ggc_mem *x, int depth, size_t *nleaf, size_t *sumdepth)
struct ggc_mem *x;
int depth;
size_t *nleaf;
size_t *sumdepth;
{ {
if (! x->sub[0] && !x->sub[1]) if (! x->sub[0] && !x->sub[1])
{ {
...@@ -472,7 +457,7 @@ tally_leaves (x, depth, nleaf, sumdepth) ...@@ -472,7 +457,7 @@ tally_leaves (x, depth, nleaf, sumdepth)
/* Report on GC memory usage. */ /* Report on GC memory usage. */
void void
ggc_print_statistics () ggc_print_statistics (void)
{ {
struct ggc_statistics stats; struct ggc_statistics stats;
size_t nleaf = 0, sumdepth = 0; size_t nleaf = 0, sumdepth = 0;
...@@ -506,73 +491,63 @@ Total memory in GC arena\t%ld%c\n", ...@@ -506,73 +491,63 @@ Total memory in GC arena\t%ld%c\n",
} }
struct ggc_pch_data * struct ggc_pch_data *
init_ggc_pch () init_ggc_pch (void)
{ {
sorry ("Generating PCH files is not supported when using ggc-simple.c"); sorry ("Generating PCH files is not supported when using ggc-simple.c");
/* It could be supported, but the code is not yet written. */ /* It could be supported, but the code is not yet written. */
return NULL; return NULL;
} }
void void
ggc_pch_count_object (d, x, size) ggc_pch_count_object (struct ggc_pch_data *d ATTRIBUTE_UNUSED,
struct ggc_pch_data *d ATTRIBUTE_UNUSED; void *x ATTRIBUTE_UNUSED,
void *x ATTRIBUTE_UNUSED; size_t size ATTRIBUTE_UNUSED)
size_t size ATTRIBUTE_UNUSED;
{ {
} }
size_t size_t
ggc_pch_total_size (d) ggc_pch_total_size (struct ggc_pch_data *d ATTRIBUTE_UNUSED)
struct ggc_pch_data *d ATTRIBUTE_UNUSED;
{ {
return 0; return 0;
} }
void void
ggc_pch_this_base (d, base) ggc_pch_this_base (struct ggc_pch_data *d ATTRIBUTE_UNUSED,
struct ggc_pch_data *d ATTRIBUTE_UNUSED; void *base ATTRIBUTE_UNUSED)
void *base ATTRIBUTE_UNUSED;
{ {
} }
char * char *
ggc_pch_alloc_object (d, x, size) ggc_pch_alloc_object (struct ggc_pch_data *d ATTRIBUTE_UNUSED,
struct ggc_pch_data *d ATTRIBUTE_UNUSED; void *x ATTRIBUTE_UNUSED,
void *x ATTRIBUTE_UNUSED; size_t size ATTRIBUTE_UNUSED)
size_t size ATTRIBUTE_UNUSED;
{ {
return NULL; return NULL;
} }
void void
ggc_pch_prepare_write (d, f) ggc_pch_prepare_write (struct ggc_pch_data *d ATTRIBUTE_UNUSED,
struct ggc_pch_data * d ATTRIBUTE_UNUSED; FILE * f ATTRIBUTE_UNUSED)
FILE * f ATTRIBUTE_UNUSED;
{ {
} }
void void
ggc_pch_write_object (d, f, x, newx, size) ggc_pch_write_object (struct ggc_pch_data *d ATTRIBUTE_UNUSED,
struct ggc_pch_data * d ATTRIBUTE_UNUSED; FILE *f ATTRIBUTE_UNUSED, void *x ATTRIBUTE_UNUSED,
FILE *f ATTRIBUTE_UNUSED; void *newx ATTRIBUTE_UNUSED,
void *x ATTRIBUTE_UNUSED; size_t size ATTRIBUTE_UNUSED)
void *newx ATTRIBUTE_UNUSED;
size_t size ATTRIBUTE_UNUSED;
{ {
} }
void void
ggc_pch_finish (d, f) ggc_pch_finish (struct ggc_pch_data *d ATTRIBUTE_UNUSED,
struct ggc_pch_data * d ATTRIBUTE_UNUSED; FILE *f ATTRIBUTE_UNUSED)
FILE *f ATTRIBUTE_UNUSED;
{ {
} }
void void
ggc_pch_read (f, addr) ggc_pch_read (FILE *f ATTRIBUTE_UNUSED, void *addr ATTRIBUTE_UNUSED)
FILE *f ATTRIBUTE_UNUSED;
void *addr ATTRIBUTE_UNUSED;
{ {
/* This should be impossible, since we won't generate any valid PCH /* This should be impossible, since we won't generate any valid PCH
files for this configuration. */ files for this configuration. */
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment