1 | /* |
---|
2 | * Copyright (c) 2000-2007 Apple Inc. All rights reserved. |
---|
3 | * |
---|
4 | * @APPLE_OSREFERENCE_LICENSE_HEADER_START@ |
---|
5 | * |
---|
6 | * This file contains Original Code and/or Modifications of Original Code |
---|
7 | * as defined in and that are subject to the Apple Public Source License |
---|
8 | * Version 2.0 (the 'License'). You may not use this file except in |
---|
9 | * compliance with the License. The rights granted to you under the License |
---|
10 | * may not be used to create, or enable the creation or redistribution of, |
---|
11 | * unlawful or unlicensed copies of an Apple operating system, or to |
---|
12 | * circumvent, violate, or enable the circumvention or violation of, any |
---|
13 | * terms of an Apple operating system software license agreement. |
---|
14 | * |
---|
15 | * Please obtain a copy of the License at |
---|
16 | * http://www.opensource.apple.com/apsl/ and read it before using this file. |
---|
17 | * |
---|
18 | * The Original Code and all software distributed under the License are |
---|
19 | * distributed on an 'AS IS' basis, WITHOUT WARRANTY OF ANY KIND, EITHER |
---|
20 | * EXPRESS OR IMPLIED, AND APPLE HEREBY DISCLAIMS ALL SUCH WARRANTIES, |
---|
21 | * INCLUDING WITHOUT LIMITATION, ANY WARRANTIES OF MERCHANTABILITY, |
---|
22 | * FITNESS FOR A PARTICULAR PURPOSE, QUIET ENJOYMENT OR NON-INFRINGEMENT. |
---|
23 | * Please see the License for the specific language governing rights and |
---|
24 | * limitations under the License. |
---|
25 | * |
---|
26 | * @APPLE_OSREFERENCE_LICENSE_HEADER_END@ |
---|
27 | */ |
---|
28 | /* Copyright 1995 NeXT Computer, Inc. All rights reserved. */ |
---|
29 | /* |
---|
30 | * Copyright (c) 1991, 1993 |
---|
31 | * The Regents of the University of California. All rights reserved. |
---|
32 | * |
---|
33 | * This code is derived from software contributed to Berkeley by |
---|
34 | * Berkeley Software Design, Inc. |
---|
35 | * |
---|
36 | * Redistribution and use in source and binary forms, with or without |
---|
37 | * modification, are permitted provided that the following conditions |
---|
38 | * are met: |
---|
39 | * 1. Redistributions of source code must retain the above copyright |
---|
40 | * notice, this list of conditions and the following disclaimer. |
---|
41 | * 2. Redistributions in binary form must reproduce the above copyright |
---|
42 | * notice, this list of conditions and the following disclaimer in the |
---|
43 | * documentation and/or other materials provided with the distribution. |
---|
44 | * 3. All advertising materials mentioning features or use of this software |
---|
45 | * must display the following acknowledgement: |
---|
46 | * This product includes software developed by the University of |
---|
47 | * California, Berkeley and its contributors. |
---|
48 | * 4. Neither the name of the University nor the names of its contributors |
---|
49 | * may be used to endorse or promote products derived from this software |
---|
50 | * without specific prior written permission. |
---|
51 | * |
---|
52 | * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND |
---|
53 | * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE |
---|
54 | * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE |
---|
55 | * ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE |
---|
56 | * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL |
---|
57 | * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS |
---|
58 | * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) |
---|
59 | * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT |
---|
60 | * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY |
---|
61 | * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF |
---|
62 | * SUCH DAMAGE. |
---|
63 | * |
---|
64 | * @(#)cdefs.h 8.8 (Berkeley) 1/9/95 |
---|
65 | */ |
---|
66 | |
---|
67 | #ifndef _CDEFS_H_ |
---|
68 | #define _CDEFS_H_ |
---|
69 | |
---|
70 | #if defined(__cplusplus) |
---|
71 | #define __BEGIN_DECLS extern "C" { |
---|
72 | #define __END_DECLS } |
---|
73 | #else |
---|
74 | #define __BEGIN_DECLS |
---|
75 | #define __END_DECLS |
---|
76 | #endif |
---|
77 | |
---|
78 | /* |
---|
79 | * The __CONCAT macro is used to concatenate parts of symbol names, e.g. |
---|
80 | * with "#define OLD(foo) __CONCAT(old,foo)", OLD(foo) produces oldfoo. |
---|
81 | * The __CONCAT macro is a bit tricky -- make sure you don't put spaces |
---|
82 | * in between its arguments. __CONCAT can also concatenate double-quoted |
---|
83 | * strings produced by the __STRING macro, but this only works with ANSI C. |
---|
84 | */ |
---|
85 | #if defined(__STDC__) || defined(__cplusplus) |
---|
86 | #define __P(protos) protos /* full-blown ANSI C */ |
---|
87 | #define __CONCAT(x,y) x ## y |
---|
88 | #define __STRING(x) #x |
---|
89 | |
---|
90 | #define __const const /* define reserved names to standard */ |
---|
91 | #define __signed signed |
---|
92 | #define __volatile volatile |
---|
93 | #if defined(__cplusplus) |
---|
94 | #define __inline inline /* convert to C++ keyword */ |
---|
95 | #else |
---|
96 | #ifndef __GNUC__ |
---|
97 | #define __inline /* delete GCC keyword */ |
---|
98 | #endif /* !__GNUC__ */ |
---|
99 | #endif /* !__cplusplus */ |
---|
100 | |
---|
101 | #else /* !(__STDC__ || __cplusplus) */ |
---|
102 | #define __P(protos) () /* traditional C preprocessor */ |
---|
103 | #define __CONCAT(x,y) x/**/y |
---|
104 | #define __STRING(x) "x" |
---|
105 | |
---|
106 | #ifndef __GNUC__ |
---|
107 | #define __const /* delete pseudo-ANSI C keywords */ |
---|
108 | #define __inline |
---|
109 | #define __signed |
---|
110 | #define __volatile |
---|
111 | #endif /* !__GNUC__ */ |
---|
112 | |
---|
113 | /* |
---|
114 | * In non-ANSI C environments, new programs will want ANSI-only C keywords |
---|
115 | * deleted from the program and old programs will want them left alone. |
---|
116 | * When using a compiler other than gcc, programs using the ANSI C keywords |
---|
117 | * const, inline etc. as normal identifiers should define -DNO_ANSI_KEYWORDS. |
---|
118 | * When using "gcc -traditional", we assume that this is the intent; if |
---|
119 | * __GNUC__ is defined but __STDC__ is not, we leave the new keywords alone. |
---|
120 | */ |
---|
121 | #ifndef NO_ANSI_KEYWORDS |
---|
122 | #define const __const /* convert ANSI C keywords */ |
---|
123 | #define inline __inline |
---|
124 | #define signed __signed |
---|
125 | #define volatile __volatile |
---|
126 | #endif /* !NO_ANSI_KEYWORDS */ |
---|
127 | #endif /* !(__STDC__ || __cplusplus) */ |
---|
128 | |
---|
129 | /* |
---|
130 | * GCC1 and some versions of GCC2 declare dead (non-returning) and |
---|
131 | * pure (no side effects) functions using "volatile" and "const"; |
---|
132 | * unfortunately, these then cause warnings under "-ansi -pedantic". |
---|
133 | * GCC2 uses a new, peculiar __attribute__((attrs)) style. All of |
---|
134 | * these work for GNU C++ (modulo a slight glitch in the C++ grammar |
---|
135 | * in the distribution version of 2.5.5). |
---|
136 | */ |
---|
137 | #if defined(__MWERKS__) && (__MWERKS__ > 0x2400) |
---|
138 | /* newer Metrowerks compilers support __attribute__() */ |
---|
139 | #elif __GNUC__ > 2 || __GNUC__ == 2 && __GNUC_MINOR__ >= 5 |
---|
140 | #define __dead2 __attribute__((__noreturn__)) |
---|
141 | #define __pure2 __attribute__((__const__)) |
---|
142 | #if __GNUC__ == 2 && __GNUC_MINOR__ >= 5 && __GNUC_MINOR__ < 7 |
---|
143 | #define __unused /* no attribute */ |
---|
144 | #else |
---|
145 | #define __unused __attribute__((__unused__)) |
---|
146 | #endif |
---|
147 | #else |
---|
148 | #define __attribute__(x) /* delete __attribute__ if non-gcc or gcc1 */ |
---|
149 | #if defined(__GNUC__) && !defined(__STRICT_ANSI__) |
---|
150 | /* __dead and __pure are depreciated. Use __dead2 and __pure2 instead */ |
---|
151 | #define __dead __volatile |
---|
152 | #define __pure __const |
---|
153 | #endif |
---|
154 | #endif |
---|
155 | |
---|
156 | /* Delete pseudo-keywords wherever they are not available or needed. */ |
---|
157 | #ifndef __dead |
---|
158 | #define __dead |
---|
159 | #define __pure |
---|
160 | #endif |
---|
161 | #ifndef __dead2 |
---|
162 | #define __dead2 |
---|
163 | #define __pure2 |
---|
164 | #define __unused |
---|
165 | #endif |
---|
166 | |
---|
167 | /* |
---|
168 | * GCC 2.95 provides `__restrict' as an extension to C90 to support the |
---|
169 | * C99-specific `restrict' type qualifier. We happen to use `__restrict' as |
---|
170 | * a way to define the `restrict' type qualifier without disturbing older |
---|
171 | * software that is unaware of C99 keywords. |
---|
172 | */ |
---|
173 | #if !(__GNUC__ == 2 && __GNUC_MINOR__ == 95) |
---|
174 | #if __STDC_VERSION__ < 199901 |
---|
175 | #define __restrict |
---|
176 | #else |
---|
177 | #define __restrict restrict |
---|
178 | #endif |
---|
179 | #endif |
---|
180 | |
---|
181 | /* |
---|
182 | * Compiler-dependent macros to declare that functions take printf-like |
---|
183 | * or scanf-like arguments. They are null except for versions of gcc |
---|
184 | * that are known to support the features properly. Functions declared |
---|
185 | * with these attributes will cause compilation warnings if there is a |
---|
186 | * mismatch between the format string and subsequent function parameter |
---|
187 | * types. |
---|
188 | */ |
---|
189 | #if __GNUC__ > 2 || __GNUC__ == 2 && __GNUC_MINOR__ >= 7 |
---|
190 | #define __printflike(fmtarg, firstvararg) \ |
---|
191 | __attribute__((__format__ (__printf__, fmtarg, firstvararg))) |
---|
192 | #define __scanflike(fmtarg, firstvararg) \ |
---|
193 | __attribute__((__format__ (__scanf__, fmtarg, firstvararg))) |
---|
194 | #else |
---|
195 | #define __printflike(fmtarg, firstvararg) |
---|
196 | #define __scanflike(fmtarg, firstvararg) |
---|
197 | #endif |
---|
198 | |
---|
199 | #define __IDSTRING(name,string) static const char name[] __unused = string |
---|
200 | |
---|
201 | #ifndef __COPYRIGHT |
---|
202 | #define __COPYRIGHT(s) __IDSTRING(copyright,s) |
---|
203 | #endif |
---|
204 | |
---|
205 | #ifndef __RCSID |
---|
206 | #define __RCSID(s) __IDSTRING(rcsid,s) |
---|
207 | #endif |
---|
208 | |
---|
209 | #ifndef __SCCSID |
---|
210 | #define __SCCSID(s) __IDSTRING(sccsid,s) |
---|
211 | #endif |
---|
212 | |
---|
213 | #ifndef __PROJECT_VERSION |
---|
214 | #define __PROJECT_VERSION(s) __IDSTRING(project_version,s) |
---|
215 | #endif |
---|
216 | |
---|
217 | /* |
---|
218 | * COMPILATION ENVIRONMENTS |
---|
219 | * |
---|
220 | * DEFAULT By default newly complied code will get POSIX APIs plus |
---|
221 | * Apple API extensions in scope. |
---|
222 | * |
---|
223 | * Most users will use this compilation environment to avoid |
---|
224 | * behavioural differences between 32 and 64 bit code. |
---|
225 | * |
---|
226 | * LEGACY Defining _NONSTD_SOURCE will get pre-POSIX APIs plus Apple |
---|
227 | * API extensions in scope. |
---|
228 | * |
---|
229 | * This is generally equivalent to the Tiger release compilation |
---|
230 | * environment, except that it cannot be applied to 64 bit code; |
---|
231 | * its use is discouraged. |
---|
232 | * |
---|
233 | * We expect this environment to be deprecated in the future. |
---|
234 | * |
---|
235 | * STRICT Defining _POSIX_C_SOURCE or _XOPEN_SOURCE restricts the |
---|
236 | * available APIs to exactly the set of APIs defined by the |
---|
237 | * corresponding standard, based on the value defined. |
---|
238 | * |
---|
239 | * A correct, portable definition for _POSIX_C_SOURCE is 200112L. |
---|
240 | * A correct, portable definition for _XOPEN_SOURCE is 600L. |
---|
241 | * |
---|
242 | * Apple API extensions are not visible in this environment, |
---|
243 | * which can cause Apple specific code to fail to compile, |
---|
244 | * or behave incorrectly if prototypes are not in scope or |
---|
245 | * warnings about missing prototypes are not enabled or ignored. |
---|
246 | * |
---|
247 | * In any compilation environment, for correct symbol resolution to occur, |
---|
248 | * function prototypes must be in scope. It is recommended that all Apple |
---|
249 | * tools users add etiher the "-Wall" or "-Wimplicit-function-declaration" |
---|
250 | * compiler flags to their projects to be warned when a function is being |
---|
251 | * used without a prototype in scope. |
---|
252 | */ |
---|
253 | |
---|
254 | /* |
---|
255 | * The __DARWIN_ALIAS macros are used to do symbol renaming; they allow |
---|
256 | * legacy code to use the old symbol, thus maintiang binary compatability |
---|
257 | * while new code can use a standards compliant version of the same function. |
---|
258 | * |
---|
259 | * __DARWIN_ALIAS is used by itself if the function signature has not |
---|
260 | * changed, it is used along with a #ifdef check for __DARWIN_UNIX03 |
---|
261 | * if the signature has changed. Because the __LP64__ enviroment |
---|
262 | * only supports UNIX03 sementics it causes __DARWIN_UNIX03 to be |
---|
263 | * defined, but causes __DARWIN_ALIAS to do no symbol mangling. |
---|
264 | * |
---|
265 | * As a special case, when XCode is used to target a specific version of the |
---|
266 | * OS, the manifest constant __ENVIRONMENT_MAC_OS_X_VERSION_MIN_REQUIRED__ |
---|
267 | * will be defined by the compiler, with the digits representing major version |
---|
268 | * time 100 + minor version times 10 (e.g. 10.5 := 1050). If we are targetting |
---|
269 | * pre-10.5, and it is the default compilation environment, revert the |
---|
270 | * compilation environment to pre-__DARWIN_UNIX03. |
---|
271 | */ |
---|
272 | #if !defined(__DARWIN_UNIX03) |
---|
273 | # if defined(_DARWIN_C_SOURCE) || defined(_XOPEN_SOURCE) || defined(_POSIX_C_SOURCE) || defined(__LP64__) || (defined(__arm__) && !defined(KERNEL)) |
---|
274 | # if defined(_NONSTD_SOURCE) |
---|
275 | # error "Can't define both _NONSTD_SOURCE and any of _DARWIN_C_SOURCE, _XOPEN_SOURCE, _POSIX_C_SOURCE, or __LP64__" |
---|
276 | # endif /* _NONSTD_SOURCE */ |
---|
277 | # define __DARWIN_UNIX03 1 |
---|
278 | # elif defined(_NONSTD_SOURCE) || defined(KERNEL) |
---|
279 | # define __DARWIN_UNIX03 0 |
---|
280 | # else /* default */ |
---|
281 | # if defined(__ENVIRONMENT_MAC_OS_X_VERSION_MIN_REQUIRED__) && ((__ENVIRONMENT_MAC_OS_X_VERSION_MIN_REQUIRED__-0) < 1050) |
---|
282 | # define __DARWIN_UNIX03 0 |
---|
283 | # else /* __ENVIRONMENT_MAC_OS_X_VERSION_MIN_REQUIRED__ >= 1050 */ |
---|
284 | # define __DARWIN_UNIX03 1 |
---|
285 | # endif /* __ENVIRONMENT_MAC_OS_X_VERSION_MIN_REQUIRED__ >= 1050 */ |
---|
286 | # endif /* _DARWIN_C_SOURCE || _XOPEN_SOURCE || _POSIX_C_SOURCE || __LP64__ */ |
---|
287 | #endif /* !__DARWIN_UNIX03 */ |
---|
288 | |
---|
289 | #if !defined(__DARWIN_64_BIT_INO_T) |
---|
290 | # if defined(_DARWIN_USE_64_BIT_INODE) |
---|
291 | # define __DARWIN_64_BIT_INO_T 1 |
---|
292 | # elif defined(_DARWIN_NO_64_BIT_INODE) || defined(KERNEL) |
---|
293 | # define __DARWIN_64_BIT_INO_T 0 |
---|
294 | # else /* default */ |
---|
295 | # define __DARWIN_64_BIT_INO_T 0 |
---|
296 | # endif |
---|
297 | #endif /* !__DARWIN_64_BIT_INO_T */ |
---|
298 | |
---|
299 | #if !defined(__DARWIN_NON_CANCELABLE) |
---|
300 | # define __DARWIN_NON_CANCELABLE 0 |
---|
301 | #endif /* !__DARWIN_NON_CANCELABLE */ |
---|
302 | |
---|
303 | #if !defined(__DARWIN_VERS_1050) |
---|
304 | # if !defined(KERNEL) && defined(__ENVIRONMENT_MAC_OS_X_VERSION_MIN_REQUIRED__) && ((__ENVIRONMENT_MAC_OS_X_VERSION_MIN_REQUIRED__-0) >= 1050) |
---|
305 | # define __DARWIN_VERS_1050 1 |
---|
306 | # else /* default */ |
---|
307 | # define __DARWIN_VERS_1050 0 |
---|
308 | # endif |
---|
309 | #endif /* !__DARWIN_NON_CANCELABLE */ |
---|
310 | |
---|
311 | /* |
---|
312 | * symbol suffixes used for symbol versioning |
---|
313 | */ |
---|
314 | #if __DARWIN_UNIX03 |
---|
315 | # if !defined(__LP64__) && !defined(__arm__) |
---|
316 | # define __DARWIN_SUF_UNIX03 "$UNIX2003" |
---|
317 | # define __DARWIN_SUF_UNIX03_SET 1 |
---|
318 | # else /* __LP64__ || __arm__ */ |
---|
319 | # define __DARWIN_SUF_UNIX03 /* nothing */ |
---|
320 | # define __DARWIN_SUF_UNIX03_SET 0 |
---|
321 | # endif /* !__LP64__ && !__arm__ */ |
---|
322 | |
---|
323 | # if __DARWIN_64_BIT_INO_T |
---|
324 | # define __DARWIN_SUF_64_BIT_INO_T "$INODE64" |
---|
325 | # else /* !__DARWIN_64_BIT_INO_T */ |
---|
326 | # define __DARWIN_SUF_64_BIT_INO_T /* nothing */ |
---|
327 | # endif /* __DARWIN_UNIX03 */ |
---|
328 | |
---|
329 | # if __DARWIN_NON_CANCELABLE |
---|
330 | # define __DARWIN_SUF_NON_CANCELABLE "$NOCANCEL" |
---|
331 | # else /* !__DARWIN_NON_CANCELABLE */ |
---|
332 | # define __DARWIN_SUF_NON_CANCELABLE /* nothing */ |
---|
333 | # endif /* __DARWIN_NON_CANCELABLE */ |
---|
334 | |
---|
335 | # if __DARWIN_VERS_1050 |
---|
336 | # define __DARWIN_SUF_1050 "$1050" |
---|
337 | # else /* !__DARWIN_VERS_1050 */ |
---|
338 | # define __DARWIN_SUF_1050 /* nothing */ |
---|
339 | # endif /* __DARWIN_VERS_1050 */ |
---|
340 | |
---|
341 | #else /* !__DARWIN_UNIX03 */ |
---|
342 | # define __DARWIN_SUF_UNIX03 /* nothing */ |
---|
343 | # define __DARWIN_SUF_UNIX03_SET 0 |
---|
344 | # define __DARWIN_SUF_64_BIT_INO_T /* nothing */ |
---|
345 | # define __DARWIN_SUF_NON_CANCELABLE /* nothing */ |
---|
346 | # define __DARWIN_SUF_1050 /* nothing */ |
---|
347 | #endif /* __DARWIN_UNIX03 */ |
---|
348 | |
---|
349 | #define __DARWIN_SUF_EXTSN "$DARWIN_EXTSN" |
---|
350 | |
---|
351 | /* |
---|
352 | * symbol versioning macros |
---|
353 | */ |
---|
354 | #define __DARWIN_ALIAS(sym) __asm("_" __STRING(sym) __DARWIN_SUF_UNIX03) |
---|
355 | #define __DARWIN_ALIAS_C(sym) __asm("_" __STRING(sym) __DARWIN_SUF_NON_CANCELABLE __DARWIN_SUF_UNIX03) |
---|
356 | #define __DARWIN_ALIAS_I(sym) __asm("_" __STRING(sym) __DARWIN_SUF_64_BIT_INO_T __DARWIN_SUF_UNIX03) |
---|
357 | #define __DARWIN_INODE64(sym) __asm("_" __STRING(sym) __DARWIN_SUF_64_BIT_INO_T) |
---|
358 | |
---|
359 | #define __DARWIN_1050(sym) __asm("_" __STRING(sym) __DARWIN_SUF_1050) |
---|
360 | #define __DARWIN_1050ALIAS(sym) __asm("_" __STRING(sym) __DARWIN_SUF_1050 __DARWIN_SUF_UNIX03) |
---|
361 | #define __DARWIN_1050ALIAS_C(sym) __asm("_" __STRING(sym) __DARWIN_SUF_1050 __DARWIN_SUF_NON_CANCELABLE __DARWIN_SUF_UNIX03) |
---|
362 | #define __DARWIN_1050ALIAS_I(sym) __asm("_" __STRING(sym) __DARWIN_SUF_1050 __DARWIN_SUF_64_BIT_INO_T __DARWIN_SUF_UNIX03) |
---|
363 | #define __DARWIN_1050INODE64(sym) __asm("_" __STRING(sym) __DARWIN_SUF_1050 __DARWIN_SUF_64_BIT_INO_T) |
---|
364 | |
---|
365 | #define __DARWIN_EXTSN(sym) __asm("_" __STRING(sym) __DARWIN_SUF_EXTSN) |
---|
366 | #define __DARWIN_EXTSN_C(sym) __asm("_" __STRING(sym) __DARWIN_SUF_EXTSN __DARWIN_SUF_NON_CANCELABLE) |
---|
367 | |
---|
368 | |
---|
369 | /* |
---|
370 | * POSIX.1 requires that the macros we test be defined before any standard |
---|
371 | * header file is included. This permits us to convert values for feature |
---|
372 | * testing, as necessary, using only _POSIX_C_SOURCE. |
---|
373 | * |
---|
374 | * Here's a quick run-down of the versions: |
---|
375 | * defined(_POSIX_SOURCE) 1003.1-1988 |
---|
376 | * _POSIX_C_SOURCE == 1L 1003.1-1990 |
---|
377 | * _POSIX_C_SOURCE == 2L 1003.2-1992 C Language Binding Option |
---|
378 | * _POSIX_C_SOURCE == 199309L 1003.1b-1993 |
---|
379 | * _POSIX_C_SOURCE == 199506L 1003.1c-1995, 1003.1i-1995, |
---|
380 | * and the omnibus ISO/IEC 9945-1: 1996 |
---|
381 | * _POSIX_C_SOURCE == 200112L 1003.1-2001 |
---|
382 | * |
---|
383 | * In addition, the X/Open Portability Guide, which is now the Single UNIX |
---|
384 | * Specification, defines a feature-test macro which indicates the version of |
---|
385 | * that specification, and which subsumes _POSIX_C_SOURCE. |
---|
386 | */ |
---|
387 | |
---|
388 | /* Deal with IEEE Std. 1003.1-1990, in which _POSIX_C_SOURCE == 1L. */ |
---|
389 | #if defined(_POSIX_C_SOURCE) && _POSIX_C_SOURCE == 1L |
---|
390 | #undef _POSIX_C_SOURCE |
---|
391 | #define _POSIX_C_SOURCE 199009L |
---|
392 | #endif |
---|
393 | |
---|
394 | /* Deal with IEEE Std. 1003.2-1992, in which _POSIX_C_SOURCE == 2L. */ |
---|
395 | #if defined(_POSIX_C_SOURCE) && _POSIX_C_SOURCE == 2L |
---|
396 | #undef _POSIX_C_SOURCE |
---|
397 | #define _POSIX_C_SOURCE 199209L |
---|
398 | #endif |
---|
399 | |
---|
400 | /* Deal with various X/Open Portability Guides and Single UNIX Spec. */ |
---|
401 | #ifdef _XOPEN_SOURCE |
---|
402 | #if _XOPEN_SOURCE - 0L >= 600L |
---|
403 | #undef _POSIX_C_SOURCE |
---|
404 | #define _POSIX_C_SOURCE 200112L |
---|
405 | #elif _XOPEN_SOURCE - 0L >= 500L |
---|
406 | #undef _POSIX_C_SOURCE |
---|
407 | #define _POSIX_C_SOURCE 199506L |
---|
408 | #endif |
---|
409 | #endif |
---|
410 | |
---|
411 | /* |
---|
412 | * Deal with all versions of POSIX. The ordering relative to the tests above is |
---|
413 | * important. |
---|
414 | */ |
---|
415 | #if defined(_POSIX_SOURCE) && !defined(_POSIX_C_SOURCE) |
---|
416 | #define _POSIX_C_SOURCE 198808L |
---|
417 | #endif |
---|
418 | |
---|
419 | /* |
---|
420 | * long long is not supported in c89 (__STRICT_ANSI__), but g++ -ansi and |
---|
421 | * c99 still want long longs. While not perfect, we allow long longs for |
---|
422 | * g++. |
---|
423 | */ |
---|
424 | #define __DARWIN_NO_LONG_LONG (defined(__STRICT_ANSI__) \ |
---|
425 | && (__STDC_VERSION__-0 < 199901L) \ |
---|
426 | && !defined(__GNUG__)) |
---|
427 | |
---|
428 | /* |
---|
429 | * Long double compatibility macro allow selecting variant symbols based |
---|
430 | * on the old (compatible) 64-bit long doubles, or the new 128-bit |
---|
431 | * long doubles. This applies only to ppc; i386 already has long double |
---|
432 | * support, while ppc64 doesn't have any backwards history. |
---|
433 | */ |
---|
434 | #if defined(__ppc__) |
---|
435 | # if defined(__LDBL_MANT_DIG__) && defined(__DBL_MANT_DIG__) && \ |
---|
436 | __LDBL_MANT_DIG__ > __DBL_MANT_DIG__ |
---|
437 | # if __ENVIRONMENT_MAC_OS_X_VERSION_MIN_REQUIRED__-0 < 1040 |
---|
438 | # define __DARWIN_LDBL_COMPAT(x) __asm("_" __STRING(x) "$LDBLStub") |
---|
439 | # else |
---|
440 | # define __DARWIN_LDBL_COMPAT(x) __asm("_" __STRING(x) "$LDBL128") |
---|
441 | # endif |
---|
442 | # define __DARWIN_LDBL_COMPAT2(x) __asm("_" __STRING(x) "$LDBL128") |
---|
443 | # define __DARWIN_LONG_DOUBLE_IS_DOUBLE 0 |
---|
444 | # else |
---|
445 | # define __DARWIN_LDBL_COMPAT(x) /* nothing */ |
---|
446 | # define __DARWIN_LDBL_COMPAT2(x) /* nothing */ |
---|
447 | # define __DARWIN_LONG_DOUBLE_IS_DOUBLE 1 |
---|
448 | # endif |
---|
449 | #elif defined(__i386__) || defined(__ppc64__) || defined(__x86_64__) || defined (__arm__) |
---|
450 | # define __DARWIN_LDBL_COMPAT(x) /* nothing */ |
---|
451 | # define __DARWIN_LDBL_COMPAT2(x) /* nothing */ |
---|
452 | # define __DARWIN_LONG_DOUBLE_IS_DOUBLE 0 |
---|
453 | #else |
---|
454 | # error Unknown architecture |
---|
455 | #endif |
---|
456 | |
---|
457 | /* |
---|
458 | * Deprecation macro |
---|
459 | */ |
---|
460 | #if __GNUC__ >= 3 |
---|
461 | #define __deprecated __attribute__((deprecated)) |
---|
462 | #else |
---|
463 | #define __deprecated /* nothing */ |
---|
464 | #endif |
---|
465 | |
---|
466 | /***************************************** |
---|
467 | * Public darwin-specific feature macros |
---|
468 | *****************************************/ |
---|
469 | |
---|
470 | /* |
---|
471 | * _DARWIN_FEATURE_LONG_DOUBLE_IS_DOUBLE indicates when the long double type |
---|
472 | * is the same as the double type (ppc only) |
---|
473 | */ |
---|
474 | #if __DARWIN_LONG_DOUBLE_IS_DOUBLE |
---|
475 | #define _DARWIN_FEATURE_LONG_DOUBLE_IS_DOUBLE 1 |
---|
476 | #endif |
---|
477 | |
---|
478 | /* |
---|
479 | * _DARWIN_FEATURE_UNIX_CONFORMANCE indicates whether UNIX conformance is on, |
---|
480 | * and specifies the conformance level (3 is SUSv3) |
---|
481 | */ |
---|
482 | #if __DARWIN_UNIX03 |
---|
483 | #define _DARWIN_FEATURE_UNIX_CONFORMANCE 3 |
---|
484 | #endif |
---|
485 | |
---|
486 | /* |
---|
487 | * _DARWIN_FEATURE_64_BIT_INODE indicates that the ino_t type is 64-bit, and |
---|
488 | * structures modified for 64-bit inodes (like struct stat) will be used. |
---|
489 | */ |
---|
490 | #if __DARWIN_64_BIT_INO_T |
---|
491 | #define _DARWIN_FEATURE_64_BIT_INODE 1 |
---|
492 | #endif |
---|
493 | |
---|
494 | #endif /* !_CDEFS_H_ */ |
---|