|
14 | 14 | * need to use some of its interfaces. Otherwise this header provides all of |
15 | 15 | * the expected interfaces. |
16 | 16 | * |
17 | | - * When clang modules are enabled, this header is a textual header. It ignores |
18 | | - * its header guard so that multiple submodules can export its interfaces. |
19 | | - * Take module SM with submodules A and B, whose headers both include stddef.h |
20 | | - * When SM.A builds, __STDDEF_H will be defined. When SM.B builds, the |
21 | | - * definition from SM.A will leak when building without local submodule |
22 | | - * visibility. stddef.h wouldn't include any of its implementation headers, and |
23 | | - * SM.B wouldn't import any of the stddef modules, and SM.B's `export *` |
24 | | - * wouldn't export any stddef interfaces as expected. However, since stddef.h |
25 | | - * ignores its header guard when building with modules, it all works as |
26 | | - * expected. |
27 | | - * |
28 | | - * When clang modules are not enabled, the header guards can function in the |
29 | | - * normal simple fashion. |
| 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. |
30 | 21 | */ |
31 | | -#if !defined(__STDDEF_H) || __has_feature(modules) || \ |
32 | | - (defined(__STDC_WANT_LIB_EXT1__) && __STDC_WANT_LIB_EXT1__ >= 1) || \ |
33 | | - defined(__need_ptrdiff_t) || defined(__need_size_t) || \ |
34 | | - defined(__need_rsize_t) || defined(__need_wchar_t) || \ |
35 | | - defined(__need_NULL) || defined(__need_nullptr_t) || \ |
36 | | - defined(__need_unreachable) || defined(__need_max_align_t) || \ |
37 | | - defined(__need_offsetof) || defined(__need_wint_t) |
38 | | - |
39 | 22 | #if defined(__MVS__) && __has_include_next(<stddef.h>) |
40 | | -#define __STDDEF_H |
| 23 | +#include <__stddef_header_macro.h> |
41 | 24 | #undef __need_ptrdiff_t |
42 | 25 | #undef __need_size_t |
43 | 26 | #undef __need_rsize_t |
|
57 | 40 | !defined(__need_NULL) && !defined(__need_nullptr_t) && \ |
58 | 41 | !defined(__need_unreachable) && !defined(__need_max_align_t) && \ |
59 | 42 | !defined(__need_offsetof) && !defined(__need_wint_t) |
60 | | -#define __STDDEF_H |
| 43 | +#include <__stddef_header_macro.h> |
61 | 44 | #define __need_ptrdiff_t |
62 | 45 | #define __need_size_t |
63 | 46 | /* ISO9899:2011 7.20 (C11 Annex K): Define rsize_t if __STDC_WANT_LIB_EXT1__ is |
@@ -137,4 +120,3 @@ __WINT_TYPE__ directly; accommodate both by requiring __need_wint_t */ |
137 | 120 | #endif /* __need_wint_t */ |
138 | 121 |
|
139 | 122 | #endif /* __MVS__ */ |
140 | | -#endif |
0 commit comments