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 //===----------------------------------------------------------------------===// 8 9 // Test that headers are not tripped up by the surrounding code defining the 10 // min() and max() macros. 11 12 // The system-provided <uchar.h> seems to be broken on AIX 13 // XFAIL: LIBCXX-AIX-FIXME 14 15 // Prevent <ext/hash_map> from generating deprecated warnings for this test. 16 #if defined(__DEPRECATED) 17 # undef __DEPRECATED 18 #endif 19 20 #define TEST_MACROS() static_assert(min() == true && max() == true, "") 21 #define min() true 22 #define max() true 23 24 /* 25 BEGIN-SCRIPT 26 27 for header in public_headers: 28 print("{}#{}include <{}>\nTEST_MACROS();{}".format( 29 '#if ' + header_restrictions[header] + '\n' if header in header_restrictions else '', 30 3 * ' ' if header in header_restrictions else '', 31 header, 32 '\n#endif' if header in header_restrictions else '' 33 )) 34 35 END-SCRIPT 36 */ 37 38 // DO NOT MANUALLY EDIT ANYTHING BETWEEN THE MARKERS BELOW 39 // GENERATED-MARKER 40 #include <algorithm> 41 TEST_MACROS(); 42 #include <any> 43 TEST_MACROS(); 44 #include <array> 45 TEST_MACROS(); 46 #include <atomic> 47 TEST_MACROS(); 48 #if !defined(_LIBCPP_HAS_NO_THREADS) 49 # include <barrier> 50 TEST_MACROS(); 51 #endif 52 #include <bit> 53 TEST_MACROS(); 54 #include <bitset> 55 TEST_MACROS(); 56 #include <cassert> 57 TEST_MACROS(); 58 #include <ccomplex> 59 TEST_MACROS(); 60 #include <cctype> 61 TEST_MACROS(); 62 #include <cerrno> 63 TEST_MACROS(); 64 #include <cfenv> 65 TEST_MACROS(); 66 #include <cfloat> 67 TEST_MACROS(); 68 #include <charconv> 69 TEST_MACROS(); 70 #include <chrono> 71 TEST_MACROS(); 72 #include <cinttypes> 73 TEST_MACROS(); 74 #include <ciso646> 75 TEST_MACROS(); 76 #include <climits> 77 TEST_MACROS(); 78 #if !defined(_LIBCPP_HAS_NO_LOCALIZATION) 79 # include <clocale> 80 TEST_MACROS(); 81 #endif 82 #include <cmath> 83 TEST_MACROS(); 84 #if !defined(_LIBCPP_HAS_NO_LOCALIZATION) 85 # include <codecvt> 86 TEST_MACROS(); 87 #endif 88 #include <compare> 89 TEST_MACROS(); 90 #include <complex> 91 TEST_MACROS(); 92 #include <complex.h> 93 TEST_MACROS(); 94 #include <concepts> 95 TEST_MACROS(); 96 #include <condition_variable> 97 TEST_MACROS(); 98 #include <coroutine> 99 TEST_MACROS(); 100 #include <csetjmp> 101 TEST_MACROS(); 102 #include <csignal> 103 TEST_MACROS(); 104 #include <cstdarg> 105 TEST_MACROS(); 106 #include <cstdbool> 107 TEST_MACROS(); 108 #include <cstddef> 109 TEST_MACROS(); 110 #include <cstdint> 111 TEST_MACROS(); 112 #include <cstdio> 113 TEST_MACROS(); 114 #include <cstdlib> 115 TEST_MACROS(); 116 #include <cstring> 117 TEST_MACROS(); 118 #include <ctgmath> 119 TEST_MACROS(); 120 #include <ctime> 121 TEST_MACROS(); 122 #include <ctype.h> 123 TEST_MACROS(); 124 #include <cuchar> 125 TEST_MACROS(); 126 #if !defined(_LIBCPP_HAS_NO_WIDE_CHARACTERS) 127 # include <cwchar> 128 TEST_MACROS(); 129 #endif 130 #if !defined(_LIBCPP_HAS_NO_WIDE_CHARACTERS) 131 # include <cwctype> 132 TEST_MACROS(); 133 #endif 134 #include <deque> 135 TEST_MACROS(); 136 #include <errno.h> 137 TEST_MACROS(); 138 #include <exception> 139 TEST_MACROS(); 140 #include <execution> 141 TEST_MACROS(); 142 #include <fenv.h> 143 TEST_MACROS(); 144 #if !defined(_LIBCPP_HAS_NO_FILESYSTEM_LIBRARY) 145 # include <filesystem> 146 TEST_MACROS(); 147 #endif 148 #include <float.h> 149 TEST_MACROS(); 150 #include <format> 151 TEST_MACROS(); 152 #include <forward_list> 153 TEST_MACROS(); 154 #if !defined(_LIBCPP_HAS_NO_LOCALIZATION) 155 # include <fstream> 156 TEST_MACROS(); 157 #endif 158 #include <functional> 159 TEST_MACROS(); 160 #if !defined(_LIBCPP_HAS_NO_THREADS) 161 # include <future> 162 TEST_MACROS(); 163 #endif 164 #include <initializer_list> 165 TEST_MACROS(); 166 #include <inttypes.h> 167 TEST_MACROS(); 168 #if !defined(_LIBCPP_HAS_NO_LOCALIZATION) 169 # include <iomanip> 170 TEST_MACROS(); 171 #endif 172 #if !defined(_LIBCPP_HAS_NO_LOCALIZATION) 173 # include <ios> 174 TEST_MACROS(); 175 #endif 176 #include <iosfwd> 177 TEST_MACROS(); 178 #if !defined(_LIBCPP_HAS_NO_LOCALIZATION) 179 # include <iostream> 180 TEST_MACROS(); 181 #endif 182 #if !defined(_LIBCPP_HAS_NO_LOCALIZATION) 183 # include <istream> 184 TEST_MACROS(); 185 #endif 186 #include <iterator> 187 TEST_MACROS(); 188 #if !defined(_LIBCPP_HAS_NO_THREADS) 189 # include <latch> 190 TEST_MACROS(); 191 #endif 192 #include <limits> 193 TEST_MACROS(); 194 #include <limits.h> 195 TEST_MACROS(); 196 #include <list> 197 TEST_MACROS(); 198 #if !defined(_LIBCPP_HAS_NO_LOCALIZATION) 199 # include <locale> 200 TEST_MACROS(); 201 #endif 202 #if !defined(_LIBCPP_HAS_NO_LOCALIZATION) 203 # include <locale.h> 204 TEST_MACROS(); 205 #endif 206 #include <map> 207 TEST_MACROS(); 208 #include <math.h> 209 TEST_MACROS(); 210 #include <memory> 211 TEST_MACROS(); 212 #if !defined(_LIBCPP_HAS_NO_THREADS) 213 # include <mutex> 214 TEST_MACROS(); 215 #endif 216 #include <new> 217 TEST_MACROS(); 218 #include <numbers> 219 TEST_MACROS(); 220 #include <numeric> 221 TEST_MACROS(); 222 #include <optional> 223 TEST_MACROS(); 224 #if !defined(_LIBCPP_HAS_NO_LOCALIZATION) 225 # include <ostream> 226 TEST_MACROS(); 227 #endif 228 #include <queue> 229 TEST_MACROS(); 230 #include <random> 231 TEST_MACROS(); 232 #include <ranges> 233 TEST_MACROS(); 234 #include <ratio> 235 TEST_MACROS(); 236 #if !defined(_LIBCPP_HAS_NO_LOCALIZATION) 237 # include <regex> 238 TEST_MACROS(); 239 #endif 240 #include <scoped_allocator> 241 TEST_MACROS(); 242 #if !defined(_LIBCPP_HAS_NO_THREADS) 243 # include <semaphore> 244 TEST_MACROS(); 245 #endif 246 #include <set> 247 TEST_MACROS(); 248 #include <setjmp.h> 249 TEST_MACROS(); 250 #if !defined(_LIBCPP_HAS_NO_THREADS) 251 # include <shared_mutex> 252 TEST_MACROS(); 253 #endif 254 #include <span> 255 TEST_MACROS(); 256 #if !defined(_LIBCPP_HAS_NO_LOCALIZATION) 257 # include <sstream> 258 TEST_MACROS(); 259 #endif 260 #include <stack> 261 TEST_MACROS(); 262 #if __cplusplus > 202002L && !defined(_LIBCPP_HAS_NO_THREADS) 263 # include <stdatomic.h> 264 TEST_MACROS(); 265 #endif 266 #include <stdbool.h> 267 TEST_MACROS(); 268 #include <stddef.h> 269 TEST_MACROS(); 270 #include <stdexcept> 271 TEST_MACROS(); 272 #include <stdint.h> 273 TEST_MACROS(); 274 #include <stdio.h> 275 TEST_MACROS(); 276 #include <stdlib.h> 277 TEST_MACROS(); 278 #if !defined(_LIBCPP_HAS_NO_LOCALIZATION) 279 # include <streambuf> 280 TEST_MACROS(); 281 #endif 282 #include <string> 283 TEST_MACROS(); 284 #include <string.h> 285 TEST_MACROS(); 286 #include <string_view> 287 TEST_MACROS(); 288 #if !defined(_LIBCPP_HAS_NO_LOCALIZATION) 289 # include <strstream> 290 TEST_MACROS(); 291 #endif 292 #include <system_error> 293 TEST_MACROS(); 294 #include <tgmath.h> 295 TEST_MACROS(); 296 #if !defined(_LIBCPP_HAS_NO_THREADS) 297 # include <thread> 298 TEST_MACROS(); 299 #endif 300 #include <tuple> 301 TEST_MACROS(); 302 #include <type_traits> 303 TEST_MACROS(); 304 #include <typeindex> 305 TEST_MACROS(); 306 #include <typeinfo> 307 TEST_MACROS(); 308 #include <uchar.h> 309 TEST_MACROS(); 310 #include <unordered_map> 311 TEST_MACROS(); 312 #include <unordered_set> 313 TEST_MACROS(); 314 #include <utility> 315 TEST_MACROS(); 316 #include <valarray> 317 TEST_MACROS(); 318 #include <variant> 319 TEST_MACROS(); 320 #include <vector> 321 TEST_MACROS(); 322 #include <version> 323 TEST_MACROS(); 324 #if !defined(_LIBCPP_HAS_NO_WIDE_CHARACTERS) 325 # include <wchar.h> 326 TEST_MACROS(); 327 #endif 328 #if !defined(_LIBCPP_HAS_NO_WIDE_CHARACTERS) 329 # include <wctype.h> 330 TEST_MACROS(); 331 #endif 332 #if __cplusplus >= 201103L 333 # include <experimental/algorithm> 334 TEST_MACROS(); 335 #endif 336 #if __cplusplus >= 201103L && !defined(_LIBCPP_HAS_NO_EXPERIMENTAL_COROUTINES) 337 # include <experimental/coroutine> 338 TEST_MACROS(); 339 #endif 340 #if __cplusplus >= 201103L 341 # include <experimental/deque> 342 TEST_MACROS(); 343 #endif 344 #if __cplusplus >= 201103L 345 # include <experimental/forward_list> 346 TEST_MACROS(); 347 #endif 348 #if __cplusplus >= 201103L 349 # include <experimental/functional> 350 TEST_MACROS(); 351 #endif 352 #if __cplusplus >= 201103L 353 # include <experimental/iterator> 354 TEST_MACROS(); 355 #endif 356 #if __cplusplus >= 201103L 357 # include <experimental/list> 358 TEST_MACROS(); 359 #endif 360 #if __cplusplus >= 201103L 361 # include <experimental/map> 362 TEST_MACROS(); 363 #endif 364 #if __cplusplus >= 201103L 365 # include <experimental/memory_resource> 366 TEST_MACROS(); 367 #endif 368 #if __cplusplus >= 201103L 369 # include <experimental/propagate_const> 370 TEST_MACROS(); 371 #endif 372 #if !defined(_LIBCPP_HAS_NO_LOCALIZATION) && __cplusplus >= 201103L 373 # include <experimental/regex> 374 TEST_MACROS(); 375 #endif 376 #if __cplusplus >= 201103L 377 # include <experimental/set> 378 TEST_MACROS(); 379 #endif 380 #if __cplusplus >= 201103L 381 # include <experimental/simd> 382 TEST_MACROS(); 383 #endif 384 #if __cplusplus >= 201103L 385 # include <experimental/string> 386 TEST_MACROS(); 387 #endif 388 #if __cplusplus >= 201103L 389 # include <experimental/type_traits> 390 TEST_MACROS(); 391 #endif 392 #if __cplusplus >= 201103L 393 # include <experimental/unordered_map> 394 TEST_MACROS(); 395 #endif 396 #if __cplusplus >= 201103L 397 # include <experimental/unordered_set> 398 TEST_MACROS(); 399 #endif 400 #if __cplusplus >= 201103L 401 # include <experimental/utility> 402 TEST_MACROS(); 403 #endif 404 #if __cplusplus >= 201103L 405 # include <experimental/vector> 406 TEST_MACROS(); 407 #endif 408 #include <ext/hash_map> 409 TEST_MACROS(); 410 #include <ext/hash_set> 411 TEST_MACROS(); 412 // GENERATED-MARKER 413