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