Adjust vendor import of llvm-project main llvmorg-21-init-19288-gface93e724f4: add more items to the libc/ top-level directory.

This commit is contained in:
Dimitry Andric 2025-12-09 15:03:29 +01:00
parent e6df1a75c4
commit 7f920884cd
611 changed files with 170014 additions and 0 deletions

28
libc/hdr/errno_macros.h Normal file
View file

@ -0,0 +1,28 @@
//===-- Definition of macros from errno.h ---------------------------------===//
//
// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
// See https://llvm.org/LICENSE.txt for license information.
// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
//
//===----------------------------------------------------------------------===//
#ifndef LLVM_LIBC_HDR_ERRNO_MACROS_H
#define LLVM_LIBC_HDR_ERRNO_MACROS_H
#ifdef LIBC_FULL_BUILD
#ifdef __linux__
#include <linux/errno.h>
#include "include/llvm-libc-macros/error-number-macros.h"
#else // __linux__
#include "include/llvm-libc-macros/generic-error-number-macros.h"
#endif
#else // Overlay mode
#include <errno.h>
#endif // LLVM_LIBC_FULL_BUILD
#endif // LLVM_LIBC_HDR_ERRNO_MACROS_H

22
libc/hdr/fcntl_macros.h Normal file
View file

@ -0,0 +1,22 @@
//===-- Definition of macros from fcntl/fcntl.h ---------------------------===//
//
// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
// See https://llvm.org/LICENSE.txt for license information.
// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
//
//===----------------------------------------------------------------------===//
#ifndef LLVM_LIBC_HDR_FCNTL_MACROS_H
#define LLVM_LIBC_HDR_FCNTL_MACROS_H
#ifdef LIBC_FULL_BUILD
#include "include/llvm-libc-macros/fcntl-macros.h"
#else // Overlay mode
#include "hdr/fcntl_overlay.h"
#endif // LLVM_LIBC_FULL_BUILD
#endif // LLVM_LIBC_HDR_FCNTL_MACROS_H

47
libc/hdr/fcntl_overlay.h Normal file
View file

@ -0,0 +1,47 @@
//===-- Including fcntl.h in overlay mode ---------------------------------===//
//
// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
// See https://llvm.org/LICENSE.txt for license information.
// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
//
//===----------------------------------------------------------------------===//
#ifndef LLVM_LIBC_HDR_FCNTL_OVERLAY_H
#define LLVM_LIBC_HDR_FCNTL_OVERLAY_H
#ifdef LIBC_FULL_BUILD
#error "This header should only be included in overlay mode"
#endif
// Overlay mode
// glibc <fcntl.h> header might provide extern inline definitions for few
// functions, causing external alias errors. They are guarded by
// `__USE_FORTIFY_LEVEL`, which will be temporarily disabled
// with `_FORTIFY_SOURCE`.
#ifdef _FORTIFY_SOURCE
#define LIBC_OLD_FORTIFY_SOURCE _FORTIFY_SOURCE
#undef _FORTIFY_SOURCE
#endif
#ifdef __USE_FORTIFY_LEVEL
#define LIBC_OLD_USE_FORTIFY_LEVEL __USE_FORTIFY_LEVEL
#undef __USE_FORTIFY_LEVEL
#define __USE_FORTIFY_LEVEL 0
#endif
#include <fcntl.h>
#ifdef LIBC_OLD_FORTIFY_SOURCE
#define _FORTIFY_SOURCE LIBC_OLD_FORTIFY_SOURCE
#undef LIBC_OLD_FORTIFY_SOURCE
#endif
#ifdef LIBC_OLD_USE_FORTIFY_LEVEL
#undef __USE_FORTIFY_LEVEL
#define __USE_FORTIFY_LEVEL LIBC_OLD_USE_FORTIFY_LEVEL
#undef LIBC_OLD_USE_FORTIFY_LEVEL
#endif
#endif // LLVM_LIBC_HDR_FCNTL_OVERLAY_H

61
libc/hdr/fenv_macros.h Normal file
View file

@ -0,0 +1,61 @@
//===-- Definition of macros from fenv.h ----------------------------------===//
//
// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
// See https://llvm.org/LICENSE.txt for license information.
// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
//
//===----------------------------------------------------------------------===//
#ifndef LLVM_LIBC_HDR_FENV_MACROS_H
#define LLVM_LIBC_HDR_FENV_MACROS_H
#ifdef LIBC_FULL_BUILD
#include "include/llvm-libc-macros/fenv-macros.h"
#else // Overlay mode
#include <fenv.h>
// In some environment, FE_ALL_EXCEPT is set to 0 and the remaining exceptions
// FE_* are missing.
#ifndef FE_DIVBYZERO
#define FE_DIVBYZERO 0
#endif // FE_DIVBYZERO
#ifndef FE_INEXACT
#define FE_INEXACT 0
#endif // FE_INEXACT
#ifndef FE_INVALID
#define FE_INVALID 0
#endif // FE_INVALID
#ifndef FE_OVERFLOW
#define FE_OVERFLOW 0
#endif // FE_OVERFLOW
#ifndef FE_UNDERFLOW
#define FE_UNDERFLOW 0
#endif // FE_UNDERFLOW
// Rounding mode macros might be missing.
#ifndef FE_DOWNWARD
#define FE_DOWNWARD 0x400
#endif // FE_DOWNWARD
#ifndef FE_TONEAREST
#define FE_TONEAREST 0
#endif // FE_TONEAREST
#ifndef FE_TOWARDZERO
#define FE_TOWARDZERO 0xC00
#endif // FE_TOWARDZERO
#ifndef FE_UPWARD
#define FE_UPWARD 0x800
#endif // FE_UPWARD
#endif // LLVM_LIBC_FULL_BUILD
#endif // LLVM_LIBC_HDR_FENV_MACROS_H

22
libc/hdr/float_macros.h Normal file
View file

@ -0,0 +1,22 @@
//===-- Definition of macros from math.h ----------------------------------===//
//
// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
// See https://llvm.org/LICENSE.txt for license information.
// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
//
//===----------------------------------------------------------------------===//
#ifndef LLVM_LIBC_HDR_FLOAT_MACROS_H
#define LLVM_LIBC_HDR_FLOAT_MACROS_H
#ifdef LIBC_FULL_BUILD
#include "include/llvm-libc-macros/float-macros.h"
#else // Overlay mode
#include <float.h>
#endif // LLVM_LIBC_FULL_BUILD
#endif // LLVM_LIBC_HDR_FLOAT_MACROS_H

View file

@ -0,0 +1,22 @@
//===-- Definition of the aligned_alloc.h proxy ---------------------------===//
//
// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
// See https://llvm.org/LICENSE.txt for license information.
// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
//
//===----------------------------------------------------------------------===//
#ifndef LLVM_LIBC_HDR_FUNC_ALIGNED_ALLOC_H
#define LLVM_LIBC_HDR_FUNC_ALIGNED_ALLOC_H
#ifdef LIBC_FULL_BUILD
#include "hdr/types/size_t.h"
extern "C" void *aligned_alloc(size_t, size_t);
#else // Overlay mode
#include "hdr/stdlib_overlay.h"
#endif
#endif

22
libc/hdr/func/free.h Normal file
View file

@ -0,0 +1,22 @@
//===-- Definition of the free.h proxy ------------------------------------===//
//
// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
// See https://llvm.org/LICENSE.txt for license information.
// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
//
//===----------------------------------------------------------------------===//
#ifndef LLVM_LIBC_HDR_FUNC_FREE_H
#define LLVM_LIBC_HDR_FUNC_FREE_H
#ifdef LIBC_FULL_BUILD
extern "C" void free(void *) noexcept;
#else // Overlay mode
#include "hdr/stdlib_overlay.h"
#endif
#endif

24
libc/hdr/func/malloc.h Normal file
View file

@ -0,0 +1,24 @@
//===-- Definition of the malloc.h proxy ----------------------------------===//
//
// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
// See https://llvm.org/LICENSE.txt for license information.
// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
//
//===----------------------------------------------------------------------===//
#ifndef LLVM_LIBC_HDR_FUNC_MALLOC_H
#define LLVM_LIBC_HDR_FUNC_MALLOC_H
#ifdef LIBC_FULL_BUILD
#include "hdr/types/size_t.h"
extern "C" void *malloc(size_t) noexcept;
#else // Overlay mode
#include "hdr/stdlib_overlay.h"
#endif
#endif

24
libc/hdr/func/realloc.h Normal file
View file

@ -0,0 +1,24 @@
//===-- Definition of the realloc.h proxy ---------------------------------===//
//
// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
// See https://llvm.org/LICENSE.txt for license information.
// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
//
//===----------------------------------------------------------------------===//
#ifndef LLVM_LIBC_HDR_FUNC_REALLOC_H
#define LLVM_LIBC_HDR_FUNC_REALLOC_H
#ifdef LIBC_FULL_BUILD
#include "hdr/types/size_t.h"
extern "C" void *realloc(void *ptr, size_t new_size) noexcept;
#else // Overlay mode
#include "hdr/stdlib_overlay.h"
#endif
#endif

22
libc/hdr/limits_macros.h Normal file
View file

@ -0,0 +1,22 @@
//===-- Definition of macros from limits.h --------------------------------===//
//
// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
// See https://llvm.org/LICENSE.txt for license information.
// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
//
//===----------------------------------------------------------------------===//
#ifndef LLVM_LIBC_HDR_LIMITS_MACROS_H
#define LLVM_LIBC_HDR_LIMITS_MACROS_H
#ifdef LIBC_FULL_BUILD
#include "include/llvm-libc-macros/limits-macros.h"
#else // Overlay mode
#include <limits.h>
#endif // LLVM_LIBC_FULL_BUILD
#endif // LLVM_LIBC_HDR_LIMITS_MACROS_H

22
libc/hdr/link_macros.h Normal file
View file

@ -0,0 +1,22 @@
//===-- Definition of macros from link.h ----------------------------------===//
//
// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
// See https://llvm.org/LICENSE.txt for license information.
// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
//
//===----------------------------------------------------------------------===//
#ifndef LLVM_LIBC_HDR_LINK_MACROS_H
#define LLVM_LIBC_HDR_LINK_MACROS_H
#ifdef LIBC_FULL_BUILD
#include "include/llvm-libc-macros/link-macros.h"
#else // Overlay mode
#include <link.h>
#endif // LLVM_LIBC_FULL_BUILD
#endif // LLVM_LIBC_HDR_LINK_MACROS_H

22
libc/hdr/locale_macros.h Normal file
View file

@ -0,0 +1,22 @@
//===-- Definition of macros from locale.h --------------------------------===//
//
// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
// See https://llvm.org/LICENSE.txt for license information.
// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
//
//===----------------------------------------------------------------------===//
#ifndef LLVM_LIBC_HDR_LOCALE_MACROS_H
#define LLVM_LIBC_HDR_LOCALE_MACROS_H
#ifdef LIBC_FULL_BUILD
#include "include/llvm-libc-macros/locale-macros.h"
#else // Overlay mode
#error "macros not available in overlay mode"
#endif // LLVM_LIBC_FULL_BUILD
#endif // LLVM_LIBC_HDR_LOCALE_MACROS_H

View file

@ -0,0 +1,27 @@
//===-- Definition of macros from math.h ----------------------------------===//
//
// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
// See https://llvm.org/LICENSE.txt for license information.
// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
//
//===----------------------------------------------------------------------===//
#ifndef LLVM_LIBC_HDR_MATH_FUNCTION_MACROS_H
#define LLVM_LIBC_HDR_MATH_FUNCTION_MACROS_H
#ifdef LIBC_FULL_BUILD
#include "include/llvm-libc-macros/math-function-macros.h"
#else // Overlay mode
// GCC will include CXX headers when __cplusplus is defined. This behavior
// can be suppressed by defining _GLIBCXX_INCLUDE_NEXT_C_HEADERS.
#if defined(__GNUC__) && !defined(__clang__)
#define _GLIBCXX_INCLUDE_NEXT_C_HEADERS
#endif
#include <math.h>
#endif // LLVM_LIBC_FULL_BUILD
#endif // LLVM_LIBC_HDR_MATH_MACROS_H

48
libc/hdr/math_macros.h Normal file
View file

@ -0,0 +1,48 @@
//===-- Definition of macros from math.h ----------------------------------===//
//
// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
// See https://llvm.org/LICENSE.txt for license information.
// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
//
//===----------------------------------------------------------------------===//
#ifndef LLVM_LIBC_HDR_MATH_MACROS_H
#define LLVM_LIBC_HDR_MATH_MACROS_H
#ifdef LIBC_FULL_BUILD
#include "include/llvm-libc-macros/math-macros.h"
#else // Overlay mode
// GCC will include CXX headers when __cplusplus is defined. This behavior
// can be suppressed by defining _GLIBCXX_INCLUDE_NEXT_C_HEADERS.
#if defined(__GNUC__) && !defined(__clang__)
#define _GLIBCXX_INCLUDE_NEXT_C_HEADERS
#endif
#include <math.h>
// Some older math.h header does not have FP_INT_* constants yet.
#ifndef FP_INT_UPWARD
#define FP_INT_UPWARD 0
#endif // FP_INT_UPWARD
#ifndef FP_INT_DOWNWARD
#define FP_INT_DOWNWARD 1
#endif // FP_INT_DOWNWARD
#ifndef FP_INT_TOWARDZERO
#define FP_INT_TOWARDZERO 2
#endif // FP_INT_TOWARDZERO
#ifndef FP_INT_TONEARESTFROMZERO
#define FP_INT_TONEARESTFROMZERO 3
#endif // FP_INT_TONEARESTFROMZERO
#ifndef FP_INT_TONEAREST
#define FP_INT_TONEAREST 4
#endif // FP_INT_TONEAREST
#endif // LLVM_LIBC_FULL_BUILD
#endif // LLVM_LIBC_HDR_MATH_MACROS_H

View file

@ -0,0 +1,23 @@
//===-- Definition of macros for offsetof ---------------------------------===//
//
// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
// See https://llvm.org/LICENSE.txt for license information.
// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
//
//===----------------------------------------------------------------------===//
#ifndef LLVM_LIBC_HDR_OFFSETOF_MACROS_H
#define LLVM_LIBC_HDR_OFFSETOF_MACROS_H
#ifdef LIBC_FULL_BUILD
#include "include/llvm-libc-macros/offsetof-macro.h"
#else // Overlay mode
#define __need_offsetof
#include <stddef.h>
#endif // LLVM_LIBC_FULL_BUILD
#endif // LLVM_LIBC_HDR_OFFSETOF_MACROS_H

22
libc/hdr/sched_macros.h Normal file
View file

@ -0,0 +1,22 @@
//===-- Definition of macros from sched.h ---------------------------------===//
//
// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
// See https://llvm.org/LICENSE.txt for license information.
// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
//
//===----------------------------------------------------------------------===//
#ifndef LLVM_LIBC_HDR_SCHED_MACROS_H
#define LLVM_LIBC_HDR_SCHED_MACROS_H
#ifdef LIBC_FULL_BUILD
#include "include/llvm-libc-macros/sched-macros.h"
#else // Overlay mode
#include <sched.h>
#endif // LLVM_LIBC_FULL_BUILD
#endif // LLVM_LIBC_HDR_SCHED_MACROS_H

22
libc/hdr/signal_macros.h Normal file
View file

