[AMDGPU][AsmParser][NFC] Get rid of custom default operand handlers.
[llvm-project.git] / clang / lib / Headers / stddef.h
blob539541f0ed41afc7497e835d004b7476d783dc7b
1 /*===---- stddef.h - Basic type definitions --------------------------------===
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
7 *===-----------------------------------------------------------------------===
8 */
10 #if !defined(__STDDEF_H) || defined(__need_ptrdiff_t) || \
11 defined(__need_size_t) || defined(__need_wchar_t) || \
12 defined(__need_NULL) || defined(__need_wint_t)
14 #if !defined(__need_ptrdiff_t) && !defined(__need_size_t) && \
15 !defined(__need_wchar_t) && !defined(__need_NULL) && \
16 !defined(__need_wint_t)
17 /* Always define miscellaneous pieces when modules are available. */
18 #if !__has_feature(modules)
19 #define __STDDEF_H
20 #endif
21 #define __need_ptrdiff_t
22 #define __need_size_t
23 #define __need_wchar_t
24 #define __need_NULL
25 #define __need_STDDEF_H_misc
26 /* __need_wint_t is intentionally not defined here. */
27 #endif
29 #if defined(__need_ptrdiff_t)
30 #if !defined(_PTRDIFF_T) || __has_feature(modules)
31 /* Always define ptrdiff_t when modules are available. */
32 #if !__has_feature(modules)
33 #define _PTRDIFF_T
34 #endif
35 typedef __PTRDIFF_TYPE__ ptrdiff_t;
36 #endif
37 #undef __need_ptrdiff_t
38 #endif /* defined(__need_ptrdiff_t) */
40 #if defined(__need_size_t)
41 #if !defined(_SIZE_T) || __has_feature(modules)
42 /* Always define size_t when modules are available. */
43 #if !__has_feature(modules)
44 #define _SIZE_T
45 #endif
46 typedef __SIZE_TYPE__ size_t;
47 #endif
48 #undef __need_size_t
49 #endif /*defined(__need_size_t) */
51 #if defined(__need_STDDEF_H_misc)
52 /* ISO9899:2011 7.20 (C11 Annex K): Define rsize_t if __STDC_WANT_LIB_EXT1__ is
53 * enabled. */
54 #if (defined(__STDC_WANT_LIB_EXT1__) && __STDC_WANT_LIB_EXT1__ >= 1 && \
55 !defined(_RSIZE_T)) || __has_feature(modules)
56 /* Always define rsize_t when modules are available. */
57 #if !__has_feature(modules)
58 #define _RSIZE_T
59 #endif
60 typedef __SIZE_TYPE__ rsize_t;
61 #endif
62 #endif /* defined(__need_STDDEF_H_misc) */
64 #if defined(__need_wchar_t)
65 #if !defined(__cplusplus) || (defined(_MSC_VER) && !_NATIVE_WCHAR_T_DEFINED)
66 /* Always define wchar_t when modules are available. */
67 #if !defined(_WCHAR_T) || __has_feature(modules)
68 #if !__has_feature(modules)
69 #define _WCHAR_T
70 #if defined(_MSC_EXTENSIONS)
71 #define _WCHAR_T_DEFINED
72 #endif
73 #endif
74 typedef __WCHAR_TYPE__ wchar_t;
75 #endif
76 #endif
77 #undef __need_wchar_t
78 #endif /* defined(__need_wchar_t) */
80 #if defined(__need_NULL)
81 #undef NULL
82 #ifdef __cplusplus
83 # if !defined(__MINGW32__) && !defined(_MSC_VER)
84 # define NULL __null
85 # else
86 # define NULL 0
87 # endif
88 #else
89 # define NULL ((void*)0)
90 #endif
91 #ifdef __cplusplus
92 #if defined(_MSC_EXTENSIONS) && defined(_NATIVE_NULLPTR_SUPPORTED)
93 namespace std { typedef decltype(nullptr) nullptr_t; }
94 using ::std::nullptr_t;
95 #endif
96 #endif
97 #undef __need_NULL
98 #endif /* defined(__need_NULL) */
100 /* FIXME: This is using the placeholder dates Clang produces for these macros
101 in C2x mode; switch to the correct values once they've been published. */
102 #if defined(__STDC_VERSION__) && __STDC_VERSION__ >= 202000L
103 typedef typeof(nullptr) nullptr_t;
104 #endif /* defined(__STDC_VERSION__) && __STDC_VERSION__ >= 202000L */
106 #if defined(__need_STDDEF_H_misc) && defined(__STDC_VERSION__) && \
107 __STDC_VERSION__ >= 202000L
108 #define unreachable() __builtin_unreachable()
109 #endif /* defined(__need_STDDEF_H_misc) && >= C23 */
111 #if defined(__need_STDDEF_H_misc)
112 #if (defined(__STDC_VERSION__) && __STDC_VERSION__ >= 201112L) || \
113 (defined(__cplusplus) && __cplusplus >= 201103L)
114 #include "__stddef_max_align_t.h"
115 #endif
116 #define offsetof(t, d) __builtin_offsetof(t, d)
117 #undef __need_STDDEF_H_misc
118 #endif /* defined(__need_STDDEF_H_misc) */
120 /* Some C libraries expect to see a wint_t here. Others (notably MinGW) will use
121 __WINT_TYPE__ directly; accommodate both by requiring __need_wint_t */
122 #if defined(__need_wint_t)
123 /* Always define wint_t when modules are available. */
124 #if !defined(_WINT_T) || __has_feature(modules)
125 #if !__has_feature(modules)
126 #define _WINT_T
127 #endif
128 typedef __WINT_TYPE__ wint_t;
129 #endif
130 #undef __need_wint_t
131 #endif /* __need_wint_t */
133 #endif