xref: /titanic_41/usr/src/lib/libresolv2/include/sys/cdefs.h (revision 9c7bbd7179a96404fb22fa83f4680174da8b2239)
1 /*
2  * Copyright (c) 1997, by Sun Microsystems, Inc.
3  * All rights reserved.
4  */
5 
6 /*
7  * ++Copyright++ 1991, 1993
8  * -
9  * Copyright (c) 1991, 1993
10  *    The Regents of the University of California.  All rights reserved.
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  * Portions Copyright (c) 1993 by Digital Equipment Corporation.
41  *
42  * Permission to use, copy, modify, and distribute this software for any
43  * purpose with or without fee is hereby granted, provided that the above
44  * copyright notice and this permission notice appear in all copies, and that
45  * the name of Digital Equipment Corporation not be used in advertising or
46  * publicity pertaining to distribution of the document or software without
47  * specific, written prior permission.
48  *
49  * THE SOFTWARE IS PROVIDED "AS IS" AND DIGITAL EQUIPMENT CORP. DISCLAIMS ALL
50  * WARRANTIES WITH REGARD TO THIS SOFTWARE, INCLUDING ALL IMPLIED WARRANTIES
51  * OF MERCHANTABILITY AND FITNESS.   IN NO EVENT SHALL DIGITAL EQUIPMENT
52  * CORPORATION BE LIABLE FOR ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL
53  * DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR
54  * PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS
55  * ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS
56  * SOFTWARE.
57  * -
58  * --Copyright--
59  */
60 
61 /*
62  *	@(#)cdefs.h	8.1 (Berkeley) 6/2/93
63  *	$Id: cdefs.h,v 1.1 1996/11/22 02:20:19 vixie Exp $
64  */
65 
66 #pragma ident	"%Z%%M%	%I%	%E% SMI"
67 
68 #ifndef	_CDEFS_H_
69 #define	_CDEFS_H_
70 
71 #if defined(__cplusplus)
72 #define	__BEGIN_DECLS	extern "C" {
73 #define	__END_DECLS	};
74 #else
75 #define	__BEGIN_DECLS
76 #define	__END_DECLS
77 #endif
78 
79 /*
80  * The __CONCAT macro is used to concatenate parts of symbol names, e.g.
81  * with "#define OLD(foo) __CONCAT(old,foo)", OLD(foo) produces oldfoo.
82  * The __CONCAT macro is a bit tricky -- make sure you don't put spaces
83  * in between its arguments.  __CONCAT can also concatenate double-quoted
84  * strings produced by the __STRING macro, but this only works with ANSI C.
85  */
86 #if defined(__STDC__) || defined(__cplusplus)
87 #define	__P(protos)	protos		/* full-blown ANSI C */
88 #define	__CONCAT(x,y)	x ## y
89 #define	__STRING(x)	#x
90 
91 #define	__const		const		/* define reserved names to standard */
92 #define	__signed	signed
93 #define	__volatile	volatile
94 #if defined(__cplusplus)
95 #define	__inline	inline		/* convert to C++ keyword */
96 #else
97 #ifndef __GNUC__
98 #define	__inline			/* delete GCC keyword */
99 #endif /* !__GNUC__ */
100 #endif /* !__cplusplus */
101 
102 #else	/* !(__STDC__ || __cplusplus) */
103 #define	__P(protos)	()		/* traditional C preprocessor */
104 #define	__CONCAT(x,y)	x/**/y
105 #define	__STRING(x)	"x"
106 
107 #ifndef __GNUC__
108 #define	__const				/* delete pseudo-ANSI C keywords */
109 #define	__inline
110 #define	__signed
111 #define	__volatile
112 /*
113  * In non-ANSI C environments, new programs will want ANSI-only C keywords
114  * deleted from the program and old programs will want them left alone.
115  * When using a compiler other than gcc, programs using the ANSI C keywords
116  * const, inline etc. as normal identifiers should define -DNO_ANSI_KEYWORDS.
117  * When using "gcc -traditional", we assume that this is the intent; if
118  * __GNUC__ is defined but __STDC__ is not, we leave the new keywords alone.
119  */
120 #ifndef	NO_ANSI_KEYWORDS
121 #define	const				/* delete ANSI C keywords */
122 #define	inline
123 #define	signed
124 #define	volatile
125 #endif
126 #endif	/* !__GNUC__ */
127 #endif	/* !(__STDC__ || __cplusplus) */
128 
129 /*
130  * GCC1 and some versions of GCC2 declare dead (non-returning) and
131  * pure (no side effects) functions using "volatile" and "const";
132  * unfortunately, these then cause warnings under "-ansi -pedantic".
133  * GCC2 uses a new, peculiar __attribute__((attrs)) style.  All of
134  * these work for GNU C++ (modulo a slight glitch in the C++ grammar
135  * in the distribution version of 2.5.5).
136  */
137 #if !defined(__GNUC__) || __GNUC__ < 2 || __GNUC_MINOR__ < 5
138 #define	__attribute__(x)	/* delete __attribute__ if non-gcc or gcc1 */
139 #if defined(__GNUC__) && !defined(__STRICT_ANSI__)
140 #define	__dead		__volatile
141 #define	__pure		__const
142 #endif
143 #endif
144 
145 /* Delete pseudo-keywords wherever they are not available or needed. */
146 #ifndef __dead
147 #define	__dead
148 #define	__pure
149 #endif
150 
151 #endif /* !_CDEFS_H_ */
152