@ -0,0 +1,22 @@
//===-- Definition of macros from signal.h --------------------------------===//
//
// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
// See https://llvm.org/LICENSE.txt for license information.
// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
//
//===----------------------------------------------------------------------===//
#ifndef LLVM_LIBC_HDR_SIGNAL_MACROS_H
#define LLVM_LIBC_HDR_SIGNAL_MACROS_H
#ifdef LIBC_FULL_BUILD
#include "include/llvm-libc-macros/signal-macros.h"
#else // Overlay mode
#include <signal.h>
#endif // LLVM_LIBC_FULL_BUILD
#endif // LLVM_LIBC_HDR_SIGNAL_MACROS_H

23
libc/hdr/stdio_macros.h Normal file
View file

@ -0,0 +1,23 @@
//===-- Definition of macros from stdio.h --------------------------------===//
//
// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
// See https://llvm.org/LICENSE.txt for license information.
// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
//
//===----------------------------------------------------------------------===//
#ifndef LLVM_LIBC_HDR_STDIO_MACROS_H
#define LLVM_LIBC_HDR_STDIO_MACROS_H
#ifdef LIBC_FULL_BUILD
#include "include/llvm-libc-macros/file-seek-macros.h"
#include "include/llvm-libc-macros/stdio-macros.h"
#else // Overlay mode
#include "stdio_overlay.h"
#endif // LLVM_LIBC_FULL_BUILD
#endif // LLVM_LIBC_HDR_STDIO_MACROS_H

69
libc/hdr/stdio_overlay.h Normal file
View file

@ -0,0 +1,69 @@
//===-- Including stdio.h in overlay mode ---------------------------------===//
//
// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
// See https://llvm.org/LICENSE.txt for license information.
// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
//
//===----------------------------------------------------------------------===//
#ifndef LLVM_LIBC_HDR_STDIO_OVERLAY_H
#define LLVM_LIBC_HDR_STDIO_OVERLAY_H
#ifdef LIBC_FULL_BUILD
#error "This header should only be included in overlay mode"
#endif
// Overlay mode
// glibc <stdio.h> header might provide extern inline definitions for few
// functions, causing external alias errors. They are guarded by
// `__USE_EXTERN_INLINES` macro. We temporarily disable `__USE_EXTERN_INLINES`
// macro by defining `__NO_INLINE__` before including <stdio.h>.
// And the same with `__USE_FORTIFY_LEVEL`, which will be temporarily disabled
// with `_FORTIFY_SOURCE`.
#ifdef _FORTIFY_SOURCE
#define LIBC_OLD_FORTIFY_SOURCE _FORTIFY_SOURCE
#undef _FORTIFY_SOURCE
#endif
#ifdef __USE_EXTERN_INLINES
#define LIBC_OLD_USE_EXTERN_INLINES
#undef __USE_EXTERN_INLINES
#endif
#ifdef __USE_FORTIFY_LEVEL
#define LIBC_OLD_USE_FORTIFY_LEVEL __USE_FORTIFY_LEVEL
#undef __USE_FORTIFY_LEVEL
#define __USE_FORTIFY_LEVEL 0
#endif
#ifndef __NO_INLINE__
#define __NO_INLINE__ 1
#define LIBC_SET_NO_INLINE
#endif
#include <stdio.h>
#ifdef LIBC_OLD_FORTIFY_SOURCE
#define _FORTIFY_SOURCE LIBC_OLD_FORTIFY_SOURCE
#undef LIBC_OLD_FORTIFY_SOURCE
#endif
#ifdef LIBC_SET_NO_INLINE
#undef __NO_INLINE__
#undef LIBC_SET_NO_INLINE
#endif
#ifdef LIBC_OLD_USE_FORTIFY_LEVEL
#undef __USE_FORTIFY_LEVEL
#define __USE_FORTIFY_LEVEL LIBC_OLD_USE_FORTIFY_LEVEL
#undef LIBC_OLD_USE_FORTIFY_LEVEL
#endif
#ifdef LIBC_OLD_USE_EXTERN_INLINES
#define __USE_EXTERN_INLINES
#undef LIBC_OLD_USE_EXTERN_INLINES
#endif
#endif // LLVM_LIBC_HDR_STDIO_OVERLAY_H

22
libc/hdr/stdlib_macros.h Normal file
View file

@ -0,0 +1,22 @@
//===-- Definition of macros from stdlib.h --------------------------------===//
//
// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
// See https://llvm.org/LICENSE.txt for license information.
// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
//
//===----------------------------------------------------------------------===//
#ifndef LLVM_LIBC_HDR_STDLIB_MACROS_H
#define LLVM_LIBC_HDR_STDLIB_MACROS_H
#ifdef LIBC_FULL_BUILD
#include "include/llvm-libc-macros/stdlib-macros.h"
#else // Overlay mode
#include "stdlib_overlay.h"
#endif // LLVM_LIBC_FULL_BUILD
#endif // LLVM_LIBC_HDR_STDLIB_MACROS_H

46
libc/hdr/stdlib_overlay.h Normal file
View file

@ -0,0 +1,46 @@
//===-- Including stdlib.h in overlay mode --------------------------------===//
//
// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
// See https://llvm.org/LICENSE.txt for license information.
// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
//
//===----------------------------------------------------------------------===//
#ifndef LLVM_LIBC_HDR_STDLIB_OVERLAY_H
#define LLVM_LIBC_HDR_STDLIB_OVERLAY_H
#ifdef LIBC_FULL_BUILD
#error "This header should only be included in overlay mode"
#endif
// Overlay mode
// glibc <stdlib.h> header might provide extern inline definitions for few
// functions, causing external alias errors. They are guarded by
// `__USE_FORTIFY_LEVEL`, which will be temporarily disabled.
#ifdef _FORTIFY_SOURCE
#define LIBC_OLD_FORTIFY_SOURCE _FORTIFY_SOURCE
#undef _FORTIFY_SOURCE
#endif
#ifdef __USE_FORTIFY_LEVEL
#define LIBC_OLD_USE_FORTIFY_LEVEL __USE_FORTIFY_LEVEL
#undef __USE_FORTIFY_LEVEL
#define __USE_FORTIFY_LEVEL 0
#endif
#include <stdlib.h>
#ifdef LIBC_OLD_FORTIFY_SOURCE
#define _FORTIFY_SOURCE LIBC_OLD_FORTIFY_SOURCE
#undef LIBC_OLD_FORTIFY_SOURCE
#endif
#ifdef LIBC_OLD_USE_FORTIFY_LEVEL
#undef __USE_FORTIFY_LEVEL
#define __USE_FORTIFY_LEVEL LIBC_OLD_USE_FORTIFY_LEVEL
#undef LIBC_OLD_USE_FORTIFY_LEVEL
#endif
#endif

View file

@ -0,0 +1,22 @@
//===-- Definition of macros from sys/auxv.h ------------------------------===//
//
// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
// See https://llvm.org/LICENSE.txt for license information.
// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
//
//===----------------------------------------------------------------------===//
#ifndef LLVM_LIBC_HDR_SYS_AUXV_MACROS_H
#define LLVM_LIBC_HDR_SYS_AUXV_MACROS_H
#ifdef LIBC_FULL_BUILD
#include "include/llvm-libc-macros/sys-auxv-macros.h"
#else // Overlay mode
#include <sys/auxv.h>
#endif // LLVM_LIBC_FULL_BUILD
#endif // LLVM_LIBC_HDR_SYS_AUXV_MACROS_H

View file

@ -0,0 +1,22 @@
//===-- Definition of macros from sys/epoll.h -----------------------------===//
//
// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
// See https://llvm.org/LICENSE.txt for license information.
// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
//
//===----------------------------------------------------------------------===//
#ifndef LLVM_LIBC_HDR_SYS_EPOLL_MACROS_H
#define LLVM_LIBC_HDR_SYS_EPOLL_MACROS_H
#ifdef LIBC_FULL_BUILD
#include "include/llvm-libc-macros/sys-epoll-macros.h"
#else // Overlay mode
#include <sys/epoll.h>
#endif // LLVM_LIBC_FULL_BUILD
#endif // LLVM_LIBC_HDR_SYS/EPOLL_MACROS_H

View file

@ -0,0 +1,22 @@
//===-- Definition of macros from sys/ioctl.h -----------------------------===//
//
// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
// See https://llvm.org/LICENSE.txt for license information.
// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
//
//===----------------------------------------------------------------------===//
#ifndef LLVM_LIBC_HDR_SYS_IOCTL_MACROS_H
#define LLVM_LIBC_HDR_SYS_IOCTL_MACROS_H
#ifdef LIBC_FULL_BUILD
#include "include/llvm-libc-macros/sys-ioctl-macros.h"
#else // Overlay mode
#include <sys/ioctl.h>
#endif // LLVM_LIBC_FULL_BUILD
#endif // LLVM_LIBC_HDR_SYS_IOCTL_MACROS_H

View file

@ -0,0 +1,22 @@
//===-- Definition of macros from sys/stat.h ------------------------------===//
//
// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
// See https://llvm.org/LICENSE.txt for license information.
// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
//
//===----------------------------------------------------------------------===//
#ifndef LLVM_LIBC_HDR_SYS_STAT_MACROS_H
#define LLVM_LIBC_HDR_SYS_STAT_MACROS_H
#ifdef LIBC_FULL_BUILD
#include "include/llvm-libc-macros/sys-stat-macros.h"
#else // Overlay mode
#include <sys/stat.h>
#endif // LLVM_LIBC_FULL_BUILD
#endif // LLVM_LIBC_HDR_SYS_STAT_MACROS_H

28
libc/hdr/time_macros.h Normal file
View file

@ -0,0 +1,28 @@
//===-- Definition of macros from time.h ----------------------------------===//
//
// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
// See https://llvm.org/LICENSE.txt for license information.
// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
//
//===----------------------------------------------------------------------===//
#ifndef LLVM_LIBC_HDR_TIME_MACROS_H
#define LLVM_LIBC_HDR_TIME_MACROS_H
#ifdef LIBC_FULL_BUILD
#include "include/llvm-libc-macros/time-macros.h"
#else // Overlay mode
#include <time.h>
#endif // LLVM_LIBC_FULL_BUILD
// TODO: For now, on windows, let's always include the extension header.
// We will need to decide how to export this header.
#ifdef _WIN32
#include "include/llvm-libc-macros/windows/time-macros-ext.h"
#endif // _WIN32
#endif // LLVM_LIBC_HDR_TIME_MACROS_H

22
libc/hdr/types/ACTION.h Normal file
View file

@ -0,0 +1,22 @@
//===-- Proxy header for ACTION -------------------------------------------===//
//
// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
// See https://llvm.org/LICENSE.txt for license information.
// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
//
//===----------------------------------------------------------------------===//
#ifndef LLVM_LIBC_HDR_TYPES_ACTION_H
#define LLVM_LIBC_HDR_TYPES_ACTION_H
#ifdef LIBC_FULL_BUILD
#include "include/llvm-libc-types/ACTION.h"
#else // Overlay mode
#include <search.h>
#endif // LLVM_LIBC_FULL_BUILD
#endif // LLVM_LIBC_HDR_TYPES_ACTION_H

22
libc/hdr/types/ENTRY.h Normal file
View file

@ -0,0 +1,22 @@
//===-- Proxy header for ENTRY --------------------------------------------===//
//
// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
// See https://llvm.org/LICENSE.txt for license information.
// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
//
//===----------------------------------------------------------------------===//
#ifndef LLVM_LIBC_HDR_TYPES_ENTRY_H
#define LLVM_LIBC_HDR_TYPES_ENTRY_H
#ifdef LIBC_FULL_BUILD
#include "include/llvm-libc-types/ENTRY.h"
#else // Overlay mode
#include <search.h>
#endif // LLVM_LIBC_FULL_BUILD
#endif // LLVM_LIBC_HDR_TYPES_ENTRY_H

22
libc/hdr/types/FILE.h Normal file
View file

@ -0,0 +1,22 @@
//===-- Proxy for FILE ----------------------------------------------------===//
//
// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
// See https://llvm.org/LICENSE.txt for license information.
// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
//
//===----------------------------------------------------------------------===//
#ifndef LLVM_LIBC_HDR_TYPES_FILE_H
#define LLVM_LIBC_HDR_TYPES_FILE_H
#ifdef LIBC_FULL_BUILD
#include "include/llvm-libc-types/FILE.h"
#else // Overlay mode
#include "hdr/stdio_overlay.h"
#endif // LLVM_LIBC_FULL_BUILD
#endif // LLVM_LIBC_HDR_TYPES_FILE_H

View file

@ -0,0 +1,22 @@
//===-- Definition of macros from atexithandler_t.h -----------------------===//
//
// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
// See https://llvm.org/LICENSE.txt for license information.
// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
//
//===----------------------------------------------------------------------===//
#ifndef LLVM_LIBC_HDR_TYPES_ATEXITHANDLER_T_H
#define LLVM_LIBC_HDR_TYPES_ATEXITHANDLER_T_H
#ifdef LIBC_FULL_BUILD
#include "include/llvm-libc-types/__atexithandler_t.h"
#else // overlay mode
#error // type not available in overlay mode
#endif // LLVM_LIBC_FULL_BUILD
#endif // LLVM_LIBC_HDR_TYPES_ATEXITHANDLER_T_H

22
libc/hdr/types/char32_t.h Normal file
View file

@ -0,0 +1,22 @@
//===-- Definition of char32_t.h ------------------------------------------===//
//
// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
// See https://llvm.org/LICENSE.txt for license information.
// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
//
//===----------------------------------------------------------------------===//
#ifndef LLVM_LIBC_HDR_TYPES_CHAR32_T_H
#define LLVM_LIBC_HDR_TYPES_CHAR32_T_H
#ifdef LIBC_FULL_BUILD
#include "include/llvm-libc-types/char32_t.h"
#else // overlay mode
#include "hdr/uchar_overlay.h"
#endif // LLVM_LIBC_FULL_BUILD
#endif // LLVM_LIBC_HDR_TYPES_CHAR32_T_H

14
libc/hdr/types/char8_t.h Normal file
View file

@ -0,0 +1,14 @@
//===-- Definition of char8_t.h -------------------------------------------===//
//
// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
// See https://llvm.org/LICENSE.txt for license information.
// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
//
//===----------------------------------------------------------------------===//
#ifndef LLVM_LIBC_HDR_TYPES_CHAR8_T_H
#define LLVM_LIBC_HDR_TYPES_CHAR8_T_H
#include "include/llvm-libc-types/char8_t.h"
#endif // LLVM_LIBC_HDR_TYPES_CHAR8_T_H

22
libc/hdr/types/clock_t.h Normal file
View file

@ -0,0 +1,22 @@
//===-- Proxy for clock_t -------------------------------------------------===//
//
// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
// See https://llvm.org/LICENSE.txt for license information.
// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
//
//===----------------------------------------------------------------------===//
#ifndef LLVM_LIBC_HDR_TYPES_CLOCK_T_H
#define LLVM_LIBC_HDR_TYPES_CLOCK_T_H
#ifdef LIBC_FULL_BUILD
#include "include/llvm-libc-types/clock_t.h"
#else // Overlay mode
#include <sys/types.h>
#endif // LLVM_LIBC_FULL_BUILD
#endif // LLVM_LIBC_HDR_TYPES_CLOCK_T_H

View file

