Eli Friedman | 0c2f26dd | 2008-02-28 19:45:29 +0000 | [diff] [blame] | 1 | /*===---- stdbool.h - Standard header for booleans -------------------------=== |
| 2 | * |
Chandler Carruth | 4cf5743 | 2019-04-08 20:51:30 +0000 | [diff] [blame] | 3 | * 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 Friedman | 0c2f26dd | 2008-02-28 19:45:29 +0000 | [diff] [blame] | 6 | * |
| 7 | *===-----------------------------------------------------------------------=== |
| 8 | */ |
| 9 | |
| 10 | #ifndef __STDBOOL_H |
| 11 | #define __STDBOOL_H |
| 12 | |
Douglas Gregor | 1f7d02f | 2010-09-29 04:57:11 +0000 | [diff] [blame] | 13 | /* Don't define bool, true, and false in C++, except as a GNU extension. */ |
Eli Friedman | 0c2f26dd | 2008-02-28 19:45:29 +0000 | [diff] [blame] | 14 | #ifndef __cplusplus |
| 15 | #define bool _Bool |
| 16 | #define true 1 |
| 17 | #define false 0 |
Douglas Gregor | 1f7d02f | 2010-09-29 04:57:11 +0000 | [diff] [blame] | 18 | #elif defined(__GNUC__) && !defined(__STRICT_ANSI__) |
Stephan Bergmann | feed26f | 2017-12-08 08:28:08 +0000 | [diff] [blame] | 19 | /* Define _Bool as a GNU extension. */ |
Douglas Gregor | 1f7d02f | 2010-09-29 04:57:11 +0000 | [diff] [blame] | 20 | #define _Bool bool |
Stephan Bergmann | feed26f | 2017-12-08 08:28:08 +0000 | [diff] [blame] | 21 | #if __cplusplus < 201103L |
| 22 | /* For C++98, define bool, false, true as a GNU extension. */ |
Douglas Gregor | 1f7d02f | 2010-09-29 04:57:11 +0000 | [diff] [blame] | 23 | #define bool bool |
| 24 | #define false false |
| 25 | #define true true |
Eli Friedman | 0c2f26dd | 2008-02-28 19:45:29 +0000 | [diff] [blame] | 26 | #endif |
Stephan Bergmann | feed26f | 2017-12-08 08:28:08 +0000 | [diff] [blame] | 27 | #endif |
Eli Friedman | 0c2f26dd | 2008-02-28 19:45:29 +0000 | [diff] [blame] | 28 | |
| 29 | #define __bool_true_false_are_defined 1 |
| 30 | |
| 31 | #endif /* __STDBOOL_H */ |