1 | /* $Id: $ */
|
---|
2 | /** @file
|
---|
3 | * FreeBSD 9.0
|
---|
4 | *
|
---|
5 | * @changed bird: Toolkit compatibility (_CDEFS_H_ and __TCPROTO()).
|
---|
6 | * @changed bird: Check if stuff is defined before accessing it in #if. Stops -Wundef
|
---|
7 | * from bitching.
|
---|
8 | * @changed bird: __offsetof__ was apparently introduced in gcc 3.4.x.
|
---|
9 | */
|
---|
10 |
|
---|
11 | /*-
|
---|
12 | * Copyright (c) 1991, 1993
|
---|
13 | * The Regents of the University of California. All rights reserved.
|
---|
14 | *
|
---|
15 | * This code is derived from software contributed to Berkeley by
|
---|
16 | * Berkeley Software Design, Inc.
|
---|
17 | *
|
---|
18 | * Redistribution and use in source and binary forms, with or without
|
---|
19 | * modification, are permitted provided that the following conditions
|
---|
20 | * are met:
|
---|
21 | * 1. Redistributions of source code must retain the above copyright
|
---|
22 | * notice, this list of conditions and the following disclaimer.
|
---|
23 | * 2. Redistributions in binary form must reproduce the above copyright
|
---|
24 | * notice, this list of conditions and the following disclaimer in the
|
---|
25 | * documentation and/or other materials provided with the distribution.
|
---|
26 | * 4. Neither the name of the University nor the names of its contributors
|
---|
27 | * may be used to endorse or promote products derived from this software
|
---|
28 | * without specific prior written permission.
|
---|
29 | *
|
---|
30 | * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND
|
---|
31 | * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
|
---|
32 | * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
|
---|
33 | * ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
|
---|
34 | * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
|
---|
35 | * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
|
---|
36 | * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
|
---|
37 | * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
|
---|
38 | * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
|
---|
39 | * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
|
---|
40 | * SUCH DAMAGE.
|
---|
41 | *
|
---|
42 | * @(#)cdefs.h 8.8 (Berkeley) 1/9/95
|
---|
43 | * $FreeBSD: src/sys/sys/cdefs.h,v 1.114 2011/02/18 21:44:53 nwhitehorn Exp $
|
---|
44 | */
|
---|
45 |
|
---|
46 | #ifndef _SYS_CDEFS_H_
|
---|
47 | #define _SYS_CDEFS_H_
|
---|
48 | #define _CDEFS_H_ /* bird: compatability */
|
---|
49 |
|
---|
50 | #if defined(__cplusplus)
|
---|
51 | #define __BEGIN_DECLS extern "C" {
|
---|
52 | #define __END_DECLS }
|
---|
53 | #else
|
---|
54 | #define __BEGIN_DECLS
|
---|
55 | #define __END_DECLS
|
---|
56 | #endif
|
---|
57 |
|
---|
58 | /*
|
---|
59 | * This code has been put in place to help reduce the addition of
|
---|
60 | * compiler specific defines in FreeBSD code. It helps to aid in
|
---|
61 | * having a compiler-agnostic source tree.
|
---|
62 | */
|
---|
63 |
|
---|
64 | #if defined(__GNUC__) || defined(__INTEL_COMPILER)
|
---|
65 |
|
---|
66 | #if __GNUC__ >= 3 || defined(__INTEL_COMPILER)
|
---|
67 | #define __GNUCLIKE_ASM 3
|
---|
68 | #define __GNUCLIKE_MATH_BUILTIN_CONSTANTS
|
---|
69 | #else
|
---|
70 | #define __GNUCLIKE_ASM 2
|
---|
71 | #endif
|
---|
72 | #define __GNUCLIKE___TYPEOF 1
|
---|
73 | #define __GNUCLIKE___OFFSETOF 1
|
---|
74 | #define __GNUCLIKE___SECTION 1
|
---|
75 |
|
---|
76 | #ifndef __INTEL_COMPILER
|
---|
77 | # define __GNUCLIKE_CTOR_SECTION_HANDLING 1
|
---|
78 | #endif
|
---|
79 |
|
---|
80 | #define __GNUCLIKE_BUILTIN_CONSTANT_P 1
|
---|
81 | # if defined(__INTEL_COMPILER) && defined(__cplusplus) \
|
---|
82 | && __INTEL_COMPILER < 800
|
---|
83 | # undef __GNUCLIKE_BUILTIN_CONSTANT_P
|
---|
84 | # endif
|
---|
85 |
|
---|
86 | #if (__GNUC_MINOR__ > 95 || __GNUC__ >= 3) && !defined(__INTEL_COMPILER)
|
---|
87 | # define __GNUCLIKE_BUILTIN_VARARGS 1
|
---|
88 | # define __GNUCLIKE_BUILTIN_STDARG 1
|
---|
89 | # define __GNUCLIKE_BUILTIN_VAALIST 1
|
---|
90 | #endif
|
---|
91 |
|
---|
92 | #if defined(__GNUC__)
|
---|
93 | # define __GNUC_VA_LIST_COMPATIBILITY 1
|
---|
94 | #endif
|
---|
95 |
|
---|
96 | #ifndef __INTEL_COMPILER
|
---|
97 | # define __GNUCLIKE_BUILTIN_NEXT_ARG 1
|
---|
98 | # define __GNUCLIKE_MATH_BUILTIN_RELOPS
|
---|
99 | #endif
|
---|
100 |
|
---|
101 | #define __GNUCLIKE_BUILTIN_MEMCPY 1
|
---|
102 |
|
---|
103 | /* XXX: if __GNUC__ >= 2: not tested everywhere originally, where replaced */
|
---|
104 | #define __CC_SUPPORTS_INLINE 1
|
---|
105 | #define __CC_SUPPORTS___INLINE 1
|
---|
106 | #define __CC_SUPPORTS___INLINE__ 1
|
---|
107 |
|
---|
108 | #define __CC_SUPPORTS___FUNC__ 1
|
---|
109 | #define __CC_SUPPORTS_WARNING 1
|
---|
110 |
|
---|
111 | #define __CC_SUPPORTS_VARADIC_XXX 1 /* see varargs.h */
|
---|
112 |
|
---|
113 | #define __CC_SUPPORTS_DYNAMIC_ARRAY_INIT 1
|
---|
114 |
|
---|
115 | #endif /* __GNUC__ || __INTEL_COMPILER */
|
---|
116 |
|
---|
117 | /*
|
---|
118 | * Macro to test if we're using a specific version of gcc or later.
|
---|
119 | */
|
---|
120 | #if defined(__GNUC__) && !defined(__INTEL_COMPILER)
|
---|
121 | #define __GNUC_PREREQ__(ma, mi) \
|
---|
122 | (__GNUC__ > (ma) || __GNUC__ == (ma) && __GNUC_MINOR__ >= (mi))
|
---|
123 | #else
|
---|
124 | #define __GNUC_PREREQ__(ma, mi) 0
|
---|
125 | #endif
|
---|
126 |
|
---|
127 | /*
|
---|
128 | * The __CONCAT macro is used to concatenate parts of symbol names, e.g.
|
---|
129 | * with "#define OLD(foo) __CONCAT(old,foo)", OLD(foo) produces oldfoo.
|
---|
130 | * The __CONCAT macro is a bit tricky to use if it must work in non-ANSI
|
---|
131 | * mode -- there must be no spaces between its arguments, and for nested
|
---|
132 | * __CONCAT's, all the __CONCAT's must be at the left. __CONCAT can also
|
---|
133 | * concatenate double-quoted strings produced by the __STRING macro, but
|
---|
134 | * this only works with ANSI C.
|
---|
135 | *
|
---|
136 | * __XSTRING is like __STRING, but it expands any macros in its argument
|
---|
137 | * first. It is only available with ANSI C.
|
---|
138 | */
|
---|
139 | #if defined(__STDC__) || defined(__cplusplus)
|
---|
140 | #define __P(protos) protos /* full-blown ANSI C */
|
---|
141 | #define __CONCAT1(x,y) x ## y
|
---|
142 | #define __CONCAT(x,y) __CONCAT1(x,y)
|
---|
143 | #define __STRING(x) #x /* stringify without expanding x */
|
---|
144 | #define __XSTRING(x) __STRING(x) /* expand x, then stringify */
|
---|
145 |
|
---|
146 | #define __const const /* define reserved names to standard */
|
---|
147 | #define __signed signed
|
---|
148 | #define __volatile volatile
|
---|
149 | #if defined(__cplusplus)
|
---|
150 | #define __inline inline /* convert to C++ keyword */
|
---|
151 | #else
|
---|
152 | #if !(defined(__CC_SUPPORTS___INLINE))
|
---|
153 | #define __inline /* delete GCC keyword */
|
---|
154 | #endif /* ! __CC_SUPPORTS___INLINE */
|
---|
155 | #endif /* !__cplusplus */
|
---|
156 |
|
---|
157 | #else /* !(__STDC__ || __cplusplus) */
|
---|
158 | #define __P(protos) () /* traditional C preprocessor */
|
---|
159 | #define __CONCAT(x,y) x/**/y
|
---|
160 | #define __STRING(x) "x"
|
---|
161 |
|
---|
162 | #if !defined(__CC_SUPPORTS___INLINE)
|
---|
163 | #define __const /* delete pseudo-ANSI C keywords */
|
---|
164 | #define __inline
|
---|
165 | #define __signed
|
---|
166 | #define __volatile
|
---|
167 | /*
|
---|
168 | * In non-ANSI C environments, new programs will want ANSI-only C keywords
|
---|
169 | * deleted from the program and old programs will want them left alone.
|
---|
170 | * When using a compiler other than gcc, programs using the ANSI C keywords
|
---|
171 | * const, inline etc. as normal identifiers should define -DNO_ANSI_KEYWORDS.
|
---|
172 | * When using "gcc -traditional", we assume that this is the intent; if
|
---|
173 | * __GNUC__ is defined but __STDC__ is not, we leave the new keywords alone.
|
---|
174 | */
|
---|
175 | #ifndef NO_ANSI_KEYWORDS
|
---|
176 | #define const /* delete ANSI C keywords */
|
---|
177 | #define inline
|
---|
178 | #define signed
|
---|
179 | #define volatile
|
---|
180 | #endif /* !NO_ANSI_KEYWORDS */
|
---|
181 | #endif /* !__CC_SUPPORTS___INLINE */
|
---|
182 | #endif /* !(__STDC__ || __cplusplus) */
|
---|
183 |
|
---|
184 | /*
|
---|
185 | * Compiler-dependent macros to help declare dead (non-returning) and
|
---|
186 | * pure (no side effects) functions, and unused variables. They are
|
---|
187 | * null except for versions of gcc that are known to support the features
|
---|
188 | * properly (old versions of gcc-2 supported the dead and pure features
|
---|
189 | * in a different (wrong) way). If we do not provide an implementation
|
---|
190 | * for a given compiler, let the compile fail if it is told to use
|
---|
191 | * a feature that we cannot live without.
|
---|
192 | */
|
---|
193 | #ifdef lint
|
---|
194 | #define __dead2
|
---|
195 | #define __pure2
|
---|
196 | #define __unused
|
---|
197 | #define __packed
|
---|
198 | #define __aligned(x)
|
---|
199 | #define __section(x)
|
---|
200 | #else
|
---|
201 | #if !__GNUC_PREREQ__(2, 5) && !defined(__INTEL_COMPILER)
|
---|
202 | #define __dead2
|
---|
203 | #define __pure2
|
---|
204 | #define __unused
|
---|
205 | #endif
|
---|
206 | #if __GNUC__ == 2 && __GNUC_MINOR__ >= 5 && __GNUC_MINOR__ < 7 && !defined(__INTEL_COMPILER)
|
---|
207 | #define __dead2 __attribute__((__noreturn__))
|
---|
208 | #define __pure2 __attribute__((__const__))
|
---|
209 | #define __unused
|
---|
210 | /* XXX Find out what to do for __packed, __aligned and __section */
|
---|
211 | #endif
|
---|
212 | #if __GNUC_PREREQ__(2, 7)
|
---|
213 | #define __dead2 __attribute__((__noreturn__))
|
---|
214 | #define __pure2 __attribute__((__const__))
|
---|
215 | #define __unused __attribute__((__unused__))
|
---|
216 | #define __used __attribute__((__used__))
|
---|
217 | #define __packed __attribute__((__packed__))
|
---|
218 | #define __aligned(x) __attribute__((__aligned__(x)))
|
---|
219 | #define __section(x) __attribute__((__section__(x)))
|
---|
220 | #endif
|
---|
221 | #if defined(__INTEL_COMPILER)
|
---|
222 | #define __dead2 __attribute__((__noreturn__))
|
---|
223 | #define __pure2 __attribute__((__const__))
|
---|
224 | #define __unused __attribute__((__unused__))
|
---|
225 | #define __used __attribute__((__used__))
|
---|
226 | #define __packed __attribute__((__packed__))
|
---|
227 | #define __aligned(x) __attribute__((__aligned__(x)))
|
---|
228 | #define __section(x) __attribute__((__section__(x)))
|
---|
229 | #endif
|
---|
230 | #endif
|
---|
231 |
|
---|
232 | #if __GNUC_PREREQ__(2, 96)
|
---|
233 | #define __malloc_like __attribute__((__malloc__))
|
---|
234 | #define __pure __attribute__((__pure__))
|
---|
235 | #else
|
---|
236 | #define __malloc_like
|
---|
237 | #define __pure
|
---|
238 | #endif
|
---|
239 |
|
---|
240 | #if __GNUC_PREREQ__(3, 1) || (defined(__INTEL_COMPILER) && __INTEL_COMPILER >= 800)
|
---|
241 | #define __always_inline __attribute__((__always_inline__))
|
---|
242 | #else
|
---|
243 | #define __always_inline
|
---|
244 | #endif
|
---|
245 |
|
---|
246 | #if __GNUC_PREREQ__(3, 1)
|
---|
247 | #define __noinline __attribute__ ((__noinline__))
|
---|
248 | #else
|
---|
249 | #define __noinline
|
---|
250 | #endif
|
---|
251 |
|
---|
252 | #if __GNUC_PREREQ__(3, 3)
|
---|
253 | #define __nonnull(x) __attribute__((__nonnull__(x)))
|
---|
254 | #else
|
---|
255 | #define __nonnull(x)
|
---|
256 | #endif
|
---|
257 |
|
---|
258 | /* XXX: should use `#if __STDC_VERSION__ < 199901'. */
|
---|
259 | #if !__GNUC_PREREQ__(2, 7) && !defined(__INTEL_COMPILER)
|
---|
260 | #define __func__ NULL
|
---|
261 | #endif
|
---|
262 |
|
---|
263 | #if (defined(__INTEL_COMPILER) || (defined(__GNUC__) && __GNUC__ >= 2)) && !defined(__STRICT_ANSI__) || __STDC_VERSION__ >= 199901
|
---|
264 | #define __LONG_LONG_SUPPORTED
|
---|
265 | #endif
|
---|
266 |
|
---|
267 | /*
|
---|
268 | * GCC 2.95 provides `__restrict' as an extension to C90 to support the
|
---|
269 | * C99-specific `restrict' type qualifier. We happen to use `__restrict' as
|
---|
270 | * a way to define the `restrict' type qualifier without disturbing older
|
---|
271 | * software that is unaware of C99 keywords.
|
---|
272 | */
|
---|
273 | #if !(__GNUC__ == 2 && __GNUC_MINOR__ == 95)
|
---|
274 | #if !defined(__STDC_VERSION__) || __STDC_VERSION__ < 199901 || defined(lint)
|
---|
275 | #define __restrict
|
---|
276 | #else
|
---|
277 | #define __restrict restrict
|
---|
278 | #endif
|
---|
279 | #endif
|
---|
280 |
|
---|
281 | /*
|
---|
282 | * GNU C version 2.96 adds explicit branch prediction so that
|
---|
283 | * the CPU back-end can hint the processor and also so that
|
---|
284 | * code blocks can be reordered such that the predicted path
|
---|
285 | * sees a more linear flow, thus improving cache behavior, etc.
|
---|
286 | *
|
---|
287 | * The following two macros provide us with a way to utilize this
|
---|
288 | * compiler feature. Use __predict_true() if you expect the expression
|
---|
289 | * to evaluate to true, and __predict_false() if you expect the
|
---|
290 | * expression to evaluate to false.
|
---|
291 | *
|
---|
292 | * A few notes about usage:
|
---|
293 | *
|
---|
294 | * * Generally, __predict_false() error condition checks (unless
|
---|
295 | * you have some _strong_ reason to do otherwise, in which case
|
---|
296 | * document it), and/or __predict_true() `no-error' condition
|
---|
297 | * checks, assuming you want to optimize for the no-error case.
|
---|
298 | *
|
---|
299 | * * Other than that, if you don't know the likelihood of a test
|
---|
300 | * succeeding from empirical or other `hard' evidence, don't
|
---|
301 | * make predictions.
|
---|
302 | *
|
---|
303 | * * These are meant to be used in places that are run `a lot'.
|
---|
304 | * It is wasteful to make predictions in code that is run
|
---|
305 | * seldomly (e.g. at subsystem initialization time) as the
|
---|
306 | * basic block reordering that this affects can often generate
|
---|
307 | * larger code.
|
---|
308 | */
|
---|
309 | #if __GNUC_PREREQ__(2, 96)
|
---|
310 | #define __predict_true(exp) __builtin_expect((exp), 1)
|
---|
311 | #define __predict_false(exp) __builtin_expect((exp), 0)
|
---|
312 | #else
|
---|
313 | #define __predict_true(exp) (exp)
|
---|
314 | #define __predict_false(exp) (exp)
|
---|
315 | #endif
|
---|
316 |
|
---|
317 | #if __GNUC_PREREQ__(4, 2)
|
---|
318 | #define __hidden __attribute__((__visibility__("hidden")))
|
---|
319 | #define __exported __attribute__((__visibility__("default")))
|
---|
320 | #else
|
---|
321 | #define __hidden
|
---|
322 | #define __exported
|
---|
323 | #endif
|
---|
324 |
|
---|
325 | /*
|
---|
326 | * We define this here since <stddef.h>, <sys/queue.h>, and <sys/types.h>
|
---|
327 | * require it.
|
---|
328 | */
|
---|
329 | #if __GNUC_PREREQ__(4, 1)
|
---|
330 | #define __offsetof(type, field) __builtin_offsetof(type, field)
|
---|
331 | #else
|
---|
332 | #if !defined(__cplusplus) || !__GNUC_PREREQ__(3,4) /* bird: __offsetof__ was introduced in 3.4.x. */
|
---|
333 | #define __offsetof(type, field) ((size_t)(&((type *)0)->field))
|
---|
334 | #else
|
---|
335 | #define __offsetof(type, field) \
|
---|
336 | (__offsetof__ (reinterpret_cast <size_t> \
|
---|
337 | (&reinterpret_cast <const volatile char &> \
|
---|
338 | (static_cast<type *> (0)->field))))
|
---|
339 | #endif
|
---|
340 | #endif
|
---|
341 | #define __rangeof(type, start, end) \
|
---|
342 | (__offsetof(type, end) - __offsetof(type, start))
|
---|
343 |
|
---|
344 | /*
|
---|
345 | * Compiler-dependent macros to declare that functions take printf-like
|
---|
346 | * or scanf-like arguments. They are null except for versions of gcc
|
---|
347 | * that are known to support the features properly (old versions of gcc-2
|
---|
348 | * didn't permit keeping the keywords out of the application namespace).
|
---|
349 | */
|
---|
350 | #if !__GNUC_PREREQ__(2, 7) && !defined(__INTEL_COMPILER)
|
---|
351 | #define __printflike(fmtarg, firstvararg)
|
---|
352 | #define __scanflike(fmtarg, firstvararg)
|
---|
353 | #define __format_arg(fmtarg)
|
---|
354 | #else
|
---|
355 | #define __printflike(fmtarg, firstvararg) \
|
---|
356 | __attribute__((__format__ (__printf__, fmtarg, firstvararg)))
|
---|
357 | #define __scanflike(fmtarg, firstvararg) \
|
---|
358 | __attribute__((__format__ (__scanf__, fmtarg, firstvararg)))
|
---|
359 | #define __format_arg(fmtarg) __attribute__((__format_arg__ (fmtarg)))
|
---|
360 | #endif
|
---|
361 |
|
---|
362 | /* Compiler-dependent macros that rely on FreeBSD-specific extensions. */
|
---|
363 | #ifdef __FreeBSD_cc_version /* bird */
|
---|
364 | #if __FreeBSD_cc_version >= 300001 && defined(__GNUC__) && !defined(__INTEL_COMPILER)
|
---|
365 | #define __printf0like(fmtarg, firstvararg) \
|
---|
366 | __attribute__((__format__ (__printf0__, fmtarg, firstvararg)))
|
---|
367 | #else
|
---|
368 | #define __printf0like(fmtarg, firstvararg)
|
---|
369 | #endif
|
---|
370 | #else /* bird */
|
---|
371 | #define __printf0like(fmtarg, firstvararg) /* bird */
|
---|
372 | #endif /* bird */
|
---|
373 |
|
---|
374 | #if 0 /* bird - mostly ELF specific, so skip it. */
|
---|
375 | #if defined(__GNUC__) || defined(__INTEL_COMPILER)
|
---|
376 | #ifndef __INTEL_COMPILER
|
---|
377 | #define __strong_reference(sym,aliassym) \
|
---|
378 | extern __typeof (sym) aliassym __attribute__ ((__alias__ (#sym)))
|
---|
379 | #endif
|
---|
380 | #ifdef __STDC__
|
---|
381 | #define __weak_reference(sym,alias) \
|
---|
382 | __asm__(".weak " #alias); \
|
---|
383 | __asm__(".equ " #alias ", " #sym)
|
---|
384 | #define __warn_references(sym,msg) \
|
---|
385 | __asm__(".section .gnu.warning." #sym); \
|
---|
386 | __asm__(".asciz \"" msg "\""); \
|
---|
387 | __asm__(".previous")
|
---|
388 | #define __sym_compat(sym,impl,verid) \
|
---|
389 | __asm__(".symver " #impl ", " #sym "@" #verid)
|
---|
390 | #define __sym_default(sym,impl,verid) \
|
---|
391 | __asm__(".symver " #impl ", " #sym "@@" #verid)
|
---|
392 | #else
|
---|
393 | #define __weak_reference(sym,alias) \
|
---|
394 | __asm__(".weak alias"); \
|
---|
395 | __asm__(".equ alias, sym")
|
---|
396 | #define __warn_references(sym,msg) \
|
---|
397 | __asm__(".section .gnu.warning.sym"); \
|
---|
398 | __asm__(".asciz \"msg\""); \
|
---|
399 | __asm__(".previous")
|
---|
400 | #define __sym_compat(sym,impl,verid) \
|
---|
401 | __asm__(".symver impl, sym@verid")
|
---|
402 | #define __sym_default(impl,sym,verid) \
|
---|
403 | __asm__(".symver impl, sym@@verid")
|
---|
404 | #endif /* __STDC__ */
|
---|
405 | #endif /* __GNUC__ || __INTEL_COMPILER */
|
---|
406 | #else /* bird */
|
---|
407 | #define __strong_reference(sym,aliassym) \
|
---|
408 | extern __typeof (sym) aliassym __attribute__ ((__alias__ (#sym))); /* bird */
|
---|
409 | #endif /* bird */
|
---|
410 |
|
---|
411 | #define __GLOBL1(sym) __asm__(".globl " #sym)
|
---|
412 | #define __GLOBL(sym) __GLOBL1(sym)
|
---|
413 |
|
---|
414 | #if 0 /* defined(__GNUC__) || defined(__INTEL_COMPILER) - bird: ELF specific. */
|
---|
415 | #define __IDSTRING(name,string) __asm__(".ident\t\"" string "\"")
|
---|
416 | #else
|
---|
417 | /*
|
---|
418 | * The following definition might not work well if used in header files,
|
---|
419 | * but it should be better than nothing. If you want a "do nothing"
|
---|
420 | * version, then it should generate some harmless declaration, such as:
|
---|
421 | * #define __IDSTRING(name,string) struct __hack
|
---|
422 | */
|
---|
423 | #define __IDSTRING(name,string) static const char name[] __unused = string
|
---|
424 | #endif
|
---|
425 |
|
---|
426 | /*
|
---|
427 | * Embed the rcs id of a source file in the resulting library. Note that in
|
---|
428 | * more recent ELF binutils, we use .ident allowing the ID to be stripped.
|
---|
429 | * Usage:
|
---|
430 | * __FBSDID("$FreeBSD: src/sys/sys/cdefs.h,v 1.114 2011/02/18 21:44:53 nwhitehorn Exp $");
|
---|
431 | */
|
---|
432 | #ifndef __FBSDID
|
---|
433 | #if !defined(lint) && !defined(STRIP_FBSDID)
|
---|
434 | #define __FBSDID(s) __IDSTRING(__CONCAT(__rcsid_,__LINE__),s)
|
---|
435 | #else
|
---|
436 | #define __FBSDID(s) struct __hack
|
---|
437 | #endif
|
---|
438 | #endif
|
---|
439 |
|
---|
440 | #ifndef __RCSID
|
---|
441 | #ifndef NO__RCSID
|
---|
442 | #define __RCSID(s) __IDSTRING(__CONCAT(__rcsid_,__LINE__),s)
|
---|
443 | #else
|
---|
444 | #define __RCSID(s) struct __hack
|
---|
445 | #endif
|
---|
446 | #endif
|
---|
447 |
|
---|
448 | #ifndef __RCSID_SOURCE
|
---|
449 | #ifndef NO__RCSID_SOURCE
|
---|
450 | #define __RCSID_SOURCE(s) __IDSTRING(__CONCAT(__rcsid_source_,__LINE__),s)
|
---|
451 | #else
|
---|
452 | #define __RCSID_SOURCE(s) struct __hack
|
---|
453 | #endif
|
---|
454 | #endif
|
---|
455 |
|
---|
456 | #ifndef __SCCSID
|
---|
457 | #ifndef NO__SCCSID
|
---|
458 | #define __SCCSID(s) __IDSTRING(__CONCAT(__sccsid_,__LINE__),s)
|
---|
459 | #else
|
---|
460 | #define __SCCSID(s) struct __hack
|
---|
461 | #endif
|
---|
462 | #endif
|
---|
463 |
|
---|
464 | #ifndef __COPYRIGHT
|
---|
465 | #ifndef NO__COPYRIGHT
|
---|
466 | #define __COPYRIGHT(s) __IDSTRING(__CONCAT(__copyright_,__LINE__),s)
|
---|
467 | #else
|
---|
468 | #define __COPYRIGHT(s) struct __hack
|
---|
469 | #endif
|
---|
470 | #endif
|
---|
471 |
|
---|
472 | #ifndef __DECONST
|
---|
473 | #define __DECONST(type, var) ((type)(uintptr_t)(const void *)(var))
|
---|
474 | #endif
|
---|
475 |
|
---|
476 | #ifndef __DEVOLATILE
|
---|
477 | #define __DEVOLATILE(type, var) ((type)(uintptr_t)(volatile void *)(var))
|
---|
478 | #endif
|
---|
479 |
|
---|
480 | #ifndef __DEQUALIFY
|
---|
481 | #define __DEQUALIFY(type, var) ((type)(uintptr_t)(const volatile void *)(var))
|
---|
482 | #endif
|
---|
483 |
|
---|
484 | /*-
|
---|
485 | * The following definitions are an extension of the behavior originally
|
---|
486 | * implemented in <sys/_posix.h>, but with a different level of granularity.
|
---|
487 | * POSIX.1 requires that the macros we test be defined before any standard
|
---|
488 | * header file is included.
|
---|
489 | *
|
---|
490 | * Here's a quick run-down of the versions:
|
---|
491 | * defined(_POSIX_SOURCE) 1003.1-1988
|
---|
492 | * _POSIX_C_SOURCE == 1 1003.1-1990
|
---|
493 | * _POSIX_C_SOURCE == 2 1003.2-1992 C Language Binding Option
|
---|
494 | * _POSIX_C_SOURCE == 199309 1003.1b-1993
|
---|
495 | * _POSIX_C_SOURCE == 199506 1003.1c-1995, 1003.1i-1995,
|
---|
496 | * and the omnibus ISO/IEC 9945-1: 1996
|
---|
497 | * _POSIX_C_SOURCE == 200112 1003.1-2001
|
---|
498 | * _POSIX_C_SOURCE == 200809 1003.1-2008
|
---|
499 | *
|
---|
500 | * In addition, the X/Open Portability Guide, which is now the Single UNIX
|
---|
501 | * Specification, defines a feature-test macro which indicates the version of
|
---|
502 | * that specification, and which subsumes _POSIX_C_SOURCE.
|
---|
503 | *
|
---|
504 | * Our macros begin with two underscores to avoid namespace screwage.
|
---|
505 | */
|
---|
506 |
|
---|
507 | /* Deal with IEEE Std. 1003.1-1990, in which _POSIX_C_SOURCE == 1. */
|
---|
508 | #if defined(_POSIX_C_SOURCE) && _POSIX_C_SOURCE == 1
|
---|
509 | #undef _POSIX_C_SOURCE /* Probably illegal, but beyond caring now. */
|
---|
510 | #define _POSIX_C_SOURCE 199009
|
---|
511 | #endif
|
---|
512 |
|
---|
513 | /* Deal with IEEE Std. 1003.2-1992, in which _POSIX_C_SOURCE == 2. */
|
---|
514 | #if defined(_POSIX_C_SOURCE) && _POSIX_C_SOURCE == 2
|
---|
515 | #undef _POSIX_C_SOURCE
|
---|
516 | #define _POSIX_C_SOURCE 199209
|
---|
517 | #endif
|
---|
518 |
|
---|
519 | /* Deal with various X/Open Portability Guides and Single UNIX Spec. */
|
---|
520 | #ifdef _XOPEN_SOURCE
|
---|
521 | #if _XOPEN_SOURCE - 0 >= 700
|
---|
522 | #define __XSI_VISIBLE 700
|
---|
523 | #undef _POSIX_C_SOURCE
|
---|
524 | #define _POSIX_C_SOURCE 200809
|
---|
525 | #elif _XOPEN_SOURCE - 0 >= 600
|
---|
526 | #define __XSI_VISIBLE 600
|
---|
527 | #undef _POSIX_C_SOURCE
|
---|
528 | #define _POSIX_C_SOURCE 200112
|
---|
529 | #elif _XOPEN_SOURCE - 0 >= 500
|
---|
530 | #define __XSI_VISIBLE 500
|
---|
531 | #undef _POSIX_C_SOURCE
|
---|
532 | #define _POSIX_C_SOURCE 199506
|
---|
533 | #endif
|
---|
534 | #endif
|
---|
535 |
|
---|
536 | /*
|
---|
537 | * Deal with all versions of POSIX. The ordering relative to the tests above is
|
---|
538 | * important.
|
---|
539 | */
|
---|
540 | #if defined(_POSIX_SOURCE) && !defined(_POSIX_C_SOURCE)
|
---|
541 | #define _POSIX_C_SOURCE 198808
|
---|
542 | #endif
|
---|
543 | #ifdef _POSIX_C_SOURCE
|
---|
544 | #if _POSIX_C_SOURCE >= 200809
|
---|
545 | #define __POSIX_VISIBLE 200809
|
---|
546 | #define __ISO_C_VISIBLE 1999
|
---|
547 | #elif _POSIX_C_SOURCE >= 200112
|
---|
548 | #define __POSIX_VISIBLE 200112
|
---|
549 | #define __ISO_C_VISIBLE 1999
|
---|
550 | #elif _POSIX_C_SOURCE >= 199506
|
---|
551 | #define __POSIX_VISIBLE 199506
|
---|
552 | #define __ISO_C_VISIBLE 1990
|
---|
553 | #elif _POSIX_C_SOURCE >= 199309
|
---|
554 | #define __POSIX_VISIBLE 199309
|
---|
555 | #define __ISO_C_VISIBLE 1990
|
---|
556 | #elif _POSIX_C_SOURCE >= 199209
|
---|
557 | #define __POSIX_VISIBLE 199209
|
---|
558 | #define __ISO_C_VISIBLE 1990
|
---|
559 | #elif _POSIX_C_SOURCE >= 199009
|
---|
560 | #define __POSIX_VISIBLE 199009
|
---|
561 | #define __ISO_C_VISIBLE 1990
|
---|
562 | #else
|
---|
563 | #define __POSIX_VISIBLE 198808
|
---|
564 | #define __ISO_C_VISIBLE 0
|
---|
565 | #endif /* _POSIX_C_SOURCE */
|
---|
566 | #else
|
---|
567 | /*-
|
---|
568 | * Deal with _ANSI_SOURCE:
|
---|
569 | * If it is defined, and no other compilation environment is explicitly
|
---|
570 | * requested, then define our internal feature-test macros to zero. This
|
---|
571 | * makes no difference to the preprocessor (undefined symbols in preprocessing
|
---|
572 | * expressions are defined to have value zero), but makes it more convenient for
|
---|
573 | * a test program to print out the values.
|
---|
574 | *
|
---|
575 | * If a program mistakenly defines _ANSI_SOURCE and some other macro such as
|
---|
576 | * _POSIX_C_SOURCE, we will assume that it wants the broader compilation
|
---|
577 | * environment (and in fact we will never get here).
|
---|
578 | */
|
---|
579 | #if defined(_ANSI_SOURCE) /* Hide almost everything. */
|
---|
580 | #define __POSIX_VISIBLE 0
|
---|
581 | #define __XSI_VISIBLE 0
|
---|
582 | #define __BSD_VISIBLE 0
|
---|
583 | #define __ISO_C_VISIBLE 1990
|
---|
584 | #elif defined(_C99_SOURCE) /* Localism to specify strict C99 env. */
|
---|
585 | #define __POSIX_VISIBLE 0
|
---|
586 | #define __XSI_VISIBLE 0
|
---|
587 | #define __BSD_VISIBLE 0
|
---|
588 | #define __ISO_C_VISIBLE 1999
|
---|
589 | #else /* Default environment: show everything. */
|
---|
590 | #define __POSIX_VISIBLE 200809
|
---|
591 | #define __XSI_VISIBLE 700
|
---|
592 | #define __BSD_VISIBLE 1
|
---|
593 | #define __ISO_C_VISIBLE 1999
|
---|
594 | #endif
|
---|
595 | #endif
|
---|
596 |
|
---|
597 | /*-
|
---|
598 | * There are two strict backwards compatibility modes:
|
---|
599 | * TCPV40HDRS - BSD 4.3 based stack. TCP/IP versions prior to 4.1.
|
---|
600 | * TCPV41HDRS - BSD 4.4 based stack. TCP/IP versions 4.1 and higher.
|
---|
601 | *
|
---|
602 | * __USE_LIBC_TCPIP will add additional features for better compatability
|
---|
603 | * with the current BSD stack. It can be defined together with the two
|
---|
604 | * strict modes, but will have little effect in TCPV40HDRS mode.
|
---|
605 | *
|
---|
606 | * The default mode non-strict with __USE_LIBC_TCPIP defined.
|
---|
607 | */
|
---|
608 | #if !defined(__USE_LIBC_TCPIP) && !defined(TCPV40HDRS) && !defined(TCPV41HDRS)
|
---|
609 | # define __USE_LIBC_TCPIP
|
---|
610 | #endif
|
---|
611 | #if defined(TCPV40HDRS) && defined(TCPV41HDRS)
|
---|
612 | # error Cannot define both TCPV40HDRS and TCPV41HDRS. Make up your mind!
|
---|
613 | #endif
|
---|
614 |
|
---|
615 | /* bird: toolkit pollution */
|
---|
616 | #define __TCPPROTO(args) __P(args)
|
---|
617 | #ifndef TCPCALL
|
---|
618 | # ifdef __USE_LIBC_TCPIP
|
---|
619 | # define TCPCALL
|
---|
620 | # else
|
---|
621 | # define TCPCALL _System
|
---|
622 | # endif
|
---|
623 | #endif
|
---|
624 |
|
---|
625 | /* bird: include the GNU sys/cdefs.h (which fortunately have another
|
---|
626 | blocker, _SYS_CDEFS_H). */
|
---|
627 | #include <sys/gnu/cdefs.h>
|
---|
628 |
|
---|
629 | /* bird: kLIBC specifics - start */
|
---|
630 | /** @def __KLIBC_PATH_SLASH
|
---|
631 | * The default slash character (path component separator). */
|
---|
632 | /** @def __KLIBC_PATH_SLASH_ALT
|
---|
633 | * Alternative slash character (path component separator). Optional. */
|
---|
634 | /** @def __KLIBC_PATH_HAVE_DRIVE_LETTERS
|
---|
635 | * Defined if we have driver letters on this platform. */
|
---|
636 | /** @def __KLIBC_PATH_HAVE_DRIVES
|
---|
637 | * Defined if we have UNC paths on this platform. */
|
---|
638 | #if defined(__OS2__) || defined(_WIN32) || defined(_WIN64) || defined(__NT__)
|
---|
639 | # define __KLIBC_PATH_SLASH '\\'
|
---|
640 | # define __KLIBC_PATH_SLASH_ALT '/'
|
---|
641 | # define __KLIBC_PATH_HAVE_DRIVE_LETTERS 1
|
---|
642 | # define __KLIBC_PATH_HAVE_UNC 1
|
---|
643 | #else
|
---|
644 | # define __KLIBC_PATH_SLASH '/'
|
---|
645 | # undef __KLIBC_PATH_SLASH_ALT
|
---|
646 | # undef __KLIBC_PATH_HAVE_DRIVE_LETTERS
|
---|
647 | # undef __KLIBC_PATH_HAVE_UNC
|
---|
648 | #endif
|
---|
649 | /** @def __KLIBC_PATH_IS_SLASH
|
---|
650 | * Checks if @a a_ch is a slash character.
|
---|
651 | * @param a_ch The character. */
|
---|
652 | #ifdef __KLIBC_PATH_SLASH_ALT
|
---|
653 | # define __KLIBC_PATH_IS_SLASH(a_ch) ((a_ch) == __KLIBC_PATH_SLASH || (a_ch) == __KLIBC_PATH_SLASH_ALT)
|
---|
654 | #else
|
---|
655 | # define __KLIBC_PATH_IS_SLASH(a_ch) ((a_ch) == __KLIBC_PATH_SLASH)
|
---|
656 | #endif
|
---|
657 | /* bird: kLIBC specifics - end */
|
---|
658 |
|
---|
659 | #endif /* !_SYS_CDEFS_H_ */
|
---|