@ -0,0 +1,23 @@
//===-- Proxy for clockid_t -----------------------------------------------===//
//
// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
// See https://llvm.org/LICENSE.txt for license information.
// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
//
//===----------------------------------------------------------------------===//
#ifndef LLVM_LIBC_HDR_TYPES_CLOCKID_T_H
#define LLVM_LIBC_HDR_TYPES_CLOCKID_T_H
// TODO: we will need to decide how to export extension to windows.
#if defined(LIBC_FULL_BUILD) || defined(_WIN32)
#include "include/llvm-libc-types/clockid_t.h"
#else // Overlay mode
#include <sys/types.h>
#endif // LLVM_LIBC_FULL_BUILD
#endif // LLVM_LIBC_HDR_TYPES_CLOCKID_T_H

View file

@ -0,0 +1,22 @@
//===-- Proxy for cookie_io_functions_t -----------------------------------===//
//
// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
// See https://llvm.org/LICENSE.txt for license information.
// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
//
//===----------------------------------------------------------------------===//
#ifndef LLVM_LIBC_HDR_TYPES_COOKIE_IO_FUNCTIONS_T_H
#define LLVM_LIBC_HDR_TYPES_COOKIE_IO_FUNCTIONS_T_H
#ifdef LIBC_FULL_BUILD
#include "include/llvm-libc-types/cookie_io_functions_t.h"
#else // Overlay mode
#include "hdr/stdio_overlay.h"
#endif // LLVM_LIBC_FULL_BUILD
#endif // LLVM_LIBC_HDR_TYPES_COOKIE_IO_FUNCTIONS_T_H

View file

@ -0,0 +1,22 @@
//===-- Proxy for cpu_set_t -----------------------------------------------===//
//
// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
// See https://llvm.org/LICENSE.txt for license information.
// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
//
//===----------------------------------------------------------------------===//
#ifndef LLVM_LIBC_HDR_TYPES_CPU_SET_T_H
#define LLVM_LIBC_HDR_TYPES_CPU_SET_T_H
#ifdef LIBC_FULL_BUILD
#include "include/llvm-libc-types/cpu_set_t.h"
#else // Overlay mode
#include <sched.h>
#endif // LLVM_LIBC_FULL_BUILD
#endif // LLVM_LIBC_HDR_TYPES_CPU_SET_T_H

22
libc/hdr/types/div_t.h Normal file
View file

@ -0,0 +1,22 @@
//===-- Definition of macros from div_t.h ---------------------------------===//
//
// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
// See https://llvm.org/LICENSE.txt for license information.
// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
//
//===----------------------------------------------------------------------===//
#ifndef LLVM_LIBC_HDR_TYPES_DIV_T_H
#define LLVM_LIBC_HDR_TYPES_DIV_T_H
#ifdef LIBC_FULL_BUILD
#include "include/llvm-libc-types/div_t.h"
#else // Overlay mode
#include "hdr/stdlib_overlay.h"
#endif // LLVM_LIBC_FULL_BUILD
#endif // LLVM_LIBC_HDR_TYPES_DIV_T_H

22
libc/hdr/types/fenv_t.h Normal file
View file

@ -0,0 +1,22 @@
//===-- Definition of macros from fenv_t.h --------------------------------===//
//
// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
// See https://llvm.org/LICENSE.txt for license information.
// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
//
//===----------------------------------------------------------------------===//
#ifndef LLVM_LIBC_HDR_TYPES_FENV_T_H
#define LLVM_LIBC_HDR_TYPES_FENV_T_H
#ifdef LIBC_FULL_BUILD
#include "include/llvm-libc-types/fenv_t.h"
#else // Overlay mode
#include <fenv.h>
#endif // LLVM_LIBC_FULL_BUILD
#endif // LLVM_LIBC_HDR_TYPES_FENV_T_H

View file

@ -0,0 +1,22 @@
//===-- Definition of macros from fexcept_t.h -----------------------------===//
//
// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
// See https://llvm.org/LICENSE.txt for license information.
// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
//
//===----------------------------------------------------------------------===//
#ifndef LLVM_LIBC_HDR_TYPES_FEXCEPT_T_H
#define LLVM_LIBC_HDR_TYPES_FEXCEPT_T_H
#ifdef LIBC_FULL_BUILD
#include "include/llvm-libc-types/fexcept_t.h"
#else // Overlay mode
#include <fenv.h>
#endif // LLVM_LIBC_FULL_BUILD
#endif // LLVM_LIBC_HDR_TYPES_FEXCEPT_T_H

22
libc/hdr/types/jmp_buf.h Normal file
View file

@ -0,0 +1,22 @@
//===-- Definition of jmp_buf.h ------------------------------------------===//
//
// Part of the LLVM Project, under the Apahce License v2.0 with LLVM Exceptions.
// See https://llvm.org/LICENSE.txt for license information.
// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
//
//===----------------------------------------------------------------------===//
#ifndef LLVM_LIBC_HDR_TYPES_JMP_BUF_H
#define LLVM_LIBC_HDR_TYPES_JMP_BUF_H
#ifdef LIBC_FULL_BUILD
#include "include/llvm-libc-types/jmp_buf.h"
#else // overlay mode
#include <setjmp.h>
#endif // LLVM_LIBC_FULL_BUILD
#endif // LLVM_LIBC_HDR_TYPES_JMP_BUF_H

22
libc/hdr/types/ldiv_t.h Normal file
View file

@ -0,0 +1,22 @@
//===-- Definition of macros from ldiv_t.h --------------------------------===//
//
// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
// See https://llvm.org/LICENSE.txt for license information.
// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
//
//===----------------------------------------------------------------------===//
#ifndef LLVM_LIBC_HDR_TYPES_LDIV_T_H
#define LLVM_LIBC_HDR_TYPES_LDIV_T_H
#ifdef LIBC_FULL_BUILD
#include "include/llvm-libc-types/ldiv_t.h"
#else // Overlay mode
#include "hdr/stdlib_overlay.h"
#endif // LLVM_LIBC_FULL_BUILD
#endif // LLVM_LIBC_HDR_TYPES_LDIV_T_H

22
libc/hdr/types/lldiv_t.h Normal file
View file

@ -0,0 +1,22 @@
//===-- Definition of macros from lldiv_t.h -------------------------------===//
//
// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
// See https://llvm.org/LICENSE.txt for license information.
// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
//
//===----------------------------------------------------------------------===//
#ifndef LLVM_LIBC_HDR_TYPES_LLDIV_T_H
#define LLVM_LIBC_HDR_TYPES_LLDIV_T_H
#ifdef LIBC_FULL_BUILD
#include "include/llvm-libc-types/lldiv_t.h"
#else // Overlay mode
#include "hdr/stdlib_overlay.h"
#endif // LLVM_LIBC_FULL_BUILD
#endif // LLVM_LIBC_HDR_TYPES_LLDIV_T_H

22
libc/hdr/types/locale_t.h Normal file
View file

@ -0,0 +1,22 @@
//===-- Definition of macros from locale_t.h ------------------------------===//
//
// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
// See https://llvm.org/LICENSE.txt for license information.
// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
//
//===----------------------------------------------------------------------===//
#ifndef LLVM_LIBC_HDR_TYPES_LOCALE_T_H
#define LLVM_LIBC_HDR_TYPES_LOCALE_T_H
#ifdef LIBC_FULL_BUILD
#include "include/llvm-libc-types/locale_t.h"
#else // overlay mode
#error "type not available in overlay mode"
#endif // LLVM_LIBC_FULL_BUILD
#endif // LLVM_LIBC_HDR_TYPES_LOCALE_T_H

View file

@ -0,0 +1,22 @@
//===-- Definition of macros from mbstate_t.h -----------------------------===//
//
// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
// See https://llvm.org/LICENSE.txt for license information.
// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
//
//===----------------------------------------------------------------------===//
#ifndef LLVM_LIBC_HDR_TYPES_MBSTATE_T_H
#define LLVM_LIBC_HDR_TYPES_MBSTATE_T_H
#ifdef LIBC_FULL_BUILD
#include "include/llvm-libc-types/mbstate_t.h"
#else // Overlay mode
#error "Cannot overlay mbstate_t"
#endif // LLVM_LIBC_FULL_BUILD
#endif // LLVM_LIBC_HDR_TYPES_MBSTATE_T_H

22
libc/hdr/types/mode_t.h Normal file
View file

@ -0,0 +1,22 @@
//===-- Definition of macros from mode_t.h --------------------------------===//
//
// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
// See https://llvm.org/LICENSE.txt for license information.
// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
//
//===----------------------------------------------------------------------===//
#ifndef LLVM_LIBC_HDR_TYPES_MODE_T_H
#define LLVM_LIBC_HDR_TYPES_MODE_T_H
#ifdef LIBC_FULL_BUILD
#include "include/llvm-libc-types/mode_t.h"
#else // Overlay mode
#include "hdr/fcntl_overlay.h"
#endif // LLVM_LIBC_FULL_BUILD
#endif // LLVM_LIBC_HDR_TYPES_MODE_T_H

23
libc/hdr/types/nfds_t.h Normal file
View file

@ -0,0 +1,23 @@
//===-- Definition of nfds_t ----------------------------------------------===//
//
// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
// See https://llvm.org/LICENSE.txt for license information.
// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
//
//
//===----------------------------------------------------------------------===//
#ifndef LLVM_LIBC_HDR_TYPES_NFDS_T_H
#define LLVM_LIBC_HDR_TYPES_NFDS_T_H
#ifdef LIBC_FULL_BUILD
#include "include/llvm-libc-types/nfds_t.h"
#else // overlay mode
#include <poll.h>
#endif // LLVM_LIBC_FULL_BUILD
#endif // LLVM_LIBC_HDR_TYPES_NFDS_T_H

22
libc/hdr/types/off_t.h Normal file
View file

@ -0,0 +1,22 @@
//===-- Proxy for off_t ---------------------------------------------------===//
//
// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
// See https://llvm.org/LICENSE.txt for license information.
// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
//
//===----------------------------------------------------------------------===//
#ifndef LLVM_LIBC_HDR_TYPES_OFF_T_H
#define LLVM_LIBC_HDR_TYPES_OFF_T_H
#ifdef LIBC_FULL_BUILD
#include "include/llvm-libc-types/off_t.h"
#else // Overlay mode
#include "hdr/stdio_overlay.h"
#endif // LLVM_LIBC_FULL_BUILD
#endif // LLVM_LIBC_HDR_TYPES_OFF_T_H

22
libc/hdr/types/pid_t.h Normal file
View file

@ -0,0 +1,22 @@
//===-- Proxy for pid_t ---------------------------------------------------===//
//
// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
// See https://llvm.org/LICENSE.txt for license information.
// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
//
//===----------------------------------------------------------------------===//
#ifndef LLVM_LIBC_HDR_TYPES_PID_T_H
#define LLVM_LIBC_HDR_TYPES_PID_T_H
#ifdef LIBC_FULL_BUILD
#include "include/llvm-libc-types/pid_t.h"
#else // Overlay mode
#include <sys/types.h>
#endif // LLVM_LIBC_FULL_BUILD
#endif // LLVM_LIBC_HDR_TYPES_PID_T_H

21
libc/hdr/types/sigset_t.h Normal file
View file

@ -0,0 +1,21 @@
//===-- Proxy for sigset_t ------------------------------------------------===//
//
// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
// See https://llvm.org/LICENSE.txt for license information.
// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
//
//===----------------------------------------------------------------------===//
#ifndef LLVM_LIBC_HDR_TYPES_SIGSET_T_H
#define LLVM_LIBC_HDR_TYPES_SIGSET_T_H
#ifdef LIBC_FULL_BUILD
#include "include/llvm-libc-types/sigset_t.h"
#else
#include <signal.h>
#endif // LIBC_FULL_BUILD
#endif // LLVM_LIBC_HDR_TYPES_SIGSET_T_H

23
libc/hdr/types/size_t.h Normal file
View file

@ -0,0 +1,23 @@
//===-- Proxy for size_t --------------------------------------------------===//
//
// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
// See https://llvm.org/LICENSE.txt for license information.
// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
//
//===----------------------------------------------------------------------===//
#ifndef LLVM_LIBC_HDR_TYPES_SIZE_T_H
#define LLVM_LIBC_HDR_TYPES_SIZE_T_H
#ifdef LIBC_FULL_BUILD
#include "include/llvm-libc-types/size_t.h"
#else
#define __need_size_t
#include <stddef.h>
#undef __need_size_t
#endif // LIBC_FULL_BUILD
#endif // LLVM_LIBC_HDR_TYPES_SIZE_T_H

View file

@ -0,0 +1,21 @@
//===-- Proxy for socklen_t -----------------------------------------------===//
//
// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
// See https://llvm.org/LICENSE.txt for license information.
// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
//
//===----------------------------------------------------------------------===//
#ifndef LLVM_LIBC_HDR_TYPES_SOCKLEN_T_H
#define LLVM_LIBC_HDR_TYPES_SOCKLEN_T_H
#ifdef LIBC_FULL_BUILD
#include "include/llvm-libc-types/socklen_t.h"
#else
#include <signal.h>
#endif // LIBC_FULL_BUILD
#endif // LLVM_LIBC_HDR_TYPES_SOCKLEN_T_H

21
libc/hdr/types/ssize_t.h Normal file
View file

@ -0,0 +1,21 @@
//===-- Proxy for ssize_t -------------------------------------------------===//
//
// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
// See https://llvm.org/LICENSE.txt for license information.
// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
//
//===----------------------------------------------------------------------===//
#ifndef LLVM_LIBC_HDR_TYPES_SSIZE_T_H
#define LLVM_LIBC_HDR_TYPES_SSIZE_T_H
#ifdef LIBC_FULL_BUILD
#include "include/llvm-libc-types/ssize_t.h"
#else
#include <sys/types.h>
#endif // LIBC_FULL_BUILD
#endif // LLVM_LIBC_HDR_TYPES_SSIZE_T_H

23
libc/hdr/types/stack_t.h Normal file
View file

@ -0,0 +1,23 @@
//===-- Definition of stack_t.h -------------------------------------------===//
//
// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
// See https://llvm.org/LICENSE.txt for license information.
// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
//
//
//===----------------------------------------------------------------------===//
#ifndef LLVM_LIBC_HDR_TYPES_STACK_T_H
#define LLVM_LIBC_HDR_TYPES_STACK_T_H
#ifdef LIBC_FULL_BUILD
#include "include/llvm-libc-types/stack_t.h"
#else // overlay mode
#include <signal.h>
#endif // LLVM_LIBC_FULL_BUILD
#endif // LLVM_LIBC_HDR_TYPES_STACK_T_H

View file

@ -0,0 +1,21 @@
//===-- Proxy for struct dl_phdr_info -----------------------------------===//
//
// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
// See https://llvm.org/LICENSE.txt for license information.
// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
//
//===---------------------------------------------------------------------===//
#ifndef LLVM_LIBC_HDR_TYPES_STRUCT_DL_PHDR_INFO_H
#define LLVM_LIBC_HDR_TYPES_STRUCT_DL_PHDR_INFO_H
#ifdef LIBC_FULL_BUILD
#include "include/llvm-libc-types/struct_dl_phdr_info.h"
#else
#include <link.h>
#endif // LIBC_FULL_BUILD
#endif // LLVM_LIBC_HDR_TYPES_STRUCT_DL_PHDR_INFO_H

