1 |
786 |
skrzyp |
//==========================================================================
|
2 |
|
|
//
|
3 |
|
|
// include/sys/cdefs.h
|
4 |
|
|
//
|
5 |
|
|
//==========================================================================
|
6 |
|
|
// ####BSDALTCOPYRIGHTBEGIN####
|
7 |
|
|
// -------------------------------------------
|
8 |
|
|
// Portions of this software may have been derived from FreeBSD
|
9 |
|
|
// or other sources, and if so are covered by the appropriate copyright
|
10 |
|
|
// and license included herein.
|
11 |
|
|
// -------------------------------------------
|
12 |
|
|
// ####BSDALTCOPYRIGHTEND####
|
13 |
|
|
//==========================================================================
|
14 |
|
|
|
15 |
|
|
/*
|
16 |
|
|
* Copyright (c) 1991, 1993
|
17 |
|
|
* The Regents of the University of California. All rights reserved.
|
18 |
|
|
*
|
19 |
|
|
* This code is derived from software contributed to Berkeley by
|
20 |
|
|
* Berkeley Software Design, Inc.
|
21 |
|
|
*
|
22 |
|
|
* Redistribution and use in source and binary forms, with or without
|
23 |
|
|
* modification, are permitted provided that the following conditions
|
24 |
|
|
* are met:
|
25 |
|
|
* 1. Redistributions of source code must retain the above copyright
|
26 |
|
|
* notice, this list of conditions and the following disclaimer.
|
27 |
|
|
* 2. Redistributions in binary form must reproduce the above copyright
|
28 |
|
|
* notice, this list of conditions and the following disclaimer in the
|
29 |
|
|
* documentation and/or other materials provided with the distribution.
|
30 |
|
|
* 3. All advertising materials mentioning features or use of this software
|
31 |
|
|
* must display the following acknowledgement:
|
32 |
|
|
* This product includes software developed by the University of
|
33 |
|
|
* California, Berkeley and its contributors.
|
34 |
|
|
* 4. Neither the name of the University nor the names of its contributors
|
35 |
|
|
* may be used to endorse or promote products derived from this software
|
36 |
|
|
* without specific prior written permission.
|
37 |
|
|
*
|
38 |
|
|
* THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND
|
39 |
|
|
* ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
|
40 |
|
|
* IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
|
41 |
|
|
* ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
|
42 |
|
|
* FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
|
43 |
|
|
* DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
|
44 |
|
|
* OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
|
45 |
|
|
* HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
|
46 |
|
|
* LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
|
47 |
|
|
* OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
|
48 |
|
|
* SUCH DAMAGE.
|
49 |
|
|
*
|
50 |
|
|
* @(#)cdefs.h 8.8 (Berkeley) 1/9/95
|
51 |
|
|
* $FreeBSD: src/sys/sys/cdefs.h,v 1.28.2.4 2001/06/02 17:36:24 obrien Exp $
|
52 |
|
|
*/
|
53 |
|
|
|
54 |
|
|
#ifndef _SYS_CDEFS_H_
|
55 |
|
|
#define _SYS_CDEFS_H_
|
56 |
|
|
|
57 |
|
|
#if defined(__cplusplus)
|
58 |
|
|
#define __BEGIN_DECLS extern "C" {
|
59 |
|
|
#define __END_DECLS }
|
60 |
|
|
#else
|
61 |
|
|
#define __BEGIN_DECLS
|
62 |
|
|
#define __END_DECLS
|
63 |
|
|
#endif
|
64 |
|
|
|
65 |
|
|
/*
|
66 |
|
|
* The __CONCAT macro is used to concatenate parts of symbol names, e.g.
|
67 |
|
|
* with "#define OLD(foo) __CONCAT(old,foo)", OLD(foo) produces oldfoo.
|
68 |
|
|
* The __CONCAT macro is a bit tricky to use if it must work in non-ANSI
|
69 |
|
|
* mode -- there must be no spaces between its arguments, and for nested
|
70 |
|
|
* __CONCAT's, all the __CONCAT's must be at the left. __CONCAT can also
|
71 |
|
|
* concatenate double-quoted strings produced by the __STRING macro, but
|
72 |
|
|
* this only works with ANSI C.
|
73 |
|
|
*
|
74 |
|
|
* __XSTRING is like __STRING, but it expands any macros in its argument
|
75 |
|
|
* first. It is only available with ANSI C.
|
76 |
|
|
*/
|
77 |
|
|
#if defined(__STDC__) || defined(__cplusplus)
|
78 |
|
|
#define __P(protos) protos /* full-blown ANSI C */
|
79 |
|
|
#define __CONCAT1(x,y) x ## y
|
80 |
|
|
#define __CONCAT(x,y) __CONCAT1(x,y)
|
81 |
|
|
#define __STRING(x) #x /* stringify without expanding x */
|
82 |
|
|
#define __XSTRING(x) __STRING(x) /* expand x, then stringify */
|
83 |
|
|
|
84 |
|
|
#define __const const /* define reserved names to standard */
|
85 |
|
|
#define __signed signed
|
86 |
|
|
#define __volatile volatile
|
87 |
|
|
#if defined(__cplusplus)
|
88 |
|
|
#define __inline inline /* convert to C++ keyword */
|
89 |
|
|
#else
|
90 |
|
|
#ifndef __GNUC__
|
91 |
|
|
#define __inline /* delete GCC keyword */
|
92 |
|
|
#endif /* !__GNUC__ */
|
93 |
|
|
#endif /* !__cplusplus */
|
94 |
|
|
|
95 |
|
|
#else /* !(__STDC__ || __cplusplus) */
|
96 |
|
|
#define __P(protos) () /* traditional C preprocessor */
|
97 |
|
|
#define __CONCAT(x,y) x/**/y
|
98 |
|
|
#define __STRING(x) "x"
|
99 |
|
|
|
100 |
|
|
#ifndef __GNUC__
|
101 |
|
|
#define __const /* delete pseudo-ANSI C keywords */
|
102 |
|
|
#define __inline
|
103 |
|
|
#define __signed
|
104 |
|
|
#define __volatile
|
105 |
|
|
/*
|
106 |
|
|
* In non-ANSI C environments, new programs will want ANSI-only C keywords
|
107 |
|
|
* deleted from the program and old programs will want them left alone.
|
108 |
|
|
* When using a compiler other than gcc, programs using the ANSI C keywords
|
109 |
|
|
* const, inline etc. as normal identifiers should define -DNO_ANSI_KEYWORDS.
|
110 |
|
|
* When using "gcc -traditional", we assume that this is the intent; if
|
111 |
|
|
* __GNUC__ is defined but __STDC__ is not, we leave the new keywords alone.
|
112 |
|
|
*/
|
113 |
|
|
#ifndef NO_ANSI_KEYWORDS
|
114 |
|
|
#define const /* delete ANSI C keywords */
|
115 |
|
|
#define inline
|
116 |
|
|
#define signed
|
117 |
|
|
#define volatile
|
118 |
|
|
#endif /* !NO_ANSI_KEYWORDS */
|
119 |
|
|
#endif /* !__GNUC__ */
|
120 |
|
|
#endif /* !(__STDC__ || __cplusplus) */
|
121 |
|
|
|
122 |
|
|
/*
|
123 |
|
|
* Compiler-dependent macros to help declare dead (non-returning) and
|
124 |
|
|
* pure (no side effects) functions, and unused variables. They are
|
125 |
|
|
* null except for versions of gcc that are known to support the features
|
126 |
|
|
* properly (old versions of gcc-2 supported the dead and pure features
|
127 |
|
|
* in a different (wrong) way).
|
128 |
|
|
*/
|
129 |
|
|
#if __GNUC__ < 2 || __GNUC__ == 2 && __GNUC_MINOR__ < 5
|
130 |
|
|
#define __dead2
|
131 |
|
|
#define __pure2
|
132 |
|
|
#define __unused
|
133 |
|
|
#endif
|
134 |
|
|
#if __GNUC__ == 2 && __GNUC_MINOR__ >= 5 && __GNUC_MINOR__ < 7
|
135 |
|
|
#define __dead2 __attribute__((__noreturn__))
|
136 |
|
|
#define __pure2 __attribute__((__const__))
|
137 |
|
|
#define __unused
|
138 |
|
|
#endif
|
139 |
|
|
#if __GNUC__ == 2 && __GNUC_MINOR__ >= 7 || __GNUC__ == 3
|
140 |
|
|
#define __dead2 __attribute__((__noreturn__))
|
141 |
|
|
#define __pure2 __attribute__((__const__))
|
142 |
|
|
#define __unused __attribute__((__unused__))
|
143 |
|
|
#endif
|
144 |
|
|
|
145 |
|
|
/*
|
146 |
|
|
* Compiler-dependent macros to declare that functions take printf-like
|
147 |
|
|
* or scanf-like arguments. They are null except for versions of gcc
|
148 |
|
|
* that are known to support the features properly (old versions of gcc-2
|
149 |
|
|
* didn't permit keeping the keywords out of the application namespace).
|
150 |
|
|
*/
|
151 |
|
|
#if __GNUC__ < 2 || __GNUC__ == 2 && __GNUC_MINOR__ < 7
|
152 |
|
|
#define __printflike(fmtarg, firstvararg)
|
153 |
|
|
#define __scanflike(fmtarg, firstvararg)
|
154 |
|
|
#else
|
155 |
|
|
#define __printflike(fmtarg, firstvararg) \
|
156 |
|
|
__attribute__((__format__ (__printf__, fmtarg, firstvararg)))
|
157 |
|
|
#define __scanflike(fmtarg, firstvararg) \
|
158 |
|
|
__attribute__((__format__ (__scanf__, fmtarg, firstvararg)))
|
159 |
|
|
#endif
|
160 |
|
|
|
161 |
|
|
/* Compiler-dependent macros that rely on FreeBSD-specific extensions. */
|
162 |
|
|
#if defined(__FreeBSD_cc_version) && (__FreeBSD_cc_version >= 300001)
|
163 |
|
|
#define __printf0like(fmtarg, firstvararg) \
|
164 |
|
|
__attribute__((__format__ (__printf0__, fmtarg, firstvararg)))
|
165 |
|
|
#else
|
166 |
|
|
#define __printf0like(fmtarg, firstvararg)
|
167 |
|
|
#endif
|
168 |
|
|
|
169 |
|
|
#ifdef __GNUC__
|
170 |
|
|
#define __strong_reference(sym,aliassym) \
|
171 |
|
|
extern __typeof (sym) aliassym __attribute__ ((__alias__ (#sym)));
|
172 |
|
|
#ifdef __ELF__
|
173 |
|
|
#ifdef __STDC__
|
174 |
|
|
#define __weak_reference(sym,alias) \
|
175 |
|
|
__asm__(".weak " #alias); \
|
176 |
|
|
__asm__(".equ " #alias ", " #sym)
|
177 |
|
|
#define __warn_references(sym,msg) \
|
178 |
|
|
__asm__(".section .gnu.warning." #sym); \
|
179 |
|
|
__asm__(".asciz \"" msg "\""); \
|
180 |
|
|
__asm__(".previous")
|
181 |
|
|
#else
|
182 |
|
|
#define __weak_reference(sym,alias) \
|
183 |
|
|
__asm__(".weak alias"); \
|
184 |
|
|
__asm__(".equ alias, sym")
|
185 |
|
|
#define __warn_references(sym,msg) \
|
186 |
|
|
__asm__(".section .gnu.warning.sym"); \
|
187 |
|
|
__asm__(".asciz \"msg\""); \
|
188 |
|
|
__asm__(".previous")
|
189 |
|
|
#endif /* __STDC__ */
|
190 |
|
|
#else /* !__ELF__ */
|
191 |
|
|
#ifdef __STDC__
|
192 |
|
|
#define __weak_reference(sym,alias) \
|
193 |
|
|
__asm__(".stabs \"_" #alias "\",11,0,0,0"); \
|
194 |
|
|
__asm__(".stabs \"_" #sym "\",1,0,0,0")
|
195 |
|
|
#define __warn_references(sym,msg) \
|
196 |
|
|
__asm__(".stabs \"" msg "\",30,0,0,0"); \
|
197 |
|
|
__asm__(".stabs \"_" #sym "\",1,0,0,0")
|
198 |
|
|
#else
|
199 |
|
|
#define __weak_reference(sym,alias) \
|
200 |
|
|
__asm__(".stabs \"_/**/alias\",11,0,0,0"); \
|
201 |
|
|
__asm__(".stabs \"_/**/sym\",1,0,0,0")
|
202 |
|
|
#define __warn_references(sym,msg) \
|
203 |
|
|
__asm__(".stabs msg,30,0,0,0"); \
|
204 |
|
|
__asm__(".stabs \"_/**/sym\",1,0,0,0")
|
205 |
|
|
#endif /* __STDC__ */
|
206 |
|
|
#endif /* __ELF__ */
|
207 |
|
|
#endif /* __GNUC__ */
|
208 |
|
|
|
209 |
|
|
#if defined(__GNUC__) && defined(__ELF__)
|
210 |
|
|
#define __IDSTRING(name,string) __asm__(".ident\t\"" string "\"")
|
211 |
|
|
#else
|
212 |
|
|
#define __IDSTRING(name,string) static const char name[] __unused = string
|
213 |
|
|
#endif
|
214 |
|
|
|
215 |
|
|
#ifndef __RCSID
|
216 |
|
|
#define __RCSID(s) __IDSTRING(rcsid,s)
|
217 |
|
|
#endif
|
218 |
|
|
|
219 |
|
|
#ifndef __RCSID_SOURCE
|
220 |
|
|
#define __RCSID_SOURCE(s) __IDSTRING(rcsid_source,s)
|
221 |
|
|
#endif
|
222 |
|
|
|
223 |
|
|
#ifndef __COPYRIGHT
|
224 |
|
|
#define __COPYRIGHT(s) __IDSTRING(copyright,s)
|
225 |
|
|
#endif
|
226 |
|
|
|
227 |
|
|
#endif /* !_SYS_CDEFS_H_ */
|