xref: /dflybsd-src/contrib/gcc-4.7/gcc/ggc-none.c (revision 04febcfb30580676d3e95f58a16c5137ee478b32)
1*e4b17023SJohn Marino /* Null garbage collection for the GNU compiler.
2*e4b17023SJohn Marino    Copyright (C) 1998, 1999, 2000, 2003, 2004, 2005, 2007, 2010
3*e4b17023SJohn Marino    Free Software Foundation, Inc.
4*e4b17023SJohn Marino 
5*e4b17023SJohn Marino    This file is part of GCC.
6*e4b17023SJohn Marino 
7*e4b17023SJohn Marino    GCC is free software; you can redistribute it and/or modify it
8*e4b17023SJohn Marino    under the terms of the GNU General Public License as published by
9*e4b17023SJohn Marino    the Free Software Foundation; either version 3, or (at your option)
10*e4b17023SJohn Marino    any later version.
11*e4b17023SJohn Marino 
12*e4b17023SJohn Marino    GCC is distributed in the hope that it will be useful, but WITHOUT
13*e4b17023SJohn Marino    ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
14*e4b17023SJohn Marino    or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public
15*e4b17023SJohn Marino    License for more details.
16*e4b17023SJohn Marino 
17*e4b17023SJohn Marino    You should have received a copy of the GNU General Public License
18*e4b17023SJohn Marino    along with GCC; see the file COPYING3.  If not see
19*e4b17023SJohn Marino    <http://www.gnu.org/licenses/>.  */
20*e4b17023SJohn Marino 
21*e4b17023SJohn Marino /* This version is used by the gen* programs and certain language-specific
22*e4b17023SJohn Marino    targets (such as java), where we don't really need GC at all.
23*e4b17023SJohn Marino    This prevents problems with pulling in all the tree stuff.  */
24*e4b17023SJohn Marino 
25*e4b17023SJohn Marino #ifdef GENERATOR_FILE
26*e4b17023SJohn Marino #include "bconfig.h"
27*e4b17023SJohn Marino #else
28*e4b17023SJohn Marino #include "config.h"
29*e4b17023SJohn Marino #endif
30*e4b17023SJohn Marino 
31*e4b17023SJohn Marino #include "system.h"
32*e4b17023SJohn Marino #include "coretypes.h"
33*e4b17023SJohn Marino #include "ggc.h"
34*e4b17023SJohn Marino 
35*e4b17023SJohn Marino void *
ggc_alloc_typed_stat(enum gt_types_enum ARG_UNUSED (gte),size_t size MEM_STAT_DECL)36*e4b17023SJohn Marino ggc_alloc_typed_stat (enum gt_types_enum ARG_UNUSED (gte), size_t size
37*e4b17023SJohn Marino 		      MEM_STAT_DECL)
38*e4b17023SJohn Marino {
39*e4b17023SJohn Marino   return xmalloc (size);
40*e4b17023SJohn Marino }
41*e4b17023SJohn Marino 
42*e4b17023SJohn Marino /* For a given size of memory requested for allocation, return the
43*e4b17023SJohn Marino    actual size that is going to be allocated.  */
44*e4b17023SJohn Marino 
45*e4b17023SJohn Marino size_t
ggc_round_alloc_size(size_t requested_size)46*e4b17023SJohn Marino ggc_round_alloc_size (size_t requested_size)
47*e4b17023SJohn Marino {
48*e4b17023SJohn Marino   return requested_size;
49*e4b17023SJohn Marino }
50*e4b17023SJohn Marino 
51*e4b17023SJohn Marino void *
ggc_internal_alloc_stat(size_t size MEM_STAT_DECL)52*e4b17023SJohn Marino ggc_internal_alloc_stat (size_t size MEM_STAT_DECL)
53*e4b17023SJohn Marino {
54*e4b17023SJohn Marino   return xmalloc (size);
55*e4b17023SJohn Marino }
56*e4b17023SJohn Marino 
57*e4b17023SJohn Marino void *
ggc_internal_cleared_alloc_stat(size_t size MEM_STAT_DECL)58*e4b17023SJohn Marino ggc_internal_cleared_alloc_stat (size_t size MEM_STAT_DECL)
59*e4b17023SJohn Marino {
60*e4b17023SJohn Marino   return xcalloc (size, 1);
61*e4b17023SJohn Marino }
62*e4b17023SJohn Marino 
63*e4b17023SJohn Marino void *
ggc_realloc_stat(void * x,size_t size MEM_STAT_DECL)64*e4b17023SJohn Marino ggc_realloc_stat (void *x, size_t size MEM_STAT_DECL)
65*e4b17023SJohn Marino {
66*e4b17023SJohn Marino   return xrealloc (x, size);
67*e4b17023SJohn Marino }
68*e4b17023SJohn Marino 
69*e4b17023SJohn Marino void
ggc_free(void * p)70*e4b17023SJohn Marino ggc_free (void *p)
71*e4b17023SJohn Marino {
72*e4b17023SJohn Marino   free (p);
73*e4b17023SJohn Marino }
74*e4b17023SJohn Marino 
75*e4b17023SJohn Marino struct alloc_zone
76*e4b17023SJohn Marino {
77*e4b17023SJohn Marino   int dummy;
78*e4b17023SJohn Marino };
79*e4b17023SJohn Marino 
80*e4b17023SJohn Marino struct alloc_zone rtl_zone;
81*e4b17023SJohn Marino struct alloc_zone tree_zone;
82*e4b17023SJohn Marino struct alloc_zone tree_id_zone;
83*e4b17023SJohn Marino 
84*e4b17023SJohn Marino #if defined (GGC_ZONE) && !defined (GENERATOR_FILE)
85*e4b17023SJohn Marino 
86*e4b17023SJohn Marino void *
ggc_internal_alloc_zone_stat(size_t size,struct alloc_zone * ARG_UNUSED (z)MEM_STAT_DECL)87*e4b17023SJohn Marino ggc_internal_alloc_zone_stat (size_t size,
88*e4b17023SJohn Marino                               struct alloc_zone * ARG_UNUSED(z) MEM_STAT_DECL)
89*e4b17023SJohn Marino {
90*e4b17023SJohn Marino     return xmalloc (size);
91*e4b17023SJohn Marino }
92*e4b17023SJohn Marino 
93*e4b17023SJohn Marino void *
ggc_internal_cleared_alloc_zone_stat(size_t size,struct alloc_zone * ARG_UNUSED (z)MEM_STAT_DECL)94*e4b17023SJohn Marino ggc_internal_cleared_alloc_zone_stat (size_t size,
95*e4b17023SJohn Marino                                       struct alloc_zone * ARG_UNUSED(z)
96*e4b17023SJohn Marino                                       MEM_STAT_DECL)
97*e4b17023SJohn Marino {
98*e4b17023SJohn Marino     return xcalloc (size, 1);
99*e4b17023SJohn Marino }
100*e4b17023SJohn Marino 
101*e4b17023SJohn Marino #endif
102