View file

@ -0,0 +1,21 @@
//===-- Proxy for struct epoll_event --------------------------------------===//
//
// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
// See https://llvm.org/LICENSE.txt for license information.
// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
//
//===----------------------------------------------------------------------===//
#ifndef LLVM_LIBC_HDR_TYPES_STRUCT_EPOLL_EVENT_H
#define LLVM_LIBC_HDR_TYPES_STRUCT_EPOLL_EVENT_H
#ifdef LIBC_FULL_BUILD
#include "include/llvm-libc-types/struct_epoll_event.h"
#else
#include <sys/epoll.h>
#endif // LIBC_FULL_BUILD
#endif // LLVM_LIBC_HDR_TYPES_STRUCT_EPOLL_EVENT_H

View file

@ -0,0 +1,21 @@
//===-- Proxy for struct f_owner_ex --------------------------------------===//
//
// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
// See https://llvm.org/LICENSE.txt for license information.
// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
//
//===----------------------------------------------------------------------===//
#ifndef LLVM_LIBC_HDR_TYPES_STRUCT_F_OWNER_EX_H
#define LLVM_LIBC_HDR_TYPES_STRUCT_F_OWNER_EX_H
#ifdef LIBC_FULL_BUILD
#include "include/llvm-libc-types/struct_f_owner_ex.h"
#else
#include "hdr/fcntl_overlay.h"
#endif // LIBC_FULL_BUILD
#endif // LLVM_LIBC_HDR_TYPES_STRUCT_F_OWNER_EX_H

View file

@ -0,0 +1,21 @@
//===-- Proxy for struct flock -------------------------------------------===//
//
// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
// See https://llvm.org/LICENSE.txt for license information.
// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
//
//===----------------------------------------------------------------------===//
#ifndef LLVM_LIBC_HDR_TYPES_STRUCT_FLOCK_H
#define LLVM_LIBC_HDR_TYPES_STRUCT_FLOCK_H
#ifdef LIBC_FULL_BUILD
#include "include/llvm-libc-types/struct_flock.h"
#else
#include "hdr/fcntl_overlay.h"
#endif // LIBC_FULL_BUILD
#endif // LLVM_LIBC_HDR_TYPES_STRUCT_FLOCK_H

View file

@ -0,0 +1,21 @@
//===-- Proxy for struct flock64 -----------------------------------------===//
//
// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
// See https://llvm.org/LICENSE.txt for license information.
// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
//
//===----------------------------------------------------------------------===//
#ifndef LLVM_LIBC_HDR_TYPES_STRUCT_FLOCK64_H
#define LLVM_LIBC_HDR_TYPES_STRUCT_FLOCK64_H
#ifdef LIBC_FULL_BUILD
#include "include/llvm-libc-types/struct_flock64.h"
#else
#include "hdr/fcntl_overlay.h"
#endif // LIBC_FULL_BUILD
#endif // LLVM_LIBC_HDR_TYPES_STRUCT_FLOCK64_H

View file

@ -0,0 +1,21 @@
//===-- Proxy for struct iovec -------------------------------------------===//
//
// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
// See https://llvm.org/LICENSE.txt for license information.
// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
//
//===----------------------------------------------------------------------===//
#ifndef LLVM_LIBC_HDR_TYPES_STRUCT_IOVEC_H
#define LLVM_LIBC_HDR_TYPES_STRUCT_IOVEC_H
#ifdef LIBC_FULL_BUILD
#include "include/llvm-libc-types/struct_iovec.h"
#else
#include <sys/uio.h>
#endif // LIBC_FULL_BUILD
#endif // LLVM_LIBC_HDR_TYPES_STRUCT_IOVEC_H

View file

@ -0,0 +1,21 @@
//===-- Proxy for struct itimerval ----------------------------------------===//
//
// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
// See https://llvm.org/LICENSE.txt for license information.
// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
//
//===----------------------------------------------------------------------===//
#ifndef LLVM_LIBC_HDR_TYPES_STRUCT_ITIMERVAL_H
#define LLVM_LIBC_HDR_TYPES_STRUCT_ITIMERVAL_H
#ifdef LIBC_FULL_BUILD
#include "include/llvm-libc-types/struct_itimerval.h"
#else
#include <sys/time.h>
#endif // LIBC_FULL_BUILD
#endif // LLVM_LIBC_HDR_TYPES_STRUCT_ITIMERVAL_H

View file

@ -0,0 +1,21 @@
//===-- Proxy for struct msghdr ------------------------------------------===//
//
// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
// See https://llvm.org/LICENSE.txt for license information.
// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
//
//===----------------------------------------------------------------------===//
#ifndef LLVM_LIBC_HDR_TYPES_STRUCT_MSGHDR_H
#define LLVM_LIBC_HDR_TYPES_STRUCT_MSGHDR_H
#ifdef LIBC_FULL_BUILD
#include "include/llvm-libc-types/struct_msghdr.h"
#else
#include <sys/socket.h>
#endif // LIBC_FULL_BUILD
#endif // LLVM_LIBC_HDR_TYPES_STRUCT_MSGHDR_H

View file

@ -0,0 +1,23 @@
//===-- Definition of struct pollfd ---------------------------------------===//
//
// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
// See https://llvm.org/LICENSE.txt for license information.
// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
//
//
//===----------------------------------------------------------------------===//
#ifndef LLVM_LIBC_HDR_TYPES_STRUCT_POLLFD_H
#define LLVM_LIBC_HDR_TYPES_STRUCT_POLLFD_H
#ifdef LIBC_FULL_BUILD
#include "include/llvm-libc-types/struct_pollfd.h"
#else // overlay mode
#include <poll.h>
#endif // LLVM_LIBC_FULL_BUILD
#endif // LLVM_LIBC_HDR_TYPES_STRUCT_POLLFD_H

View file

@ -0,0 +1,21 @@
//===-- Proxy for struct sigaction ---------------------------------------===//
//
// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
// See https://llvm.org/LICENSE.txt for license information.
// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
//
//===----------------------------------------------------------------------===//
#ifndef LLVM_LIBC_HDR_TYPES_STRUCT_SIGACTION_H
#define LLVM_LIBC_HDR_TYPES_STRUCT_SIGACTION_H
#ifdef LIBC_FULL_BUILD
#include "include/llvm-libc-types/struct_sigaction.h"
#else
#include <signal.h>
#endif // LIBC_FULL_BUILD
#endif // LLVM_LIBC_HDR_TYPES_STRUCT_SIGACTION_H

View file

@ -0,0 +1,21 @@
//===-- Proxy for struct sockaddr ----------------------------------------===//
//
// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
// See https://llvm.org/LICENSE.txt for license information.
// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
//
//===----------------------------------------------------------------------===//
#ifndef LLVM_LIBC_HDR_TYPES_STRUCT_SOCKADDR_H
#define LLVM_LIBC_HDR_TYPES_STRUCT_SOCKADDR_H
#ifdef LIBC_FULL_BUILD
#include "include/llvm-libc-types/struct_sockaddr.h"
#else
#include <sys/socket.h>
#endif // LIBC_FULL_BUILD
#endif // LLVM_LIBC_HDR_TYPES_STRUCT_SOCKADDR_H

View file

@ -0,0 +1,21 @@
//===-- Proxy for struct timespec ----------------------------------------===//
//
// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
// See https://llvm.org/LICENSE.txt for license information.
// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
//
//===----------------------------------------------------------------------===//
#ifndef LLVM_LIBC_HDR_TYPES_STRUCT_TIMESPEC_H
#define LLVM_LIBC_HDR_TYPES_STRUCT_TIMESPEC_H
#ifdef LIBC_FULL_BUILD
#include "include/llvm-libc-types/struct_timespec.h"
#else
#include <time.h>
#endif // LIBC_FULL_BUILD
#endif // LLVM_LIBC_HDR_TYPES_STRUCT_TIMESPEC_H

View file

@ -0,0 +1,21 @@
//===-- Proxy for struct timeval ----------------------------------------===//
//
// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
// See https://llvm.org/LICENSE.txt for license information.
// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
//
//===----------------------------------------------------------------------===//
#ifndef LLVM_LIBC_HDR_TYPES_STRUCT_TIMEVAL_H
#define LLVM_LIBC_HDR_TYPES_STRUCT_TIMEVAL_H
#ifdef LIBC_FULL_BUILD
#include "include/llvm-libc-types/struct_timeval.h"
#else
#include <sys/time.h>
#endif // LIBC_FULL_BUILD
#endif // LLVM_LIBC_HDR_TYPES_STRUCT_TIMEVAL_H

View file

@ -0,0 +1,21 @@
//===-- Proxy for struct tm ----------------------------------------===//
//
// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
// See https://llvm.org/LICENSE.txt for license information.
// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
//
//===----------------------------------------------------------------------===//
#ifndef LLVM_LIBC_HDR_TYPES_STRUCT_TM_H
#define LLVM_LIBC_HDR_TYPES_STRUCT_TM_H
#ifdef LIBC_FULL_BUILD
#include "include/llvm-libc-types/struct_tm.h"
#else
#include <time.h>
#endif // LIBC_FULL_BUILD
#endif // LLVM_LIBC_HDR_TYPES_STRUCT_TM_H

View file

@ -0,0 +1,22 @@
//===-- Proxy for suseconds_t ---------------------------------------------===//
//
// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
// See https://llvm.org/LICENSE.txt for license information.
// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
//
//===----------------------------------------------------------------------===//
#ifndef LLVM_LIBC_HDR_TYPES_SUSECONDS_T_H
#define LLVM_LIBC_HDR_TYPES_SUSECONDS_T_H
#ifdef LIBC_FULL_BUILD
#include "include/llvm-libc-types/suseconds_t.h"
#else // Overlay mode
#include <sys/types.h>
#endif // LLVM_LIBC_FULL_BUILD
#endif // #ifndef LLVM_LIBC_HDR_TYPES_SUSECONDS_T_H

22
libc/hdr/types/time_t.h Normal file
View file

@ -0,0 +1,22 @@
//===-- Proxy for time_t --------------------------------------------------===//
//
// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
// See https://llvm.org/LICENSE.txt for license information.
// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
//
//===----------------------------------------------------------------------===//
#ifndef LLVM_LIBC_HDR_TYPES_TIME_T_H
#define LLVM_LIBC_HDR_TYPES_TIME_T_H
#ifdef LIBC_FULL_BUILD
#include "include/llvm-libc-types/time_t.h"
#else // Overlay mode
#include <time.h>
#endif // LLVM_LIBC_FULL_BUILD
#endif // LLVM_LIBC_HDR_TYPES_TIME_T_H

22
libc/hdr/types/uid_t.h Normal file
View file

@ -0,0 +1,22 @@
//===-- Proxy for uid_t ---------------------------------------------------===//
//
// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
// See https://llvm.org/LICENSE.txt for license information.
// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
//
//===----------------------------------------------------------------------===//
#ifndef LLVM_LIBC_HDR_TYPES_UID_T_H
#define LLVM_LIBC_HDR_TYPES_UID_T_H
#ifdef LIBC_FULL_BUILD
#include "include/llvm-libc-types/uid_t.h"
#else // Overlay mode
#include <sys/types.h>
#endif // LLVM_LIBC_FULL_BUILD
#endif // LLVM_LIBC_HDR_TYPES_UID_T_H

23
libc/hdr/types/wchar_t.h Normal file
View file

@ -0,0 +1,23 @@
//===-- Definition of wchar_t.h -------------------------------------------===//
//
// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
// See https://llvm.org/LICENSE.txt for license information.
// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
//
//
//===----------------------------------------------------------------------===//
#ifndef LLVM_LIBC_HDR_TYPES_WCHAR_T_H
#define LLVM_LIBC_HDR_TYPES_WCHAR_T_H
#ifdef LIBC_FULL_BUILD
#include "include/llvm-libc-types/wchar_t.h"
#else // overlay mode
#include "hdr/wchar_overlay.h"
#endif // LLVM_LIBC_FULL_BUILD
#endif // LLVM_LIBC_HDR_TYPES_WCHAR_T_H

23
libc/hdr/types/wint_t.h Normal file
View file

@ -0,0 +1,23 @@
//===-- Definition of wint_t.h --------------------------------------------===//
//
// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
// See https://llvm.org/LICENSE.txt for license information.
// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
//
//
//===----------------------------------------------------------------------===//
#ifndef LLVM_LIBC_HDR_TYPES_WINT_T_H
#define LLVM_LIBC_HDR_TYPES_WINT_T_H
#ifdef LIBC_FULL_BUILD
#include "include/llvm-libc-types/wint_t.h"
#else // overlay mode
#include "hdr/wchar_overlay.h"
#endif // LLVM_LIBC_FULL_BUILD
#endif // LLVM_LIBC_HDR_TYPES_WINT_T_H

69
libc/hdr/uchar_overlay.h Normal file
View file

@ -0,0 +1,69 @@
//===-- Including uchar.h in overlay mode ---------------------------------===//
//
// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
// See https://llvm.org/LICENSE.txt for license information.
// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
//
//===----------------------------------------------------------------------===//
#ifndef LLVM_LIBC_HDR_UCHAR_OVERLAY_H
#define LLVM_LIBC_HDR_UCHAR_OVERLAY_H
#ifdef LIBC_FULL_BUILD
#error "This header should only be included in overlay mode"
#endif
// Overlay mode
// glibc <uchar.h> header might provide extern inline definitions for few
// functions, causing external alias errors. They are guarded by
// `__USE_EXTERN_INLINES` macro. We temporarily disable `__USE_EXTERN_INLINES`
// macro by defining `__NO_INLINE__` before including <uchar.h>.
// And the same with `__USE_FORTIFY_LEVEL`, which will be temporarily disabled
// with `_FORTIFY_SOURCE`.
#ifdef _FORTIFY_SOURCE
#define LIBC_OLD_FORTIFY_SOURCE _FORTIFY_SOURCE
#undef _FORTIFY_SOURCE
#endif
#ifndef __NO_INLINE__
#define __NO_INLINE__ 1
#define LIBC_SET_NO_INLINE
#endif
#ifdef __USE_EXTERN_INLINES
#define LIBC_OLD_USE_EXTERN_INLINES
#undef __USE_EXTERN_INLINES
#endif
#ifdef __USE_FORTIFY_LEVEL
#define LIBC_OLD_USE_FORTIFY_LEVEL __USE_FORTIFY_LEVEL
#undef __USE_FORTIFY_LEVEL
#define __USE_FORTIFY_LEVEL 0
#endif
#include <uchar.h>
#ifdef LIBC_OLD_FORTIFY_SOURCE
#define _FORTIFY_SOURCE LIBC_OLD_FORTIFY_SOURCE
#undef LIBC_OLD_FORTIFY_SOURCE
#endif
#ifdef LIBC_SET_NO_INLINE
#undef __NO_INLINE__
#undef LIBC_SET_NO_INLINE
#endif
#ifdef LIBC_OLD_USE_FORTIFY_LEVEL
#undef __USE_FORTIFY_LEVEL
#define __USE_FORTIFY_LEVEL LIBC_OLD_USE_FORTIFY_LEVEL
#undef LIBC_OLD_USE_FORTIFY_LEVEL
#endif
#ifdef LIBC_OLD_USE_EXTERN_INLINES
#define __USE_EXTERN_INLINES
#undef LIBC_OLD_USE_EXTERN_INLINES
#endif
#endif // LLVM_LIBC_HDR_UCHAR_OVERLAY_H

