1/*
2 * Copyright (c) 1991, 1993
3 *	The Regents of the University of California.  All rights reserved.
4 *
5 * This code is derived from software contributed to Berkeley by
6 * Berkeley Software Design, Inc.
7 *
8 * Redistribution and use in source and binary forms, with or without
9 * modification, are permitted provided that the following conditions
10 * are met:
11 * 1. Redistributions of source code must retain the above copyright
12 *    notice, this list of conditions and the following disclaimer.
13 * 2. Redistributions in binary form must reproduce the above copyright
14 *    notice, this list of conditions and the following disclaimer in the
15 *    documentation and/or other materials provided with the distribution.
16 * 3. All advertising materials mentioning features or use of this software
17 *    must display the following acknowledgement:
18 *	This product includes software developed by the University of
19 *	California, Berkeley and its contributors.
20 * 4. Neither the name of the University nor the names of its contributors
21 *    may be used to endorse or promote products derived from this software
22 *    without specific prior written permission.
23 *
24 * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND
25 * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
26 * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
27 * ARE DISCLAIMED.  IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
28 * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
29 * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
30 * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
31 * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
32 * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
33 * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
34 * SUCH DAMAGE.
35 *
36 *	@(#)cdefs.h	8.8 (Berkeley) 1/9/95
37 * $FreeBSD: /repoman/r/ncvs/src/sys/sys/cdefs.h,v 1.68 2002/10/21 20:50:30 mike Exp $
38 */
39
40#ifndef	_SYS_CDEFS_H_
41
42/*
43 * Compiler-dependent macros to help declare dead (non-returning) and
44 * pure (no side effects) functions, and unused variables.  They are
45 * null except for versions of gcc that are known to support the features
46 * properly (old versions of gcc-2 supported the dead and pure features
47 * in a different (wrong) way).  If we do not provide an implementation
48 * for a given compiler, let the compile fail if it is told to use
49 * a feature that we cannot live without.
50 */
51#ifdef lint
52#define	__packed
53#define	__aligned(x)
54#define	__section(x)
55#else
56#define	__packed	__attribute__((__packed__))
57#define	__aligned(x)	__attribute__((__aligned__(x)))
58#define	__section(x)	__attribute__((__section__(x)))
59#endif
60
61#if !defined(__STRICT_ANSI__) || __STDC_VERSION__ >= 199901
62#define	__LONG_LONG_SUPPORTED
63#endif
64
65/*
66 * We define this here since <stddef.h>, <sys/queue.h>, and <sys/types.h>
67 * require it.
68 */
69#define	__strong_reference(sym,aliassym)	\
70	extern __typeof (sym) aliassym __attribute__ ((__alias__ (#sym)));
71#define	__weak_reference(sym,alias)
72#define	__warn_references(sym,msg)
73
74#ifndef	__RCSID_SOURCE
75#ifndef	NO__RCSID_SOURCE
76#define	__RCSID_SOURCE(s)	__IDSTRING(__CONCAT(__rcsid_source_,__LINE__),s)
77#else
78#define	__RCSID_SOURCE(s)
79#endif
80#endif
81
82#ifndef	__DECONST
83#define	__DECONST(type, var)	((type)(uintptr_t)(const void *)(var))
84#endif
85
86#ifndef	__DEVOLATILE
87#define	__DEVOLATILE(type, var)	((type)(uintptr_t)(volatile void *)(var))
88#endif
89
90#ifndef	__DEQUALIFY
91#define	__DEQUALIFY(type, var)	((type)(uintptr_t)(const volatile void *)(var))
92#endif
93
94/*
95 * Now include the Apple version of sys/cdefs.h
96 */
97
98#include_next <sys/cdefs.h>
99
100/*
101 * Use FreeBSD version of __CONCAT
102 */
103#if defined(__STDC__) || defined(__cplusplus)
104#undef __CONCAT1
105#undef __CONCAT
106#define __CONCAT1(x,y)	x ## y
107#define __CONCAT(x,y)	__CONCAT1(x,y)
108#endif
109
110/*
111 * Deal with all versions of POSIX.  The ordering relative to the tests above is
112 * important.
113 */
114#ifdef _POSIX_C_SOURCE
115#if _POSIX_C_SOURCE >= 200112
116#define	__POSIX_VISIBLE		200112
117#define	__ISO_C_VISIBLE		1999
118#elif _POSIX_C_SOURCE >= 199506
119#define	__POSIX_VISIBLE		199506
120#define	__ISO_C_VISIBLE		1990
121#elif _POSIX_C_SOURCE >= 199309
122#define	__POSIX_VISIBLE		199309
123#define	__ISO_C_VISIBLE		1990
124#elif _POSIX_C_SOURCE >= 199209
125#define	__POSIX_VISIBLE		199209
126#define	__ISO_C_VISIBLE		1990
127#elif _POSIX_C_SOURCE >= 199009
128#define	__POSIX_VISIBLE		199009
129#define	__ISO_C_VISIBLE		1990
130#else
131#define	__POSIX_VISIBLE		198808
132#define	__ISO_C_VISIBLE		0
133#endif /* _POSIX_C_SOURCE */
134#else
135/*-
136 * Deal with _ANSI_SOURCE:
137 * If it is defined, and no other compilation environment is explicitly
138 * requested, then define our internal feature-test macros to zero.  This
139 * makes no difference to the preprocessor (undefined symbols in preprocessing
140 * expressions are defined to have value zero), but makes it more convenient for
141 * a test program to print out the values.
142 *
143 * If a program mistakenly defines _ANSI_SOURCE and some other macro such as
144 * _POSIX_C_SOURCE, we will assume that it wants the broader compilation
145 * environment (and in fact we will never get here).
146 */
147#if defined(_ANSI_SOURCE)	/* Hide almost everything. */
148#define	__POSIX_VISIBLE		0
149#define	__XSI_VISIBLE		0
150#define	__BSD_VISIBLE		0
151#define	__ISO_C_VISIBLE		1990
152#elif defined(_C99_SOURCE)	/* Localism to specify strict C99 env. */
153#define	__POSIX_VISIBLE		0
154#define	__XSI_VISIBLE		0
155#define	__BSD_VISIBLE		0
156#define	__ISO_C_VISIBLE		1999
157#else				/* Default environment: show everything. */
158#define	__POSIX_VISIBLE		200112
159#define	__XSI_VISIBLE		600
160#define	__BSD_VISIBLE		1
161#define	__ISO_C_VISIBLE		1999
162#endif
163#endif
164
165#endif /* !_SYS_CDEFS_H_ */
166