Mirror of the gdb-patches mailing list
 help / color / mirror / Atom feed
* Confusion over the definition of 'bool' in rdi-share/host.h
@ 2002-02-05 10:11 Nick Clifton
  2002-02-05 10:59 ` Daniel Jacobowitz
                   ` (2 more replies)
  0 siblings, 3 replies; 10+ messages in thread
From: Nick Clifton @ 2002-02-05 10:11 UTC (permalink / raw)
  To: gdb-patches

Hi Guys,

  The ARM port of GDB is currently failing to build for me because of
  this problem:

In file included from /home/nickc/work/sources/egcs/gdb/rdi-share/ardi.h:17,
                 from /home/nickc/work/sources/egcs/gdb/remote-rdi.c:46:
/home/nickc/work/sources/egcs/gdb/rdi-share/host.h:123: conflicting types for `_Bool'
/usr/lib/gcc-lib/i386-redhat-linux/2.96/include/stdbool.h:41: previous declaration of `_Bool'

  It seems that host.h has code that looks like this (trimmed a little):

    #  define _bool int

    #ifdef _bool
       typedef _bool bool;
    #endif

  And stdbool.h has:

    typedef enum
    {
      false = 0,
      true = 1
    } _Bool;

    #define bool _Bool

  So the typedef in host.h becomes, effectively  "typedef int enum _Bool".

  I am not sure if we are allowed to modify rdi-share/host.h, it
  appears to be copyright to ARM, but if we are, then may I submit the
  following patch to undefine bool before it is used ?

Cheers
        Nick

2002-02-05  Nick Clifton  <nickc@cambridge.redhat.com>

	* rdi-share/host.h: Before creating a typedef from _bool, make
        sure that bool is not defined.

Index: gdb/rdi-share/host.h
===================================================================
RCS file: /cvs/src/src/gdb/rdi-share/host.h,v
retrieving revision 1.4
diff -c -3 -p -w -r1.4 host.h
*** host.h	2001/06/29 01:19:23	1.4
--- host.h	2002/02/05 17:48:54
*************** typedef unsigned       char  unsigned8;
*** 120,125 ****
--- 120,128 ----
  #  if defined(_MFC_VER) || defined(__CC_NORCROFT) /* When using MS Visual C/C++ v4.2 */
  #    define bool _bool /* avoids "'bool' is reserved word" warning      */
  #  else
+ #    ifdef bool
+ #    undef bool
+ #    endif
       typedef _bool bool;
  #  endif
  #  define true _true



^ permalink raw reply	[flat|nested] 10+ messages in thread

end of thread, other threads:[~2002-02-14 16:09 UTC | newest]

Thread overview: 10+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2002-02-05 10:11 Confusion over the definition of 'bool' in rdi-share/host.h Nick Clifton
2002-02-05 10:59 ` Daniel Jacobowitz
2002-02-05 11:38 ` Stan Shebs
2002-02-05 19:29   ` Andrew Cagney
2002-02-06 13:02     ` Grant Edwards
2002-02-06 21:36       ` Stan Shebs
2002-02-14  8:09         ` Grant Edwards
2002-02-06  2:57 ` Richard Earnshaw
2002-02-06  6:13   ` Fernando Nasser
2002-02-06 13:06     ` Grant Edwards

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox