File tree Expand file tree Collapse file tree 6 files changed +58
-84
lines changed Expand file tree Collapse file tree 6 files changed +58
-84
lines changed Original file line number Diff line number Diff line change @@ -161,10 +161,14 @@ add_proxy_header_library(
161
161
libc.include.sys_auxv
162
162
)
163
163
164
+ add_header_library (wchar_overlay HDRS wchar_overlay.h )
165
+
164
166
add_proxy_header_library (
165
167
wchar_macros
166
168
HDRS
167
169
wchar_macros.h
170
+ DEPENDS
171
+ .wchar_overlay
168
172
FULL_BUILD_DEPENDS
169
173
libc.include.llvm-libc-macros.wchar_macros
170
174
libc.include.wchar
Original file line number Diff line number Diff line change @@ -230,6 +230,8 @@ add_proxy_header_library(
230
230
wchar_t
231
231
HDRS
232
232
wchar_t.h
233
+ DEPENDS
234
+ libc.hdr.wchar_overlay
233
235
FULL_BUILD_DEPENDS
234
236
libc.include.llvm-libc-types.wchar_t
235
237
libc.include.wchar
@@ -239,6 +241,8 @@ add_proxy_header_library(
239
241
wint_t
240
242
HDRS
241
243
wint_t.h
244
+ DEPENDS
245
+ libc.hdr.wchar_overlay
242
246
FULL_BUILD_DEPENDS
243
247
libc.include.llvm-libc-types.wint_t
244
248
libc.include.wchar
Original file line number Diff line number Diff line change 16
16
17
17
#else // overlay mode
18
18
19
- // glibc <wchar.h header might provide extern inline definitions for few
20
- // functions, causing external alias errors. They are guarded by
21
- // `__USE_EXTERN_INLINES` macro. We temporarily disable `__USE_EXTERN_INLINES`
22
- // macro by defining `__NO_INLINE__` before including <wchar.h>.
23
- // And the same with `__USE_FORTIFY_LEVEL`, which will be temporarily disabled
24
- // with `_FORTIFY_SOURCE`.
25
-
26
- #ifdef _FORTIFY_SOURCE
27
- #define LIBC_OLD_FORTIFY_SOURCE _FORTIFY_SOURCE
28
- #undef _FORTIFY_SOURCE
29
- #endif
30
-
31
- #ifndef __NO_INLINE__
32
- #define __NO_INLINE__ 1
33
- #define LIBC_SET_NO_INLINE
34
- #endif
35
-
36
- #include <wchar.h>
37
-
38
- #ifdef LIBC_OLD_FORTIFY_SOURCE
39
- #define _FORTIFY_SOURCE LIBC_OLD_FORTIFY_SOURCE
40
- #undef LIBC_OLD_FORTIFY_SOURCE
41
- #endif
42
-
43
- #ifdef LIBC_SET_NO_INLINE
44
- #undef __NO_INLINE__
45
- #undef LIBC_SET_NO_INLINE
46
- #endif
19
+ #include "hdr/wchar_overlay.h"
47
20
48
21
#endif // LLVM_LIBC_FULL_BUILD
49
22
Original file line number Diff line number Diff line change 16
16
17
17
#else // overlay mode
18
18
19
- // glibc <wchar.h header might provide extern inline definitions for few
20
- // functions, causing external alias errors. They are guarded by
21
- // `__USE_EXTERN_INLINES` macro. We temporarily disable `__USE_EXTERN_INLINES`
22
- // macro by defining `__NO_INLINE__` before including <wchar.h>.
23
- // And the same with `__USE_FORTIFY_LEVEL`, which will be temporarily disabled
24
- // with `_FORTIFY_SOURCE`.
25
-
26
- #ifdef _FORTIFY_SOURCE
27
- #define LIBC_OLD_FORTIFY_SOURCE _FORTIFY_SOURCE
28
- #undef _FORTIFY_SOURCE
29
- #endif
30
-
31
- #ifndef __NO_INLINE__
32
- #define __NO_INLINE__ 1
33
- #define LIBC_SET_NO_INLINE
34
- #endif
35
-
36
- #include <wchar.h>
37
-
38
- #ifdef LIBC_OLD_FORTIFY_SOURCE
39
- #define _FORTIFY_SOURCE LIBC_OLD_FORTIFY_SOURCE
40
- #undef LIBC_OLD_FORTIFY_SOURCE
41
- #endif
42
-
43
- #ifdef LIBC_SET_NO_INLINE
44
- #undef __NO_INLINE__
45
- #undef LIBC_SET_NO_INLINE
46
- #endif
19
+ #include "hdr/wchar_overlay.h"
47
20
48
21
#endif // LLVM_LIBC_FULL_BUILD
49
22
Original file line number Diff line number Diff line change 15
15
16
16
#else // Overlay mode
17
17
18
- // glibc <wchar.h header might provide extern inline definitions for few
19
- // functions, causing external alias errors. They are guarded by
20
- // `__USE_EXTERN_INLINES` macro. We temporarily disable `__USE_EXTERN_INLINES`
21
- // macro by defining `__NO_INLINE__` before including <wchar.h>.
22
- // And the same with `__USE_FORTIFY_LEVEL`, which will be temporarily disabled
23
- // with `_FORTIFY_SOURCE`.
24
-
25
- #ifdef _FORTIFY_SOURCE
26
- #define LIBC_OLD_FORTIFY_SOURCE _FORTIFY_SOURCE
27
- #undef _FORTIFY_SOURCE
28
- #endif
29
-
30
- #ifndef __NO_INLINE__
31
- #define __NO_INLINE__ 1
32
- #define LIBC_SET_NO_INLINE
33
- #endif
34
-
35
- #include <wchar.h>
36
-
37
- #ifdef LIBC_OLD_FORTIFY_SOURCE
38
- #define _FORTIFY_SOURCE LIBC_OLD_FORTIFY_SOURCE
39
- #undef LIBC_OLD_FORTIFY_SOURCE
40
- #endif
41
-
42
- #ifdef LIBC_SET_NO_INLINE
43
- #undef __NO_INLINE__
44
- #undef LIBC_SET_NO_INLINE
45
- #endif
18
+ #include "hdr/wchar_overlay.h"
46
19
47
20
#endif // LLVM_LIBC_FULL_BUILD
48
21
Original file line number Diff line number Diff line change
1
+ //===-- Including wchar.h in overlay mode ---------------------------------===//
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
+ #ifndef LLVM_LIBC_HDR_WCHAR_OVERLAY_H
10
+ #define LLVM_LIBC_HDR_WCHAR_OVERLAY_H
11
+
12
+ #ifdef LIBC_FULL_BUILD
13
+ #error "This header should only be included in overlay mode"
14
+ #endif
15
+
16
+ // Overlay mode
17
+
18
+ // glibc <wchar.h header might provide extern inline definitions for few
19
+ // functions, causing external alias errors. They are guarded by
20
+ // `__USE_EXTERN_INLINES` macro. We temporarily disable `__USE_EXTERN_INLINES`
21
+ // macro by defining `__NO_INLINE__` before including <wchar.h>.
22
+ // And the same with `__USE_FORTIFY_LEVEL`, which will be temporarily disabled
23
+ // with `_FORTIFY_SOURCE`.
24
+
25
+ #ifdef _FORTIFY_SOURCE
26
+ #define LIBC_OLD_FORTIFY_SOURCE _FORTIFY_SOURCE
27
+ #undef _FORTIFY_SOURCE
28
+ #endif
29
+
30
+ #ifndef __NO_INLINE__
31
+ #define __NO_INLINE__ 1
32
+ #define LIBC_SET_NO_INLINE
33
+ #endif
34
+
35
+ #include <wchar.h>
36
+
37
+ #ifdef LIBC_OLD_FORTIFY_SOURCE
38
+ #define _FORTIFY_SOURCE LIBC_OLD_FORTIFY_SOURCE
39
+ #undef LIBC_OLD_FORTIFY_SOURCE
40
+ #endif
41
+
42
+ #ifdef LIBC_SET_NO_INLINE
43
+ #undef __NO_INLINE__
44
+ #undef LIBC_SET_NO_INLINE
45
+ #endif
46
+
47
+ #endif // LLVM_LIBC_HDR_WCHAR_OVERLAY_H
You can’t perform that action at this time.
0 commit comments