22
libc/hdr/unistd_macros.h Normal file
View file

@ -0,0 +1,22 @@
//===-- Definition of macros from unistd.h --------------------------------===//
//
// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
// See https://llvm.org/LICENSE.txt for license information.
// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
//
//===----------------------------------------------------------------------===//
#ifndef LLVM_LIBC_HDR_UNISTD_MACROS_H
#define LLVM_LIBC_HDR_UNISTD_MACROS_H
#ifdef LIBC_FULL_BUILD
#include "include/llvm-libc-macros/unistd-macros.h"
#else // Overlay mode
#include "unistd_overlay.h"
#endif // LLVM_LIBC_FULL_BUILD
#endif // LLVM_LIBC_HDR_UNISTD_MACROS_H

69
libc/hdr/unistd_overlay.h Normal file
View file

@ -0,0 +1,69 @@
//===-- Including unistd.h in overlay mode -------------------------------===//
//
// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
// See https://llvm.org/LICENSE.txt for license information.
// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
//
//===----------------------------------------------------------------------===//
#ifndef LLVM_LIBC_HDR_UNISTD_OVERLAY_H
#define LLVM_LIBC_HDR_UNISTD_OVERLAY_H
#ifdef LIBC_FULL_BUILD
#error "This header should only be included in overlay mode"
#endif
// Overlay mode
// glibc <unistd.h> header might provide extern inline definitions for few
// functions, causing external alias errors. They are guarded by
// `__USE_EXTERN_INLINES` macro. We temporarily disable `__USE_EXTERN_INLINES`
// macro by defining `__NO_INLINE__` before including <stdio.h>.
// And the same with `__USE_FORTIFY_LEVEL`, which will be temporarily disabled
// with `_FORTIFY_SOURCE`.
#ifdef _FORTIFY_SOURCE
#define LIBC_OLD_FORTIFY_SOURCE _FORTIFY_SOURCE
#undef _FORTIFY_SOURCE
#endif
#ifdef __USE_EXTERN_INLINES
#define LIBC_OLD_USE_EXTERN_INLINES
#undef __USE_EXTERN_INLINES
#endif
#ifdef __USE_FORTIFY_LEVEL
#define LIBC_OLD_USE_FORTIFY_LEVEL __USE_FORTIFY_LEVEL
#undef __USE_FORTIFY_LEVEL
#define __USE_FORTIFY_LEVEL 0
#endif
#ifndef __NO_INLINE__
#define __NO_INLINE__ 1
#define LIBC_SET_NO_INLINE
#endif
#include <unistd.h>
#ifdef LIBC_OLD_FORTIFY_SOURCE
#define _FORTIFY_SOURCE LIBC_OLD_FORTIFY_SOURCE
#undef LIBC_OLD_FORTIFY_SOURCE
#endif
#ifdef LIBC_SET_NO_INLINE
#undef __NO_INLINE__
#undef LIBC_SET_NO_INLINE
#endif
#ifdef LIBC_OLD_USE_FORTIFY_LEVEL
#undef __USE_FORTIFY_LEVEL
#define __USE_FORTIFY_LEVEL LIBC_OLD_USE_FORTIFY_LEVEL
#undef LIBC_OLD_USE_FORTIFY_LEVEL
#endif
#ifdef LIBC_OLD_USE_EXTERN_INLINES
#define __USE_EXTERN_INLINES
#undef LIBC_OLD_USE_EXTERN_INLINES
#endif
#endif // LLVM_LIBC_HDR_UNISTD_OVERLAY_H

22
libc/hdr/wchar_macros.h Normal file
View file

@ -0,0 +1,22 @@
//===-- Definition of macros from wchar.h ---------------------------------===//
//
// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
// See https://llvm.org/LICENSE.txt for license information.
// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
//
//===----------------------------------------------------------------------===//
#ifndef LLVM_LIBC_HDR_WCHAR_MACROS_H
#define LLVM_LIBC_HDR_WCHAR_MACROS_H
#ifdef LIBC_FULL_BUILD
#include "include/llvm-libc-macros/wchar-macros.h"
#else // Overlay mode
#include "hdr/wchar_overlay.h"
#endif // LLVM_LIBC_FULL_BUILD
#endif // LLVM_LIBC_HDR_WCHAR_MACROS_H

69
libc/hdr/wchar_overlay.h Normal file
View file

@ -0,0 +1,69 @@
//===-- Including wchar.h in overlay mode ---------------------------------===//
//
// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
// See https://llvm.org/LICENSE.txt for license information.
// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
//
//===----------------------------------------------------------------------===//
#ifndef LLVM_LIBC_HDR_WCHAR_OVERLAY_H
#define LLVM_LIBC_HDR_WCHAR_OVERLAY_H
#ifdef LIBC_FULL_BUILD
#error "This header should only be included in overlay mode"
#endif
// Overlay mode
// glibc <wchar.h> header might provide extern inline definitions for few
// functions, causing external alias errors. They are guarded by
// `__USE_EXTERN_INLINES` macro. We temporarily disable `__USE_EXTERN_INLINES`
// macro by defining `__NO_INLINE__` before including <wchar.h>.
// And the same with `__USE_FORTIFY_LEVEL`, which will be temporarily disabled
// with `_FORTIFY_SOURCE`.
#ifdef _FORTIFY_SOURCE
#define LIBC_OLD_FORTIFY_SOURCE _FORTIFY_SOURCE
#undef _FORTIFY_SOURCE
#endif
#ifndef __NO_INLINE__
#define __NO_INLINE__ 1
#define LIBC_SET_NO_INLINE
#endif
#ifdef __USE_EXTERN_INLINES
#define LIBC_OLD_USE_EXTERN_INLINES
#undef __USE_EXTERN_INLINES
#endif
#ifdef __USE_FORTIFY_LEVEL
#define LIBC_OLD_USE_FORTIFY_LEVEL __USE_FORTIFY_LEVEL
#undef __USE_FORTIFY_LEVEL
#define __USE_FORTIFY_LEVEL 0
#endif
#include <wchar.h>
#ifdef LIBC_OLD_FORTIFY_SOURCE
#define _FORTIFY_SOURCE LIBC_OLD_FORTIFY_SOURCE
#undef LIBC_OLD_FORTIFY_SOURCE
#endif
#ifdef LIBC_SET_NO_INLINE
#undef __NO_INLINE__
#undef LIBC_SET_NO_INLINE
#endif
#ifdef LIBC_OLD_USE_FORTIFY_LEVEL
#undef __USE_FORTIFY_LEVEL
#define __USE_FORTIFY_LEVEL LIBC_OLD_USE_FORTIFY_LEVEL
#undef LIBC_OLD_USE_FORTIFY_LEVEL
#endif
#ifdef LIBC_OLD_USE_EXTERN_INLINES
#define __USE_EXTERN_INLINES
#undef LIBC_OLD_USE_EXTERN_INLINES
#endif
#endif // LLVM_LIBC_HDR_WCHAR_OVERLAY_H

View file

@ -0,0 +1,98 @@
//===-- Common definitions for LLVM-libc public header files --------------===//
//
// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
// See https://llvm.org/LICENSE.txt for license information.
// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
//
//===----------------------------------------------------------------------===//
#ifndef _LLVM_LIBC_COMMON_H
#define _LLVM_LIBC_COMMON_H
#define __LLVM_LIBC__ 1
#ifdef __cplusplus
#undef __BEGIN_C_DECLS
#define __BEGIN_C_DECLS extern "C" {
#undef __END_C_DECLS
#define __END_C_DECLS }
// Standard C++ doesn't have C99 restrict but GNU C++ has it with __ spelling.
#undef __restrict
#ifndef __GNUC__
#define __restrict
#endif
#undef _Noreturn
#define _Noreturn [[noreturn]]
#undef _Alignas
#define _Alignas alignas
#undef _Static_assert
#define _Static_assert static_assert
#undef _Alignof
#define _Alignof alignof
#undef _Thread_local
#define _Thread_local thread_local
#undef __NOEXCEPT
#if __cplusplus >= 201103L
#define __NOEXCEPT noexcept
#else
#define __NOEXCEPT throw()
#endif
// This macro serves as a generic cast implementation for use in both C and C++,
// similar to `__BIONIC_CAST` in Android.
#undef __LLVM_LIBC_CAST
#define __LLVM_LIBC_CAST(cast, type, value) (cast<type>(value))
#else // not __cplusplus
#undef __BEGIN_C_DECLS
#define __BEGIN_C_DECLS
#undef __END_C_DECLS
#define __END_C_DECLS
#undef __restrict
#if __STDC_VERSION__ >= 199901L
// C99 and above support the restrict keyword.
#define __restrict restrict
#elif !defined(__GNUC__)
// GNU-compatible compilers accept the __ spelling in all modes.
// Otherwise, omit the qualifier for pure C89 compatibility.
#define __restrict
#endif
#undef _Noreturn
#if __STDC_VERSION__ >= 201112L
// In C11 and later, _Noreturn is a keyword.
#elif defined(__GNUC__)
// GNU-compatible compilers have an equivalent attribute.
#define _Noreturn __attribute__((__noreturn__))
#else
#define _Noreturn
#endif
#undef __NOEXCEPT
#ifdef __GNUC__
#define __NOEXCEPT __attribute__((__nothrow__))
#else
#define __NOEXCEPT
#endif
#undef _Returns_twice
#define _Returns_twice __attribute__((returns_twice))
#undef __LLVM_LIBC_CAST
#define __LLVM_LIBC_CAST(cast, type, value) ((type)(value))
#endif // __cplusplus
#endif // _LLVM_LIBC_COMMON_H

View file

@ -0,0 +1,18 @@
//===-- Definition of EFIAPI macro ------------------------------------===//
//
// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
// See https://llvm.org/LICENSE.txt for license information.
// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
//
//===------------------------------------------------------------------===//
#ifndef LLVM_LIBC_MACROS_EFIAPI_MACROS_H
#define LLVM_LIBC_MACROS_EFIAPI_MACROS_H
#if defined(__x86_64__) && !defined(__ILP32__)
#define EFIAPI __attribute__((ms_abi))
#else
#define EFIAPI
#endif
#endif // LLVM_LIBC_MACROS_EFIAPI_MACROS_H

View file

@ -0,0 +1,14 @@
//===-- Definition of macros to be used with assert functions -------------===//
//
// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
// See https://llvm.org/LICENSE.txt for license information.
// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
//
//===----------------------------------------------------------------------===//
#ifndef __LLVM_LIBC_MACROS_ASSERT_MACROS_H
#define __LLVM_LIBC_MACROS_ASSERT_MACROS_H
#define __STDC_VERSION_ASSERT_H__ 202311L
#endif // __LLVM_LIBC_MACROS_ASSERT_MACROS_H

View file

@ -0,0 +1,26 @@
//===-- Definition of macros from time.h ---------------------------------===//
//
// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
// See https://llvm.org/LICENSE.txt for license information.
// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
//
//===----------------------------------------------------------------------===//
#ifndef LLVM_LIBC_MACROS_BAREMETAL_TIME_MACROS_H
#define LLVM_LIBC_MACROS_BAREMETAL_TIME_MACROS_H
#ifdef __CLK_TCK
#define CLOCKS_PER_SEC __CLK_TCK
#else
#if defined(__arm__) || defined(_M_ARM) || defined(__aarch64__) || \
defined(__arm64__) || defined(_M_ARM64)
// This default implementation of this function shall use semihosting
// Semihosting measures time in centiseconds
// https://github.com/ARM-software/abi-aa/blob/main/semihosting/semihosting.rst#sys-clock-0x10
#define CLOCKS_PER_SEC 100
#else
#define CLOCKS_PER_SEC 1000000
#endif
#endif
#endif // LLVM_LIBC_MACROS_BAREMETAL_TIME_MACROS_H

View file

@ -0,0 +1,24 @@
//===-- Definition of macros to be used with complex functions ------------===//
//
// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
// See https://llvm.org/LICENSE.txt for license information.
// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
//
//===----------------------------------------------------------------------===//
#ifndef __LLVM_LIBC_MACROS_COMPLEX_MACROS_H
#define __LLVM_LIBC_MACROS_COMPLEX_MACROS_H
#ifndef __STDC_NO_COMPLEX__
#define __STDC_VERSION_COMPLEX_H__ 202311L
#define complex _Complex
#define _Complex_I ((_Complex float)1.0fi)
#define I _Complex_I
// TODO: Add imaginary macros once GCC or Clang support _Imaginary builtin-type.
#endif
#endif // __LLVM_LIBC_MACROS_COMPLEX_MACROS_H

View file

@ -0,0 +1,20 @@
//===-- Definition of the containerof macro -------------------------------===//
//
// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
// See https://llvm.org/LICENSE.txt for license information.
// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
//
//===----------------------------------------------------------------------===//
#ifndef LLVM_LIBC_MACROS_CONTAINEROF_MACRO_H
#define LLVM_LIBC_MACROS_CONTAINEROF_MACRO_H
#include "offsetof-macro.h"
#define __containerof(ptr, type, member) \
({ \
const __typeof(((type *)0)->member) *__ptr = (ptr); \
(type *)(void *)((const char *)__ptr - offsetof(type, member)); \
})
#endif // LLVM_LIBC_MACROS_CONTAINEROF_MACRO_H

View file

@ -0,0 +1,23 @@
//===-- Definition of macros from dlfcn.h ---------------------------------===//
//
// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
// See https://llvm.org/LICENSE.txt for license information.
// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
//
//===----------------------------------------------------------------------===//
#ifndef LLVM_LIBC_MACROS_DLFCN_MACROS_H
#define LLVM_LIBC_MACROS_DLFCN_MACROS_H
#define RTLD_LAZY 0x00001
#define RTLD_NOW 0x00002
#define RTLD_GLOBAL 0x00100
#define RTLD_LOCAL 0
// Non-standard stuff here
#define RTLD_BINDING_MASK 0x3
#define RTLD_NOLOAD 0x00004
#define RTLD_DEEPBIND 0x00008
#define RTLD_NODELETE 0x01000
#endif // LLVM_LIBC_MACROS_DLFCN_MACROS_H

View file

@ -0,0 +1,18 @@
//===-- Definition of macros from elf.h -----------------------------------===//
//
// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
// See https://llvm.org/LICENSE.txt for license information.
// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
//
//===----------------------------------------------------------------------===//
#ifndef LLVM_LIBC_MACROS_ELF_MACROS_H
#define LLVM_LIBC_MACROS_ELF_MACROS_H
#if __has_include(<linux/elf.h>)
#include <linux/elf.h>
#else
#error "cannot use <sys/elf.h> without proper system headers."
#endif
#endif // LLVM_LIBC_MACROS_ELF_MACROS_H

View file

