summaryrefslogtreecommitdiff
path: root/gcc/ggc.h
diff options
context:
space:
mode:
authorbernie <bernie@138bc75d-0d04-0410-961f-82ee72b054a4>2004-07-25 00:20:14 +0000
committerbernie <bernie@138bc75d-0d04-0410-961f-82ee72b054a4>2004-07-25 00:20:14 +0000
commit7511644a5559dbe85d8553feb76d7feffe140c96 (patch)
tree253d1f0af9fce4be5616190b1b14531fe8576f9c /gcc/ggc.h
parent0cc5621223e7c3e8135464be35cd91ce10f48be7 (diff)
downloadgcc-7511644a5559dbe85d8553feb76d7feffe140c96.tar.gz
* ggc.h (GGC_NEW, GGC_CNEW, GGC_NEWVEC, GGC_CNEWVEC, GGC_NEWVAR,
GGC_CNEWVAR): New macros. git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@85133 138bc75d-0d04-0410-961f-82ee72b054a4
Diffstat (limited to 'gcc/ggc.h')
-rw-r--r--gcc/ggc.h8
1 files changed, 8 insertions, 0 deletions
diff --git a/gcc/ggc.h b/gcc/ggc.h
index 4ce271a0760..821de0c2b32 100644
--- a/gcc/ggc.h
+++ b/gcc/ggc.h
@@ -237,6 +237,14 @@ extern void ggc_record_overhead (size_t, size_t MEM_STAT_DECL);
extern void dump_ggc_loc_statistics (void);
+/* Type-safe, C++-friendly versions of ggc_alloc() and gcc_calloc(). */
+#define GGC_NEW(T) ((T *) ggc_alloc (sizeof (T)))
+#define GGC_CNEW(T) ((T *) ggc_alloc_cleared (sizeof (T)))
+#define GGC_NEWVEC(T, N) ((T *) ggc_alloc ((N) * sizeof(T)))
+#define GGC_CNEWVEC(T, N) ((T *) ggc_alloc_cleared ((N) * sizeof(T)))
+#define GGC_NEWVAR(T, S) ((T *) ggc_alloc ((S)))
+#define GGC_CNEWVAR(T, S) ((T *) ggc_alloc_cleared ((S)))
+
#define ggc_alloc_rtx(CODE) \
((rtx) ggc_alloc_typed (gt_ggc_e_7rtx_def, RTX_SIZE (CODE)))