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: [RFA] Move cpplib to the toplevel


Yes the IA64 C++ ABI says that sizeof(bool) should equal to
1.  But Apple did not want to break backward compatibility
with code written before the ABI was written so they kept
the sizeof(bool) and sizeof(_Bool) to equal to 4 instead
of 1 like the ABI.  So powerpc-apple-darwin does not follow
the IA64 C++ ABI to the wire but instead is modified version
of it with only the sizeof(bool) being different.

Ah, ok.


But there's a more important reason to discard such a sizeof (bool): the bool/_Bool that is detected by ACX_HEADER_STDBOOL *really* must match whatever is used as a default by system.h, in this case a char. Otherwise, this will cause problems for example with toplevel bootstrap: you start with a compiler that has no stdbool.h and no _Bool, so stage1/libiberty/libcpp/libbanshee will use a 1-byte bool on Darwin, while stage2 will happily use the 4-byte builtin _Bool.

This is the same problem that (with gcc configured just once) occurs with runtime libraries, see http://gcc.gnu.org/ml/gcc/2004-03/msg01219.html (Darwin's saveFP/restFP).

I think that replacing bool with char is a bad thing because it will lead to subtle bugs one day or another. But if we are to emulate bool, well, we should do it well and ensure that we ever use a non-emulated bool only if it is the same as the emulated one.

Paolo


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