4 * Copyright 1995-2002, The AROS Development Team. All rights reserved.
7 * <sys/cdefs.h> header file, would you believe it's mostly the same as
8 * <aros/system.h>, except that here we define all the things that
9 * BSD/UNIX/POSIX like systems are expecting.
11 * The namespace checks below are
13 * Copyright (c) 1991, 1993
14 * The Regents of the University of California. All rights reserved.
16 * This code is derived from software contributed to Berkeley by
17 * Berkeley Software Design, Inc.
19 * Redistribution and use in source and binary forms, with or without
20 * modification, are permitted provided that the following conditions
22 * 1. Redistributions of source code must retain the above copyright
23 * notice, this list of conditions and the following disclaimer.
24 * 2. Redistributions in binary form must reproduce the above copyright
25 * notice, this list of conditions and the following disclaimer in the
26 * documentation and/or other materials provided with the distribution.
27 * 3. All advertising materials mentioning features or use of this software
28 * must display the following acknowledgement:
29 * This product includes software developed by the University of
30 * California, Berkeley and its contributors.
31 * 4. Neither the name of the University nor the names of its contributors
32 * may be used to endorse or promote products derived from this software
33 * without specific prior written permission.
35 * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND
36 * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
37 * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
38 * ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
39 * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
40 * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
41 * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
42 * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
43 * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
44 * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
47 * @(#)cdefs.h 8.8 (Berkeley) 1/9/95
48 * $FreeBSD: src/sys/sys/cdefs.h,v 1.75 2003/07/25 18:40:36 gad Exp $
51 #include <aros/system.h>
53 #if defined(__STDC__) || defined(__cplusplus)
54 #define __P(protos) protos
56 #define __P(protos) ()
59 #if !defined(__IDSTRING)
60 # if defined(__GNUC__) && defined(__ELF__)
61 # define __IDSTRING(name,str) __asm__(".ident\t\"" str "\"")
63 # define __IDSTRING(name,str) static const char name[] __unused = str
67 /* Need to protect __RCSID against the host system headers */
69 # define __RCSID(id) __IDSTRING(rcsid,id)
72 /* FreeBSD's, it's basically yet another IDSTRING like thing. */
73 #define __FBSDID(id) __IDSTRING(__CONCAT(__rcsid_,__LINE__),id)
75 /*****************************************************************************
76 IMPORTANT IMPORTANT IMPORTANT IMPORTANT IMPORTANT etc
78 If you do not understand what the following code does, then please do
79 not change it. Basically various standards (POSIX, ISO C, etc) are
80 very pedantic about what is visible and what is not.
82 The following code from FreeBSD's cdefs.h basically does all the
83 standards check. That is where the BSD licenced part comes from above.
85 This should be compatible with *BSD, and hopefully Linux as well.
86 Other forms of UNIX might have some more trouble.
87 *****************************************************************************/
90 * POSIX.1 requires that the macros we test be defined before any standard
91 * header file is included.
93 * Here's a quick run-down of the versions:
94 * defined(_POSIX_SOURCE) 1003.1-1988
95 * _POSIX_C_SOURCE == 1 1003.1-1990
96 * _POSIX_C_SOURCE == 2 1003.2-1992 C Language Binding Option
97 * _POSIX_C_SOURCE == 199309 1003.1b-1993
98 * _POSIX_C_SOURCE == 199506 1003.1c-1995, 1003.1i-1995,
99 * and the omnibus ISO/IEC 9945-1: 1996
100 * _POSIX_C_SOURCE == 200112 1003.1-2001
102 * In addition, the X/Open Portability Guide, which is now the Single UNIX
103 * Specification, defines a feature-test macro which indicates the version of
104 * that specification, and which subsumes _POSIX_C_SOURCE.
106 * Our macros begin with two underscores to avoid namespace screwage.
109 /* Deal with IEEE Std. 1003.1-1990, in which _POSIX_C_SOURCE == 1. */
110 #if _POSIX_C_SOURCE == 1
111 #undef _POSIX_C_SOURCE /* Probably illegal, but beyond caring now. */
112 #define _POSIX_C_SOURCE 199009
115 /* Deal with IEEE Std. 1003.2-1992, in which _POSIX_C_SOURCE == 2. */
116 #if _POSIX_C_SOURCE == 2
117 #undef _POSIX_C_SOURCE
118 #define _POSIX_C_SOURCE 199209
121 /* Deal with various X/Open Portability Guides and Single UNIX Spec. */
123 #if _XOPEN_SOURCE - 0 >= 600
124 #define __XSI_VISIBLE 600
125 #undef _POSIX_C_SOURCE
126 #define _POSIX_C_SOURCE 200112
127 #elif _XOPEN_SOURCE - 0 >= 500
128 #define __XSI_VISIBLE 500
129 #undef _POSIX_C_SOURCE
130 #define _POSIX_C_SOURCE 199506
135 * Deal with all versions of POSIX. The ordering relative to the tests above is
138 #if defined(_POSIX_SOURCE) && !defined(_POSIX_C_SOURCE)
139 #define _POSIX_C_SOURCE 198808
141 #ifdef _POSIX_C_SOURCE
142 #if _POSIX_C_SOURCE >= 200112
143 #define __POSIX_VISIBLE 200112
144 #define __ISO_C_VISIBLE 1999
145 #elif _POSIX_C_SOURCE >= 199506
146 #define __POSIX_VISIBLE 199506
147 #define __ISO_C_VISIBLE 1990
148 #elif _POSIX_C_SOURCE >= 199309
149 #define __POSIX_VISIBLE 199309
150 #define __ISO_C_VISIBLE 1990
151 #elif _POSIX_C_SOURCE >= 199209
152 #define __POSIX_VISIBLE 199209
153 #define __ISO_C_VISIBLE 1990
154 #elif _POSIX_C_SOURCE >= 199009
155 #define __POSIX_VISIBLE 199009
156 #define __ISO_C_VISIBLE 1990
158 #define __POSIX_VISIBLE 198808
159 #define __ISO_C_VISIBLE 0
160 #endif /* _POSIX_C_SOURCE */
163 * Deal with _ANSI_SOURCE:
164 * If it is defined, and no other compilation environment is explicitly
165 * requested, then define our internal feature-test macros to zero. This
166 * makes no difference to the preprocessor (undefined symbols in preprocessing
167 * expressions are defined to have value zero), but makes it more convenient for
168 * a test program to print out the values.
170 * If a program mistakenly defines _ANSI_SOURCE and some other macro such as
171 * _POSIX_C_SOURCE, we will assume that it wants the broader compilation
172 * environment (and in fact we will never get here).
174 #if defined(_ANSI_SOURCE) /* Hide almost everything. */
175 #define __POSIX_VISIBLE 0
176 #define __XSI_VISIBLE 0
177 #define __BSD_VISIBLE 0
178 #define __ISO_C_VISIBLE 1990
179 #elif defined(_C99_SOURCE) /* Localism to specify strict C99 env. */
180 #define __POSIX_VISIBLE 0
181 #define __XSI_VISIBLE 0
182 #define __BSD_VISIBLE 0
183 #define __ISO_C_VISIBLE 1999
184 #else /* Default environment: show everything. */
185 #define __POSIX_VISIBLE 200112
186 #define __XSI_VISIBLE 600
187 #define __BSD_VISIBLE 1
188 #define __ISO_C_VISIBLE 1999
192 /*****************************************************************************
193 END OF IMPORTANT STUFF
194 ****************************************************************************/
196 /* These are taken (more or less) from FreeBSD sys/cdefs.h */
197 #define __strong_reference(sym,aliassym) \
198 extern __typeof__ (sym) aliassym __attribute__ ((alias (#sym)))
199 #define __weak_reference(sym,alias) \
200 __asm__(".weak " #alias); \
201 __asm__(".equ " #alias ", " #sym)
205 #endif /* _SYS_CDEFS_H_ */