jpayne@69
|
1 /* DO NOT EDIT! GENERATED AUTOMATICALLY! */
|
jpayne@69
|
2 #if !defined _GL_STDBOOL_H
|
jpayne@69
|
3 #if (__GNUC__ > 2 || (__GNUC__ == 2 && __GNUC_MINOR__ >= 95))
|
jpayne@69
|
4 #include <stdbool.h>
|
jpayne@69
|
5 #else
|
jpayne@69
|
6 /* Copyright (C) 2001-2003, 2006-2017, 2019 Free Software Foundation, Inc.
|
jpayne@69
|
7 Written by Bruno Haible <haible@clisp.cons.org>, 2001.
|
jpayne@69
|
8
|
jpayne@69
|
9 This program is free software; you can redistribute it and/or modify
|
jpayne@69
|
10 it under the terms of the GNU Lesser General Public License as published by
|
jpayne@69
|
11 the Free Software Foundation; either version 2, or (at your option)
|
jpayne@69
|
12 any later version.
|
jpayne@69
|
13
|
jpayne@69
|
14 This program is distributed in the hope that it will be useful,
|
jpayne@69
|
15 but WITHOUT ANY WARRANTY; without even the implied warranty of
|
jpayne@69
|
16 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
jpayne@69
|
17 GNU Lesser General Public License for more details.
|
jpayne@69
|
18
|
jpayne@69
|
19 You should have received a copy of the GNU Lesser General Public License
|
jpayne@69
|
20 along with this program; if not, see <https://www.gnu.org/licenses/>. */
|
jpayne@69
|
21
|
jpayne@69
|
22 #ifndef _TEXTSTYLE_STDBOOL_H
|
jpayne@69
|
23 #define _TEXTSTYLE_STDBOOL_H
|
jpayne@69
|
24
|
jpayne@69
|
25 /* ISO C 99 <stdbool.h> for platforms that lack it. */
|
jpayne@69
|
26
|
jpayne@69
|
27 /* Usage suggestions:
|
jpayne@69
|
28
|
jpayne@69
|
29 Programs that use <stdbool.h> should be aware of some limitations
|
jpayne@69
|
30 and standards compliance issues.
|
jpayne@69
|
31
|
jpayne@69
|
32 Standards compliance:
|
jpayne@69
|
33
|
jpayne@69
|
34 - <stdbool.h> must be #included before 'bool', 'false', 'true'
|
jpayne@69
|
35 can be used.
|
jpayne@69
|
36
|
jpayne@69
|
37 - You cannot assume that sizeof (bool) == 1.
|
jpayne@69
|
38
|
jpayne@69
|
39 - Programs should not undefine the macros bool, true, and false,
|
jpayne@69
|
40 as C99 lists that as an "obsolescent feature".
|
jpayne@69
|
41
|
jpayne@69
|
42 Limitations of this substitute, when used in a C89 environment:
|
jpayne@69
|
43
|
jpayne@69
|
44 - <stdbool.h> must be #included before the '_Bool' type can be used.
|
jpayne@69
|
45
|
jpayne@69
|
46 - You cannot assume that _Bool is a typedef; it might be a macro.
|
jpayne@69
|
47
|
jpayne@69
|
48 - Bit-fields of type 'bool' are not supported. Portable code
|
jpayne@69
|
49 should use 'unsigned int foo : 1;' rather than 'bool foo : 1;'.
|
jpayne@69
|
50
|
jpayne@69
|
51 - In C99, casts and automatic conversions to '_Bool' or 'bool' are
|
jpayne@69
|
52 performed in such a way that every nonzero value gets converted
|
jpayne@69
|
53 to 'true', and zero gets converted to 'false'. This doesn't work
|
jpayne@69
|
54 with this substitute. With this substitute, only the values 0 and 1
|
jpayne@69
|
55 give the expected result when converted to _Bool' or 'bool'.
|
jpayne@69
|
56
|
jpayne@69
|
57 - C99 allows the use of (_Bool)0.0 in constant expressions, but
|
jpayne@69
|
58 this substitute cannot always provide this property.
|
jpayne@69
|
59
|
jpayne@69
|
60 Also, it is suggested that programs use 'bool' rather than '_Bool';
|
jpayne@69
|
61 this isn't required, but 'bool' is more common. */
|
jpayne@69
|
62
|
jpayne@69
|
63
|
jpayne@69
|
64 /* 7.16. Boolean type and values */
|
jpayne@69
|
65
|
jpayne@69
|
66 #ifdef __cplusplus
|
jpayne@69
|
67 /* Assume the compiler has 'bool' and '_Bool'. */
|
jpayne@69
|
68 #else
|
jpayne@69
|
69 /* <stdbool.h> is known to exist and work with the following compilers:
|
jpayne@69
|
70 - GNU C 3.0 or newer, on any platform,
|
jpayne@69
|
71 - Intel C,
|
jpayne@69
|
72 - MSVC 12 (Visual Studio 2013) or newer,
|
jpayne@69
|
73 - Sun C, on Solaris, if _STDC_C99 is defined,
|
jpayne@69
|
74 - AIX xlc, if _ANSI_C_SOURCE is defined,
|
jpayne@69
|
75 - HP C, on HP-UX 11.31 or newer.
|
jpayne@69
|
76 It is know not to work with:
|
jpayne@69
|
77 - Sun C, on Solaris, if __C99FEATURES__ is defined but _STDC_C99 is not,
|
jpayne@69
|
78 - MIPSpro C 7.30, on IRIX. */
|
jpayne@69
|
79 # if (__GNUC__ >= 3) \
|
jpayne@69
|
80 || defined __INTEL_COMPILER \
|
jpayne@69
|
81 || (_MSC_VER >= 1800) \
|
jpayne@69
|
82 || (defined __SUNPRO_C && defined _STDC_C99) \
|
jpayne@69
|
83 || (defined _AIX && !defined __GNUC__ && defined _ANSI_C_SOURCE) \
|
jpayne@69
|
84 || defined __HP_cc
|
jpayne@69
|
85 /* Assume the compiler has <stdbool.h>. */
|
jpayne@69
|
86 # include <stdbool.h>
|
jpayne@69
|
87 # else
|
jpayne@69
|
88 /* Need to define _Bool ourselves. As 'signed char' or as an enum type?
|
jpayne@69
|
89 Use of a typedef, with SunPRO C, leads to a stupid
|
jpayne@69
|
90 "warning: _Bool is a keyword in ISO C99".
|
jpayne@69
|
91 Use of an enum type, with IRIX cc, leads to a stupid
|
jpayne@69
|
92 "warning(1185): enumerated type mixed with another type".
|
jpayne@69
|
93 Even the existence of an enum type, without a typedef,
|
jpayne@69
|
94 "Invalid enumerator. (badenum)" with HP-UX cc on Tru64.
|
jpayne@69
|
95 The only benefit of the enum, debuggability, is not important
|
jpayne@69
|
96 with these compilers. So use 'signed char' and no enum. */
|
jpayne@69
|
97 # define _Bool signed char
|
jpayne@69
|
98 # define bool _Bool
|
jpayne@69
|
99 # endif
|
jpayne@69
|
100 #endif
|
jpayne@69
|
101
|
jpayne@69
|
102 /* The other macros must be usable in preprocessor directives. */
|
jpayne@69
|
103 #ifdef __cplusplus
|
jpayne@69
|
104 # define false false
|
jpayne@69
|
105 # define true true
|
jpayne@69
|
106 #else
|
jpayne@69
|
107 # undef false
|
jpayne@69
|
108 # define false 0
|
jpayne@69
|
109 # undef true
|
jpayne@69
|
110 # define true 1
|
jpayne@69
|
111 #endif
|
jpayne@69
|
112
|
jpayne@69
|
113 #define __bool_true_false_are_defined 1
|
jpayne@69
|
114
|
jpayne@69
|
115 #endif /* _TEXTSTYLE_STDBOOL_H */
|
jpayne@69
|
116 #endif
|
jpayne@69
|
117 #endif
|