This is the mail archive of the
gcc-patches@gcc.gnu.org
mailing list for the GCC project.
patch for <stdbool.h>
- To: gcc-patches at gcc dot gnu dot org
- Subject: patch for <stdbool.h>
- From: fnf at ninemoons dot com
- Date: Fri, 29 Dec 2000 11:57:05 -0700 (MST)
- Cc: fnf at ninemoons dot com
- Reply-To: fnf at ninemoons dot com
$ cat bug.c
#include <stdbool.h>
struct { int x; bool y; } foo = { 0, false};
$ gcc -c bug.c
bug.c:2: invalid initializer
bug.c:2: (near initialization for `foo.y')
This patch seems to fix it:
2000-12-29 Fred Fish <fnf@geekgadgets.org>
* ginclude/stdbool.h (true, false): Cast to type _Bool.
Index: ginclude/stdbool.h
===================================================================
RCS file: /cvs/gcc/gcc/gcc/ginclude/stdbool.h,v
retrieving revision 1.6
diff -c -p -r1.6 stdbool.h
*** stdbool.h 2000/11/13 14:14:42 1.6
--- stdbool.h 2000/12/29 18:59:28
*************** Boston, MA 02111-1307, USA. */
*** 34,41 ****
#ifndef __cplusplus
#define bool _Bool
! #define true 1
! #define false 0
#else /* __cplusplus */
--- 34,41 ----
#ifndef __cplusplus
#define bool _Bool
! #define true (_Bool) 1
! #define false (_Bool) 0
#else /* __cplusplus */