@ -0,0 +1,50 @@
//===-- Definition of macros from endian.h --------------------------------===//
//
// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
// See https://llvm.org/LICENSE.txt for license information.
// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
//
//===----------------------------------------------------------------------===//
#ifndef LLVM_LIBC_MACROS_ENDIAN_MACROS_H
#define LLVM_LIBC_MACROS_ENDIAN_MACROS_H
#include "stdint-macros.h"
#define LITTLE_ENDIAN __ORDER_LITTLE_ENDIAN__
#define BIG_ENDIAN __ORDER_BIG_ENDIAN__
#define BYTE_ORDER __BYTE_ORDER__
#if BYTE_ORDER == LITTLE_ENDIAN
#define htobe16(x) __builtin_bswap16((x))
#define htobe32(x) __builtin_bswap32((x))
#define htobe64(x) __builtin_bswap64((x))
#define htole16(x) __LLVM_LIBC_CAST(static_cast, uint16_t, x)
#define htole32(x) __LLVM_LIBC_CAST(static_cast, uint32_t, x)
#define htole64(x) __LLVM_LIBC_CAST(static_cast, uint64_t, x)
#define be16toh(x) __builtin_bswap16((x))
#define be32toh(x) __builtin_bswap32((x))
#define be64toh(x) __builtin_bswap64((x))
#define le16toh(x) __LLVM_LIBC_CAST(static_cast, uint16_t, x)
#define le32toh(x) __LLVM_LIBC_CAST(static_cast, uint32_t, x)
#define le64toh(x) __LLVM_LIBC_CAST(static_cast, uint64_t, x)
#else
#define htobe16(x) __LLVM_LIBC_CAST(static_cast, uint16_t, x)
#define htobe32(x) __LLVM_LIBC_CAST(static_cast, uint32_t, x)
#define htobe64(x) __LLVM_LIBC_CAST(static_cast, uint64_t, x)
#define htole16(x) __builtin_bswap16((x))
#define htole32(x) __builtin_bswap32((x))
#define htole64(x) __builtin_bswap64((x))
#define be16toh(x) __LLVM_LIBC_CAST(static_cast, uint16_t, x)
#define be32toh(x) __LLVM_LIBC_CAST(static_cast, uint32_t, x)
#define be64toh(x) __LLVM_LIBC_CAST(static_cast, uint64_t, x)
#define le16toh(x) __builtin_bswap16((x))
#define le32toh(x) __builtin_bswap32((x))
#define le64toh(x) __builtin_bswap64((x))
#endif
#endif // LLVM_LIBC_MACROS_ENDIAN_MACROS_H

View file

@ -0,0 +1,8 @@
#ifndef LLVM_LIBC_MACROS_ERROR_NUMBER_MACROS_H
#define LLVM_LIBC_MACROS_ERROR_NUMBER_MACROS_H
#ifdef __linux__
#include "linux/error-number-macros.h"
#endif
#endif // LLVM_LIBC_MACROS_ERROR_NUMBER_MACROS_H

View file

@ -0,0 +1,8 @@
#ifndef LLVM_LIBC_MACROS_FCNTL_MACROS_H
#define LLVM_LIBC_MACROS_FCNTL_MACROS_H
#ifdef __linux__
#include "linux/fcntl-macros.h"
#endif
#endif // LLVM_LIBC_MACROS_FCNTL_MACROS_H

View file

@ -0,0 +1,12 @@
//===-- Definition of macros from features.h ------------------------------===//
//
// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
// See https://llvm.org/LICENSE.txt for license information.
// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
//
//===----------------------------------------------------------------------===//
#ifndef LLVM_LIBC_MACROS_FEATURES_MACROS_H
#define LLVM_LIBC_MACROS_FEATURES_MACROS_H
#endif // LLVM_LIBC_MACROS_FEATURES_MACROS_H

View file

@ -0,0 +1,28 @@
//===-- Definition of macros from fenv.h ----------------------------------===//
//
// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
// See https://llvm.org/LICENSE.txt for license information.
// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
//
//===----------------------------------------------------------------------===//
#ifndef LLVM_LIBC_MACROS_FENV_MACROS_H
#define LLVM_LIBC_MACROS_FENV_MACROS_H
#define FE_DIVBYZERO 0x1
#define FE_INEXACT 0x2
#define FE_INVALID 0x4
#define FE_OVERFLOW 0x8
#define FE_UNDERFLOW 0x10
#define __FE_DENORM 0x20
#define FE_ALL_EXCEPT \
(FE_DIVBYZERO | FE_INEXACT | FE_INVALID | FE_OVERFLOW | FE_UNDERFLOW)
#define FE_DOWNWARD 0x400
#define FE_TONEAREST 0
#define FE_TOWARDZERO 0xC00
#define FE_UPWARD 0x800
#define FE_DFL_ENV ((fenv_t *)-1)
#endif // LLVM_LIBC_MACROS_FENV_MACROS_H

View file

@ -0,0 +1,16 @@
//===-- Definition of macros to be used with file seek functions ----------===//
//
// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
// See https://llvm.org/LICENSE.txt for license information.
// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
//
//===----------------------------------------------------------------------===//
#ifndef LLVM_LIBC_MACROS_FILE_SEEK_MACROS_H
#define LLVM_LIBC_MACROS_FILE_SEEK_MACROS_H
#define SEEK_SET 0
#define SEEK_CUR 1
#define SEEK_END 2
#endif // LLVM_LIBC_MACROS_FILE_SEEK_MACROS_H

View file

@ -0,0 +1,178 @@
//===-- Definition of macros from float.h ---------------------------------===//
//
// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
// See https://llvm.org/LICENSE.txt for license information.
// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
//
//===----------------------------------------------------------------------===//
#ifndef LLVM_LIBC_MACROS_FLOAT_MACROS_H
#define LLVM_LIBC_MACROS_FLOAT_MACROS_H
#ifndef FLT_RADIX
#define FLT_RADIX __FLT_RADIX__
#endif // FLT_RADIX
#ifndef FLT_EVAL_METHOD
#define FLT_EVAL_METHOD __FLT_EVAL_METHOD__
#endif // FLT_EVAL_METHOD
#ifndef FLT_ROUNDS
#if __has_builtin(__builtin_flt_rounds)
#define FLT_ROUNDS __builtin_flt_rounds()
#else
#define FLT_ROUNDS 1
#endif
#endif // FLT_ROUNDS
#ifndef FLT_DECIMAL_DIG
#define FLT_DECIMAL_DIG __FLT_DECIMAL_DIG__
#endif // FLT_DECIMAL_DIG
#ifndef DBL_DECIMAL_DIG
#define DBL_DECIMAL_DIG __DBL_DECIMAL_DIG__
#endif // DBL_DECIMAL_DIG
#ifndef LDBL_DECIMAL_DIG
#define LDBL_DECIMAL_DIG __LDBL_DECIMAL_DIG__
#endif // LDBL_DECIMAL_DIG
#ifndef DECIMAL_DIG
#define DECIMAL_DIG __DECIMAL_DIG__
#endif // DECIMAL_DIG
#ifndef FLT_DIG
#define FLT_DIG __FLT_DIG__
#endif // FLT_DIG
#ifndef DBL_DIG
#define DBL_DIG __DBL_DIG__
#endif // DBL_DIG
#ifndef LDBL_DIG
#define LDBL_DIG __LDBL_DIG__
#endif // LDBL_DIG
#ifndef FLT_MANT_DIG
#define FLT_MANT_DIG __FLT_MANT_DIG__
#endif // FLT_MANT_DIG
#ifndef DBL_MANT_DIG
#define DBL_MANT_DIG __DBL_MANT_DIG__
#endif // DBL_MANT_DIG
#ifndef LDBL_MANT_DIG
#define LDBL_MANT_DIG __LDBL_MANT_DIG__
#endif // LDBL_MANT_DIG
#ifndef FLT_MIN
#define FLT_MIN __FLT_MIN__
#endif // FLT_MIN
#ifndef DBL_MIN
#define DBL_MIN __DBL_MIN__
#endif // DBL_MIN
#ifndef LDBL_MIN
#define LDBL_MIN __LDBL_MIN__
#endif // LDBL_MIN
#ifndef FLT_MAX
#define FLT_MAX __FLT_MAX__
#endif // FLT_MAX
#ifndef DBL_MAX
#define DBL_MAX __DBL_MAX__
#endif // DBL_MAX
#ifndef LDBL_MAX
#define LDBL_MAX __LDBL_MAX__
#endif // LDBL_MAX
#ifndef FLT_TRUE_MIN
#define FLT_TRUE_MIN __FLT_DENORM_MIN__
#endif // FLT_TRUE_MIN
#ifndef DBL_TRUE_MIN
#define DBL_TRUE_MIN __DBL_DENORM_MIN__
#endif // DBL_TRUE_MIN
#ifndef LDBL_TRUE_MIN
#define LDBL_TRUE_MIN __LDBL_DENORM_MIN__
#endif // LDBL_TRUE_MIN
#ifndef FLT_EPSILON
#define FLT_EPSILON __FLT_EPSILON__
#endif // FLT_EPSILON
#ifndef DBL_EPSILON
#define DBL_EPSILON __DBL_EPSILON__
#endif // DBL_EPSILON
#ifndef LDBL_EPSILON
#define LDBL_EPSILON __LDBL_EPSILON__
#endif // LDBL_EPSILON
#ifndef FLT_MIN_EXP
#define FLT_MIN_EXP __FLT_MIN_EXP__
#endif // FLT_MIN_EXP
#ifndef DBL_MIN_EXP
#define DBL_MIN_EXP __DBL_MIN_EXP__
#endif // DBL_MIN_EXP
#ifndef LDBL_MIN_EXP
#define LDBL_MIN_EXP __LDBL_MIN_EXP__
#endif // LDBL_MIN_EXP
#ifndef FLT_MIN_10_EXP
#define FLT_MIN_10_EXP __FLT_MIN_10_EXP__
#endif // FLT_MIN_10_EXP
#ifndef DBL_MIN_10_EXP
#define DBL_MIN_10_EXP __DBL_MIN_10_EXP__
#endif // DBL_MIN_10_EXP
#ifndef LDBL_MIN_10_EXP
#define LDBL_MIN_10_EXP __LDBL_MIN_10_EXP__
#endif // LDBL_MIN_10_EXP
#ifndef FLT_MAX_EXP
#define FLT_MAX_EXP __FLT_MAX_EXP__
#endif // FLT_MAX_EXP
#ifndef DBL_MAX_EXP
#define DBL_MAX_EXP __DBL_MAX_EXP__
#endif // DBL_MAX_EXP
#ifndef LDBL_MAX_EXP
#define LDBL_MAX_EXP __LDBL_MAX_EXP__
#endif // LDBL_MAX_EXP
#ifndef FLT_MAX_10_EXP
#define FLT_MAX_10_EXP __FLT_MAX_10_EXP__
#endif // FLT_MAX_10_EXP
#ifndef DBL_MAX_10_EXP
#define DBL_MAX_10_EXP __DBL_MAX_10_EXP__
#endif // DBL_MAX_10_EXP
#ifndef LDBL_MAX_10_EXP
#define LDBL_MAX_10_EXP __LDBL_MAX_10_EXP__
#endif // LDBL_MAX_10_EXP
#ifndef FLT_HAS_SUBNORM
#define FLT_HAS_SUBNORM __FLT_HAS_DENORM__
#endif // FLT_HAS_SUBNORM
#ifndef DBL_HAS_SUBNORM
#define DBL_HAS_SUBNORM __DBL_HAS_DENORM__
#endif // DBL_HAS_SUBNORM
#ifndef LDBL_HAS_SUBNORM
#define LDBL_HAS_SUBNORM __LDBL_HAS_DENORM__
#endif // LDBL_HAS_SUBNORM
// TODO: Add FLT16 and FLT128 constants.
#endif // LLVM_LIBC_MACROS_FLOAT_MACROS_H

View file

@ -0,0 +1,27 @@
//===-- Detection of _Float16 compiler builtin type -----------------------===//
//
// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
// See https://llvm.org/LICENSE.txt for license information.
// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
//
//===----------------------------------------------------------------------===//
#ifndef LLVM_LIBC_MACROS_FLOAT16_MACROS_H
#define LLVM_LIBC_MACROS_FLOAT16_MACROS_H
#include "../llvm-libc-types/float128.h"
#if defined(__FLT16_MANT_DIG__) && \
(!defined(__GNUC__) || __GNUC__ >= 13 || defined(__clang__)) && \
!defined(__arm__) && !defined(_M_ARM) && !defined(__riscv) && \
!defined(_WIN32)
#define LIBC_TYPES_HAS_FLOAT16
// TODO: This would no longer be required if HdrGen let us guard function
// declarations with multiple macros.
#ifdef LIBC_TYPES_HAS_FLOAT128
#define LIBC_TYPES_HAS_FLOAT16_AND_FLOAT128
#endif // LIBC_TYPES_HAS_FLOAT128
#endif
#endif // LLVM_LIBC_MACROS_FLOAT16_MACROS_H

View file

@ -0,0 +1,48 @@
//===-- Definition of generic error number macros -------------------------===//
//
// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
// See https://llvm.org/LICENSE.txt for license information.
// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
//
//===----------------------------------------------------------------------===//
#ifndef LLVM_LIBC_MACROS_GENERIC_ERROR_NUMBER_MACROS_H
#define LLVM_LIBC_MACROS_GENERIC_ERROR_NUMBER_MACROS_H
#define EPERM 1
#define ENOENT 2
#define ESRCH 3
#define EINTR 4
#define EIO 5
#define ENXIO 6
#define E2BIG 7
#define ENOEXEC 8
#define EBADF 9
#define ECHILD 10
#define EAGAIN 11
#define ENOMEM 12
#define EACCES 13
#define EFAULT 14
#define ENOTBLK 15
#define EBUSY 16
#define EEXIST 17
#define EXDEV 18
#define ENODEV 19
#define ENOTDIR 20
#define EISDIR 21
#define EINVAL 22
#define ENFILE 23
#define EMFILE 24
#define ENOTTY 25
#define ETXTBSY 26
#define EFBIG 27
#define ENOSPC 28
#define ESPIPE 29
#define EROFS 30
#define EMLINK 31
#define EPIPE 32
#define EDOM 33
#define ERANGE 34
#define EILSEQ 84
#endif // LLVM_LIBC_MACROS_GENERIC_ERROR_NUMBER_MACROS_H

View file

@ -0,0 +1,28 @@
//===-- Definition of GPU signal number macros ----------------------------===//
//
// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
// See https://llvm.org/LICENSE.txt for license information.
// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
//
//===----------------------------------------------------------------------===//
#ifndef LLVM_LIBC_MACROS_GPU_SIGNAL_MACROS_H
#define LLVM_LIBC_MACROS_GPU_SIGNAL_MACROS_H
#define SIGINT 2
#define SIGILL 4
#define SIGABRT 6
#define SIGFPE 8
#define SIGSEGV 11
#define SIGTERM 15
#define SIG_DFL ((void (*)(int))(0))
#define SIG_IGN ((void (*)(int))(1))
#define SIG_ERR ((void (*)(int))(-1))
// Max signal number
#define NSIG 64
#define __NSIGSET_WORDS NSIG
#endif // LLVM_LIBC_MACROS_GPU_SIGNAL_MACROS_H

View file

@ -0,0 +1,17 @@
//===-- Definition of macros from time.h ---------------------------------===//
//
// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
// See https://llvm.org/LICENSE.txt for license information.
// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
//
//===----------------------------------------------------------------------===//
#ifndef LLVM_LIBC_MACROS_GPU_TIME_MACROS_H
#define LLVM_LIBC_MACROS_GPU_TIME_MACROS_H
#define CLOCK_REALTIME 0
#define CLOCK_MONOTONIC 1
#define CLOCKS_PER_SEC 1000000
#endif // LLVM_LIBC_MACROS_GPU_TIME_MACROS_H

