xref: /illumos-gate/usr/src/head/stdbool.h (revision 7c478bd9)
1 /*
2  * CDDL HEADER START
3  *
4  * The contents of this file are subject to the terms of the
5  * Common Development and Distribution License, Version 1.0 only
6  * (the "License").  You may not use this file except in compliance
7  * with the License.
8  *
9  * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
10  * or http://www.opensolaris.org/os/licensing.
11  * See the License for the specific language governing permissions
12  * and limitations under the License.
13  *
14  * When distributing Covered Code, include this CDDL HEADER in each
15  * file and include the License file at usr/src/OPENSOLARIS.LICENSE.
16  * If applicable, add the following below this CDDL HEADER, with the
17  * fields enclosed by brackets "[]" replaced with your own identifying
18  * information: Portions Copyright [yyyy] [name of copyright owner]
19  *
20  * CDDL HEADER END
21  */
22 /*
23  * Copyright 2003 Sun Microsystems, Inc.  All rights reserved.
24  * Use is subject to license terms.
25  */
26 
27 #ifndef _STDBOOL_H
28 #define	_STDBOOL_H
29 
30 #pragma ident	"%Z%%M%	%I%	%E% SMI"
31 
32 #ifdef	__cplusplus
33 extern "C" {
34 #endif
35 
36 /*
37  * Included for alignment with the ISO/IEC 9899:1999 standard. The
38  * contents of this header are only visible when using a c99
39  * compiler, otherwise inclusion of this header will result in a
40  * forced compilation failure.
41  *
42  * Note that the ability to undefine and redefine the macros bool,
43  * true, and false  is an obsolescent feature which may be withdrawn
44  * in a future version of the standards specifications.
45  */
46 
47 #include <sys/feature_tests.h>
48 
49 #if defined(_STDC_C99)
50 
51 #undef	bool
52 #undef	true
53 #undef	false
54 
55 #define	bool	_Bool
56 #define	true	1
57 #define	false	0
58 
59 #define	__bool_true_false_are_defined	1
60 
61 #else /* _STDC_C99 */
62 
63 #error "Use of <stdbool.h> is valid only in a c99 compilation environment."
64 
65 #endif /* _STDC_C99 */
66 
67 #ifdef	__cplusplus
68 }
69 #endif
70 
71 #endif /* _STDBOOL_H */
72