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