Path: blob/main/system/lib/llvm-libc/hdr/stdio_overlay.h
6168 views
//===-- Including stdio.h in overlay mode ---------------------------------===//1//2// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.3// See https://llvm.org/LICENSE.txt for license information.4// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception5//6//===----------------------------------------------------------------------===//78#ifndef LLVM_LIBC_HDR_STDIO_OVERLAY_H9#define LLVM_LIBC_HDR_STDIO_OVERLAY_H1011#ifdef LIBC_FULL_BUILD12#error "This header should only be included in overlay mode"13#endif1415// Overlay mode1617// glibc <stdio.h> header might provide extern inline definitions for few18// functions, causing external alias errors. They are guarded by19// `__USE_EXTERN_INLINES` macro. We temporarily disable `__USE_EXTERN_INLINES`20// macro by defining `__NO_INLINE__` before including <stdio.h>.21// And the same with `__USE_FORTIFY_LEVEL`, which will be temporarily disabled22// with `_FORTIFY_SOURCE`.2324#ifdef _FORTIFY_SOURCE25#define LIBC_OLD_FORTIFY_SOURCE _FORTIFY_SOURCE26#undef _FORTIFY_SOURCE27#endif2829#ifdef __USE_EXTERN_INLINES30#define LIBC_OLD_USE_EXTERN_INLINES31#undef __USE_EXTERN_INLINES32#endif3334#ifdef __USE_FORTIFY_LEVEL35#define LIBC_OLD_USE_FORTIFY_LEVEL __USE_FORTIFY_LEVEL36#undef __USE_FORTIFY_LEVEL37#define __USE_FORTIFY_LEVEL 038#endif3940#ifndef __NO_INLINE__41#define __NO_INLINE__ 142#define LIBC_SET_NO_INLINE43#endif4445#include <stdio.h>4647#ifdef LIBC_OLD_FORTIFY_SOURCE48#define _FORTIFY_SOURCE LIBC_OLD_FORTIFY_SOURCE49#undef LIBC_OLD_FORTIFY_SOURCE50#endif5152#ifdef LIBC_SET_NO_INLINE53#undef __NO_INLINE__54#undef LIBC_SET_NO_INLINE55#endif5657#ifdef LIBC_OLD_USE_FORTIFY_LEVEL58#undef __USE_FORTIFY_LEVEL59#define __USE_FORTIFY_LEVEL LIBC_OLD_USE_FORTIFY_LEVEL60#undef LIBC_OLD_USE_FORTIFY_LEVEL61#endif6263#ifdef LIBC_OLD_USE_EXTERN_INLINES64#define __USE_EXTERN_INLINES65#undef LIBC_OLD_USE_EXTERN_INLINES66#endif6768#endif // LLVM_LIBC_HDR_STDIO_OVERLAY_H697071