xref: /illumos-gate/usr/src/uts/common/sys/stdbool.h (revision 1de1bbba)
1*1de1bbbaSGarrett D'Amore /*
2*1de1bbbaSGarrett D'Amore  * CDDL HEADER START
3*1de1bbbaSGarrett D'Amore  *
4*1de1bbbaSGarrett D'Amore  * The contents of this file are subject to the terms of the
5*1de1bbbaSGarrett D'Amore  * Common Development and Distribution License (the "License").
6*1de1bbbaSGarrett D'Amore  * You may not use this file except in compliance with the License.
7*1de1bbbaSGarrett D'Amore  *
8*1de1bbbaSGarrett D'Amore  * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
9*1de1bbbaSGarrett D'Amore  * or http://www.opensolaris.org/os/licensing.
10*1de1bbbaSGarrett D'Amore  * See the License for the specific language governing permissions
11*1de1bbbaSGarrett D'Amore  * and limitations under the License.
12*1de1bbbaSGarrett D'Amore  *
13*1de1bbbaSGarrett D'Amore  * When distributing Covered Code, include this CDDL HEADER in each
14*1de1bbbaSGarrett D'Amore  * file and include the License file at usr/src/OPENSOLARIS.LICENSE.
15*1de1bbbaSGarrett D'Amore  * If applicable, add the following below this CDDL HEADER, with the
16*1de1bbbaSGarrett D'Amore  * fields enclosed by brackets "[]" replaced with your own identifying
17*1de1bbbaSGarrett D'Amore  * information: Portions Copyright [yyyy] [name of copyright owner]
18*1de1bbbaSGarrett D'Amore  *
19*1de1bbbaSGarrett D'Amore  * CDDL HEADER END
20*1de1bbbaSGarrett D'Amore  */
21*1de1bbbaSGarrett D'Amore 
22*1de1bbbaSGarrett D'Amore /*
23*1de1bbbaSGarrett D'Amore  * Copyright 2009 Sun Microsystems, Inc.  All rights reserved.
24*1de1bbbaSGarrett D'Amore  * Use is subject to license terms.
25*1de1bbbaSGarrett D'Amore  */
26*1de1bbbaSGarrett D'Amore 
27*1de1bbbaSGarrett D'Amore #ifndef _SYS_STDBOOL_H
28*1de1bbbaSGarrett D'Amore #define	_SYS_STDBOOL_H
29*1de1bbbaSGarrett D'Amore 
30*1de1bbbaSGarrett D'Amore /*
31*1de1bbbaSGarrett D'Amore  * This header is included for alignment with the ISO/IEC 9899:1999 standard.
32*1de1bbbaSGarrett D'Amore  * The contents are only visible when using a c99 compiler. In the case of
33*1de1bbbaSGarrett D'Amore  * the Sun compiler, some C99 features, including the _Bool built-in type,
34*1de1bbbaSGarrett D'Amore  * are provided in the default compilation mode. This is a subset of what
35*1de1bbbaSGarrett D'Amore  * is provided when __STDC_VERSION__ is 199901; hence the contents of this
36*1de1bbbaSGarrett D'Amore  * header are made visible when either __STDC_VERSION__ >= 199901 (_STDC_C99
37*1de1bbbaSGarrett D'Amore  * as defined in sys/feature_tests.h) or if __C99FEATURES__ (a Sun compiler
38*1de1bbbaSGarrett D'Amore  * built-in) is defined. Likewise for GNU C, support for C99 features,
39*1de1bbbaSGarrett D'Amore  * including this header, is provided in versions 3.0 or greater. In no
40*1de1bbbaSGarrett D'Amore  * case should the contents of this header be visible in a C++ build
41*1de1bbbaSGarrett D'Amore  * environment.
42*1de1bbbaSGarrett D'Amore  *
43*1de1bbbaSGarrett D'Amore  * Note that the ability to undefine and redefine the macros bool,
44*1de1bbbaSGarrett D'Amore  * true, and false  is an obsolescent feature which may be withdrawn
45*1de1bbbaSGarrett D'Amore  * in a future version of the standards specifications.
46*1de1bbbaSGarrett D'Amore  */
47*1de1bbbaSGarrett D'Amore 
48*1de1bbbaSGarrett D'Amore #include <sys/feature_tests.h>
49*1de1bbbaSGarrett D'Amore 
50*1de1bbbaSGarrett D'Amore #ifndef __cplusplus
51*1de1bbbaSGarrett D'Amore #if defined(_STDC_C99) || defined(__C99FEATURES__) || __GNUC__ >= 3
52*1de1bbbaSGarrett D'Amore 
53*1de1bbbaSGarrett D'Amore #undef	bool
54*1de1bbbaSGarrett D'Amore #undef	true
55*1de1bbbaSGarrett D'Amore #undef	false
56*1de1bbbaSGarrett D'Amore 
57*1de1bbbaSGarrett D'Amore #define	bool	_Bool
58*1de1bbbaSGarrett D'Amore #define	true	1
59*1de1bbbaSGarrett D'Amore #define	false	0
60*1de1bbbaSGarrett D'Amore 
61*1de1bbbaSGarrett D'Amore #define	__bool_true_false_are_defined	1
62*1de1bbbaSGarrett D'Amore 
63*1de1bbbaSGarrett D'Amore #endif /* defined(_STDC_C99) || defined(__C99FEATURES__) || __GNUC__ >= 3 */
64*1de1bbbaSGarrett D'Amore #endif /* __cplusplus */
65*1de1bbbaSGarrett D'Amore 
66*1de1bbbaSGarrett D'Amore #endif /* !_SYS_STDBOOL_H */
67