xref: /netbsd-src/external/gpl3/gcc/dist/libgomp/libgomp-plugin.c (revision b1e838363e3c6fc78a55519254d99869742dd33c)
1*b1e83836Smrg /* Copyright (C) 2014-2022 Free Software Foundation, Inc.
24d5abbe8Smrg 
34d5abbe8Smrg    Contributed by Mentor Embedded.
44d5abbe8Smrg 
54d5abbe8Smrg    This file is part of the GNU Offloading and Multi Processing Library
64d5abbe8Smrg    (libgomp).
74d5abbe8Smrg 
84d5abbe8Smrg    Libgomp is free software; you can redistribute it and/or modify it
94d5abbe8Smrg    under the terms of the GNU General Public License as published by
104d5abbe8Smrg    the Free Software Foundation; either version 3, or (at your option)
114d5abbe8Smrg    any later version.
124d5abbe8Smrg 
134d5abbe8Smrg    Libgomp is distributed in the hope that it will be useful, but WITHOUT ANY
144d5abbe8Smrg    WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
154d5abbe8Smrg    FOR A PARTICULAR PURPOSE.  See the GNU General Public License for
164d5abbe8Smrg    more details.
174d5abbe8Smrg 
184d5abbe8Smrg    Under Section 7 of GPL version 3, you are granted additional
194d5abbe8Smrg    permissions described in the GCC Runtime Library Exception, version
204d5abbe8Smrg    3.1, as published by the Free Software Foundation.
214d5abbe8Smrg 
224d5abbe8Smrg    You should have received a copy of the GNU General Public License and
234d5abbe8Smrg    a copy of the GCC Runtime Library Exception along with this program;
244d5abbe8Smrg    see the files COPYING3 and COPYING.RUNTIME respectively.  If not, see
254d5abbe8Smrg    <http://www.gnu.org/licenses/>.  */
264d5abbe8Smrg 
274d5abbe8Smrg /* Exported (non-hidden) functions exposing libgomp interface for plugins.  */
284d5abbe8Smrg 
294d5abbe8Smrg #include <stdlib.h>
304d5abbe8Smrg 
314d5abbe8Smrg #include "libgomp.h"
324d5abbe8Smrg #include "libgomp-plugin.h"
334d5abbe8Smrg 
344d5abbe8Smrg void *
GOMP_PLUGIN_malloc(size_t size)354d5abbe8Smrg GOMP_PLUGIN_malloc (size_t size)
364d5abbe8Smrg {
374d5abbe8Smrg   return gomp_malloc (size);
384d5abbe8Smrg }
394d5abbe8Smrg 
404d5abbe8Smrg void *
GOMP_PLUGIN_malloc_cleared(size_t size)414d5abbe8Smrg GOMP_PLUGIN_malloc_cleared (size_t size)
424d5abbe8Smrg {
434d5abbe8Smrg   return gomp_malloc_cleared (size);
444d5abbe8Smrg }
454d5abbe8Smrg 
464d5abbe8Smrg void *
GOMP_PLUGIN_realloc(void * ptr,size_t size)474d5abbe8Smrg GOMP_PLUGIN_realloc (void *ptr, size_t size)
484d5abbe8Smrg {
494d5abbe8Smrg   return gomp_realloc (ptr, size);
504d5abbe8Smrg }
514d5abbe8Smrg 
524d5abbe8Smrg void
GOMP_PLUGIN_debug(int kind,const char * msg,...)534d5abbe8Smrg GOMP_PLUGIN_debug (int kind, const char *msg, ...)
544d5abbe8Smrg {
554d5abbe8Smrg   va_list ap;
564d5abbe8Smrg 
574d5abbe8Smrg   va_start (ap, msg);
584d5abbe8Smrg   gomp_vdebug (kind, msg, ap);
594d5abbe8Smrg   va_end (ap);
604d5abbe8Smrg }
614d5abbe8Smrg 
624d5abbe8Smrg void
GOMP_PLUGIN_error(const char * msg,...)634d5abbe8Smrg GOMP_PLUGIN_error (const char *msg, ...)
644d5abbe8Smrg {
654d5abbe8Smrg   va_list ap;
664d5abbe8Smrg 
674d5abbe8Smrg   va_start (ap, msg);
684d5abbe8Smrg   gomp_verror (msg, ap);
694d5abbe8Smrg   va_end (ap);
704d5abbe8Smrg }
714d5abbe8Smrg 
724d5abbe8Smrg void
GOMP_PLUGIN_fatal(const char * msg,...)734d5abbe8Smrg GOMP_PLUGIN_fatal (const char *msg, ...)
744d5abbe8Smrg {
754d5abbe8Smrg   va_list ap;
764d5abbe8Smrg 
774d5abbe8Smrg   va_start (ap, msg);
784d5abbe8Smrg   gomp_vfatal (msg, ap);
794d5abbe8Smrg   va_end (ap);
804d5abbe8Smrg }
81