[RISCV] Fix mgather -> riscv.masked.strided.load combine not extending indices (...
[llvm-project.git] / libcxx / test / std / depr / depr.c.headers / stdint_h.pass.cpp
blob080efcd4fb3e3eb5a002a488806f4b2e96d35dfb
1 //===----------------------------------------------------------------------===//
2 //
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
6 //
7 //===----------------------------------------------------------------------===//
9 // test <stdint.h>
11 #include <stdint.h>
13 void use() {
14 // Make sure we can use the following types without including anything else
15 (void)sizeof(int8_t);
16 (void)sizeof(int16_t);
17 (void)sizeof(int32_t);
18 (void)sizeof(int64_t);
20 (void)sizeof(uint8_t);
21 (void)sizeof(uint16_t);
22 (void)sizeof(uint32_t);
23 (void)sizeof(uint64_t);
25 (void)sizeof(int_least8_t);
26 (void)sizeof(int_least16_t);
27 (void)sizeof(int_least32_t);
28 (void)sizeof(int_least64_t);
30 (void)sizeof(uint_least8_t);
31 (void)sizeof(uint_least16_t);
32 (void)sizeof(uint_least32_t);
33 (void)sizeof(uint_least64_t);
35 (void)sizeof(int_fast8_t);
36 (void)sizeof(int_fast16_t);
37 (void)sizeof(int_fast32_t);
38 (void)sizeof(int_fast64_t);
40 (void)sizeof(uint_fast8_t);
41 (void)sizeof(uint_fast16_t);
42 (void)sizeof(uint_fast32_t);
43 (void)sizeof(uint_fast64_t);
45 (void)sizeof(intptr_t);
46 (void)sizeof(uintptr_t);
47 (void)sizeof(intmax_t);
48 (void)sizeof(uintmax_t);
51 #include <cstddef>
52 #include <csignal>
53 #include <climits>
54 #include <type_traits>
55 #include <limits>
56 #include <cassert>
58 #include "test_macros.h"
60 #ifndef TEST_HAS_NO_WIDE_CHARACTERS
61 # include <cwctype>
62 #endif
64 int main(int, char**) {
65 // typedef int8_t
66 static_assert(sizeof(int8_t)*CHAR_BIT == 8, "");
67 static_assert(std::is_signed<int8_t>::value, "");
68 // typedef int16_t
69 static_assert(sizeof(int16_t)*CHAR_BIT == 16, "");
70 static_assert(std::is_signed<int16_t>::value, "");
71 // typedef int32_t
72 static_assert(sizeof(int32_t)*CHAR_BIT == 32, "");
73 static_assert(std::is_signed<int32_t>::value, "");
74 // typedef int64_t
75 static_assert(sizeof(int64_t)*CHAR_BIT == 64, "");
76 static_assert(std::is_signed<int64_t>::value, "");
78 // typedef uint8_t
79 static_assert(sizeof(uint8_t)*CHAR_BIT == 8, "");
80 static_assert(std::is_unsigned<uint8_t>::value, "");
81 // typedef uint16_t
82 static_assert(sizeof(uint16_t)*CHAR_BIT == 16, "");
83 static_assert(std::is_unsigned<uint16_t>::value, "");
84 // typedef uint32_t
85 static_assert(sizeof(uint32_t)*CHAR_BIT == 32, "");
86 static_assert(std::is_unsigned<uint32_t>::value, "");
87 // typedef uint64_t
88 static_assert(sizeof(uint64_t)*CHAR_BIT == 64, "");
89 static_assert(std::is_unsigned<uint64_t>::value, "");
91 // typedef int_least8_t
92 static_assert(sizeof(int_least8_t)*CHAR_BIT >= 8, "");
93 static_assert(std::is_signed<int_least8_t>::value, "");
94 // typedef int_least16_t
95 static_assert(sizeof(int_least16_t)*CHAR_BIT >= 16, "");
96 static_assert(std::is_signed<int_least16_t>::value, "");
97 // typedef int_least32_t
98 static_assert(sizeof(int_least32_t)*CHAR_BIT >= 32, "");
99 static_assert(std::is_signed<int_least32_t>::value, "");
100 // typedef int_least64_t
101 static_assert(sizeof(int_least64_t)*CHAR_BIT >= 64, "");
102 static_assert(std::is_signed<int_least64_t>::value, "");
104 // typedef uint_least8_t
105 static_assert(sizeof(uint_least8_t)*CHAR_BIT >= 8, "");
106 static_assert(std::is_unsigned<uint_least8_t>::value, "");
107 // typedef uint_least16_t
108 static_assert(sizeof(uint_least16_t)*CHAR_BIT >= 16, "");
109 static_assert(std::is_unsigned<uint_least16_t>::value, "");
110 // typedef uint_least32_t
111 static_assert(sizeof(uint_least32_t)*CHAR_BIT >= 32, "");
112 static_assert(std::is_unsigned<uint_least32_t>::value, "");
113 // typedef uint_least64_t
114 static_assert(sizeof(uint_least64_t)*CHAR_BIT >= 64, "");
115 static_assert(std::is_unsigned<uint_least64_t>::value, "");
117 // typedef int_fast8_t
118 static_assert(sizeof(int_fast8_t)*CHAR_BIT >= 8, "");
119 static_assert(std::is_signed<int_fast8_t>::value, "");
120 // typedef int_fast16_t
121 static_assert(sizeof(int_fast16_t)*CHAR_BIT >= 16, "");
122 static_assert(std::is_signed<int_fast16_t>::value, "");
123 // typedef int_fast32_t
124 static_assert(sizeof(int_fast32_t)*CHAR_BIT >= 32, "");
125 static_assert(std::is_signed<int_fast32_t>::value, "");
126 // typedef int_fast64_t
127 static_assert(sizeof(int_fast64_t)*CHAR_BIT >= 64, "");
128 static_assert(std::is_signed<int_fast64_t>::value, "");
130 // typedef uint_fast8_t
131 static_assert(sizeof(uint_fast8_t)*CHAR_BIT >= 8, "");
132 static_assert(std::is_unsigned<uint_fast8_t>::value, "");
133 // typedef uint_fast16_t
134 static_assert(sizeof(uint_fast16_t)*CHAR_BIT >= 16, "");
135 static_assert(std::is_unsigned<uint_fast16_t>::value, "");
136 // typedef uint_fast32_t
137 static_assert(sizeof(uint_fast32_t)*CHAR_BIT >= 32, "");
138 static_assert(std::is_unsigned<uint_fast32_t>::value, "");
139 // typedef uint_fast64_t
140 static_assert(sizeof(uint_fast64_t)*CHAR_BIT >= 64, "");
141 static_assert(std::is_unsigned<uint_fast64_t>::value, "");
143 // typedef intptr_t
144 static_assert(sizeof(intptr_t) >= sizeof(void*), "");
145 static_assert(std::is_signed<intptr_t>::value, "");
146 // typedef uintptr_t
147 static_assert(sizeof(uintptr_t) >= sizeof(void*), "");
148 static_assert(std::is_unsigned<uintptr_t>::value, "");
150 // typedef intmax_t
151 static_assert(sizeof(intmax_t) >= sizeof(long long), "");
152 static_assert(std::is_signed<intmax_t>::value, "");
153 // typedef uintmax_t
154 static_assert(sizeof(uintmax_t) >= sizeof(unsigned long long), "");
155 static_assert(std::is_unsigned<uintmax_t>::value, "");
157 // INTN_MIN
158 static_assert(INT8_MIN == -128, "");
159 static_assert(INT16_MIN == -32768, "");
160 static_assert(INT32_MIN == -2147483647 - 1, "");
161 static_assert(INT64_MIN == -9223372036854775807LL - 1, "");
163 // INTN_MAX
164 static_assert(INT8_MAX == 127, "");
165 static_assert(INT16_MAX == 32767, "");
166 static_assert(INT32_MAX == 2147483647, "");
167 static_assert(INT64_MAX == 9223372036854775807LL, "");
169 // UINTN_MAX
170 static_assert(UINT8_MAX == 255, "");
171 static_assert(UINT16_MAX == 65535, "");
172 static_assert(UINT32_MAX == 4294967295U, "");
173 static_assert(UINT64_MAX == 18446744073709551615ULL, "");
175 // INT_FASTN_MIN
176 static_assert(INT_FAST8_MIN <= -128, "");
177 static_assert(INT_FAST16_MIN <= -32768, "");
178 static_assert(INT_FAST32_MIN <= -2147483647 - 1, "");
179 static_assert(INT_FAST64_MIN <= -9223372036854775807LL - 1, "");
181 // INT_FASTN_MAX
182 static_assert(INT_FAST8_MAX >= 127, "");
183 static_assert(INT_FAST16_MAX >= 32767, "");
184 static_assert(INT_FAST32_MAX >= 2147483647, "");
185 static_assert(INT_FAST64_MAX >= 9223372036854775807LL, "");
187 // UINT_FASTN_MAX
188 static_assert(UINT_FAST8_MAX >= 255, "");
189 static_assert(UINT_FAST16_MAX >= 65535, "");
190 static_assert(UINT_FAST32_MAX >= 4294967295U, "");
191 static_assert(UINT_FAST64_MAX >= 18446744073709551615ULL, "");
193 // INTPTR_MIN
194 assert(INTPTR_MIN == std::numeric_limits<intptr_t>::min());
196 // INTPTR_MAX
197 assert(INTPTR_MAX == std::numeric_limits<intptr_t>::max());
199 // UINTPTR_MAX
200 assert(UINTPTR_MAX == std::numeric_limits<uintptr_t>::max());
202 // INTMAX_MIN
203 assert(INTMAX_MIN == std::numeric_limits<intmax_t>::min());
205 // INTMAX_MAX
206 assert(INTMAX_MAX == std::numeric_limits<intmax_t>::max());
208 // UINTMAX_MAX
209 assert(UINTMAX_MAX == std::numeric_limits<uintmax_t>::max());
211 // PTRDIFF_MIN
212 assert(PTRDIFF_MIN == std::numeric_limits<std::ptrdiff_t>::min());
214 // PTRDIFF_MAX
215 assert(PTRDIFF_MAX == std::numeric_limits<std::ptrdiff_t>::max());
217 // SIG_ATOMIC_MIN
218 assert(SIG_ATOMIC_MIN == std::numeric_limits<sig_atomic_t>::min());
220 // SIG_ATOMIC_MAX
221 assert(SIG_ATOMIC_MAX == std::numeric_limits<sig_atomic_t>::max());
223 // SIZE_MAX
224 assert(SIZE_MAX == std::numeric_limits<size_t>::max());
226 #ifndef TEST_HAS_NO_WIDE_CHARACTERS
227 // WCHAR_MIN
228 assert(WCHAR_MIN == std::numeric_limits<wchar_t>::min());
230 // WCHAR_MAX
231 assert(WCHAR_MAX == std::numeric_limits<wchar_t>::max());
233 // WINT_MIN
234 assert(WINT_MIN == std::numeric_limits<wint_t>::min());
236 // WINT_MAX
237 assert(WINT_MAX == std::numeric_limits<wint_t>::max());
238 #endif
240 #ifndef INT8_C
241 #error INT8_C not defined
242 #endif
244 #ifndef INT16_C
245 #error INT16_C not defined
246 #endif
248 #ifndef INT32_C
249 #error INT32_C not defined
250 #endif
252 #ifndef INT64_C
253 #error INT64_C not defined
254 #endif
256 #ifndef UINT8_C
257 #error UINT8_C not defined
258 #endif
260 #ifndef UINT16_C
261 #error UINT16_C not defined
262 #endif
264 #ifndef UINT32_C
265 #error UINT32_C not defined
266 #endif
268 #ifndef UINT64_C
269 #error UINT64_C not defined
270 #endif
272 #ifndef INTMAX_C
273 #error INTMAX_C not defined
274 #endif
276 #ifndef UINTMAX_C
277 #error UINTMAX_C not defined
278 #endif
280 return 0;