[LLD][COFF] Emit tail merge pdata for delay load thunks on ARM64EC (#116810)
[llvm-project.git] / libc / hdr / wchar_overlay.h
blob99a70899779e7c5b7d04ad32e046d5908e4f2755
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 //===----------------------------------------------------------------------===//
9 #ifndef LLVM_LIBC_HDR_WCHAR_OVERLAY_H
10 #define LLVM_LIBC_HDR_WCHAR_OVERLAY_H
12 #ifdef LIBC_FULL_BUILD
13 #error "This header should only be included in overlay mode"
14 #endif
16 // Overlay mode
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`.
25 #ifdef _FORTIFY_SOURCE
26 #define LIBC_OLD_FORTIFY_SOURCE _FORTIFY_SOURCE
27 #undef _FORTIFY_SOURCE
28 #endif
30 #ifndef __NO_INLINE__
31 #define __NO_INLINE__ 1
32 #define LIBC_SET_NO_INLINE
33 #endif
35 #ifdef __USE_EXTERN_INLINES
36 #define LIBC_OLD_USE_EXTERN_INLINES
37 #undef __USE_EXTERN_INLINES
38 #endif
40 #ifdef __USE_FORTIFY_LEVEL
41 #define LIBC_OLD_USE_FORTIFY_LEVEL __USE_FORTIFY_LEVEL
42 #undef __USE_FORTIFY_LEVEL
43 #define __USE_FORTIFY_LEVEL 0
44 #endif
46 #include <wchar.h>
48 #ifdef LIBC_OLD_FORTIFY_SOURCE
49 #define _FORTIFY_SOURCE LIBC_OLD_FORTIFY_SOURCE
50 #undef LIBC_OLD_FORTIFY_SOURCE
51 #endif
53 #ifdef LIBC_SET_NO_INLINE
54 #undef __NO_INLINE__
55 #undef LIBC_SET_NO_INLINE
56 #endif
58 #ifdef LIBC_OLD_USE_FORTIFY_LEVEL
59 #undef __USE_FORTIFY_LEVEL
60 #define __USE_FORTIFY_LEVEL LIBC_OLD_USE_FORTIFY_LEVEL
61 #undef LIBC_OLD_USE_FORTIFY_LEVEL
62 #endif
64 #ifdef LIBC_OLD_USE_EXTERN_INLINES
65 #define __USE_EXTERN_INLINES
66 #undef LIBC_OLD_USE_EXTERN_INLINES
67 #endif
69 #endif // LLVM_LIBC_HDR_WCHAR_OVERLAY_H