Re: Confusion over the definition of 'bool' in rdi-share/host.h

Daniel Jacobowitz
2002-02-05T18:59:32Z

On Tue, Feb 05, 2002 at 06:12:16PM +0000, Nick Clifton wrote:
> 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 ?

(Ew on all counts)

Does not defining bool if it is already defined also work?

--
Daniel Jacobowitz Carnegie Mellon University
MontaVista Software Debian GNU/Linux Developer