/* This is now really controlled at startup, */
/* through GC_all_interior_pointers. */
+/* Note: never put extern "C" around an #include. */
+#ifdef __cplusplus
+ extern "C" {
+#endif
#ifndef GC_NO_FINALIZATION
# define GC_INVOKE_FINALIZERS() GC_notify_or_invoke_finalizers()
GC_INNER void GC_print_callers(struct callinfo info[NFRAMES]);
#endif
+#ifdef __cplusplus
+ } /* extern "C" */
+#endif
/*********************************/
/* */
# define MS_TIME_DIFF(a,b) ((long)((a)-(b)))
#elif defined(NN_PLATFORM_CTR)
# define CLOCK_TYPE long long
+# ifdef __cplusplus
+ extern "C" {
+# endif
CLOCK_TYPE n3ds_get_system_tick(void);
CLOCK_TYPE n3ds_convert_tick_to_ms(CLOCK_TYPE tick);
+# ifdef __cplusplus
+ } /* extern "C" */
+# endif
# define GET_TIME(x) (void)(x = n3ds_get_system_tick())
# define MS_TIME_DIFF(a,b) ((long)n3ds_convert_tick_to_ms((a)-(b)))
#else /* !BSD_TIME && !NN_PLATFORM_CTR && !MSWIN32 && !MSWINCE */
# define BZERO(x,n) bzero((void *)(x),(size_t)(n))
# endif
+#ifdef PCR
+# include "th/PCR_ThCtl.h"
+#endif
+
+#ifdef __cplusplus
+ extern "C" {
+#endif
+
/*
* Stop and restart mutator threads.
*/
# ifdef PCR
-# include "th/PCR_ThCtl.h"
# define STOP_WORLD() \
PCR_ThCtl_SetExclusiveMode(PCR_ThCtl_ExclusiveMode_stopNormal, \
PCR_allSigsBlocked, \
# define GETENV(name) getenv(name)
#endif
+#ifdef __cplusplus
+ } /* extern "C" */
+#endif
+
#if defined(DARWIN)
# include <mach/thread_status.h>
# ifndef MAC_OS_X_VERSION_MAX_ALLOWED
# endif
#endif /* DARWIN */
+#ifdef PARALLEL_MARK
+# include "gc_atomic_ops.h"
+# define counter_t volatile AO_t
+#else
+ typedef size_t counter_t;
+# if defined(THREADS) && (defined(MPROTECT_VDB) || defined(THREAD_SANITIZER) \
+ || (defined(GC_ASSERTIONS) && defined(THREAD_LOCAL_ALLOC)))
+# include "gc_atomic_ops.h"
+# endif
+#endif /* !PARALLEL_MARK */
+
+#include "../gc_tiny_fl.h"
+
+#include <setjmp.h>
+
+#ifdef __cplusplus
+ extern "C" {
+#endif
+
/*********************************/
/* */
/* Word-size-dependent defines */
/* separate free lists for each multiple of GRANULE_BYTES */
/* up to (TINY_FREELISTS-1) * GRANULE_BYTES. After that they */
/* may be spread out further. */
-#include "../gc_tiny_fl.h"
+
#define GRANULE_BYTES GC_GRANULE_BYTES
#define TINY_FREELISTS GC_TINY_FREELISTS
/* initial group of mark bits, and it is safe */
/* to allocate smaller header for large objects. */
-#ifdef PARALLEL_MARK
-# include "gc_atomic_ops.h"
-# define counter_t volatile AO_t
-#else
- typedef size_t counter_t;
-# if defined(THREADS) && (defined(MPROTECT_VDB) || defined(THREAD_SANITIZER) \
- || (defined(GC_ASSERTIONS) && defined(THREAD_LOCAL_ALLOC)))
-# include "gc_atomic_ops.h"
-# endif
-#endif /* !PARALLEL_MARK */
-
union word_ptr_ao_u {
word w;
signed_word sw;
/* Basic logging routine. Typically, GC_log_printf is called directly */
/* only inside various DEBUG_x blocks. */
-#if defined(__cplusplus) && defined(SYMBIAN)
- extern "C" {
-#endif
GC_API_PRIV void GC_log_printf(const char * format, ...)
GC_ATTR_FORMAT_PRINTF(1, 2);
-#if defined(__cplusplus) && defined(SYMBIAN)
- }
-#endif
#ifndef GC_ANDROID_LOG
# define GC_PRINT_STATS_FLAG (GC_print_stats != 0)
# define GC_SEM_INIT_PSHARED 0
#endif
-#include <setjmp.h>
-
/* Some macros for setjmp that works across signal handlers */
/* were possible, and a couple of routines to facilitate */
/* catching accesses to bad addresses when that's */
#if (defined(UNIX_LIKE) || (defined(NEED_FIND_LIMIT) && defined(CYGWIN32))) \
&& !defined(GC_NO_SIGSETJMP)
# if defined(SUNOS5SIGS) && !defined(FREEBSD) && !defined(LINUX)
-# include <sys/siginfo.h>
+# ifdef __cplusplus
+ } /* extern "C" */
+# endif
+# include <sys/siginfo.h>
+# ifdef __cplusplus
+ extern "C" {
+# endif
# endif
/* Define SETJMP and friends to be the version that restores */
/* the signal mask. */
#endif
#if defined(DATASTART_USES_BSDGETDATASTART)
+# ifdef __cplusplus
+ } /* extern "C" */
+# endif
# include <machine/trap.h>
+# ifdef __cplusplus
+ extern "C" {
+# endif
# if !defined(PCR)
# define NEED_FIND_LIMIT
# endif
# define ASSERT_CANCEL_DISABLED() (void)0
#endif /* !CANCEL_SAFE */
+#ifdef __cplusplus
+ } /* extern "C" */
+#endif
+
#endif /* GC_PRIVATE_H */
# include <stddef.h> /* For size_t etc. */
# endif
+/* Note: Only wrap our own declarations, and not the included headers. */
+/* In this case, wrap our entire file, but temporarily unwrap/rewrap */
+/* around #includes. Types and macros do not need such wrapping, only */
+/* the declared global data and functions. */
+#ifdef __cplusplus
+ extern "C" {
+#endif
+
/* Convenient internal macro to test version of Clang. */
#if defined(__clang__) && defined(__clang_major__)
# define GC_CLANG_PREREQ(major, minor) \
/* And one for Darwin: */
# if defined(macosx) || (defined(__APPLE__) && defined(__MACH__))
# define DARWIN
+# ifdef __cplusplus
+ } /* extern "C" */
+# endif
# include <TargetConditionals.h>
+# ifdef __cplusplus
+ extern "C" {
+# endif
# endif
/* Determine the machine type: */
# error IBM PC/RT no longer supported.
# endif
# if (defined(sun) || defined(__sun)) && (defined(sparc) || defined(__sparc))
-# define SPARC
- /* Test for SunOS 5.x */
+ /* Test for SunOS 5.x */
+# ifdef __cplusplus
+ } /* extern "C" */
+# endif
# include <errno.h>
+# ifdef __cplusplus
+ extern "C" {
+# endif
+# define SPARC
# define SOLARIS
# define mach_type_known
# elif defined(sparc) && defined(unix) && !defined(sun) && !defined(linux) \
# define LINUX_STACKBOTTOM
# define MPROTECT_VDB
# ifdef __ELF__
-# define DYNAMIC_LOADING
-# include <features.h>
-# if defined(__GLIBC__) && __GLIBC__ >= 2
-# define SEARCH_FOR_DATA_START
-# else /* !GLIBC2 */
- extern char **__environ;
-# define DATASTART ((ptr_t)(&__environ))
+# define DYNAMIC_LOADING
+# ifdef __cplusplus
+ } /* extern "C" */
+# endif
+# include <features.h>
+# ifdef __cplusplus
+ extern "C" {
+# endif
+# if defined(__GLIBC__) && __GLIBC__ >= 2
+# define SEARCH_FOR_DATA_START
+# else /* !GLIBC2 */
+ extern char **__environ;
+# define DATASTART ((ptr_t)(&__environ))
/* hideous kludge: __environ is the first */
/* word in crt0.o, and delimits the start */
/* of the data segment, no matter which */
/* would include .rodata, which may */
/* contain large read-only data tables */
/* that we'd rather not scan. */
-# endif /* !GLIBC2 */
- extern int _end[];
-# define DATAEND ((ptr_t)(_end))
+# endif /* !GLIBC2 */
+ extern int _end[];
+# define DATAEND ((ptr_t)(_end))
# else
- extern int etext[];
-# define DATASTART ((ptr_t)((((word)(etext)) + 0xfff) & ~0xfff))
+ extern int etext[];
+# define DATASTART ((ptr_t)((((word)(etext)) + 0xfff) & ~0xfff))
# endif
# endif
# ifdef AMIGA
# endif
# ifdef MACOS
# ifndef __LOWMEM__
-# include <LowMem.h>
+# ifdef __cplusplus
+ } /* extern "C" */
+# endif
+# include <LowMem.h>
+# ifdef __cplusplus
+ extern "C" {
+# endif
# endif
# define OS_TYPE "MACOS"
/* see os_dep.c for details of global data segments. */
# ifdef MACOS
# define ALIGNMENT 2 /* Still necessary? Could it be 4? */
# ifndef __LOWMEM__
-# include <LowMem.h>
+# ifdef __cplusplus
+ } /* extern "C" */
+# endif
+# include <LowMem.h>
+# ifdef __cplusplus
+ extern "C" {
+# endif
# endif
# define OS_TYPE "MACOS"
/* see os_dep.c for details of global data segments. */
# define DATAEND ((ptr_t)get_end())
# define USE_MMAP_ANON
# define MPROTECT_VDB
+# ifdef __cplusplus
+ } /* extern "C" */
+# endif
# include <unistd.h>
+# ifdef __cplusplus
+ extern "C" {
+# endif
# define GETPAGESIZE() (unsigned)getpagesize()
# if defined(USE_PPC_PREFETCH) && defined(__GNUC__)
/* The performance impact of prefetches is untested */
# define OS_TYPE "OPENBSD"
# define ALIGNMENT 4
# ifndef GC_OPENBSD_THREADS
+# ifdef __cplusplus
+ } /* extern "C" */
+# endif
# include <sys/param.h>
# include <uvm/uvm_extern.h>
+# ifdef __cplusplus
+ extern "C" {
+# endif
/* USRSTACK is defined in <machine/vmparam.h> but that is */
/* protected by _KERNEL in <uvm/uvm_param.h> file. */
# ifdef USRSTACK
# define HEAP_START DATAEND
# endif
# define PROC_VDB
-/* HEURISTIC1 reportedly no longer works under 2.7. */
-/* HEURISTIC2 probably works, but this appears to be preferable. */
-/* Apparently USRSTACK is defined to be USERLIMIT, but in some */
-/* installations that's undefined. We work around this with a */
-/* gross hack: */
+ /* HEURISTIC1 reportedly no longer works under 2.7. */
+ /* HEURISTIC2 probably works, but this appears to be preferable.*/
+ /* Apparently USRSTACK is defined to be USERLIMIT, but in some */
+ /* installations that's undefined. We work around this with a */
+ /* gross hack: */
+# ifdef __cplusplus
+ } /* extern "C" */
+# endif
# include <sys/vmparam.h>
+# include <unistd.h>
+# ifdef __cplusplus
+ extern "C" {
+# endif
# ifdef USERLIMIT
/* This should work everywhere, but doesn't. */
# define STACKBOTTOM ((ptr_t)USRSTACK)
# else
# define HEURISTIC2
# endif
-# include <unistd.h>
# define GETPAGESIZE() (unsigned)sysconf(_SC_PAGESIZE)
/* getpagesize() appeared to be missing from at least one */
/* Solaris 5.4 installation. Weird. */
# ifdef OPENBSD
# define OS_TYPE "OPENBSD"
# ifndef GC_OPENBSD_THREADS
+# ifdef __cplusplus
+ } /* extern "C" */
+# endif
# include <sys/param.h>
# include <uvm/uvm_extern.h>
+# ifdef __cplusplus
+ extern "C" {
+# endif
# ifdef USRSTACK
# define STACKBOTTOM ((ptr_t)USRSTACK)
# else
# endif
# ifdef HAIKU
# define OS_TYPE "HAIKU"
+# ifdef __cplusplus
+ } /* extern "C" */
+# endif
# include <OS.h>
+# ifdef __cplusplus
+ extern "C" {
+# endif
# define GETPAGESIZE() (unsigned)B_PAGE_SIZE
extern int etext[];
# define DATASTART ((ptr_t)((((word)(etext)) + 0xfff) & ~0xfff))
# define DATASTART GC_SysVGetDataStart(0x1000, (ptr_t)_etext)
# define DATASTART_IS_FUNC
# define DATAEND ((ptr_t)(_end))
-/* # define STACKBOTTOM ((ptr_t)(_start)) worked through 2.7, */
-/* but reportedly breaks under 2.8. It appears that the stack */
-/* base is a property of the executable, so this should not break */
-/* old executables. */
-/* HEURISTIC2 probably works, but this appears to be preferable. */
-/* Apparently USRSTACK is defined to be USERLIMIT, but in some */
-/* installations that's undefined. We work around this with a */
-/* gross hack: */
+ /* # define STACKBOTTOM ((ptr_t)(_start)) worked through 2.7, */
+ /* but reportedly breaks under 2.8. It appears that the stack */
+ /* base is a property of the executable, so this should not */
+ /* break old executables. */
+ /* HEURISTIC2 probably works, but this appears to be preferable.*/
+ /* Apparently USRSTACK is defined to be USERLIMIT, but in some */
+ /* installations that's undefined. We work around this with a */
+ /* gross hack: */
+# ifdef __cplusplus
+ } /* extern "C" */
+# endif
# include <sys/vmparam.h>
+# ifdef __cplusplus
+ extern "C" {
+# endif
# ifdef USERLIMIT
/* This should work everywhere, but doesn't. */
# define STACKBOTTOM ((ptr_t)USRSTACK)
# define DATAEND ((ptr_t)(&_end))
# define STACK_GROWS_DOWN
# define HEURISTIC2
+# ifdef __cplusplus
+ } /* extern "C" */
+# endif
# include <unistd.h>
+# ifdef __cplusplus
+ extern "C" {
+# endif
# define GETPAGESIZE() (unsigned)sysconf(_SC_PAGESIZE)
# define DYNAMIC_LOADING
# ifndef USE_MMAP
/* This encourages mmap to give us low addresses, */
/* thus allowing the heap to grow to ~3GB */
# ifdef __ELF__
-# define DYNAMIC_LOADING
-# include <features.h>
+# define DYNAMIC_LOADING
+# ifdef __cplusplus
+ } /* extern "C" */
+# endif
+# include <features.h>
+# ifdef __cplusplus
+ extern "C" {
+# endif
# if defined(__GLIBC__) && __GLIBC__ >= 2 \
|| defined(HOST_ANDROID) || defined(HOST_TIZEN)
# define SEARCH_FOR_DATA_START
# if defined(__GLIBC__) && !defined(__UCLIBC__)
/* Workaround lock elision implementation for some glibc. */
# define GLIBC_2_19_TSX_BUG
+# ifdef __cplusplus
+ } /* extern "C" */
+# endif
# include <gnu/libc-version.h> /* for gnu_get_libc_version() */
+# ifdef __cplusplus
+ extern "C" {
+# endif
# endif
# endif
# ifdef CYGWIN32
# endif
# ifdef DJGPP
# define OS_TYPE "DJGPP"
+# ifdef __cplusplus
+ } /* extern "C" */
+# endif
# include "stubinfo.h"
+# ifdef __cplusplus
+ extern "C" {
+# endif
extern int etext[];
extern int _stklen;
extern int __djgpp_stack_limit;
# ifdef OPENBSD
# define OS_TYPE "OPENBSD"
# ifndef GC_OPENBSD_THREADS
+# ifdef __cplusplus
+ } /* extern "C" */
+# endif
# include <sys/param.h>
# include <uvm/uvm_extern.h>
+# ifdef __cplusplus
+ extern "C" {
+# endif
# ifdef USRSTACK
# define STACKBOTTOM ((ptr_t)USRSTACK)
# else
# endif
# ifdef RTEMS
# define OS_TYPE "RTEMS"
+# ifdef __cplusplus
+ } /* extern "C" */
+# endif
# include <sys/unistd.h>
+# ifdef __cplusplus
+ extern "C" {
+# endif
extern int etext[];
extern int end[];
void *rtems_get_stack_bottom(void);
# define STACKBOTTOM ((ptr_t)0xc0000000)
# define USE_MMAP_ANON
# define MPROTECT_VDB
+# ifdef __cplusplus
+ } /* extern "C" */
+# endif
# include <unistd.h>
+# ifdef __cplusplus
+ extern "C" {
+# endif
# define GETPAGESIZE() (unsigned)getpagesize()
/* There seems to be some issues with trylock hanging on darwin. */
/* This should be looked into some more. */
# define OS_TYPE "OPENBSD"
# define ALIGNMENT 4
# ifndef GC_OPENBSD_THREADS
+# ifdef __cplusplus
+ } /* extern "C" */
+# endif
# include <sys/param.h>
# include <uvm/uvm_extern.h>
+# ifdef __cplusplus
+ extern "C" {
+# endif
# ifdef USRSTACK
# define STACKBOTTOM ((ptr_t)USRSTACK)
# else
# define STACKBOTTOM ((ptr_t)environ)
# endif
# define DYNAMIC_LOADING
+# ifdef __cplusplus
+ } /* extern "C" */
+# endif
# include <unistd.h>
+# ifdef __cplusplus
+ extern "C" {
+# endif
# define GETPAGESIZE() (unsigned)sysconf(_SC_PAGE_SIZE)
# ifndef __GNUC__
# define PREFETCH(x) do { \
# ifdef OPENBSD
# define OS_TYPE "OPENBSD"
# ifndef GC_OPENBSD_THREADS
+# ifdef __cplusplus
+ } /* extern "C" */
+# endif
# include <sys/param.h>
# include <uvm/uvm_extern.h>
+# ifdef __cplusplus
+ extern "C" {
+# endif
# ifdef USRSTACK
# define STACKBOTTOM ((ptr_t)USRSTACK)
# else
# define OS_TYPE "OPENBSD"
# define ELF_CLASS ELFCLASS64
# ifndef GC_OPENBSD_THREADS
+# ifdef __cplusplus
+ } /* extern "C" */
+# endif
# include <sys/param.h>
# include <uvm/uvm_extern.h>
+# ifdef __cplusplus
+ extern "C" {
+# endif
# ifdef USRSTACK
# define STACKBOTTOM ((ptr_t)USRSTACK)
# else
# define STACKBOTTOM ((ptr_t)environ)
# define HPUX_STACKBOTTOM
# define DYNAMIC_LOADING
+# ifdef __cplusplus
+ } /* extern "C" */
+# endif
# include <unistd.h>
+# ifdef __cplusplus
+ extern "C" {
+# endif
# define GETPAGESIZE() (unsigned)sysconf(_SC_PAGE_SIZE)
/* The following was empirically determined, and is probably */
/* not very robust. */
# define CLEAR_DOUBLE(x) \
__asm__ (" stf.spill [%0]=f0": : "r"((void *)(x)))
# else
+# ifdef __cplusplus
+ } /* extern "C" */
+# endif
# include <ia64intrin.h>
+# ifdef __cplusplus
+ extern "C" {
+# endif
# define PREFETCH(x) __lfetch(__lfhint_none, (x))
# define GC_PREFETCH_FOR_WRITE(x) __lfetch(__lfhint_nta, (x))
# define CLEAR_DOUBLE(x) __stf_spill((void *)(x), 0)
# define STACKBOTTOM ((ptr_t)0x16fdfffff)
# define USE_MMAP_ANON
# define MPROTECT_VDB
+# ifdef __cplusplus
+ } /* extern "C" */
+# endif
# include <unistd.h>
+# ifdef __cplusplus
+ extern "C" {
+# endif
# define GETPAGESIZE() (unsigned)getpagesize()
/* FIXME: There seems to be some issues with trylock hanging on */
/* darwin. This should be looked into some more. */
# undef STACK_GRAN
# define STACK_GRAN 0x10000000
# ifdef __ELF__
-# define DYNAMIC_LOADING
-# include <features.h>
+# define DYNAMIC_LOADING
+# ifdef __cplusplus
+ } /* extern "C" */
+# endif
+# include <features.h>
+# ifdef __cplusplus
+ extern "C" {
+# endif
# if defined(__GLIBC__) && __GLIBC__ >= 2 \
|| defined(HOST_ANDROID) || defined(HOST_TIZEN)
# define SEARCH_FOR_DATA_START
# define STACKBOTTOM ((ptr_t)0x30000000)
# define USE_MMAP_ANON
# define MPROTECT_VDB
+# ifdef __cplusplus
+ } /* extern "C" */
+# endif
# include <unistd.h>
+# ifdef __cplusplus
+ extern "C" {
+# endif
# define GETPAGESIZE() (unsigned)getpagesize()
/* FIXME: There seems to be some issues with trylock hanging on */
/* darwin. This should be looked into some more. */
# ifdef OPENBSD
# define OS_TYPE "OPENBSD"
# ifndef GC_OPENBSD_THREADS
+# ifdef __cplusplus
+ } /* extern "C" */
+# endif
# include <sys/param.h>
# include <uvm/uvm_extern.h>
+# ifdef __cplusplus
+ extern "C" {
+# endif
# ifdef USRSTACK
# define STACKBOTTOM ((ptr_t)USRSTACK)
# else
# ifdef OPENBSD
# define OS_TYPE "OPENBSD"
# ifndef GC_OPENBSD_THREADS
+# ifdef __cplusplus
+ } /* extern "C" */
+# endif
# include <sys/param.h>
# include <uvm/uvm_extern.h>
+# ifdef __cplusplus
+ extern "C" {
+# endif
# ifdef USRSTACK
# define STACKBOTTOM ((ptr_t)USRSTACK)
# else
# ifdef SN_TARGET_ORBIS
# define DATASTART (ptr_t)ALIGNMENT
# define DATAEND (ptr_t)ALIGNMENT
+# ifdef __cplusplus
+ } /* extern "C" */
+# endif
# include <pthread.h>
+# ifdef __cplusplus
+ extern "C" {
+# endif
void *ps4_get_stack_bottom(void);
# define STACKBOTTOM ((ptr_t)ps4_get_stack_bottom())
# endif
# define OS_TYPE "OPENBSD"
# define ELF_CLASS ELFCLASS64
# ifndef GC_OPENBSD_THREADS
+# ifdef __cplusplus
+ } /* extern "C" */
+# endif
# include <sys/param.h>
# include <uvm/uvm_extern.h>
+# ifdef __cplusplus
+ extern "C" {
+# endif
# ifdef USRSTACK
# define STACKBOTTOM ((ptr_t)USRSTACK)
# else
/* and can't deal with the signals. */
# endif
# ifdef __ELF__
-# define DYNAMIC_LOADING
-# include <features.h>
-# define SEARCH_FOR_DATA_START
- extern int _end[];
-# define DATAEND ((ptr_t)(_end))
+# define DYNAMIC_LOADING
+# ifdef __cplusplus
+ } /* extern "C" */
+# endif
+# include <features.h>
+# ifdef __cplusplus
+ extern "C" {
+# endif
+# define SEARCH_FOR_DATA_START
+ extern int _end[];
+# define DATAEND ((ptr_t)(_end))
# else
extern int etext[];
# define DATASTART ((ptr_t)((((word)(etext)) + 0xfff) & ~0xfff))
# if defined(__GLIBC__) && !defined(__UCLIBC__)
/* Workaround lock elision implementation for some glibc. */
# define GLIBC_2_19_TSX_BUG
+# ifdef __cplusplus
+ } /* extern "C" */
+# endif
# include <gnu/libc-version.h> /* for gnu_get_libc_version() */
+# ifdef __cplusplus
+ extern "C" {
+# endif
# endif
# endif
# ifdef DARWIN
# define STACKBOTTOM ((ptr_t)0x7fff5fc00000)
# define USE_MMAP_ANON
# define MPROTECT_VDB
+# ifdef __cplusplus
+ } /* extern "C" */
+# endif
# include <unistd.h>
+# ifdef __cplusplus
+ extern "C" {
+# endif
# define GETPAGESIZE() (unsigned)getpagesize()
/* There seems to be some issues with trylock hanging on darwin. */
/* This should be looked into some more. */
# endif
# ifdef HAIKU
# define OS_TYPE "HAIKU"
+# ifdef __cplusplus
+ } /* extern "C" */
+# endif
# include <OS.h>
+# ifdef __cplusplus
+ extern "C" {
+# endif
# define GETPAGESIZE() (unsigned)B_PAGE_SIZE
extern int etext[];
# define DATASTART ((ptr_t)((((word)etext) + 0xfff) & ~0xfff))
# define DATASTART GC_SysVGetDataStart(0x1000, (ptr_t)_etext)
# define DATASTART_IS_FUNC
# define DATAEND ((ptr_t)(_end))
-/* # define STACKBOTTOM ((ptr_t)(_start)) worked through 2.7, */
-/* but reportedly breaks under 2.8. It appears that the stack */
-/* base is a property of the executable, so this should not break */
-/* old executables. */
-/* HEURISTIC2 probably works, but this appears to be preferable. */
-/* Apparently USRSTACK is defined to be USERLIMIT, but in some */
-/* installations that's undefined. We work around this with a */
-/* gross hack: */
+ /* # define STACKBOTTOM ((ptr_t)(_start)) worked through 2.7, */
+ /* but reportedly breaks under 2.8. It appears that the stack */
+ /* base is a property of the executable, so this should not */
+ /* break old executables. */
+ /* HEURISTIC2 probably works, but this appears to be preferable.*/
+ /* Apparently USRSTACK is defined to be USERLIMIT, but in some */
+ /* installations that's undefined. We work around this with a */
+ /* gross hack: */
+# ifdef __cplusplus
+ } /* extern "C" */
+# endif
# include <sys/vmparam.h>
+# ifdef __cplusplus
+ extern "C" {
+# endif
# ifdef USERLIMIT
/* This should work everywhere, but doesn't. */
# define STACKBOTTOM ((ptr_t)USRSTACK)
# define LINUX_STACKBOTTOM
# define MPROTECT_VDB
# ifdef __ELF__
-# define DYNAMIC_LOADING
-# include <features.h>
+# define DYNAMIC_LOADING
+# ifdef __cplusplus
+ } /* extern "C" */
+# endif
+# include <features.h>
+# ifdef __cplusplus
+ extern "C" {
+# endif
# if defined(__GLIBC__) && __GLIBC__ >= 2
# define SEARCH_FOR_DATA_START
# else
#if (defined(SVR4) || defined(HOST_ANDROID) || defined(HOST_TIZEN)) \
&& !defined(GETPAGESIZE)
+# ifdef __cplusplus
+ } /* extern "C" */
+# endif
# include <unistd.h>
+# ifdef __cplusplus
+ extern "C" {
+# endif
# define GETPAGESIZE() (unsigned)sysconf(_SC_PAGESIZE)
#endif
#ifndef GETPAGESIZE
# if defined(SOLARIS) || defined(IRIX5) || defined(LINUX) \
|| defined(NETBSD) || defined(FREEBSD) || defined(HPUX)
+# ifdef __cplusplus
+ } /* extern "C" */
+# endif
# include <unistd.h>
+# ifdef __cplusplus
+ extern "C" {
+# endif
# endif
# define GETPAGESIZE() (unsigned)getpagesize()
#endif
#endif
#ifdef GC_OPENBSD_THREADS
+# ifdef __cplusplus
+ } /* extern "C" */
+# endif
# include <sys/param.h>
+# ifdef __cplusplus
+ extern "C" {
+# endif
/* Prior to 5.2 release, OpenBSD had user threads and required */
/* special handling. */
# if OpenBSD < 201211
# endif
#endif /* GC_PRIVATE_H */
+#ifdef __cplusplus
+ } /* extern "C" */
+#endif
+
#endif /* GCCONFIG_H */