mirror of
https://github.com/llvm-mirror/libcxx.git
synced 2025-10-22 16:37:40 +08:00
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 git-svn-id: https://llvm.org/svn/llvm-project/libcxx/trunk@261381 91177308-0d34-0410-b5e6-96231b3b80d8
This commit is contained in:
39
include/stdbool.h
Normal file
39
include/stdbool.h
Normal file
@@ -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
|
Reference in New Issue
Block a user