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]
Other format: [Raw text]

Re: C++ bootstrap (part 4/n): Don't redefine bool, true and falsein C++


[apologies if anyone gets this more than once - I was experimenting
with a new mail client - not successfully :(]

Bernardo Innocenti wrote:
> Richard Henderson wrote:
> > On Sun, Jul 25, 2004 at 04:04:15AM +0200, Bernardo Innocenti wrote:
> >>Uh?  What exactly was this isse?  system.h should only be included
> >>in GCC's source, after all system headers.
> > 
> > Something about the size of bool changing between 2.95 and 3.0,
> > affecting bootstrap.  Perhaps having libcpp not use bool or _Bool
> > is enough to avoid problems.
> > 
> > Ask Zack, since he's the one that decided that it was simply too
> > much effort to get right.
> 
> Zack, can you remember what the exact problem was?

There were, in fact, three different problems.  One was annoying, two
was a headache, three was too much.

1) If the bootstrap compiler supports bool/_Bool as a native type, it
   may give it a different size from the GCC being bootstrapped, thus
   causing ABI incompatibility between code compiled by the bootstrap
   compiler (libiberty, libcpp, libbanshee, etc) and code compiled by
   the new GCC during stage 2.

2) If the bootstrap compiler supports bool/_Bool as a native type, it
   may have bugs in that support.  This kept coming up with HP's acc,
   which would emit its equivalent of an ICE on a.b |= x when a.b was
   _Bool.

3) If the bootstrap compiler does *not* support bool/_Bool as a native
   type, then we fall back to unsigned char/int -- at which point code
   that expects the semantics of bool/_Bool breaks.

For these reasons I do not want 'bool' to designate a true boolean
type in GCC's source code, even when being compiled by a C++ compiler.
It's just a note to human readers.

(I'd also like to add that for the foreseeable future, pre-commit
testing should be done with a C compiler, lest you accidentally use a
C++ feature.)

zw


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