1/* DO NOT EDIT! GENERATED AUTOMATICALLY! */ 2#if !defined _GL_STDBOOL_H 3#if (__GNUC__ > 2 || (__GNUC__ == 2 && __GNUC_MINOR__ >= 95)) 4#include <stdbool.h> 5#else 6/* Copyright (C) 2001-2003, 2006-2009 Free Software Foundation, Inc. 7 Written by Bruno Haible <haible@clisp.cons.org>, 2001. 8 9 This program is free software; you can redistribute it and/or modify 10 it under the terms of the GNU General Public License as published by 11 the Free Software Foundation; either version 2, or (at your option) 12 any later version. 13 14 This program is distributed in the hope that it will be useful, 15 but WITHOUT ANY WARRANTY; without even the implied warranty of 16 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 17 GNU General Public License for more details. 18 19 You should have received a copy of the GNU General Public License 20 along with this program; if not, write to the Free Software Foundation, 21 Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. */ 22 23#ifndef _UNISTRING_STDBOOL_H 24#define _UNISTRING_STDBOOL_H 25 26/* ISO C 99 <stdbool.h> for platforms that lack it. */ 27 28/* Usage suggestions: 29 30 Programs that use <stdbool.h> should be aware of some limitations 31 and standards compliance issues. 32 33 Standards compliance: 34 35 - <stdbool.h> must be #included before 'bool', 'false', 'true' 36 can be used. 37 38 - You cannot assume that sizeof (bool) == 1. 39 40 - Programs should not undefine the macros bool, true, and false, 41 as C99 lists that as an "obsolescent feature". 42 43 Limitations of this substitute, when used in a C89 environment: 44 45 - <stdbool.h> must be #included before the '_Bool' type can be used. 46 47 - You cannot assume that _Bool is a typedef; it might be a macro. 48 49 - Bit-fields of type 'bool' are not supported. Portable code 50 should use 'unsigned int foo : 1;' rather than 'bool foo : 1;'. 51 52 - In C99, casts and automatic conversions to '_Bool' or 'bool' are 53 performed in such a way that every nonzero value gets converted 54 to 'true', and zero gets converted to 'false'. This doesn't work 55 with this substitute. With this substitute, only the values 0 and 1 56 give the expected result when converted to _Bool' or 'bool'. 57 58 Also, it is suggested that programs use 'bool' rather than '_Bool'; 59 this isn't required, but 'bool' is more common. */ 60 61 62/* 7.16. Boolean type and values */ 63 64/* For the sake of symbolic names in gdb, we define true and false as 65 enum constants, not only as macros. 66 It is tempting to write 67 typedef enum { false = 0, true = 1 } _Bool; 68 so that gdb prints values of type 'bool' symbolically. But if we do 69 this, values of type '_Bool' may promote to 'int' or 'unsigned int' 70 (see ISO C 99 6.7.2.2.(4)); however, '_Bool' must promote to 'int' 71 (see ISO C 99 6.3.1.1.(2)). So we add a negative value to the 72 enum; this ensures that '_Bool' promotes to 'int'. */ 73#if defined __cplusplus 74 /* Assume the compiler has 'bool' and '_Bool'. */ 75#else 76 /* If @HAVE__BOOL@: 77 Some HP-UX cc and AIX IBM C compiler versions have compiler bugs when 78 the built-in _Bool type is used. See 79 http://gcc.gnu.org/ml/gcc-patches/2003-12/msg02303.html 80 http://lists.gnu.org/archive/html/bug-coreutils/2005-11/msg00161.html 81 http://lists.gnu.org/archive/html/bug-coreutils/2005-10/msg00086.html 82 Similar bugs are likely with other compilers as well; this file 83 wouldn't be used if <stdbool.h> was working. 84 So we override the _Bool type. 85 If !@HAVE__BOOL@: 86 Need to define _Bool ourselves. As 'signed char' or as an enum type? 87 Use of a typedef, with SunPRO C, leads to a stupid 88 "warning: _Bool is a keyword in ISO C99". 89 Use of an enum type, with IRIX cc, leads to a stupid 90 "warning(1185): enumerated type mixed with another type". 91 Even the existence of an enum type, without a typedef, 92 "Invalid enumerator. (badenum)" with HP-UX cc on Tru64. 93 The only benefit of the enum, debuggability, is not important 94 with these compilers. So use 'signed char' and no enum. */ 95# define _Bool signed char 96#endif 97#define bool _Bool 98 99/* The other macros must be usable in preprocessor directives. */ 100#define false 0 101#define true 1 102#define __bool_true_false_are_defined 1 103 104#endif /* _UNISTRING_STDBOOL_H */ 105#endif 106#endif 107