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