jpayne@69: /* DO NOT EDIT! GENERATED AUTOMATICALLY! */ jpayne@69: #if !defined _GL_STDBOOL_H jpayne@69: #if (__GNUC__ > 2 || (__GNUC__ == 2 && __GNUC_MINOR__ >= 95)) jpayne@69: #include jpayne@69: #else jpayne@69: /* Copyright (C) 2001-2003, 2006-2017, 2019 Free Software Foundation, Inc. jpayne@69: Written by Bruno Haible , 2001. jpayne@69: jpayne@69: This program is free software; you can redistribute it and/or modify jpayne@69: it under the terms of the GNU Lesser General Public License as published by jpayne@69: the Free Software Foundation; either version 2, or (at your option) jpayne@69: any later version. jpayne@69: jpayne@69: This program is distributed in the hope that it will be useful, jpayne@69: but WITHOUT ANY WARRANTY; without even the implied warranty of jpayne@69: MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the jpayne@69: GNU Lesser General Public License for more details. jpayne@69: jpayne@69: You should have received a copy of the GNU Lesser General Public License jpayne@69: along with this program; if not, see . */ jpayne@69: jpayne@69: #ifndef _TEXTSTYLE_STDBOOL_H jpayne@69: #define _TEXTSTYLE_STDBOOL_H jpayne@69: jpayne@69: /* ISO C 99 for platforms that lack it. */ jpayne@69: jpayne@69: /* Usage suggestions: jpayne@69: jpayne@69: Programs that use should be aware of some limitations jpayne@69: and standards compliance issues. jpayne@69: jpayne@69: Standards compliance: jpayne@69: jpayne@69: - must be #included before 'bool', 'false', 'true' jpayne@69: can be used. jpayne@69: jpayne@69: - You cannot assume that sizeof (bool) == 1. jpayne@69: jpayne@69: - Programs should not undefine the macros bool, true, and false, jpayne@69: as C99 lists that as an "obsolescent feature". jpayne@69: jpayne@69: Limitations of this substitute, when used in a C89 environment: jpayne@69: jpayne@69: - must be #included before the '_Bool' type can be used. jpayne@69: jpayne@69: - You cannot assume that _Bool is a typedef; it might be a macro. jpayne@69: jpayne@69: - Bit-fields of type 'bool' are not supported. Portable code jpayne@69: should use 'unsigned int foo : 1;' rather than 'bool foo : 1;'. jpayne@69: jpayne@69: - In C99, casts and automatic conversions to '_Bool' or 'bool' are jpayne@69: performed in such a way that every nonzero value gets converted jpayne@69: to 'true', and zero gets converted to 'false'. This doesn't work jpayne@69: with this substitute. With this substitute, only the values 0 and 1 jpayne@69: give the expected result when converted to _Bool' or 'bool'. jpayne@69: jpayne@69: - C99 allows the use of (_Bool)0.0 in constant expressions, but jpayne@69: this substitute cannot always provide this property. jpayne@69: jpayne@69: Also, it is suggested that programs use 'bool' rather than '_Bool'; jpayne@69: this isn't required, but 'bool' is more common. */ jpayne@69: jpayne@69: jpayne@69: /* 7.16. Boolean type and values */ jpayne@69: jpayne@69: #ifdef __cplusplus jpayne@69: /* Assume the compiler has 'bool' and '_Bool'. */ jpayne@69: #else jpayne@69: /* is known to exist and work with the following compilers: jpayne@69: - GNU C 3.0 or newer, on any platform, jpayne@69: - Intel C, jpayne@69: - MSVC 12 (Visual Studio 2013) or newer, jpayne@69: - Sun C, on Solaris, if _STDC_C99 is defined, jpayne@69: - AIX xlc, if _ANSI_C_SOURCE is defined, jpayne@69: - HP C, on HP-UX 11.31 or newer. jpayne@69: It is know not to work with: jpayne@69: - Sun C, on Solaris, if __C99FEATURES__ is defined but _STDC_C99 is not, jpayne@69: - MIPSpro C 7.30, on IRIX. */ jpayne@69: # if (__GNUC__ >= 3) \ jpayne@69: || defined __INTEL_COMPILER \ jpayne@69: || (_MSC_VER >= 1800) \ jpayne@69: || (defined __SUNPRO_C && defined _STDC_C99) \ jpayne@69: || (defined _AIX && !defined __GNUC__ && defined _ANSI_C_SOURCE) \ jpayne@69: || defined __HP_cc jpayne@69: /* Assume the compiler has . */ jpayne@69: # include jpayne@69: # else jpayne@69: /* Need to define _Bool ourselves. As 'signed char' or as an enum type? jpayne@69: Use of a typedef, with SunPRO C, leads to a stupid jpayne@69: "warning: _Bool is a keyword in ISO C99". jpayne@69: Use of an enum type, with IRIX cc, leads to a stupid jpayne@69: "warning(1185): enumerated type mixed with another type". jpayne@69: Even the existence of an enum type, without a typedef, jpayne@69: "Invalid enumerator. (badenum)" with HP-UX cc on Tru64. jpayne@69: The only benefit of the enum, debuggability, is not important jpayne@69: with these compilers. So use 'signed char' and no enum. */ jpayne@69: # define _Bool signed char jpayne@69: # define bool _Bool jpayne@69: # endif jpayne@69: #endif jpayne@69: jpayne@69: /* The other macros must be usable in preprocessor directives. */ jpayne@69: #ifdef __cplusplus jpayne@69: # define false false jpayne@69: # define true true jpayne@69: #else jpayne@69: # undef false jpayne@69: # define false 0 jpayne@69: # undef true jpayne@69: # define true 1 jpayne@69: #endif jpayne@69: jpayne@69: #define __bool_true_false_are_defined 1 jpayne@69: jpayne@69: #endif /* _TEXTSTYLE_STDBOOL_H */ jpayne@69: #endif jpayne@69: #endif