| 1 |
// RUN: %clang_cc1 -verify -std=c23 -ffreestanding %s |
| 2 |
|
| 3 |
/* WG14 N2412: Clang 14 |
| 4 |
* Two's complement sign representation |
| 5 |
*/ |
| 6 |
// expected-no-diagnostics |
| 7 |
|
| 8 |
#include <limits.h> |
| 9 |
|
| 10 |
// GH117348 -- BOOL_WIDTH was accidentally expanding to the number of bits in |
| 11 |
// the object representation (8) rather than the number of bits in the value |
| 12 |
// representation (1). |
| 13 |
static_assert(BOOL_WIDTH == 1); |
| 14 |
|
| 15 |
// Validate the other macro requirements. |
| 16 |
static_assert(CHAR_WIDTH == SCHAR_WIDTH); |
| 17 |
static_assert(CHAR_WIDTH == UCHAR_WIDTH); |
| 18 |
static_assert(CHAR_WIDTH == CHAR_BIT); |
| 19 |
|
| 20 |
static_assert(USHRT_WIDTH >= 16); |
| 21 |
static_assert(UINT_WIDTH >= 16); |
| 22 |
static_assert(ULONG_WIDTH >= 32); |
| 23 |
static_assert(ULLONG_WIDTH >= 64); |
| 24 |
static_assert(BITINT_MAXWIDTH >= ULLONG_WIDTH); |
| 25 |
|
| 26 |
static_assert(MB_LEN_MAX >= 1); |
| 27 |
|