PR tree-optimization/83369 - Missing diagnostics during inlining
[official-gcc.git] / gcc / testsuite / gcc.dg / limits-width-1.c
blob7a87014526cc5117992bc8d0253e993a0eb45900
1 /* Test TS 18661-1 width macros in <limits.h>. */
2 /* { dg-do compile } */
3 /* { dg-options "-std=c11" } */
5 #define __STDC_WANT_IEC_60559_BFP_EXT__
6 #include <limits.h>
8 #define CHECK_WIDTH(TYPE, MAX, WIDTH) \
9 _Static_assert ((MAX >> ((TYPE) -1 < 0 ? (WIDTH - 2) : (WIDTH - 1))) == 1, \
10 "width must match type")
12 #ifndef CHAR_WIDTH
13 # error "missing CHAR_WIDTH"
14 #endif
15 CHECK_WIDTH (char, CHAR_MAX, CHAR_WIDTH);
16 #ifndef SCHAR_WIDTH
17 # error "missing SCHAR_WIDTH"
18 #endif
19 CHECK_WIDTH (signed char, SCHAR_MAX, SCHAR_WIDTH);
20 #ifndef UCHAR_WIDTH
21 # error "missing UCHAR_WIDTH"
22 #endif
23 CHECK_WIDTH (unsigned char, UCHAR_MAX, UCHAR_WIDTH);
24 #ifndef SHRT_WIDTH
25 # error "missing SHRT_WIDTH"
26 #endif
27 CHECK_WIDTH (signed short, SHRT_MAX, SHRT_WIDTH);
28 #ifndef USHRT_WIDTH
29 # error "missing USHRT_WIDTH"
30 #endif
31 CHECK_WIDTH (unsigned short, USHRT_MAX, USHRT_WIDTH);
32 #ifndef INT_WIDTH
33 # error "missing INT_WIDTH"
34 #endif
35 CHECK_WIDTH (signed int, INT_MAX, INT_WIDTH);
36 #ifndef UINT_WIDTH
37 # error "missing UINT_WIDTH"
38 #endif
39 CHECK_WIDTH (unsigned int, UINT_MAX, UINT_WIDTH);
40 #ifndef LONG_WIDTH
41 # error "missing LONG_WIDTH"
42 #endif
43 CHECK_WIDTH (signed long, LONG_MAX, LONG_WIDTH);
44 #ifndef ULONG_WIDTH
45 # error "missing ULONG_WIDTH"
46 #endif
47 CHECK_WIDTH (unsigned long, ULONG_MAX, ULONG_WIDTH);
48 #ifndef LLONG_WIDTH
49 # error "missing LLONG_WIDTH"
50 #endif
51 CHECK_WIDTH (signed long long, LLONG_MAX, LLONG_WIDTH);
52 #ifndef ULLONG_WIDTH
53 # error "missing ULLONG_WIDTH"
54 #endif
55 CHECK_WIDTH (unsigned long long, ULLONG_MAX, ULLONG_WIDTH);