<div dir="ltr"><div>> <span style="font-size:12.8px">Is there any point in the #include_next, even?</span></div><div><br></div><div>I think so. If stdbool.h may provide extensions/additional definitions (ex "#define _Bool"). I don't want</div><div>to manage these within libc++ and I don't want to prevent users from getting them from the actual header.</div><div><br></div><div>Although upon further inspection "_Bool" is the only additional definition libc++ would have to provide for both GCC and Clang.</div><div><br></div><div>I'm not opposed to your suggestion, I just don't want to hijack stdbool.h all together unless I'm really sure it's safe.</div><div><br></div><div>/Eric</div><div><br></div><div><br></div></div><div class="gmail_extra"><br><div class="gmail_quote">On Fri, Feb 19, 2016 at 5:31 PM, Richard Smith <span dir="ltr"><<a href="mailto:richard@metafoo.co.uk" target="_blank">richard@metafoo.co.uk</a>></span> wrote:<br><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex"><div class="HOEnZb"><div class="h5">On Fri, Feb 19, 2016 at 4:16 PM, Eric Fiselier via cfe-commits<br>
<<a href="mailto:cfe-commits@lists.llvm.org">cfe-commits@lists.llvm.org</a>> wrote:<br>
> Author: ericwf<br>
> Date: Fri Feb 19 18:16:41 2016<br>
> New Revision: 261381<br>
><br>
> URL: <a href="http://llvm.org/viewvc/llvm-project?rev=261381&view=rev" rel="noreferrer" target="_blank">http://llvm.org/viewvc/llvm-project?rev=261381&view=rev</a><br>
> Log:<br>
> Add stdbool.h wrapper for libc++<br>
><br>
> Summary:<br>
> According to the C++ standard <stdbool.h> isn't allowed to define `true` `false` or `bool`. However these macros are sometimes defined by the compilers `stdbool.h`.<br>
><br>
> Clang defines the macros whenever `__STRICT_ANSI__` isn't defined (ie `-std=gnu++11`).<br>
> New GCC versions define the macros in C++03 mode only, older GCC versions (4.9 and before) always define the macros.<br>
><br>
> This patch adds a wrapper header for `stdbool.h` that undefs the required macros.<br>
><br>
> Reviewers: mclow.lists, rsmith, EricWF<br>
><br>
> Subscribers: cfe-commits<br>
><br>
> Differential Revision: <a href="http://reviews.llvm.org/D16346" rel="noreferrer" target="_blank">http://reviews.llvm.org/D16346</a><br>
><br>
> Added:<br>
>     libcxx/trunk/include/stdbool.h<br>
><br>
> Added: libcxx/trunk/include/stdbool.h<br>
> URL: <a href="http://llvm.org/viewvc/llvm-project/libcxx/trunk/include/stdbool.h?rev=261381&view=auto" rel="noreferrer" target="_blank">http://llvm.org/viewvc/llvm-project/libcxx/trunk/include/stdbool.h?rev=261381&view=auto</a><br>
> ==============================================================================<br>
> --- libcxx/trunk/include/stdbool.h (added)<br>
> +++ libcxx/trunk/include/stdbool.h Fri Feb 19 18:16:41 2016<br>
> @@ -0,0 +1,39 @@<br>
> +// -*- C++ -*-<br>
> +//===--------------------------- stdbool.h --------------------------------===//<br>
> +//<br>
> +//                     The LLVM Compiler Infrastructure<br>
> +//<br>
> +// This file is dual licensed under the MIT and the University of Illinois Open<br>
> +// Source Licenses. See LICENSE.TXT for details.<br>
> +//<br>
> +//===----------------------------------------------------------------------===//<br>
> +#ifndef _LIBCPP_STDBOOL_H<br>
> +#define _LIBCPP_STDBOOL_H<br>
> +<br>
> +<br>
> +/*<br>
> +    stdbool.h synopsis<br>
> +<br>
> +Macros:<br>
> +<br>
> +    __bool_true_false_are_defined<br>
> +<br>
> +*/<br>
> +<br>
> +#include <__config><br>
> +<br>
> +#if !defined(_LIBCPP_HAS_NO_PRAGMA_SYSTEM_HEADER)<br>
> +#pragma GCC system_header<br>
> +#endif<br>
> +<br>
> +#include_next <stdbool.h><br>
<br>
</div></div>Is there any point in the #include_next, even? As an alternative:<br>
<br>
#ifdef __cplusplus<br>
#undef __bool_true_false_are_defined<br>
#define __bool_true_false_are_defined 1<br>
#else<br>
#include_next <stdbool.h><br>
#endif<br>
<div class="HOEnZb"><div class="h5"><br>
> +#ifdef __cplusplus<br>
> +#undef bool<br>
> +#undef true<br>
> +#undef false<br>
> +#undef __bool_true_false_are_defined<br>
> +#define __bool_true_false_are_defined 1<br>
> +#endif<br>
> +<br>
> +#endif  // _LIBCPP_STDBOOL_H<br>
><br>
><br>
> _______________________________________________<br>
> cfe-commits mailing list<br>
> <a href="mailto:cfe-commits@lists.llvm.org">cfe-commits@lists.llvm.org</a><br>
> <a href="http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits" rel="noreferrer" target="_blank">http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits</a><br>
</div></div></blockquote></div><br></div>