]> git.saurik.com Git - apple/libc.git/blame - fbsdcompat/sys/cdefs.h
Libc-825.24.tar.gz
[apple/libc.git] / fbsdcompat / sys / cdefs.h
CommitLineData
9385eb3d
A
1/*
2 * Copyright (c) 1991, 1993
3 * The Regents of the University of California. All rights reserved.
4 *
5 * This code is derived from software contributed to Berkeley by
6 * Berkeley Software Design, Inc.
7 *
8 * Redistribution and use in source and binary forms, with or without
9 * modification, are permitted provided that the following conditions
10 * are met:
11 * 1. Redistributions of source code must retain the above copyright
12 * notice, this list of conditions and the following disclaimer.
13 * 2. Redistributions in binary form must reproduce the above copyright
14 * notice, this list of conditions and the following disclaimer in the
15 * documentation and/or other materials provided with the distribution.
16 * 3. All advertising materials mentioning features or use of this software
17 * must display the following acknowledgement:
18 * This product includes software developed by the University of
19 * California, Berkeley and its contributors.
20 * 4. Neither the name of the University nor the names of its contributors
21 * may be used to endorse or promote products derived from this software
22 * without specific prior written permission.
23 *
24 * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND
25 * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
26 * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
27 * ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
28 * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
29 * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
30 * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
31 * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
32 * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
33 * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
34 * SUCH DAMAGE.
35 *
36 * @(#)cdefs.h 8.8 (Berkeley) 1/9/95
37 * $FreeBSD: /repoman/r/ncvs/src/sys/sys/cdefs.h,v 1.68 2002/10/21 20:50:30 mike Exp $
38 */
39
40#ifndef _SYS_CDEFS_H_
9385eb3d
A
41
42/*
43 * Compiler-dependent macros to help declare dead (non-returning) and
44 * pure (no side effects) functions, and unused variables. They are
45 * null except for versions of gcc that are known to support the features
46 * properly (old versions of gcc-2 supported the dead and pure features
47 * in a different (wrong) way). If we do not provide an implementation
48 * for a given compiler, let the compile fail if it is told to use
49 * a feature that we cannot live without.
50 */
51#ifdef lint
9385eb3d
A
52#define __packed
53#define __aligned(x)
54#define __section(x)
55#else
9385eb3d
A
56#define __packed __attribute__((__packed__))
57#define __aligned(x) __attribute__((__aligned__(x)))
58#define __section(x) __attribute__((__section__(x)))
59#endif
9385eb3d 60
ad3c9f2a 61#if !defined(__STRICT_ANSI__) || __STDC_VERSION__ >= 199901
9385eb3d
A
62#define __LONG_LONG_SUPPORTED
63#endif
64
9385eb3d
A
65/*
66 * We define this here since <stddef.h>, <sys/queue.h>, and <sys/types.h>
67 * require it.
68 */
69#define __offsetof(type, field) ((size_t)(&((type *)0)->field))
70
9385eb3d
A
71#define __strong_reference(sym,aliassym) \
72 extern __typeof (sym) aliassym __attribute__ ((__alias__ (#sym)));
9385eb3d
A
73#define __weak_reference(sym,alias)
74#define __warn_references(sym,msg)
9385eb3d
A
75
76#ifndef __RCSID_SOURCE
77#ifndef NO__RCSID_SOURCE
78#define __RCSID_SOURCE(s) __IDSTRING(__CONCAT(__rcsid_source_,__LINE__),s)
79#else
80#define __RCSID_SOURCE(s)
81#endif
82#endif
83
9385eb3d
A
84#ifndef __DECONST
85#define __DECONST(type, var) ((type)(uintptr_t)(const void *)(var))
86#endif
87
88#ifndef __DEVOLATILE
89#define __DEVOLATILE(type, var) ((type)(uintptr_t)(volatile void *)(var))
90#endif
91
92#ifndef __DEQUALIFY
93#define __DEQUALIFY(type, var) ((type)(uintptr_t)(const volatile void *)(var))
94#endif
95
3d9156a7
A
96/*
97 * Now include the Apple version of sys/cdefs.h
9385eb3d
A
98 */
99
3d9156a7 100#include_next <sys/cdefs.h>
9385eb3d 101
3d9156a7
A
102/*
103 * Use FreeBSD version of __CONCAT
104 */
105#if defined(__STDC__) || defined(__cplusplus)
106#undef __CONCAT1
107#undef __CONCAT
108#define __CONCAT1(x,y) x ## y
109#define __CONCAT(x,y) __CONCAT1(x,y)
9385eb3d
A
110#endif
111
112/*
113 * Deal with all versions of POSIX. The ordering relative to the tests above is
114 * important.
115 */
9385eb3d
A
116#ifdef _POSIX_C_SOURCE
117#if _POSIX_C_SOURCE >= 200112
118#define __POSIX_VISIBLE 200112
119#define __ISO_C_VISIBLE 1999
120#elif _POSIX_C_SOURCE >= 199506
121#define __POSIX_VISIBLE 199506
122#define __ISO_C_VISIBLE 1990
123#elif _POSIX_C_SOURCE >= 199309
124#define __POSIX_VISIBLE 199309
125#define __ISO_C_VISIBLE 1990
126#elif _POSIX_C_SOURCE >= 199209
127#define __POSIX_VISIBLE 199209
128#define __ISO_C_VISIBLE 1990
129#elif _POSIX_C_SOURCE >= 199009
130#define __POSIX_VISIBLE 199009
131#define __ISO_C_VISIBLE 1990
132#else
133#define __POSIX_VISIBLE 198808
134#define __ISO_C_VISIBLE 0
135#endif /* _POSIX_C_SOURCE */
136#else
137/*-
138 * Deal with _ANSI_SOURCE:
139 * If it is defined, and no other compilation environment is explicitly
140 * requested, then define our internal feature-test macros to zero. This
141 * makes no difference to the preprocessor (undefined symbols in preprocessing
142 * expressions are defined to have value zero), but makes it more convenient for
143 * a test program to print out the values.
144 *
145 * If a program mistakenly defines _ANSI_SOURCE and some other macro such as
146 * _POSIX_C_SOURCE, we will assume that it wants the broader compilation
147 * environment (and in fact we will never get here).
148 */
149#if defined(_ANSI_SOURCE) /* Hide almost everything. */
150#define __POSIX_VISIBLE 0
151#define __XSI_VISIBLE 0
152#define __BSD_VISIBLE 0
153#define __ISO_C_VISIBLE 1990
154#elif defined(_C99_SOURCE) /* Localism to specify strict C99 env. */
155#define __POSIX_VISIBLE 0
156#define __XSI_VISIBLE 0
157#define __BSD_VISIBLE 0
158#define __ISO_C_VISIBLE 1999
159#else /* Default environment: show everything. */
160#define __POSIX_VISIBLE 200112
161#define __XSI_VISIBLE 600
162#define __BSD_VISIBLE 1
163#define __ISO_C_VISIBLE 1999
164#endif
165#endif
166
167#endif /* !_SYS_CDEFS_H_ */