This is the mail archive of the gcc-patches@gcc.gnu.org mailing list for the GCC project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]

patch for <stdbool.h>


$ 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 */
  

Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]