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