xref: /netbsd-src/external/gpl3/gcc/dist/gcc/ggc-none.cc (revision b1e838363e3c6fc78a55519254d99869742dd33c)
1*b1e83836Smrg /* Null garbage collection for the GNU compiler.
2*b1e83836Smrg    Copyright (C) 1998-2022 Free Software Foundation, Inc.
3*b1e83836Smrg 
4*b1e83836Smrg    This file is part of GCC.
5*b1e83836Smrg 
6*b1e83836Smrg    GCC is free software; you can redistribute it and/or modify it
7*b1e83836Smrg    under the terms of the GNU General Public License as published by
8*b1e83836Smrg    the Free Software Foundation; either version 3, or (at your option)
9*b1e83836Smrg    any later version.
10*b1e83836Smrg 
11*b1e83836Smrg    GCC is distributed in the hope that it will be useful, but WITHOUT
12*b1e83836Smrg    ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
13*b1e83836Smrg    or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public
14*b1e83836Smrg    License for more details.
15*b1e83836Smrg 
16*b1e83836Smrg    You should have received a copy of the GNU General Public License
17*b1e83836Smrg    along with GCC; see the file COPYING3.  If not see
18*b1e83836Smrg    <http://www.gnu.org/licenses/>.  */
19*b1e83836Smrg 
20*b1e83836Smrg /* This version is used by the gen* programs and certain language-specific
21*b1e83836Smrg    targets (such as java), where we don't really need GC at all.
22*b1e83836Smrg    This prevents problems with pulling in all the tree stuff.  */
23*b1e83836Smrg 
24*b1e83836Smrg #ifdef GENERATOR_FILE
25*b1e83836Smrg #include "bconfig.h"
26*b1e83836Smrg #else
27*b1e83836Smrg #include "config.h"
28*b1e83836Smrg #endif
29*b1e83836Smrg 
30*b1e83836Smrg #include "system.h"
31*b1e83836Smrg #include "coretypes.h"
32*b1e83836Smrg #include "hash-table.h"
33*b1e83836Smrg 
34*b1e83836Smrg /* For a given size of memory requested for allocation, return the
35*b1e83836Smrg    actual size that is going to be allocated.  */
36*b1e83836Smrg 
37*b1e83836Smrg size_t
ggc_round_alloc_size(size_t requested_size)38*b1e83836Smrg ggc_round_alloc_size (size_t requested_size)
39*b1e83836Smrg {
40*b1e83836Smrg   return requested_size;
41*b1e83836Smrg }
42*b1e83836Smrg 
43*b1e83836Smrg void *
ggc_internal_alloc(size_t size,void (* f)(void *),size_t,size_t MEM_STAT_DECL)44*b1e83836Smrg ggc_internal_alloc (size_t size, void (*f)(void *), size_t, size_t
45*b1e83836Smrg 		    MEM_STAT_DECL)
46*b1e83836Smrg {
47*b1e83836Smrg   gcc_assert (!f); // ggc-none doesn't support finalizers
48*b1e83836Smrg   return xmalloc (size);
49*b1e83836Smrg }
50*b1e83836Smrg 
51*b1e83836Smrg void *
ggc_internal_cleared_alloc(size_t size,void (* f)(void *),size_t,size_t MEM_STAT_DECL)52*b1e83836Smrg ggc_internal_cleared_alloc (size_t size, void (*f)(void *), size_t, size_t
53*b1e83836Smrg 			    MEM_STAT_DECL)
54*b1e83836Smrg {
55*b1e83836Smrg   gcc_assert (!f); // ggc-none doesn't support finalizers
56*b1e83836Smrg   return xcalloc (size, 1);
57*b1e83836Smrg }
58*b1e83836Smrg 
59*b1e83836Smrg void *
ggc_realloc_stat(void * x,size_t size MEM_STAT_DECL)60*b1e83836Smrg ggc_realloc_stat (void *x, size_t size MEM_STAT_DECL)
61*b1e83836Smrg {
62*b1e83836Smrg   return xrealloc (x, size);
63*b1e83836Smrg }
64*b1e83836Smrg 
65*b1e83836Smrg void
ggc_free(void * p)66*b1e83836Smrg ggc_free (void *p)
67*b1e83836Smrg {
68*b1e83836Smrg   free (p);
69*b1e83836Smrg }
70*b1e83836Smrg 
71*b1e83836Smrg void
ggc_grow(void)72*b1e83836Smrg ggc_grow (void)
73*b1e83836Smrg {
74*b1e83836Smrg }
75*b1e83836Smrg 
76*b1e83836Smrg void
ggc_trim(void)77*b1e83836Smrg ggc_trim (void)
78*b1e83836Smrg {
79*b1e83836Smrg }
80