workflows/premerge: Fix condition for macos job (#125237)
[llvm-project.git] / libc / hdr / fcntl_overlay.h
blob17ae78b3d0eca08774bbbf18e7c4c7bbb3ec484c
1 //===-- Including fcntl.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_FCNTL_OVERLAY_H
10 #define LLVM_LIBC_HDR_FCNTL_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 <fcntl.h> header might provide extern inline definitions for few
19 // functions, causing external alias errors. They are guarded by
20 // `__USE_FORTIFY_LEVEL`, which will be temporarily disabled
21 // with `_FORTIFY_SOURCE`.
23 #ifdef _FORTIFY_SOURCE
24 #define LIBC_OLD_FORTIFY_SOURCE _FORTIFY_SOURCE
25 #undef _FORTIFY_SOURCE
26 #endif
28 #ifdef __USE_FORTIFY_LEVEL
29 #define LIBC_OLD_USE_FORTIFY_LEVEL __USE_FORTIFY_LEVEL
30 #undef __USE_FORTIFY_LEVEL
31 #define __USE_FORTIFY_LEVEL 0
32 #endif
34 #include <fcntl.h>
36 #ifdef LIBC_OLD_FORTIFY_SOURCE
37 #define _FORTIFY_SOURCE LIBC_OLD_FORTIFY_SOURCE
38 #undef LIBC_OLD_FORTIFY_SOURCE
39 #endif
41 #ifdef LIBC_OLD_USE_FORTIFY_LEVEL
42 #undef __USE_FORTIFY_LEVEL
43 #define __USE_FORTIFY_LEVEL LIBC_OLD_USE_FORTIFY_LEVEL
44 #undef LIBC_OLD_USE_FORTIFY_LEVEL
45 #endif
47 #endif // LLVM_LIBC_HDR_FCNTL_OVERLAY_H