clang  19.0.0git
stddef.h
Go to the documentation of this file.
1 /*===---- stddef.h - Basic type definitions --------------------------------===
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 
10 /*
11  * This header is designed to be included multiple times. If any of the __need_
12  * macros are defined, then only that subset of interfaces are provided. This
13  * can be useful for POSIX headers that need to not expose all of stddef.h, but
14  * need to use some of its interfaces. Otherwise this header provides all of
15  * the expected interfaces.
16  *
17  * When clang modules are enabled, this header is a textual header to support
18  * the multiple include behavior. As such, it doesn't directly declare anything
19  * so that it doesn't add duplicate declarations to all of its includers'
20  * modules.
21  */
22 #if defined(__MVS__) && __has_include_next(<stddef.h>)
23 #include <__stddef_header_macro.h>
24 #undef __need_ptrdiff_t
25 #undef __need_size_t
26 #undef __need_rsize_t
27 #undef __need_wchar_t
28 #undef __need_NULL
29 #undef __need_nullptr_t
30 #undef __need_unreachable
31 #undef __need_max_align_t
32 #undef __need_offsetof
33 #undef __need_wint_t
34 #include_next <stddef.h>
35 
36 #else
37 
38 #if !defined(__need_ptrdiff_t) && !defined(__need_size_t) && \
39  !defined(__need_rsize_t) && !defined(__need_wchar_t) && \
40  !defined(__need_NULL) && !defined(__need_nullptr_t) && \
41  !defined(__need_unreachable) && !defined(__need_max_align_t) && \
42  !defined(__need_offsetof) && !defined(__need_wint_t)
43 #include <__stddef_header_macro.h>
44 #define __need_ptrdiff_t
45 #define __need_size_t
46 /* ISO9899:2011 7.20 (C11 Annex K): Define rsize_t if __STDC_WANT_LIB_EXT1__ is
47  * enabled. */
48 #if defined(__STDC_WANT_LIB_EXT1__) && __STDC_WANT_LIB_EXT1__ >= 1
49 #define __need_rsize_t
50 #endif
51 #define __need_wchar_t
52 #define __need_NULL
53 #if (defined(__STDC_VERSION__) && __STDC_VERSION__ >= 202311L) || \
54  defined(__cplusplus)
55 #define __need_nullptr_t
56 #endif
57 #if defined(__STDC_VERSION__) && __STDC_VERSION__ >= 202311L
58 #define __need_unreachable
59 #endif
60 #if (defined(__STDC_VERSION__) && __STDC_VERSION__ >= 201112L) || \
61  (defined(__cplusplus) && __cplusplus >= 201103L)
62 #define __need_max_align_t
63 #endif
64 #define __need_offsetof
65 /* wint_t is provided by <wchar.h> and not <stddef.h>. It's here
66  * for compatibility, but must be explicitly requested. Therefore
67  * __need_wint_t is intentionally not defined here. */
68 #endif
69 
70 #if defined(__need_ptrdiff_t)
71 #include <__stddef_ptrdiff_t.h>
72 #undef __need_ptrdiff_t
73 #endif /* defined(__need_ptrdiff_t) */
74 
75 #if defined(__need_size_t)
76 #include <__stddef_size_t.h>
77 #undef __need_size_t
78 #endif /*defined(__need_size_t) */
79 
80 #if defined(__need_rsize_t)
81 #include <__stddef_rsize_t.h>
82 #undef __need_rsize_t
83 #endif /* defined(__need_rsize_t) */
84 
85 #if defined(__need_wchar_t)
86 #include <__stddef_wchar_t.h>
87 #undef __need_wchar_t
88 #endif /* defined(__need_wchar_t) */
89 
90 #if defined(__need_NULL)
91 #include <__stddef_null.h>
92 #undef __need_NULL
93 #endif /* defined(__need_NULL) */
94 
95 #if defined(__need_nullptr_t)
96 #include <__stddef_nullptr_t.h>
97 #undef __need_nullptr_t
98 #endif /* defined(__need_nullptr_t) */
99 
100 #if defined(__need_unreachable)
101 #include <__stddef_unreachable.h>
102 #undef __need_unreachable
103 #endif /* defined(__need_unreachable) */
104 
105 #if defined(__need_max_align_t)
106 #include <__stddef_max_align_t.h>
107 #undef __need_max_align_t
108 #endif /* defined(__need_max_align_t) */
109 
110 #if defined(__need_offsetof)
111 #include <__stddef_offsetof.h>
112 #undef __need_offsetof
113 #endif /* defined(__need_offsetof) */
114 
115 /* Some C libraries expect to see a wint_t here. Others (notably MinGW) will use
116 __WINT_TYPE__ directly; accommodate both by requiring __need_wint_t */
117 #if defined(__need_wint_t)
118 #include <__stddef_wint_t.h>
119 #undef __need_wint_t
120 #endif /* __need_wint_t */
121 
122 #endif /* __MVS__ */