blob: 2525363dd02a57dd5cf4cbb7a19b93bb408a8707 [file] [log] [blame]
Eli Friedman0c2f26dd2008-02-28 19:45:29 +00001/*===---- stdbool.h - Standard header for booleans -------------------------===
2 *
Chandler Carruth4cf57432019-04-08 20:51:30 +00003 * Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
4 * See https://llvm.org/LICENSE.txt for license information.
5 * SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
Eli Friedman0c2f26dd2008-02-28 19:45:29 +00006 *
7 *===-----------------------------------------------------------------------===
8 */
9
10#ifndef __STDBOOL_H
11#define __STDBOOL_H
12
Douglas Gregor1f7d02f2010-09-29 04:57:11 +000013/* Don't define bool, true, and false in C++, except as a GNU extension. */
Eli Friedman0c2f26dd2008-02-28 19:45:29 +000014#ifndef __cplusplus
15#define bool _Bool
16#define true 1
17#define false 0
Douglas Gregor1f7d02f2010-09-29 04:57:11 +000018#elif defined(__GNUC__) && !defined(__STRICT_ANSI__)
Stephan Bergmannfeed26f2017-12-08 08:28:08 +000019/* Define _Bool as a GNU extension. */
Douglas Gregor1f7d02f2010-09-29 04:57:11 +000020#define _Bool bool
Stephan Bergmannfeed26f2017-12-08 08:28:08 +000021#if __cplusplus < 201103L
22/* For C++98, define bool, false, true as a GNU extension. */
Douglas Gregor1f7d02f2010-09-29 04:57:11 +000023#define bool bool
24#define false false
25#define true true
Eli Friedman0c2f26dd2008-02-28 19:45:29 +000026#endif
Stephan Bergmannfeed26f2017-12-08 08:28:08 +000027#endif
Eli Friedman0c2f26dd2008-02-28 19:45:29 +000028
29#define __bool_true_false_are_defined 1
30
31#endif /* __STDBOOL_H */