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: [patch] <stdbool.h> should not define bool, true or false as macros for C++


I've just seen Richard's status email, so I guess this should wait for 4.8


On 9 January 2012 08:48, Jonathan Wakely wrote:
> GCC's implementation of <stdbool.h> is not valid for C++11 because
> [support.runtime] p8 says "The header <cstdbool> and the header
> <stdbool.h> shall not deïne macros named bool, true, or false."
>
> This patch adds a libstdc++ test for that requirement and adjusts
> stdbool.h to meet it. ÂI've left _Bool defined in C++ as a GNU
> extension.
>
> It's conceivable someone is relying on these macros being defined in
> C++, in which case we could only define them when __cplusplus <
> 201103L, but IMHO it's better to not define them at all.
>
> Tested x86_64-linux, OK for trunk?
>
> gcc/
> Â Â Â Â* ginclude/stdbool.h (true, false, bool): Do not define for C++.
>
> libstdc++/
> Â Â Â Â* testsuite/18_support/headers/cstdbool/macros.cc: New.


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