1 /* d-frontend.h -- D frontend interface to the gcc back-end. 2 Copyright (C) 2019-2022 Free Software Foundation, Inc. 3 4 GCC is free software; you can redistribute it and/or modify 5 it under the terms of the GNU General Public License as published by 6 the Free Software Foundation; either version 3, or (at your option) 7 any later version. 8 9 GCC is distributed in the hope that it will be useful, 10 but WITHOUT ANY WARRANTY; without even the implied warranty of 11 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 12 GNU General Public License for more details. 13 14 You should have received a copy of the GNU General Public License 15 along with GCC; see the file COPYING3. If not see 16 <http://www.gnu.org/licenses/>. */ 17 18 #ifndef GCC_D_FRONTEND_H 19 #define GCC_D_FRONTEND_H 20 21 /* These functions are defined in D runtime. */ 22 extern "C" int rt_init (void); 23 extern "C" int rt_term (void); 24 extern "C" void gc_disable (void); 25 extern "C" void *gc_malloc (size_t sz, unsigned ba = 0, const void *ti = NULL); 26 extern "C" void gc_free (void *); 27 extern "C" void gc_collect (void); 28 29 template<typename T> 30 inline T * d_gc_malloc(void)31d_gc_malloc (void) 32 { 33 void *ptr = gc_malloc (sizeof (T)); 34 return new(ptr) T (); 35 } 36 37 #endif 38