View file

@ -0,0 +1,420 @@
//===-- Definition of macros from inttypes.h ------------------------------===//
//
// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
// See https://llvm.org/LICENSE.txt for license information.
// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
//
//===----------------------------------------------------------------------===//
#ifndef LLVM_LIBC_MACROS_INTTYPES_MACROS_H
#define LLVM_LIBC_MACROS_INTTYPES_MACROS_H
// fprintf/scanf format macros.
#define __STDC_VERSION_INTTYPES_H__ 202311L
// clang provides these macros, so we don't need to define them.
#ifndef __clang__
#if __UINTPTR_MAX__ == __UINT64_MAX__
#define __PRI64 "l"
#define __PRIPTR "l"
#elif __UINTPTR_MAX__ == __UINT32_MAX__
#define __PRI64 "ll"
#define __PRIPTR ""
#else
// CHERI achitecture for example, has 128-bit pointers that use special "P"
// format.
#error "Unsupported pointer format"
#endif
#define __INT8_FMTd__ "hhd"
#define __INT16_FMTd__ "hd"
#define __INT32_FMTd__ "d"
#define __INT64_FMTd__ __PRI64 "d"
#define __INT_LEAST8_FMTd__ "hhd"
#define __INT_LEAST16_FMTd__ "hd"
#define __INT_LEAST32_FMTd__ "d"
#define __INT_LEAST64_FMTd__ __PRI64 "d"
#define __INT_FAST8_FMTd__ "hhd"
#define __INT_FAST16_FMTd__ "hd"
#define __INT_FAST32_FMTd__ "d"
#define __INT_FAST64_FMTd__ __PRI64 "d"
#define __INTMAX_FMTd__ __PRI64 "d"
#define __INTPTR_FMTd__ __PRIPTR "d"
#define __INT8_FMTi__ "hhi"
#define __INT16_FMTi__ "hi"
#define __INT32_FMTi__ "i"
#define __INT64_FMTi__ __PRI64 "i"
#define __INT_LEAST8_FMTi__ "hhi"
#define __INT_LEAST16_FMTi__ "hi"
#define __INT_LEAST32_FMTi__ "i"
#define __INT_LEAST64_FMTi__ __PRI64 "i"
#define __INT_FAST8_FMTi__ "hhi"
#define __INT_FAST16_FMTi__ "hi"
#define __INT_FAST32_FMTi__ "i"
#define __INT_FAST64_FMTi__ __PRI64 "i"
#define __INTMAX_FMTi__ __PRI64 "i"
#define __INTPTR_FMTi__ __PRIPTR "i"
#define __UINT8_FMTo__ "hho"
#define __UINT16_FMTo__ "ho"
#define __UINT32_FMTo__ "o"
#define __UINT64_FMTo__ __PRI64 "o"
#define __UINT_LEAST8_FMTo__ "hho"
#define __UINT_LEAST16_FMTo__ "ho"
#define __UINT_LEAST32_FMTo__ "o"
#define __UINT_LEAST64_FMTo__ __PRI64 "o"
#define __UINT_FAST8_FMTo__ "hho"
#define __UINT_FAST16_FMTo__ "ho"
#define __UINT_FAST32_FMTo__ "o"
#define __UINT_FAST64_FMTo__ __PRI64 "o"
#define __UINTMAX_FMTo__ __PRI64 "o"
#define __UINTPTR_FMTo__ __PRIPTR "o"
#define __UINT8_FMTu__ "hhu"
#define __UINT16_FMTu__ "hu"
#define __UINT32_FMTu__ "u"
#define __UINT64_FMTu__ __PRI64 "u"
#define __UINT_LEAST8_FMTu__ "hhu"
#define __UINT_LEAST16_FMTu__ "hu"
#define __UINT_LEAST32_FMTu__ "u"
#define __UINT_LEAST64_FMTu__ __PRI64 "u"
#define __UINT_FAST8_FMTu__ "hhu"
#define __UINT_FAST16_FMTu__ "hu"
#define __UINT_FAST32_FMTu__ "u"
#define __UINT_FAST64_FMTu__ __PRI64 "u"
#define __UINTMAX_FMTu__ __PRI64 "u"
#define __UINTPTR_FMTu__ __PRIPTR "u"
#define __UINT8_FMTx__ "hhx"
#define __UINT16_FMTx__ "hx"
#define __UINT32_FMTx__ "x"
#define __UINT64_FMTx__ __PRI64 "x"
#define __UINT_LEAST8_FMTx__ "hhx"
#define __UINT_LEAST16_FMTx__ "hx"
#define __UINT_LEAST32_FMTx__ "x"
#define __UINT_LEAST64_FMTx__ __PRI64 "x"
#define __UINT_FAST8_FMTx__ "hhx"
#define __UINT_FAST16_FMTx__ "hx"
#define __UINT_FAST32_FMTx__ "x"
#define __UINT_FAST64_FMTx__ __PRI64 "x"
#define __UINTMAX_FMTx__ __PRI64 "x"
#define __UINTPTR_FMTx__ __PRIPTR "x"
#define __UINT8_FMTX__ "hhX"
#define __UINT16_FMTX__ "hX"
#define __UINT32_FMTX__ "X"
#define __UINT64_FMTX__ __PRI64 "X"
#define __UINT_LEAST8_FMTX__ "hhX"
#define __UINT_LEAST16_FMTX__ "hX"
#define __UINT_LEAST32_FMTX__ "X"
#define __UINT_LEAST64_FMTX__ __PRI64 "X"
#define __UINT_FAST8_FMTX__ "hhX"
#define __UINT_FAST16_FMTX__ "hX"
#define __UINT_FAST32_FMTX__ "X"
#define __UINT_FAST64_FMTX__ __PRI64 "X"
#define __UINTMAX_FMTX__ __PRI64 "X"
#define __UINTPTR_FMTX__ __PRIPTR "X"
#endif
// only recent clang provides these macros, so we need to check if they are
// available.
#ifndef __UINT8_FMTb__
#define __UINT8_FMTb__ "hhb"
#endif
#ifndef __UINT16_FMTb__
#define __UINT16_FMTb__ "hb"
#endif
#ifndef __UINT32_FMTb__
#define __UINT32_FMTb__ "b"
#endif
#ifndef __UINT64_FMTb__
#define __UINT64_FMTb__ __PRI64 "b"
#endif
#ifndef __UINT_LEAST8_FMTb__
#define __UINT_LEAST8_FMTb__ "hhb"
#endif
#ifndef __UINT_LEAST16_FMTb__
#define __UINT_LEAST16_FMTb__ "hb"
#endif
#ifndef __UINT_LEAST32_FMTb__
#define __UINT_LEAST32_FMTb__ "b"
#endif
#ifndef __UINT_LEAST64_FMTb__
#define __UINT_LEAST64_FMTb__ __PRI64 "b"
#endif
#ifndef __UINT_FAST8_FMTb__
#define __UINT_FAST8_FMTb__ "hhb"
#endif
#ifndef __UINT_FAST16_FMTb__
#define __UINT_FAST16_FMTb__ "hb"
#endif
#ifndef __UINT_FAST32_FMTb__
#define __UINT_FAST32_FMTb__ "b"
#endif
#ifndef __UINT_FAST64_FMTb__
#define __UINT_FAST64_FMTb__ __PRI64 "b"
#endif
#ifndef __UINTMAX_FMTb__
#define __UINTMAX_FMTb__ __PRI64 "b"
#endif
#ifndef __UINTPTR_FMTb__
#define __UINTPTR_FMTb__ __PRIPTR "b"
#endif
#ifndef __UINT8_FMTB__
#define __UINT8_FMTB__ "hhB"
#endif
#ifndef __UINT16_FMTB__
#define __UINT16_FMTB__ "hB"
#endif
#ifndef __UINT32_FMTB__
#define __UINT32_FMTB__ "B"
#endif
#ifndef __UINT64_FMTB__
#define __UINT64_FMTB__ __PRI64 "B"
#endif
#ifndef __UINT_LEAST8_FMTB__
#define __UINT_LEAST8_FMTB__ "hhB"
#endif
#ifndef __UINT_LEAST16_FMTB__
#define __UINT_LEAST16_FMTB__ "hB"
#endif
#ifndef __UINT_LEAST32_FMTB__
#define __UINT_LEAST32_FMTB__ "B"
#endif
#ifndef __UINT_LEAST64_FMTB__
#define __UINT_LEAST64_FMTB__ __PRI64 "B"
#endif
#ifndef __UINT_FAST8_FMTB__
#define __UINT_FAST8_FMTB__ "hhB"
#endif
#ifndef __UINT_FAST16_FMTB__
#define __UINT_FAST16_FMTB__ "hB"
#endif
#ifndef __UINT_FAST32_FMTB__
#define __UINT_FAST32_FMTB__ "B"
#endif
#ifndef __UINT_FAST64_FMTB__
#define __UINT_FAST64_FMTB__ __PRI64 "B"
#endif
#ifndef __UINTMAX_FMTB__
#define __UINTMAX_FMTB__ __PRI64 "B"
#endif
#ifndef __UINTPTR_FMTB__
#define __UINTPTR_FMTB__ __PRIPTR "B"
#endif
// The fprintf() macros for signed integers.
#define PRId8 __INT8_FMTd__
#define PRId16 __INT16_FMTd__
#define PRId32 __INT32_FMTd__
#define PRId64 __INT64_FMTd__
#define PRIdLEAST8 __INT_LEAST8_FMTd__
#define PRIdLEAST16 __INT_LEAST16_FMTd__
#define PRIdLEAST32 __INT_LEAST32_FMTd__
#define PRIdLEAST64 __INT_LEAST64_FMTd__
#define PRIdFAST8 __INT_FAST8_FMTd__
#define PRIdFAST16 __INT_FAST16_FMTd__
#define PRIdFAST32 __INT_FAST32_FMTd__
#define PRIdFAST64 __INT_FAST64_FMTd__
#define PRIdMAX __INTMAX_FMTd__
#define PRIdPTR __INTPTR_FMTd__
#define PRIi8 __INT8_FMTi__
#define PRIi16 __INT16_FMTi__
#define PRIi32 __INT32_FMTi__
#define PRIi64 __INT64_FMTi__
#define PRIiLEAST8 __INT_LEAST8_FMTi__
#define PRIiLEAST16 __INT_LEAST16_FMTi__
#define PRIiLEAST32 __INT_LEAST32_FMTi__
#define PRIiLEAST64 __INT_LEAST64_FMTi__
#define PRIiFAST8 __INT_FAST8_FMTi__
#define PRIiFAST16 __INT_FAST16_FMTi__
#define PRIiFAST32 __INT_FAST32_FMTi__
#define PRIiFAST64 __INT_FAST64_FMTi__
#define PRIiMAX __INTMAX_FMTi__
#define PRIiPTR __INTPTR_FMTi__
// The fprintf() macros for unsigned integers.
#define PRIo8 __UINT8_FMTo__
#define PRIo16 __UINT16_FMTo__
#define PRIo32 __UINT32_FMTo__
#define PRIo64 __UINT64_FMTo__
#define PRIoLEAST8 __UINT_LEAST8_FMTo__
#define PRIoLEAST16 __UINT_LEAST16_FMTo__
#define PRIoLEAST32 __UINT_LEAST32_FMTo__
#define PRIoLEAST64 __UINT_LEAST64_FMTo__
#define PRIoFAST8 __UINT_FAST8_FMTo__
#define PRIoFAST16 __UINT_FAST16_FMTo__
#define PRIoFAST32 __UINT_FAST32_FMTo__
#define PRIoFAST64 __UINT_FAST64_FMTo__
#define PRIoMAX __UINTMAX_FMTo__
#define PRIoPTR __UINTPTR_FMTo__
#define PRIu8 __UINT8_FMTu__
#define PRIu16 __UINT16_FMTu__
#define PRIu32 __UINT32_FMTu__
#define PRIu64 __UINT64_FMTu__
#define PRIuLEAST8 __UINT_LEAST8_FMTu__
#define PRIuLEAST16 __UINT_LEAST16_FMTu__
#define PRIuLEAST32 __UINT_LEAST32_FMTu__
#define PRIuLEAST64 __UINT_LEAST64_FMTu__
#define PRIuFAST8 __UINT_FAST8_FMTu__
#define PRIuFAST16 __UINT_FAST16_FMTu__
#define PRIuFAST32 __UINT_FAST32_FMTu__
#define PRIuFAST64 __UINT_FAST64_FMTu__
#define PRIuMAX __UINTMAX_FMTu__
#define PRIuPTR __UINTPTR_FMTu__
#define PRIx8 __UINT8_FMTx__
#define PRIx16 __UINT16_FMTx__
#define PRIx32 __UINT32_FMTx__
#define PRIx64 __UINT64_FMTx__
#define PRIxLEAST8 __UINT_LEAST8_FMTx__
#define PRIxLEAST16 __UINT_LEAST16_FMTx__
#define PRIxLEAST32 __UINT_LEAST32_FMTx__
#define PRIxLEAST64 __UINT_LEAST64_FMTx__
#define PRIxFAST8 __UINT_FAST8_FMTx__
#define PRIxFAST16 __UINT_FAST16_FMTx__
#define PRIxFAST32 __UINT_FAST32_FMTx__
#define PRIxFAST64 __UINT_FAST64_FMTx__
#define PRIxMAX __UINTMAX_FMTx__
#define PRIxPTR __UINTPTR_FMTx__
#define PRIX8 __UINT8_FMTX__
#define PRIX16 __UINT16_FMTX__
#define PRIX32 __UINT32_FMTX__
#define PRIX64 __UINT64_FMTX__
#define PRIXLEAST8 __UINT_LEAST8_FMTX__
#define PRIXLEAST16 __UINT_LEAST16_FMTX__
#define PRIXLEAST32 __UINT_LEAST32_FMTX__
#define PRIXLEAST64 __UINT_LEAST64_FMTX__
#define PRIXFAST8 __UINT_FAST8_FMTX__
#define PRIXFAST16 __UINT_FAST16_FMTX__
#define PRIXFAST32 __UINT_FAST32_FMTX__
#define PRIXFAST64 __UINT_FAST64_FMTX__
#define PRIXMAX __UINTMAX_FMTX__
#define PRIXPTR __UINTPTR_FMTX__
#define PRIb8 __UINT8_FMTb__
#define PRIb16 __UINT16_FMTb__
#define PRIb32 __UINT32_FMTb__
#define PRIb64 __UINT64_FMTb__
#define PRIbLEAST8 __UINT_LEAST8_FMTb__
#define PRIbLEAST16 __UINT_LEAST16_FMTb__
#define PRIbLEAST32 __UINT_LEAST32_FMTb__
#define PRIbLEAST64 __UINT_LEAST64_FMTb__
#define PRIbFAST8 __UINT_FAST8_FMTb__
#define PRIbFAST16 __UINT_FAST16_FMTb__
#define PRIbFAST32 __UINT_FAST32_FMTb__
#define PRIbFAST64 __UINT_FAST64_FMTb__
#define PRIbMAX __UINTMAX_FMTb__
#define PRIbPTR __UINTPTR_FMTb__
#define PRIB8 __UINT8_FMTB__
#define PRIB16 __UINT16_FMTB__
#define PRIB32 __UINT32_FMTB__
#define PRIB64 __UINT64_FMTB__
#define PRIBLEAST8 __UINT_LEAST8_FMTB__
#define PRIBLEAST16 __UINT_LEAST16_FMTB__
#define PRIBLEAST32 __UINT_LEAST32_FMTB__
#define PRIBLEAST64 __UINT_LEAST64_FMTB__
#define PRIBFAST8 __UINT_FAST8_FMTB__
#define PRIBFAST16 __UINT_FAST16_FMTB__
#define PRIBFAST32 __UINT_FAST32_FMTB__
#define PRIBFAST64 __UINT_FAST64_FMTB__
#define PRIBMAX __UINTMAX_FMTB__
#define PRIBPTR __UINTPTR_FMTB__
// The fscanf() macros for signed integers.
#define SCNd8 __INT8_FMTd__
#define SCNd16 __INT16_FMTd__
#define SCNd32 __INT32_FMTd__
#define SCNd64 __INT64_FMTd__
#define SCNdLEAST8 __INT_LEAST8_FMTd__
#define SCNdLEAST16 __INT_LEAST16_FMTd__
#define SCNdLEAST32 __INT_LEAST32_FMTd__
#define SCNdLEAST64 __INT_LEAST64_FMTd__
#define SCNdFAST8 __INT_FAST8_FMTd__
#define SCNdFAST16 __INT_FAST16_FMTd__
#define SCNdFAST32 __INT_FAST32_FMTd__
#define SCNdFAST64 __INT_FAST64_FMTd__
#define SCNdMAX __INTMAX_FMTd__
#define SCNdPTR __INTPTR_FMTd__
#define SCNi8 __INT8_FMTi__
#define SCNi16 __INT16_FMTi__
#define SCNi32 __INT32_FMTi__
#define SCNi64 __INT64_FMTi__
#define SCNiLEAST8 __INT_LEAST8_FMTi__
#define SCNiLEAST16 __INT_LEAST16_FMTi__
#define SCNiLEAST32 __INT_LEAST32_FMTi__
#define SCNiLEAST64 __INT_LEAST64_FMTi__
#define SCNiFAST8 __INT_FAST8_FMTi__
#define SCNiFAST16 __INT_FAST16_FMTi__
#define SCNiFAST32 __INT_FAST32_FMTi__
#define SCNiFAST64 __INT_FAST64_FMTi__
#define SCNiMAX __INTMAX_FMTi__
#define SCNiPTR __INTPTR_FMTi__
// The fscanf() macros for unsigned integers.
#define SCNo8 __UINT8_FMTo__
#define SCNo16 __UINT16_FMTo__
#define SCNo32 __UINT32_FMTo__
#define SCNo64 __UINT64_FMTo__
#define SCNoLEAST8 __UINT_LEAST8_FMTo__
#define SCNoLEAST16 __UINT_LEAST16_FMTo__
#define SCNoLEAST32 __UINT_LEAST32_FMTo__
#define SCNoLEAST64 __UINT_LEAST64_FMTo__
#define SCNoFAST8 __UINT_FAST8_FMTo__
#define SCNoFAST16 __UINT_FAST16_FMTo__
#define SCNoFAST32 __UINT_FAST32_FMTo__
#define SCNoFAST64 __UINT_FAST64_FMTo__
#define SCNoMAX __UINTMAX_FMTo__
#define SCNoPTR __UINTPTR_FMTo__
#define SCNu8 __UINT8_FMTu__
#define SCNu16 __UINT16_FMTu__
#define SCNu32 __UINT32_FMTu__
#define SCNu64 __UINT64_FMTu__
#define SCNuLEAST8 __UINT_LEAST8_FMTu__
#define SCNuLEAST16 __UINT_LEAST16_FMTu__
#define SCNuLEAST32 __UINT_LEAST32_FMTu__
#define SCNuLEAST64 __UINT_LEAST64_FMTu__
#define SCNuFAST8 __UINT_FAST8_FMTu__
#define SCNuFAST16 __UINT_FAST16_FMTu__
#define SCNuFAST32 __UINT_FAST32_FMTu__
#define SCNuFAST64 __UINT_FAST64_FMTu__
#define SCNuMAX __UINTMAX_FMTu__
#define SCNuPTR __UINTPTR_FMTu__
#define SCNx8 __UINT8_FMTx__
#define SCNx16 __UINT16_FMTx__
#define SCNx32 __UINT32_FMTx__
#define SCNx64 __UINT64_FMTx__
#define SCNxLEAST8 __UINT_LEAST8_FMTx__
#define SCNxLEAST16 __UINT_LEAST16_FMTx__
#define SCNxLEAST32 __UINT_LEAST32_FMTx__
#define SCNxLEAST64 __UINT_LEAST64_FMTx__
#define SCNxFAST8 __UINT_FAST8_FMTx__
#define SCNxFAST16 __UINT_FAST16_FMTx__
#define SCNxFAST32 __UINT_FAST32_FMTx__
#define SCNxFAST64 __UINT_FAST64_FMTx__
#define SCNxMAX __UINTMAX_FMTx__
#define SCNxPTR __UINTPTR_FMTx__
#define SCNb8 __UINT8_FMTb__
#define SCNb16 __UINT16_FMTb__
#define SCNb32 __UINT32_FMTb__
#define SCNb64 __UINT64_FMTb__
#define SCNbLEAST8 __UINT_LEAST8_FMTb__
#define SCNbLEAST16 __UINT_LEAST16_FMTb__
#define SCNbLEAST32 __UINT_LEAST32_FMTb__
#define SCNbLEAST64 __UINT_LEAST64_FMTb__
#define SCNbFAST8 __UINT_FAST8_FMTb__
#define SCNbFAST16 __UINT_FAST16_FMTb__
#define SCNbFAST32 __UINT_FAST32_FMTb__
#define SCNbFAST64 __UINT_FAST64_FMTb__
#define SCNbMAX __UINTMAX_FMTb__
#define SCNbPTR __UINTPTR_FMTb__
#endif // LLVM_LIBC_MACROS_INTTYPES_MACROS_H

