Upgrade Boehm GC to 7.2alpha4.
[cacao.git] / src / mm / boehm-gc / include / gc_config_macros.h
1 /*
2  * Copyright (c) 1994 by Xerox Corporation.  All rights reserved.
3  * Copyright (c) 1996 by Silicon Graphics.  All rights reserved.
4  * Copyright (c) 1998 by Fergus Henderson.  All rights reserved.
5  * Copyright (c) 2000-2009 by Hewlett-Packard Development Company.
6  * All rights reserved.
7  *
8  * THIS MATERIAL IS PROVIDED AS IS, WITH ABSOLUTELY NO WARRANTY EXPRESSED
9  * OR IMPLIED.  ANY USE IS AT YOUR OWN RISK.
10  *
11  * Permission is hereby granted to use or copy this program
12  * for any purpose,  provided the above notices are retained on all copies.
13  * Permission to modify the code and to distribute modified code is granted,
14  * provided the above notices are retained, and a notice that the code was
15  * modified is included with the above copyright notice.
16  */
17
18 /*
19  * This should never be included directly.  It is included only from gc.h.
20  * We separate it only to make gc.h more suitable as documentation.
21  *
22  * Some tests for old macros.  These violate our namespace rules and will
23  * disappear shortly.  Use the GC_ names.
24  */
25 #if defined(SOLARIS_THREADS) || defined(_SOLARIS_THREADS) \
26     || defined(_SOLARIS_PTHREADS) || defined(GC_SOLARIS_PTHREADS)
27   /* We no longer support old style Solaris threads.            */
28   /* GC_SOLARIS_THREADS now means pthreads.                     */
29 # ifndef GC_SOLARIS_THREADS
30 #   define GC_SOLARIS_THREADS
31 # endif
32 #endif
33 #if defined(IRIX_THREADS)
34 # define GC_IRIX_THREADS
35 #endif
36 #if defined(DGUX_THREADS) && !defined(GC_DGUX386_THREADS)
37 # define GC_DGUX386_THREADS
38 #endif
39 #if defined(AIX_THREADS)
40 # define GC_AIX_THREADS
41 #endif
42 #if defined(HPUX_THREADS)
43 # define GC_HPUX_THREADS
44 #endif
45 #if defined(OSF1_THREADS)
46 # define GC_OSF1_THREADS
47 #endif
48 #if defined(LINUX_THREADS)
49 # define GC_LINUX_THREADS
50 #endif
51 #if defined(WIN32_THREADS)
52 # define GC_WIN32_THREADS
53 #endif
54 #if defined(USE_LD_WRAP)
55 # define GC_USE_LD_WRAP
56 #endif
57
58 #if defined(GC_WIN32_PTHREADS) && !defined(GC_WIN32_THREADS)
59   /* Using pthreads-w32 library. */
60 # define GC_WIN32_THREADS
61 #endif
62
63 #if defined(GC_AIX_THREADS) || defined(GC_DARWIN_THREADS) \
64     || defined(GC_DGUX386_THREADS) || defined(GC_FREEBSD_THREADS) \
65     || defined(GC_GNU_THREADS) || defined(GC_HPUX_THREADS) \
66     || defined(GC_IRIX_THREADS) || defined(GC_LINUX_THREADS) \
67     || defined(GC_NETBSD_THREADS) || defined(GC_OPENBSD_THREADS) \
68     || defined(GC_OSF1_THREADS) || defined(GC_SOLARIS_THREADS) \
69     || defined(GC_WIN32_THREADS)
70 # ifndef GC_THREADS
71 #   define GC_THREADS
72 # endif
73 #elif defined(GC_THREADS)
74 # if defined(__linux__)
75 #   define GC_LINUX_THREADS
76 # endif
77 # if !defined(__linux__) && (defined(_PA_RISC1_1) || defined(_PA_RISC2_0) \
78                              || defined(hppa) || defined(__HPPA)) \
79      || (defined(__ia64) && defined(_HPUX_SOURCE))
80 #   define GC_HPUX_THREADS
81 # endif
82 # if !defined(__linux__) && (defined(__alpha) || defined(__alpha__))
83 #   define GC_OSF1_THREADS
84 # endif
85 # if defined(__mips) && !defined(__linux__)
86 #   define GC_IRIX_THREADS
87 # endif
88 # if defined(__sparc) && !defined(__linux__) \
89      || defined(sun) && (defined(i386) || defined(__i386__) \
90                          || defined(__amd64__))
91 #   define GC_SOLARIS_THREADS
92 # elif defined(__APPLE__) && defined(__MACH__)
93 #   define GC_DARWIN_THREADS
94 # elif defined(__OpenBSD__)
95 #   define GC_OPENBSD_THREADS
96 # elif !defined(GC_LINUX_THREADS) && !defined(GC_HPUX_THREADS) \
97        && !defined(GC_OSF1_THREADS) && !defined(GC_IRIX_THREADS)
98     /* FIXME: Should we really need for FreeBSD and NetBSD to check     */
99     /* that no other GC_xxx_THREADS macro is set?                       */
100 #   if defined(__FreeBSD__) || defined(__DragonFly__)
101 #     define GC_FREEBSD_THREADS
102 #   elif defined(__NetBSD__)
103 #     define GC_NETBSD_THREADS
104 #   endif
105 # endif
106 # if defined(DGUX) && (defined(i386) || defined(__i386__))
107 #   define GC_DGUX386_THREADS
108 # endif
109 # if defined(_AIX)
110 #   define GC_AIX_THREADS
111 # endif
112 # if (defined(_WIN32) || defined(_MSC_VER) || defined(__BORLANDC__) \
113       || defined(__CYGWIN32__) || defined(__CYGWIN__) || defined(__CEGCC__) \
114       || defined(_WIN32_WCE) || defined(__MINGW32__)) \
115      && !defined(GC_WIN32_THREADS)
116     /* Either posix or native Win32 threads. */
117 #   define GC_WIN32_THREADS
118 # endif
119 #endif /* GC_THREADS */
120
121 #undef GC_PTHREADS
122 #if (!defined(GC_WIN32_THREADS) || defined(GC_WIN32_PTHREADS) \
123      || defined(__CYGWIN32__) || defined(__CYGWIN__)) && defined(GC_THREADS)
124   /* Posix threads. */
125 # define GC_PTHREADS
126 #endif
127
128 #if !defined(_PTHREADS) && defined(GC_NETBSD_THREADS)
129 # define _PTHREADS
130 #endif
131
132 #if defined(GC_DGUX386_THREADS) && !defined(_POSIX4A_DRAFT10_SOURCE)
133 # define _POSIX4A_DRAFT10_SOURCE 1
134 #endif
135
136 #if !defined(_REENTRANT) && defined(GC_PTHREADS) && !defined(GC_WIN32_THREADS)
137   /* Better late than never.  This fails if system headers that depend  */
138   /* on this were previously included.                                  */
139 # define _REENTRANT
140 #endif
141
142 #define __GC
143 #if !defined(_WIN32_WCE) || defined(__GNUC__)
144 # include <stddef.h>
145 # if defined(__MINGW32__) && !defined(_WIN32_WCE)
146 #   include <stdint.h>
147     /* We mention uintptr_t.                                            */
148     /* Perhaps this should be included in pure msft environments        */
149     /* as well?                                                         */
150 # endif
151 #else /* ! _WIN32_WCE */
152   /* Yet more kludges for WinCE */
153 # include <stdlib.h> /* size_t is defined here */
154 # ifndef _PTRDIFF_T_DEFINED
155     /* ptrdiff_t is not defined */
156 #   define _PTRDIFF_T_DEFINED
157     typedef long ptrdiff_t;
158 # endif
159 #endif
160
161 #if defined(_DLL) && !defined(GC_NOT_DLL) && !defined(GC_DLL) \
162         && !defined(__GNUC__)
163 # define GC_DLL
164 #endif
165
166 #if defined(GC_DLL) && !defined(GC_API)
167
168 # if defined(__MINGW32__) || defined(__CEGCC__)
169 #   ifdef GC_BUILD
170 #     define GC_API __declspec(dllexport)
171 #   else
172 #     define GC_API __declspec(dllimport)
173 #   endif
174
175 # elif defined(_MSC_VER) || defined(__DMC__) || defined(__BORLANDC__) \
176         || defined(__CYGWIN__)
177 #   ifdef GC_BUILD
178 #     define GC_API extern __declspec(dllexport)
179 #   else
180 #     define GC_API __declspec(dllimport)
181 #   endif
182
183 # elif defined(__WATCOMC__)
184 #   ifdef GC_BUILD
185 #     define GC_API extern __declspec(dllexport)
186 #   else
187 #     define GC_API extern __declspec(dllimport)
188 #   endif
189
190 # elif defined(__GNUC__)
191     /* Only matters if used in conjunction with -fvisibility=hidden option. */
192 #   if __GNUC__ >= 4 && defined(GC_BUILD)
193 #     define GC_API extern __attribute__((__visibility__("default")))
194 #   endif
195
196 # endif
197 #endif /* GC_DLL */
198
199 #ifndef GC_API
200 # define GC_API extern
201 #endif
202
203 #ifndef GC_CALL
204 # define GC_CALL
205 #endif
206
207 #ifndef GC_CALLBACK
208 # define GC_CALLBACK GC_CALL
209 #endif
210
211 #ifndef GC_ATTR_MALLOC
212   /* 'malloc' attribute should be used for all malloc-like functions    */
213   /* (to tell the compiler that a function may be treated as if any     */
214   /* non-NULL pointer it returns cannot alias any other pointer valid   */
215   /* when the function returns).  If the client code violates this rule */
216   /* by using custom GC_oom_func then define GC_OOM_FUNC_RETURNS_ALIAS. */
217 # if !defined(GC_OOM_FUNC_RETURNS_ALIAS) && defined(__GNUC__) \
218         && (__GNUC__ > 3 || (__GNUC__ == 3 && __GNUC_MINOR__ >= 1))
219 #   define GC_ATTR_MALLOC __attribute__((__malloc__))
220 # else
221 #   define GC_ATTR_MALLOC
222 # endif
223 #endif
224
225 #ifndef GC_ATTR_ALLOC_SIZE
226   /* 'alloc_size' attribute improves __builtin_object_size correctness. */
227   /* Only single-argument form of 'alloc_size' attribute is used.       */
228 # if defined(__GNUC__) && (__GNUC__ > 4 \
229         || (__GNUC__ == 4 && __GNUC_MINOR__ >= 3 && !defined(__ICC)))
230 #   define GC_ATTR_ALLOC_SIZE(argnum) __attribute__((__alloc_size__(argnum)))
231 # else
232 #   define GC_ATTR_ALLOC_SIZE(argnum)
233 # endif
234 #endif