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