gcc/testsuite/gcc.dg/c23-bool-limits-1.c
raw| 1 | /* Test limits for _Bool in <limits.h> in C23. */ |
| 2 | /* { dg-do compile } */ |
| 3 | /* { dg-options "-std=c23" } */ |
| 4 | |
| 5 | #include <limits.h> |
| 6 | |
| 7 | #ifndef BOOL_MAX |
| 8 | # error "missing BOOL_MAX" |
| 9 | #endif |
| 10 | |
| 11 | #ifndef BOOL_WIDTH |
| 12 | # error "missing BOOL_WIDTH" |
| 13 | #endif |
| 14 | |
| 15 | /* In principle _Bool can support values wider than 1 bit, stored via |
| 16 | type punning, but this is not supported by GCC. */ |
| 17 | |
| 18 | _Static_assert (BOOL_MAX == 1, "bad BOOL_MAX"); |
| 19 | _Static_assert (BOOL_WIDTH == 1, "bad BOOL_WIDTH"); |