1*e6e30c83Schristos /*	$NetBSD: cdefs.h,v 1.1.1.2 2012/09/09 16:08:08 christos Exp $	*/
2b5677b36Schristos 
3b5677b36Schristos /*
4b5677b36Schristos  * ++Copyright++ 1991, 1993
5b5677b36Schristos  * -
6b5677b36Schristos  * Copyright (c) 1991, 1993
7b5677b36Schristos  *    The Regents of the University of California.  All rights reserved.
8b5677b36Schristos  *
9b5677b36Schristos  * Redistribution and use in source and binary forms, with or without
10b5677b36Schristos  * modification, are permitted provided that the following conditions
11b5677b36Schristos  * are met:
12b5677b36Schristos  * 1. Redistributions of source code must retain the above copyright
13b5677b36Schristos  *    notice, this list of conditions and the following disclaimer.
14b5677b36Schristos  * 2. Redistributions in binary form must reproduce the above copyright
15b5677b36Schristos  *    notice, this list of conditions and the following disclaimer in the
16b5677b36Schristos  *    documentation and/or other materials provided with the distribution.
17b5677b36Schristos  * 3. All advertising materials mentioning features or use of this software
18b5677b36Schristos  *    must display the following acknowledgement:
19b5677b36Schristos  * 	This product includes software developed by the University of
20b5677b36Schristos  * 	California, Berkeley and its contributors.
21b5677b36Schristos  * 4. Neither the name of the University nor the names of its contributors
22b5677b36Schristos  *    may be used to endorse or promote products derived from this software
23b5677b36Schristos  *    without specific prior written permission.
24b5677b36Schristos  *
25b5677b36Schristos  * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND
26b5677b36Schristos  * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
27b5677b36Schristos  * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
28b5677b36Schristos  * ARE DISCLAIMED.  IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
29b5677b36Schristos  * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
30b5677b36Schristos  * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
31b5677b36Schristos  * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
32b5677b36Schristos  * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
33b5677b36Schristos  * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
34b5677b36Schristos  * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
35b5677b36Schristos  * SUCH DAMAGE.
36b5677b36Schristos  * -
37b5677b36Schristos  * Portions Copyright (c) 1993 by Digital Equipment Corporation.
38b5677b36Schristos  *
39b5677b36Schristos  * Permission to use, copy, modify, and distribute this software for any
40b5677b36Schristos  * purpose with or without fee is hereby granted, provided that the above
41b5677b36Schristos  * copyright notice and this permission notice appear in all copies, and that
42b5677b36Schristos  * the name of Digital Equipment Corporation not be used in advertising or
43b5677b36Schristos  * publicity pertaining to distribution of the document or software without
44b5677b36Schristos  * specific, written prior permission.
45b5677b36Schristos  *
46b5677b36Schristos  * THE SOFTWARE IS PROVIDED "AS IS" AND DIGITAL EQUIPMENT CORP. DISCLAIMS ALL
47b5677b36Schristos  * WARRANTIES WITH REGARD TO THIS SOFTWARE, INCLUDING ALL IMPLIED WARRANTIES
48b5677b36Schristos  * OF MERCHANTABILITY AND FITNESS.   IN NO EVENT SHALL DIGITAL EQUIPMENT
49b5677b36Schristos  * CORPORATION BE LIABLE FOR ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL
50b5677b36Schristos  * DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR
51b5677b36Schristos  * PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS
52b5677b36Schristos  * ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS
53b5677b36Schristos  * SOFTWARE.
54b5677b36Schristos  * -
55b5677b36Schristos  * --Copyright--
56b5677b36Schristos  */
57b5677b36Schristos 
58b5677b36Schristos /*
59b5677b36Schristos  *	@(#)cdefs.h	8.1 (Berkeley) 6/2/93
60b5677b36Schristos  *	Id: cdefs.h,v 1.2 2004/07/19 05:54:02 marka Exp
61b5677b36Schristos  */
62b5677b36Schristos 
63b5677b36Schristos #ifndef	_CDEFS_H_
64b5677b36Schristos #define	_CDEFS_H_
65b5677b36Schristos 
66b5677b36Schristos #if defined(__cplusplus)
67b5677b36Schristos #define	__BEGIN_DECLS	extern "C" {
68b5677b36Schristos #define	__END_DECLS	};
69b5677b36Schristos #else
70b5677b36Schristos #define	__BEGIN_DECLS
71b5677b36Schristos #define	__END_DECLS
72b5677b36Schristos #endif
73b5677b36Schristos 
74b5677b36Schristos /*
75b5677b36Schristos  * The __CONCAT macro is used to concatenate parts of symbol names, e.g.
76b5677b36Schristos  * with "#define OLD(foo) __CONCAT(old,foo)", OLD(foo) produces oldfoo.
77b5677b36Schristos  * The __CONCAT macro is a bit tricky -- make sure you don't put spaces
78b5677b36Schristos  * in between its arguments.  __CONCAT can also concatenate double-quoted
79b5677b36Schristos  * strings produced by the __STRING macro, but this only works with ANSI C.
80b5677b36Schristos  */
81b5677b36Schristos #if defined(__STDC__) || defined(__cplusplus)
82b5677b36Schristos #define	__P(protos)	protos		/* full-blown ANSI C */
83b5677b36Schristos #define	__CONCAT(x,y)	x ## y
84b5677b36Schristos #define	__STRING(x)	#x
85b5677b36Schristos 
86b5677b36Schristos #define	__const		const		/* define reserved names to standard */
87b5677b36Schristos #define	__signed	signed
88b5677b36Schristos #define	__volatile	volatile
89b5677b36Schristos #if defined(__cplusplus)
90b5677b36Schristos #define	__inline	inline		/* convert to C++ keyword */
91b5677b36Schristos #else
92b5677b36Schristos #ifndef __GNUC__
93b5677b36Schristos #define	__inline			/* delete GCC keyword */
94b5677b36Schristos #endif /* !__GNUC__ */
95b5677b36Schristos #endif /* !__cplusplus */
96b5677b36Schristos 
97b5677b36Schristos #else	/* !(__STDC__ || __cplusplus) */
98b5677b36Schristos #define	__P(protos)	()		/* traditional C preprocessor */
99b5677b36Schristos #define	__CONCAT(x,y)	x/**/y
100b5677b36Schristos #define	__STRING(x)	"x"
101b5677b36Schristos 
102b5677b36Schristos #ifndef __GNUC__
103b5677b36Schristos #define	__const				/* delete pseudo-ANSI C keywords */
104b5677b36Schristos #define	__inline
105b5677b36Schristos #define	__signed
106b5677b36Schristos #define	__volatile
107b5677b36Schristos /*
108b5677b36Schristos  * In non-ANSI C environments, new programs will want ANSI-only C keywords
109b5677b36Schristos  * deleted from the program and old programs will want them left alone.
110b5677b36Schristos  * When using a compiler other than gcc, programs using the ANSI C keywords
111b5677b36Schristos  * const, inline etc. as normal identifiers should define -DNO_ANSI_KEYWORDS.
112b5677b36Schristos  * When using "gcc -traditional", we assume that this is the intent; if
113b5677b36Schristos  * __GNUC__ is defined but __STDC__ is not, we leave the new keywords alone.
114b5677b36Schristos  */
115b5677b36Schristos #ifndef	NO_ANSI_KEYWORDS
116b5677b36Schristos #define	const				/* delete ANSI C keywords */
117b5677b36Schristos #define	inline
118b5677b36Schristos #define	signed
119b5677b36Schristos #define	volatile
120b5677b36Schristos #endif
121b5677b36Schristos #endif	/* !__GNUC__ */
122b5677b36Schristos #endif	/* !(__STDC__ || __cplusplus) */
123b5677b36Schristos 
124b5677b36Schristos /*
125b5677b36Schristos  * GCC1 and some versions of GCC2 declare dead (non-returning) and
126b5677b36Schristos  * pure (no side effects) functions using "volatile" and "const";
127b5677b36Schristos  * unfortunately, these then cause warnings under "-ansi -pedantic".
128b5677b36Schristos  * GCC2 uses a new, peculiar __attribute__((attrs)) style.  All of
129b5677b36Schristos  * these work for GNU C++ (modulo a slight glitch in the C++ grammar
130b5677b36Schristos  * in the distribution version of 2.5.5).
131b5677b36Schristos  */
132b5677b36Schristos #if !defined(__GNUC__) || __GNUC__ < 2 || (__GNUC__ == 2 && __GNUC_MINOR__ < 5)
133b5677b36Schristos #define	__attribute__(x)	/* delete __attribute__ if non-gcc or gcc1 */
134b5677b36Schristos #if defined(__GNUC__) && !defined(__STRICT_ANSI__)
135b5677b36Schristos #define	__dead		__volatile
136b5677b36Schristos #define	__pure		__const
137b5677b36Schristos #endif
138b5677b36Schristos #endif
139b5677b36Schristos 
140b5677b36Schristos /* Delete pseudo-keywords wherever they are not available or needed. */
141b5677b36Schristos #ifndef __dead
142b5677b36Schristos #define	__dead
143b5677b36Schristos #define	__pure
144b5677b36Schristos #endif
145b5677b36Schristos 
146b5677b36Schristos #endif /* !_CDEFS_H_ */
147