source: src/examples/gc_no_raii/src/allocate-pool.c @ bee4283

ADTaaron-thesisarm-ehast-experimentalcleanup-dtorsctordeferred_resndemanglerenumforall-pointer-decayjacob/cs343-translationjenkins-sandboxmemorynew-astnew-ast-unique-exprnew-envno_listpersistent-indexerpthread-emulationqualifiedEnumresolv-newwith_gc
Last change on this file since bee4283 was 16cfd8c, checked in by Thierry Delisle <tdelisle@…>, 8 years ago

1 error left

  • Property mode set to 100644
File size: 1.3 KB
RevLine 
[6be0cf9]1#define _BSD_SOURCE /* for MAP_ANON */
2#define _DARWIN_C_SOURCE /* for MAP_ANON on OS X */
3
[16cfd8c]4#ifdef __cforall
5extern "C"{
6#else
7#error missing cfa define
8#endif
[d67a9a1]9
[6be0cf9]10/* for standards info */
11#if defined(unix) || defined(__unix) || defined(__unix__) || \
12    (defined(__APPLE__) && defined(__MACH__))
13#include <unistd.h>
14#endif
15
16#if defined(_WIN32)
17#ifndef WIN32_LEAN_AND_MEAN
18#define WIN32_LEAN_AND_MEAN
19#endif
20#include <windows.h>
21#endif
22
23#include <errno.h>
24#include <stdlib.h>
25#include <stdio.h>
26#include <string.h>
27#include <sys/types.h>
28
29#if _POSIX_VERSION
30#include <sys/mman.h>
31#endif
32
33/* figure out which allocator to use */
34#if defined(GGGGC_USE_MALLOC)
35#define GGGGC_ALLOCATOR_MALLOC 1
[d67a9a1]36#include "../pool-alloc/allocate-malloc.c"
[6be0cf9]37
38#elif _POSIX_ADVISORY_INFO >= 200112L
39#define GGGGC_ALLOCATOR_POSIX_MEMALIGN 1
[d67a9a1]40#include "../pool-alloc/allocate-malign.c"
[6be0cf9]41
42#elif defined(MAP_ANON)
43#define GGGGC_ALLOCATOR_MMAP 1
[d67a9a1]44#include "../pool-alloc/allocate-mmap.c"
[6be0cf9]45
46#elif defined(_WIN32)
47#define GGGGC_ALLOCATOR_VIRTUALALLOC 1
[d67a9a1]48#include "../pool-alloc/allocate-win-valloc.c"
[6be0cf9]49
50#else
51#warning GGGGC: No allocator available other than malloc!
52#define GGGGC_ALLOCATOR_MALLOC 1
[d67a9a1]53#include "../pool-alloc/allocate-malloc.c"
[6be0cf9]54
55#endif
56
57void* pal_allocPool(size_t size, int mustSucceed)
58{
59      return allocPool(size, mustSucceed);
60}
61
[16cfd8c]62#ifdef __cforall
[6be0cf9]63}
64#endif
Note: See TracBrowser for help on using the repository browser.