View file

@ -0,0 +1,246 @@
//===-- Definition of macros from limits.h --------------------------------===//
//
// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
// See https://llvm.org/LICENSE.txt for license information.
// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
//
//===----------------------------------------------------------------------===//
#ifndef LLVM_LIBC_MACROS_LIMITS_MACROS_H
#define LLVM_LIBC_MACROS_LIMITS_MACROS_H
// Define all C23 macro constants of limits.h
#ifndef CHAR_BIT
#ifdef __CHAR_BIT__
#define CHAR_BIT __CHAR_BIT__
#else
#define CHAR_BIT 8
#endif // __CHAR_BIT__
#endif // CHAR_BIT
#ifndef MB_LEN_MAX
// Represents a single UTF-32 wide character in the default locale.
#define MB_LEN_MAX 4
#endif // MB_LEN_MAX
// *_WIDTH macros
#ifndef CHAR_WIDTH
#define CHAR_WIDTH CHAR_BIT
#endif // CHAR_WIDTH
#ifndef SCHAR_WIDTH
#define SCHAR_WIDTH CHAR_BIT
#endif // SCHAR_WIDTH
#ifndef UCHAR_WIDTH
#define UCHAR_WIDTH CHAR_BIT
#endif // UCHAR_WIDTH
#ifndef SHRT_WIDTH
#ifdef __SHRT_WIDTH__
#define SHRT_WIDTH __SHRT_WIDTH__
#else
#define SHRT_WIDTH 16
#endif // __SHRT_WIDTH__
#endif // SHRT_WIDTH
#ifndef USHRT_WIDTH
#define USHRT_WIDTH SHRT_WIDTH
#endif // USHRT_WIDTH
#ifndef INT_WIDTH
#ifdef __INT_WIDTH__
#define INT_WIDTH __INT_WIDTH__
#else
#define INT_WIDTH 32
#endif // __INT_WIDTH__
#endif // INT_WIDTH
#ifndef UINT_WIDTH
#define UINT_WIDTH INT_WIDTH
#endif // UINT_WIDTH
#ifndef LONG_WIDTH
#ifdef __LONG_WIDTH__
#define LONG_WIDTH __LONG_WIDTH__
#elif defined(__WORDSIZE)
#define LONG_WIDTH __WORDSIZE
#else
// Use __SIZEOF_LONG__ * CHAR_BIT as backup. This is needed for clang-13 or
// before.
#define LONG_WIDTH (__SIZEOF_LONG__ * CHAR_BIT)
#endif // __LONG_WIDTH__
#endif // LONG_WIDTH
#ifndef ULONG_WIDTH
#define ULONG_WIDTH LONG_WIDTH
#endif // ULONG_WIDTH
#ifndef LLONG_WIDTH
#ifdef __LLONG_WIDTH__
#define LLONG_WIDTH __LLONG_WIDTH__
#else
#define LLONG_WIDTH 64
#endif // __LLONG_WIDTH__
#endif // LLONG_WIDTH
#ifndef ULLONG_WIDTH
#define ULLONG_WIDTH LLONG_WIDTH
#endif // ULLONG_WIDTH
#ifndef BOOL_WIDTH
#ifdef __BOOL_WIDTH__
#define BOOL_WIDTH __BOOL_WIDTH__
#else
#define BOOL_WIDTH 1
#endif // __BOOL_WIDTH__
#endif // BOOL_WIDTH
// *_MAX macros
#ifndef SCHAR_MAX
#ifdef __SCHAR_MAX__
#define SCHAR_MAX __SCHAR_MAX__
#else
#define SCHAR_MAX 0x7f
#endif // __SCHAR_MAX__
#endif // SCHAR_MAX
#ifndef UCHAR_MAX
#define UCHAR_MAX (SCHAR_MAX * 2 + 1)
#endif // UCHAR_MAX
// Check if char is unsigned.
#if !defined(__CHAR_UNSIGNED__) && ('\xff' > 0)
#define __CHAR_UNSIGNED__
#endif
#ifndef CHAR_MAX
#ifdef __CHAR_UNSIGNED__
#define CHAR_MAX UCHAR_MAX
#else
#define CHAR_MAX SCHAR_MAX
#endif // __CHAR_UNSIGNED__
#endif // CHAR_MAX
#ifndef SHRT_MAX
#ifdef __SHRT_MAX__
#define SHRT_MAX __SHRT_MAX__
#else
#define SHRT_MAX 0x7fff
#endif // __SHRT_MAX__
#endif // SHRT_MAX
#ifndef USHRT_MAX
#define USHRT_MAX (SHRT_MAX * 2U + 1U)
#endif // USHRT_MAX
#ifndef INT_MAX
#ifdef __INT_MAX__
#define INT_MAX __INT_MAX__
#else
#define INT_MAX (0 ^ (1 << (INT_WIDTH - 1)))
#endif // __INT_MAX__
#endif // INT_MAX
#ifndef UINT_MAX
#define UINT_MAX (INT_MAX * 2U + 1U)
#endif // UINT_MAX
#ifndef LONG_MAX
#ifdef __LONG_MAX__
#define LONG_MAX __LONG_MAX__
#else
#define LONG_MAX (0L ^ (1L << (LONG_WIDTH - 1)))
#endif // __LONG_MAX__
#endif // LONG_MAX
#ifndef ULONG_MAX
#define ULONG_MAX (LONG_MAX * 2UL + 1UL)
#endif // ULONG_MAX
#ifndef LLONG_MAX
#ifdef __LONG_LONG_MAX__
#define LLONG_MAX __LONG_LONG_MAX__
#else
#define LLONG_MAX (0LL ^ (1LL << (LLONG_WIDTH - 1)))
#endif // __LONG_LONG_MAX__
#endif // LLONG_MAX
#ifndef ULLONG_MAX
#define ULLONG_MAX (LLONG_MAX * 2ULL + 1ULL)
#endif // ULLONG_MAX
// *_MIN macros
#ifndef SCHAR_MIN
#define SCHAR_MIN (-SCHAR_MAX - 1)
#endif // SCHAR_MIN
#ifndef UCHAR_MIN
#define UCHAR_MIN 0
#endif // UCHAR_MIN
#ifndef CHAR_MIN
#ifdef __CHAR_UNSIGNED__
#define CHAR_MIN UCHAR_MIN
#else
#define CHAR_MIN SCHAR_MIN
#endif // __CHAR_UNSIGNED__
#endif // CHAR_MIN
#ifndef SHRT_MIN
#define SHRT_MIN (-SHRT_MAX - 1)
#endif // SHRT_MIN
#ifndef USHRT_MIN
#define USHRT_MIN 0U
#endif // USHRT_MIN
#ifndef INT_MIN
#define INT_MIN (-INT_MAX - 1)
#endif // INT_MIN
#ifndef UINT_MIN
#define UINT_MIN 0U
#endif // UINT_MIN
#ifndef LONG_MIN
#define LONG_MIN (-LONG_MAX - 1L)
#endif // LONG_MIN
#ifndef ULONG_MIN
#define ULONG_MIN 0UL
#endif // ULONG_MIN
#ifndef LLONG_MIN
#define LLONG_MIN (-LLONG_MAX - 1LL)
#endif // LLONG_MIN
#ifndef ULLONG_MIN
#define ULLONG_MIN 0ULL
#endif // ULLONG_MIN
#ifndef _POSIX_MAX_CANON
#define _POSIX_MAX_CANON 255
#endif
#ifndef _POSIX_MAX_INPUT
#define _POSIX_MAX_INPUT 255
#endif
#ifndef _POSIX_NAME_MAX
#define _POSIX_PATH_MAX 256
#endif
#ifndef _POSIX_ARG_MAX
#define _POSIX_ARG_MAX 4096
#endif
#ifndef IOV_MAX
#define IOV_MAX 1024
#endif // IOV_MAX
#endif // LLVM_LIBC_MACROS_LIMITS_MACROS_H

View file

@ -0,0 +1,20 @@
//===-- Definition of macros to for extra dynamic linker functionality ----===//
//
// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
// See https://llvm.org/LICENSE.txt for license information.
// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
//
//===----------------------------------------------------------------------===//
#ifndef LLVM_LIBC_MACROS_LINK_MACROS_H
#define LLVM_LIBC_MACROS_LINK_MACROS_H
#include "elf-macros.h"
#ifdef __LP64__
#define ElfW(type) Elf64_##type
#else
#define ElfW(type) Elf32_##type
#endif
#endif

View file

@ -0,0 +1,32 @@
#ifndef LLVM_LIBC_MACROS_LINUX_ERROR_NUMBER_MACROS_H
#define LLVM_LIBC_MACROS_LINUX_ERROR_NUMBER_MACROS_H
#ifndef ECANCELED
#define ECANCELED 125
#endif // ECANCELED
#ifndef EOWNERDEAD
#define EOWNERDEAD 130
#endif // EOWNERDEAD
#ifndef ENOTRECOVERABLE
#define ENOTRECOVERABLE 131
#endif // ENOTRECOVERABLE
#ifndef ERFKILL
#define ERFKILL 132
#endif // ERFKILL
#ifndef EHWPOISON
#define EHWPOISON 133
#endif // EHWPOISON
#ifndef EOPNOTSUPP
#define EOPNOTSUPP 95
#endif
#ifndef ENOTSUP
#define ENOTSUP EOPNOTSUPP
#endif
#endif // LLVM_LIBC_MACROS_LINUX_ERROR_NUMBER_MACROS_H

Some files were not shown because too many files have changed in this diff Show more