diff options
author | Eric Fiselier <eric@efcs.ca> | 2016-02-20 00:16:41 +0000 |
---|---|---|
committer | Eric Fiselier <eric@efcs.ca> | 2016-02-20 00:16:41 +0000 |
commit | a6b7ebe2cd3b1cc95a195ebc6e4cfdd1584b415e (patch) | |
tree | b1c8e3e24eb45586d590394aef132ff72c334766 | |
parent | 344078f51fcd0a63e3e37692d42914ea5fafb098 (diff) | |
download | llvm-a6b7ebe2cd3b1cc95a195ebc6e4cfdd1584b415e.zip llvm-a6b7ebe2cd3b1cc95a195ebc6e4cfdd1584b415e.tar.gz llvm-a6b7ebe2cd3b1cc95a195ebc6e4cfdd1584b415e.tar.bz2 |
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
llvm-svn: 261381
-rw-r--r-- | libcxx/include/stdbool.h | 39 |
1 files changed, 39 insertions, 0 deletions
diff --git a/libcxx/include/stdbool.h b/libcxx/include/stdbool.h new file mode 100644 index 0000000..86a127f --- /dev/null +++ b/libcxx/include/stdbool.h @@ -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> + +#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 |