> Is there any point in the #include_next, even? I think so. If stdbool.h may provide extensions/additional definitions (ex "#define _Bool"). I don't want to manage these within libc++ and I don't want to prevent users from getting them from the actual header.
Although upon further inspection "_Bool" is the only additional definition libc++ would have to provide for both GCC and Clang. 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. /Eric On Fri, Feb 19, 2016 at 5:31 PM, Richard Smith <rich...@metafoo.co.uk> wrote: > On Fri, Feb 19, 2016 at 4:16 PM, Eric Fiselier via cfe-commits > <cfe-commits@lists.llvm.org> wrote: > > Author: ericwf > > Date: Fri Feb 19 18:16:41 2016 > > New Revision: 261381 > > > > URL: http://llvm.org/viewvc/llvm-project?rev=261381&view=rev > > Log: > > Add stdbool.h wrapper for libc++ > > > > Summary: > > 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`. > > > > Clang defines the macros whenever `__STRICT_ANSI__` isn't defined (ie > `-std=gnu++11`). > > New GCC versions define the macros in C++03 mode only, older GCC > versions (4.9 and before) always define the macros. > > > > This patch adds a wrapper header for `stdbool.h` that undefs the > required macros. > > > > Reviewers: mclow.lists, rsmith, EricWF > > > > Subscribers: cfe-commits > > > > Differential Revision: http://reviews.llvm.org/D16346 > > > > Added: > > libcxx/trunk/include/stdbool.h > > > > Added: libcxx/trunk/include/stdbool.h > > URL: > http://llvm.org/viewvc/llvm-project/libcxx/trunk/include/stdbool.h?rev=261381&view=auto > > > ============================================================================== > > --- libcxx/trunk/include/stdbool.h (added) > > +++ libcxx/trunk/include/stdbool.h Fri Feb 19 18:16:41 2016 > > @@ -0,0 +1,39 @@ > > +// -*- C++ -*- > > +//===--------------------------- stdbool.h > --------------------------------===// > > +// > > +// The LLVM Compiler Infrastructure > > +// > > +// This file is dual licensed under the MIT and the University of > Illinois Open > > +// Source Licenses. See LICENSE.TXT for details. > > +// > > > +//===----------------------------------------------------------------------===// > > +#ifndef _LIBCPP_STDBOOL_H > > +#define _LIBCPP_STDBOOL_H > > + > > + > > +/* > > + stdbool.h synopsis > > + > > +Macros: > > + > > + __bool_true_false_are_defined > > + > > +*/ > > + > > +#include <__config> > > + > > +#if !defined(_LIBCPP_HAS_NO_PRAGMA_SYSTEM_HEADER) > > +#pragma GCC system_header > > +#endif > > + > > +#include_next <stdbool.h> > > Is there any point in the #include_next, even? As an alternative: > > #ifdef __cplusplus > #undef __bool_true_false_are_defined > #define __bool_true_false_are_defined 1 > #else > #include_next <stdbool.h> > #endif > > > +#ifdef __cplusplus > > +#undef bool > > +#undef true > > +#undef false > > +#undef __bool_true_false_are_defined > > +#define __bool_true_false_are_defined 1 > > +#endif > > + > > +#endif // _LIBCPP_STDBOOL_H > > > > > > _______________________________________________ > > cfe-commits mailing list > > cfe-commits@lists.llvm.org > > http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits >
_______________________________________________ cfe-commits mailing list cfe-commits@lists.llvm.org http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits