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

Richard Earnshaw
2002-02-06T10:57:08Z

> 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

the rdi's host.h is really a non-autoconf approach to generating host
definitions. It's contents should really be replaced with an include of
the standard autoconf generated definitions followed by some cleanups (ie
defining the types that the rdi code need in terms of what autoconf has
provided) to make the rest of the rdi files compile cleanly.

R.