3 * C-compiler definitions.
7 * Copyright (c) 1991, 1993
8 * The Regents of the University of California. All rights reserved.
10 * This code is derived from software contributed to Berkeley by
11 * Berkeley Software Design, Inc.
13 * Redistribution and use in source and binary forms, with or without
14 * modification, are permitted provided that the following conditions
16 * 1. Redistributions of source code must retain the above copyright
17 * notice, this list of conditions and the following disclaimer.
18 * 2. Redistributions in binary form must reproduce the above copyright
19 * notice, this list of conditions and the following disclaimer in the
20 * documentation and/or other materials provided with the distribution.
21 * 3. All advertising materials mentioning features or use of this software
22 * must display the following acknowledgement:
23 * This product includes software developed by the University of
24 * California, Berkeley and its contributors.
25 * 4. Neither the name of the University nor the names of its contributors
26 * may be used to endorse or promote products derived from this software
27 * without specific prior written permission.
29 * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND
30 * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
31 * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
32 * ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
33 * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
34 * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
35 * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
36 * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
37 * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
38 * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
41 * @(#)cdefs.h 8.7 (Berkeley) 1/21/94
47 #if defined(__DJGPP__) && !defined(djgpp_cdefs_incl)
48 #include "/dev/env/DJDIR/include/sys/cdefs.h"
49 #define djgpp_cdefs_incl
53 #define __BEGIN_DECLS extern "C" {
61 #define W32_NAMESPACE(x) _w32_ ## x
67 #elif defined(__MINGW32__) && !defined(cdecl)
68 #define cdecl __attribute__((__cdecl__))
70 #elif defined(_MSC_VER) || defined(__POCC__)
79 #define NO_ANSI_KEYWORDS
81 #elif defined(__DMC__)
82 #define NO_UNDERSCORE __syscall
83 /* e.g. int NO_UNDERSCORE foo (void); */
90 #if defined(_MSC_VER) && !defined(WIN32) && !defined(_WIN32)
92 * MS's Quick-C/Visual-C (for DOS) insists that signal-handlers, atexit
93 * functions and var-arg functions must be defined cdecl.
94 * This is only an issue if a program is using 'fastcall' globally
96 * On Win32 this isn't an issue since WATT-32.DLL cannot be built
97 * as 'fastcall' anyway.
100 #define MS_CDECL cdecl
107 struct mbuf *next; /* Links mbufs belonging to single packets */
108 struct mbuf *anext; /* Links packets on queues */
109 unsigned size; /* Size of associated data buffer */
110 int refcnt; /* Reference count */
111 struct mbuf *dup; /* Pointer to duplicated mbuf */
112 char *data; /* Active working pointers */
118 * The __CONCAT macro is used to concatenate parts of symbol names, e.g.
119 * with "#define OLD(foo) __CONCAT(old,foo)", OLD(foo) produces oldfoo.
120 * The __CONCAT macro is a bit tricky -- make sure you don't put spaces
121 * in between its arguments. __CONCAT can also concatenate double-quoted
122 * strings produced by the __STRING macro, but this only works with ANSI C.
124 #if (defined(__STDC__) && __STDC__) || defined(__cplusplus) || defined(__TURBOC__)
126 #define __P(protos) protos /* full-blown ANSI C */
127 #define __CONCAT(x,y) x ## y
128 #define __STRING(x) #x
130 #define __const const /* define reserved names to standard */
131 #define __signed signed
132 #define __volatile volatile
133 #if defined(__cplusplus)
134 #define __inline inline /* convert to C++ keyword */
135 #elif !defined(__GNUC__) && !defined(_MSC_VER) && !defined(__WATCOMC__)
136 #define __inline /* delete GCC/MSC/Watcom keyword */
140 #define __P(protos) () /* traditional C preprocessor */
141 #define __CONCAT(x,y) x/**/y
142 #define __STRING(x) "x"
144 #if !defined(__GNUC__) && !defined(_MSC_VER) && !defined(__WATCOMC__)
148 #if !defined(__GNUC__)
149 #define __const /* delete pseudo-ANSI C keywords */
154 * In non-ANSI C environments, new programs will want ANSI-only C keywords
155 * deleted from the program and old programs will want them left alone.
156 * When using a compiler other than gcc, programs using the ANSI C keywords
157 * const, inline etc. as normal identifiers should define -DNO_ANSI_KEYWORDS.
158 * When using "gcc -traditional", we assume that this is the intent; if
159 * __GNUC__ is defined but __STDC__ is not, we leave the new keywords alone.
161 #if !defined(NO_ANSI_KEYWORDS)
162 #define const /* delete ANSI C keywords */
167 #endif /* !__GNUC__ */
171 * GCC1 and some versions of GCC2 declare dead (non-returning) and
172 * pure (no side effects) functions using "volatile" and "const";
173 * unfortunately, these then cause warnings under "-ansi -pedantic".
174 * GCC2 uses a new, peculiar __attribute__((attrs)) style. All of
175 * these work for GNU C++ (modulo a slight glitch in the C++ grammar
176 * in the distribution version of 2.5.5).
178 #if !defined(__GNUC__) || (__GNUC__ < 2) || ((__GNUC__ == 2) && (__GNUC_MINOR__ < 5))
180 #define __attribute__(x) /* delete __attribute__ if non-gcc or older than gcc 2.5 */
181 #if defined(__GNUC__) && !defined(__STRICT_ANSI__)
184 #define __dead __volatile
185 #define __pure __const
192 * Delete pseudo-keywords wherever they are not available or needed.
193 * This seems to break MingW in mysterious ways, so leave it,
208 * min() & max() macros
210 #if defined(__HIGHC__)
213 #define min(a,b) _min(a,b) /* intrinsic functions */
214 #define max(a,b) _max(a,b)
218 #define min(a,b) (((a) < (b)) ? (a) : (b))
222 #define max(a,b) (((a) > (b)) ? (a) : (b))
226 * from NetBSD's <sys/cdefs_aout.h>
228 * Written by J.T. Conklin <jtc@wimsey.com> 01/17/95.
232 /* #define _C_LABEL(x) __CONCAT(_,x) */
234 #if defined(__GNUC__)
235 #define __indr_reference(sym,alias) \
236 __asm__(".stabs \"_" #alias "\",11,0,0,0");\
237 __asm__(".stabs \"_" #sym "\",1,0,0,0");
239 #define __warn_references(sym,msg) \
240 __asm__(".stabs \"" msg "\",30,0,0,0"); \
241 __asm__(".stabs \"_" #sym "\",1,0,0,0");
243 #define __IDSTRING(name,string) \
244 static const char name[] __attribute__((__unused__)) = string
246 #define __indr_reference(sym,alias)
247 #define __warn_references(sym,msg)
248 #define __IDSTRING(name,string) static const char name[] = string
251 #define __RCSID(_s) __IDSTRING(rcsid,_s)
252 #define __COPYRIGHT(_s) __IDSTRING(copyright,_s)
254 #define __KERNEL_RCSID(_n,_s) __IDSTRING(__CONCAT(rcsid,_n),_s)
255 #define __KERNEL_COPYRIGHT(_n,_s) __IDSTRING(__CONCAT(copyright,_n),_s)