summaryrefslogtreecommitdiffstats
path: root/gl/stdbool.in.h
diff options
context:
space:
mode:
Diffstat (limited to 'gl/stdbool.in.h')
-rw-r--r--gl/stdbool.in.h49
1 files changed, 16 insertions, 33 deletions
diff --git a/gl/stdbool.in.h b/gl/stdbool.in.h
index 7c15772..2fa4672 100644
--- a/gl/stdbool.in.h
+++ b/gl/stdbool.in.h
@@ -1,18 +1,18 @@
1/* Copyright (C) 2001-2003, 2006-2013 Free Software Foundation, Inc. 1/* Copyright (C) 2001-2003, 2006-2022 Free Software Foundation, Inc.
2 Written by Bruno Haible <haible@clisp.cons.org>, 2001. 2 Written by Bruno Haible <haible@clisp.cons.org>, 2001.
3 3
4 This program is free software; you can redistribute it and/or modify 4 This file is free software: you can redistribute it and/or modify
5 it under the terms of the GNU General Public License as published by 5 it under the terms of the GNU Lesser General Public License as
6 the Free Software Foundation; either version 3, or (at your option) 6 published by the Free Software Foundation; either version 2.1 of the
7 any later version. 7 License, or (at your option) any later version.
8 8
9 This program is distributed in the hope that it will be useful, 9 This file is distributed in the hope that it will be useful,
10 but WITHOUT ANY WARRANTY; without even the implied warranty of 10 but WITHOUT ANY WARRANTY; without even the implied warranty of
11 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 11 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
12 GNU General Public License for more details. 12 GNU Lesser General Public License for more details.
13 13
14 You should have received a copy of the GNU General Public License 14 You should have received a copy of the GNU Lesser General Public License
15 along with this program; if not, see <http://www.gnu.org/licenses/>. */ 15 along with this program. If not, see <https://www.gnu.org/licenses/>. */
16 16
17#ifndef _GL_STDBOOL_H 17#ifndef _GL_STDBOOL_H
18#define _GL_STDBOOL_H 18#define _GL_STDBOOL_H
@@ -58,33 +58,17 @@
58 58
59/* 7.16. Boolean type and values */ 59/* 7.16. Boolean type and values */
60 60
61/* BeOS <sys/socket.h> already #defines false 0, true 1. We use the same
62 definitions below, but temporarily we have to #undef them. */
63#if defined __BEOS__ && !defined __HAIKU__
64# include <OS.h> /* defines bool but not _Bool */
65# undef false
66# undef true
67#endif
68
69#ifdef __cplusplus 61#ifdef __cplusplus
70# define _Bool bool 62# define _Bool bool
71# define bool bool 63# define bool bool
72#else 64#else
73# if defined __BEOS__ && !defined __HAIKU__ 65# if !defined __GNUC__
74 /* A compiler known to have 'bool'. */
75 /* If the compiler already has both 'bool' and '_Bool', we can assume they
76 are the same types. */
77# if !@HAVE__BOOL@
78typedef bool _Bool;
79# endif
80# else
81# if !defined __GNUC__
82 /* If @HAVE__BOOL@: 66 /* If @HAVE__BOOL@:
83 Some HP-UX cc and AIX IBM C compiler versions have compiler bugs when 67 Some HP-UX cc and AIX IBM C compiler versions have compiler bugs when
84 the built-in _Bool type is used. See 68 the built-in _Bool type is used. See
85 http://gcc.gnu.org/ml/gcc-patches/2003-12/msg02303.html 69 https://gcc.gnu.org/ml/gcc-patches/2003-12/msg02303.html
86 http://lists.gnu.org/archive/html/bug-coreutils/2005-11/msg00161.html 70 https://lists.gnu.org/r/bug-coreutils/2005-11/msg00161.html
87 http://lists.gnu.org/archive/html/bug-coreutils/2005-10/msg00086.html 71 https://lists.gnu.org/r/bug-coreutils/2005-10/msg00086.html
88 Similar bugs are likely with other compilers as well; this file 72 Similar bugs are likely with other compilers as well; this file
89 wouldn't be used if <stdbool.h> was working. 73 wouldn't be used if <stdbool.h> was working.
90 So we override the _Bool type. 74 So we override the _Bool type.
@@ -98,10 +82,10 @@ typedef bool _Bool;
98 "Invalid enumerator. (badenum)" with HP-UX cc on Tru64. 82 "Invalid enumerator. (badenum)" with HP-UX cc on Tru64.
99 The only benefit of the enum, debuggability, is not important 83 The only benefit of the enum, debuggability, is not important
100 with these compilers. So use 'signed char' and no enum. */ 84 with these compilers. So use 'signed char' and no enum. */
101# define _Bool signed char 85# define _Bool signed char
102# else 86# else
103 /* With this compiler, trust the _Bool type if the compiler has it. */ 87 /* With this compiler, trust the _Bool type if the compiler has it. */
104# if !@HAVE__BOOL@ 88# if !@HAVE__BOOL@
105 /* For the sake of symbolic names in gdb, define true and false as 89 /* For the sake of symbolic names in gdb, define true and false as
106 enum constants, not only as macros. 90 enum constants, not only as macros.
107 It is tempting to write 91 It is tempting to write
@@ -112,7 +96,6 @@ typedef bool _Bool;
112 (see ISO C 99 6.3.1.1.(2)). So add a negative value to the 96 (see ISO C 99 6.3.1.1.(2)). So add a negative value to the
113 enum; this ensures that '_Bool' promotes to 'int'. */ 97 enum; this ensures that '_Bool' promotes to 'int'. */
114typedef enum { _Bool_must_promote_to_int = -1, false = 0, true = 1 } _Bool; 98typedef enum { _Bool_must_promote_to_int = -1, false = 0, true = 1 } _Bool;
115# endif
116# endif 99# endif
117# endif 100# endif
118# define bool _Bool 101# define bool _Bool