[libc-commits] [libc] [llvm] [libc] delete hdrgen (PR #117220)
Nick Desaulniers via libc-commits
libc-commits at lists.llvm.org
Thu Nov 21 15:02:14 PST 2024
https://github.com/nickdesaulniers updated https://github.com/llvm/llvm-project/pull/117220
>From 9e0e0abcb4b3a6614a592b0924b164385b1a3c41 Mon Sep 17 00:00:00 2001
From: Nick Desaulniers <ndesaulniers at google.com>
Date: Thu, 21 Nov 2024 11:26:40 -0800
Subject: [PATCH 1/5] [libc] delete hdrgen
Thanks to the effort of @RoseZhang03 and @aaryanshukla under the guidance of
@michaelrj-google and @amykhuang, we now have newhdrgen and no longer have a
dependency on TableGen and thus LLVM in order to start bootstrapping a full
build.
This PR removes:
- LIBC_HDRGEN_EXE; the in tree newhdrgen is the only hdrgen that can be used.
- LIBC_USE_NEW_HEADER_GEN; newhdrgen is the default and only option.
- LIBC_HDRGEN_ONLY; there is no need to have a distinct build step for old
hdrgen.
- libc-api-test and libc-api-test-tidy build targets.
- Deletes all .td files.
It does not rename newhdrgen to just hdrgen. Will follow up with a distinct PR
for that.
Link: #117209
Fixes: #117208
---
libc/CMakeLists.txt | 18 +-
libc/cmake/modules/LLVMLibCHeaderRules.cmake | 33 -
libc/config/baremetal/api.td | 59 -
libc/config/gpu/api.td | 50 -
libc/config/linux/api.td | 276 ---
libc/config/public_api.td | 26 -
libc/docs/dev/header_generation.rst | 3 -
libc/docs/gpu/building.rst | 13 +-
libc/include/CMakeLists.txt | 26 +-
libc/spec/bsd_ext.td | 87 -
libc/spec/gnu_ext.td | 316 ---
libc/spec/gpu_ext.td | 18 -
libc/spec/linux.td | 328 ---
libc/spec/llvm_libc_ext.td | 116 -
libc/spec/llvm_libc_stdfix_ext.td | 27 -
libc/spec/posix.td | 1867 -----------------
libc/spec/spec.td | 253 ---
libc/spec/stdc.td | 1819 ----------------
libc/spec/stdc_ext.td | 82 -
libc/test/src/CMakeLists.txt | 78 -
libc/utils/HdrGen/CMakeLists.txt | 22 -
libc/utils/HdrGen/Command.cpp | 15 -
libc/utils/HdrGen/Command.h | 54 -
libc/utils/HdrGen/Generator.cpp | 203 --
libc/utils/HdrGen/Generator.h | 60 -
libc/utils/HdrGen/IncludeFileCommand.cpp | 50 -
libc/utils/HdrGen/IncludeFileCommand.h | 32 -
libc/utils/HdrGen/Main.cpp | 62 -
.../HdrGen/PrototypeTestGen/CMakeLists.txt | 5 -
.../PrototypeTestGen/PrototypeTestGen.cpp | 106 -
libc/utils/HdrGen/PublicAPICommand.cpp | 331 ---
libc/utils/HdrGen/PublicAPICommand.h | 48 -
libc/utils/HdrGen/README.md | 5 -
libc/utils/LibcTableGenUtil/APIIndexer.cpp | 173 --
libc/utils/LibcTableGenUtil/APIIndexer.h | 86 -
libc/utils/LibcTableGenUtil/CMakeLists.txt | 13 -
36 files changed, 13 insertions(+), 6747 deletions(-)
delete mode 100644 libc/config/baremetal/api.td
delete mode 100644 libc/config/gpu/api.td
delete mode 100644 libc/config/linux/api.td
delete mode 100644 libc/config/public_api.td
delete mode 100644 libc/spec/bsd_ext.td
delete mode 100644 libc/spec/gnu_ext.td
delete mode 100644 libc/spec/gpu_ext.td
delete mode 100644 libc/spec/linux.td
delete mode 100644 libc/spec/llvm_libc_ext.td
delete mode 100644 libc/spec/llvm_libc_stdfix_ext.td
delete mode 100644 libc/spec/posix.td
delete mode 100644 libc/spec/spec.td
delete mode 100644 libc/spec/stdc.td
delete mode 100644 libc/spec/stdc_ext.td
delete mode 100644 libc/utils/HdrGen/CMakeLists.txt
delete mode 100644 libc/utils/HdrGen/Command.cpp
delete mode 100644 libc/utils/HdrGen/Command.h
delete mode 100644 libc/utils/HdrGen/Generator.cpp
delete mode 100644 libc/utils/HdrGen/Generator.h
delete mode 100644 libc/utils/HdrGen/IncludeFileCommand.cpp
delete mode 100644 libc/utils/HdrGen/IncludeFileCommand.h
delete mode 100644 libc/utils/HdrGen/Main.cpp
delete mode 100644 libc/utils/HdrGen/PrototypeTestGen/CMakeLists.txt
delete mode 100644 libc/utils/HdrGen/PrototypeTestGen/PrototypeTestGen.cpp
delete mode 100644 libc/utils/HdrGen/PublicAPICommand.cpp
delete mode 100644 libc/utils/HdrGen/PublicAPICommand.h
delete mode 100644 libc/utils/HdrGen/README.md
delete mode 100644 libc/utils/LibcTableGenUtil/APIIndexer.cpp
delete mode 100644 libc/utils/LibcTableGenUtil/APIIndexer.h
delete mode 100644 libc/utils/LibcTableGenUtil/CMakeLists.txt
diff --git a/libc/CMakeLists.txt b/libc/CMakeLists.txt
index 77b659b2ef2322..d00888b8801dc5 100644
--- a/libc/CMakeLists.txt
+++ b/libc/CMakeLists.txt
@@ -54,27 +54,12 @@ set(LIBC_NAMESPACE ${default_namespace}
add_subdirectory(newhdrgen)
-if(LLVM_LIBC_FULL_BUILD OR LLVM_LIBC_GPU_BUILD)
- if(NOT LIBC_HDRGEN_EXE)
- # We need to set up hdrgen first since other targets depend on it.
- add_subdirectory(utils/LibcTableGenUtil)
- add_subdirectory(utils/HdrGen)
- # Calling add_tablegen sets variables like LIBC_TABLEGEN_EXE in
- # PARENT_SCOPE which get lost until saved in the cache.
- set(LIBC_TABLEGEN_EXE "${LIBC_TABLEGEN_EXE}" CACHE INTERNAL "")
- set(LIBC_TABLEGEN_TARGET "${LIBC_TABLEGEN_TARGET}" CACHE INTERNAL "")
- else()
- message(STATUS "Will use ${LIBC_HDRGEN_EXE} for libc header generation.")
- endif()
-endif()
# We will build the GPU utilities if we are not doing a runtimes build.
option(LIBC_BUILD_GPU_LOADER "Always build the GPU loader utilities" OFF)
if(LIBC_BUILD_GPU_LOADER OR (LLVM_LIBC_GPU_BUILD AND NOT LLVM_RUNTIMES_BUILD))
add_subdirectory(utils/gpu)
endif()
-option(LIBC_USE_NEW_HEADER_GEN "Generate header files using new headergen instead of the old one" ON)
-
set(NEED_LIBC_HDRGEN FALSE)
if(NOT LLVM_RUNTIMES_BUILD)
if("libc" IN_LIST LLVM_ENABLE_RUNTIMES)
@@ -88,8 +73,7 @@ if(NOT LLVM_RUNTIMES_BUILD)
endforeach()
endif()
endif()
-option(LIBC_HDRGEN_ONLY "Only build the 'libc-hdrgen' executable" OFF)
-if(LIBC_HDRGEN_ONLY OR NEED_LIBC_HDRGEN)
+if(NEED_LIBC_HDRGEN)
# When libc is build as part of the runtimes/bootstrap build's CMake run, we
# only need to build the host tools to build the libc. So, we just do enough
# to build libc-hdrgen and return.
diff --git a/libc/cmake/modules/LLVMLibCHeaderRules.cmake b/libc/cmake/modules/LLVMLibCHeaderRules.cmake
index 76c4e1f2d3244c..766225cbeab404 100644
--- a/libc/cmake/modules/LLVMLibCHeaderRules.cmake
+++ b/libc/cmake/modules/LLVMLibCHeaderRules.cmake
@@ -220,46 +220,13 @@ function(add_gen_header target_name)
set(gen_hdr_script "${LIBC_BUILD_SCRIPTS_DIR}/gen_hdr.py")
- file(GLOB td_includes ${LIBC_SOURCE_DIR}/spec/*.td)
-
set(ENTRYPOINT_NAME_LIST_ARG ${TARGET_ENTRYPOINT_NAME_LIST})
list(TRANSFORM ENTRYPOINT_NAME_LIST_ARG PREPEND "--e=")
- if(LIBC_HDRGEN_EXE)
- set(hdrgen_exe ${LIBC_HDRGEN_EXE})
- else()
- set(hdrgen_exe ${LIBC_TABLEGEN_EXE})
- set(hdrgen_deps "${LIBC_TABLEGEN_EXE};${LIBC_TABLEGEN_TARGET}")
- endif()
- add_custom_command(
- OUTPUT ${out_file}
- COMMAND ${hdrgen_exe} -o ${out_file} --header ${ADD_GEN_HDR_GEN_HDR}
- --def ${in_file} ${replacement_params} -I ${LIBC_SOURCE_DIR}
- ${ENTRYPOINT_NAME_LIST_ARG}
- ${LIBC_SOURCE_DIR}/config/${LIBC_TARGET_OS}/api.td
-
- WORKING_DIRECTORY ${CMAKE_CURRENT_SOURCE_DIR}
- DEPENDS ${in_file} ${fq_data_files} ${td_includes}
- ${LIBC_SOURCE_DIR}/config/${LIBC_TARGET_OS}/api.td
- ${hdrgen_deps}
- )
-
if(LIBC_TARGET_OS_IS_GPU)
file(MAKE_DIRECTORY ${LIBC_INCLUDE_DIR}/llvm-libc-decls)
file(MAKE_DIRECTORY ${LIBC_INCLUDE_DIR}/llvm-libc-decls/gpu)
set(decl_out_file ${LIBC_INCLUDE_DIR}/llvm-libc-decls/${relative_path})
- add_custom_command(
- OUTPUT ${decl_out_file}
- COMMAND ${hdrgen_exe} -o ${decl_out_file}
- --header ${ADD_GEN_HDR_GEN_HDR} --def ${in_file} --export-decls
- ${replacement_params} -I ${LIBC_SOURCE_DIR} ${ENTRYPOINT_NAME_LIST_ARG}
- ${LIBC_SOURCE_DIR}/config/${LIBC_TARGET_OS}/api.td
-
- WORKING_DIRECTORY ${CMAKE_CURRENT_SOURCE_DIR}
- DEPENDS ${in_file} ${fq_data_files} ${td_includes}
- ${LIBC_SOURCE_DIR}/config/${LIBC_TARGET_OS}/api.td
- ${hdrgen_deps}
- )
endif()
if(ADD_GEN_HDR_DEPENDS)
diff --git a/libc/config/baremetal/api.td b/libc/config/baremetal/api.td
deleted file mode 100644
index 7421d86fabeb08..00000000000000
--- a/libc/config/baremetal/api.td
+++ /dev/null
@@ -1,59 +0,0 @@
-include "config/public_api.td"
-
-include "spec/stdc.td"
-include "spec/stdc_ext.td"
-include "spec/bsd_ext.td"
-include "spec/llvm_libc_stdfix_ext.td"
-
-
-def CTypeAPI : PublicAPI<"ctype.h"> {
-}
-
-def FEnvAPI : PublicAPI<"fenv.h"> {
- let Types = ["fenv_t", "fexcept_t"];
-}
-
-def IntTypesAPI : PublicAPI<"inttypes.h"> {
- let Types = ["imaxdiv_t"];
-}
-
-def MathAPI : PublicAPI<"math.h"> {
- let Types = ["double_t", "float_t"];
-}
-
-def StdIOAPI : PublicAPI<"stdio.h"> {
- let Types = ["size_t"];
-}
-
-def StdlibAPI : PublicAPI<"stdlib.h"> {
- let Types = [
- "div_t",
- "ldiv_t",
- "lldiv_t",
- "size_t",
- "__bsearchcompare_t",
- "__qsortcompare_t",
- ];
-}
-
-def StringAPI : PublicAPI<"string.h"> {
- let Types = ["size_t"];
-}
-
-def TimeAPI : PublicAPI<"time.h"> {
- let Types = [
- "clock_t",
- "time_t",
- "struct tm",
- "struct timespec",
- ];
-}
-
-def UCharAPI : PublicAPI<"uchar.h"> {
- let Types = [
- "mbstate_t",
- "char8_t",
- "char16_t",
- "char32_t",
- ];
-}
diff --git a/libc/config/gpu/api.td b/libc/config/gpu/api.td
deleted file mode 100644
index 995ff31c4ac9e9..00000000000000
--- a/libc/config/gpu/api.td
+++ /dev/null
@@ -1,50 +0,0 @@
-include "config/public_api.td"
-
-include "spec/stdc.td"
-include "spec/posix.td"
-include "spec/gpu_ext.td"
-include "spec/gnu_ext.td"
-include "spec/stdc_ext.td"
-include "spec/llvm_libc_ext.td"
-
-
-def StringAPI : PublicAPI<"string.h"> {
- let Types = ["size_t"];
-}
-
-def StdlibAPI : PublicAPI<"stdlib.h"> {
- let Types = [
- "div_t",
- "ldiv_t",
- "lldiv_t",
- "size_t",
- "__bsearchcompare_t",
- "__qsortcompare_t",
- "__qsortrcompare_t",
- "__atexithandler_t",
- ];
-}
-
-def FenvAPI: PublicAPI<"fenv.h"> {
- let Types = ["fenv_t"];
-}
-
-def StdIOAPI : PublicAPI<"stdio.h"> {
- let Types = [
- "FILE",
- "off_t",
- "size_t",
- ];
-}
-
-def IntTypesAPI : PublicAPI<"inttypes.h"> {
- let Types = ["imaxdiv_t"];
-}
-
-def TimeAPI : PublicAPI<"time.h"> {
- let Types = [
- "clock_t",
- "time_t",
- "struct timespec",
- ];
-}
diff --git a/libc/config/linux/api.td b/libc/config/linux/api.td
deleted file mode 100644
index a00e0f61b90df7..00000000000000
--- a/libc/config/linux/api.td
+++ /dev/null
@@ -1,276 +0,0 @@
-include "config/public_api.td"
-
-include "spec/stdc.td"
-include "spec/posix.td"
-include "spec/linux.td"
-include "spec/gnu_ext.td"
-include "spec/bsd_ext.td"
-include "spec/stdc_ext.td"
-include "spec/llvm_libc_ext.td"
-include "spec/llvm_libc_stdfix_ext.td"
-
-def CTypeAPI : PublicAPI<"ctype.h"> {
-}
-
-def FCntlAPI : PublicAPI<"fcntl.h"> {
- let Types = [
- "mode_t",
- "off_t",
- ];
-}
-
-def IntTypesAPI : PublicAPI<"inttypes.h"> {
- let Types = ["imaxdiv_t"];
-}
-
-def MathAPI : PublicAPI<"math.h"> {
- let Types = ["double_t", "float_t", "float128"];
-}
-
-def FenvAPI: PublicAPI<"fenv.h"> {
- let Types = ["fenv_t", "fexcept_t"];
-}
-
-def StringAPI : PublicAPI<"string.h"> {
- let Types = ["size_t"];
-}
-
-def StdIOAPI : PublicAPI<"stdio.h"> {
- let Macros = [
- SimpleMacroDef<"stderr", "stderr">,
- SimpleMacroDef<"stdin", "stdin">,
- SimpleMacroDef<"stdout", "stdout">,
- ];
- let Types = [
- "FILE",
- "cookie_io_functions_t",
- "off_t",
- "size_t",
- ];
-}
-
-def StdlibAPI : PublicAPI<"stdlib.h"> {
- let Types = [
- "div_t",
- "ldiv_t",
- "lldiv_t",
- "size_t",
- "__bsearchcompare_t",
- "__qsortcompare_t",
- "__qsortrcompare_t",
- "__atexithandler_t",
- ];
-}
-
-def TimeAPI : PublicAPI<"time.h"> {
- let Types = [
- "clock_t",
- "time_t",
- "struct tm",
- "struct timespec",
- "struct timeval",
- "clockid_t",
- ];
-}
-
-def SchedAPI : PublicAPI<"sched.h"> {
- let Types = [
- "pid_t",
- "size_t",
- "cpu_set_t",
- "struct sched_param",
- // Needed according to posix standard
- "time_t",
- "struct timespec",
- ];
-}
-
-def SysMManAPI : PublicAPI<"sys/mman.h"> {
- let Types = ["off_t", "size_t", "mode_t"];
-}
-
-def SignalAPI : PublicAPI<"signal.h"> {
- let Types = [
- "sig_atomic_t",
- "sigset_t",
- "struct sigaction",
- "union sigval",
- "siginfo_t",
- "stack_t",
- "pid_t",
- ];
-}
-
-def ThreadsAPI : PublicAPI<"threads.h"> {
- let Macros = [
- SimpleMacroDef<"ONCE_FLAG_INIT", "{0}">,
- ];
-
- let Types = [
- "__call_once_func_t",
- "once_flag",
- "cnd_t",
- "mtx_t",
- "thrd_t",
- "thrd_start_t",
- "tss_t",
- "tss_dtor_t",
- ];
-
- let Enumerations = [
- "mtx_plain",
- "mtx_recursive",
- "mtx_timed",
- "thrd_timedout",
- "thrd_success",
- "thrd_busy",
- "thrd_error",
- "thrd_nomem",
- ];
-}
-
-def PThreadAPI : PublicAPI<"pthread.h"> {
- let Types = [
- "__atfork_callback_t",
- "__pthread_once_func_t",
- "__pthread_start_t",
- "__pthread_tss_dtor_t",
- "pthread_attr_t",
- "pthread_condattr_t",
- "pthread_key_t",
- "pthread_mutex_t",
- "pthread_mutexattr_t",
- "pthread_once_t",
- "pthread_rwlockattr_t",
- "pthread_rwlock_t",
- "pthread_spinlock_t",
- "pthread_t",
- ];
-}
-
-def DirentAPI : PublicAPI<"dirent.h"> {
- let Types = [
- "ino_t",
- "DIR",
- "struct dirent",
- ];
-}
-
-def UniStdAPI : PublicAPI<"unistd.h"> {
- let Types = ["__exec_argv_t", "__exec_envp_t", "off_t", "pid_t", "size_t",
- "ssize_t", "uid_t", "__getoptargv_t"];
-}
-
-def WCharAPI : PublicAPI<"wchar.h"> {
- let Types = [
- "wchar_t",
- "wint_t",
- "size_t",
- ];
-}
-
-def UCharAPI : PublicAPI<"uchar.h"> {
- let Types = [
- "mbstate_t",
- "char8_t",
- "char16_t",
- "char32_t",
- ];
-}
-
-def SysRandomAPI : PublicAPI<"sys/random.h"> {
- let Types = ["size_t", "ssize_t"];
-}
-
-def SysSelectAPI : PublicAPI<"sys/select.h"> {
- let Types = ["fd_set", "sigset_t", "suseconds_t", "time_t", "struct timespec",
- "struct timeval"];
-}
-
-def SysSocketAPI : PublicAPI<"sys/socket.h"> {
- let Types = [
- "sa_family_t",
- "socklen_t",
- "struct sockaddr",
- "struct sockaddr_un",
- "struct msghdr",
- "struct iovec",
- "size_t",
- "ssize_t",
- ];
-}
-
-def SysResourceAPI : PublicAPI<"sys/resource.h"> {
- let Types = ["rlim_t", "struct rlimit"];
-}
-
-def SysStatAPI : PublicAPI<"sys/stat.h"> {
- let Types = ["mode_t", "dev_t", "ino_t", "nlink_t", "uid_t", "gid_t", "off_t",
- "struct timespec", "struct timeval", "blksize_t", "blkcnt_t",
- "struct stat"];
-}
-
-def SysWaitAPI : PublicAPI<"sys/wait.h"> {
- let Types = ["pid_t", "struct rusage", "siginfo_t"];
-}
-
-def SysSendfileAPI : PublicAPI<"sys/sendfile.h"> {
- let Types = ["off_t", "size_t", "ssize_t"];
-}
-
-def SysTypesAPI : PublicAPI<"sys/types.h"> {
- let Types = [
- "blkcnt_t",
- "blksize_t",
- "clockid_t",
- "dev_t",
- "gid_t",
- "ino_t",
- "mode_t",
- "nlink_t",
- "off_t",
- "pid_t",
- "pthread_attr_t",
- "pthread_condattr_t",
- "pthread_key_t",
- "pthread_mutex_t",
- "pthread_mutexattr_t",
- "pthread_once_t",
- "pthread_rwlockattr_t",
- "pthread_rwlock_t",
- "pthread_t",
- "size_t",
- "ssize_t",
- "suseconds_t",
- "time_t",
- "uid_t"
- ];
-}
-
-def SysUtsNameAPI : PublicAPI<"sys/utsname.h"> {
- let Types = ["struct utsname"];
-}
-
-def SysEpollAPI : PublicAPI<"sys/epoll.h"> {
- let Types = ["struct epoll_event", "struct epoll_data", "sigset_t", "struct timespec"];
-}
-
-def SpawnAPI : PublicAPI<"spawn.h"> {
- let Types = ["mode_t", "pid_t", "posix_spawnattr_t", "posix_spawn_file_actions_t"];
-}
-
-def TermiosAPI : PublicAPI<"termios.h"> {
- let Types = ["cc_t", "pid_t", "speed_t", "struct termios", "tcflag_t"];
-}
-
-def SetJmpAPI : PublicAPI<"setjmp.h"> {
- let Types = ["jmp_buf"];
-}
-
-def SearchAPI : PublicAPI<"search.h"> {
- let Types = ["ACTION", "ENTRY", "struct hsearch_data", "__lsearchcompare_t"];
-}
-
-def SysStatvfsAPI : PublicAPI<"sys/statvfs.h"> {
- let Types = ["struct statvfs"];
-}
diff --git a/libc/config/public_api.td b/libc/config/public_api.td
deleted file mode 100644
index 1b34506c643c32..00000000000000
--- a/libc/config/public_api.td
+++ /dev/null
@@ -1,26 +0,0 @@
-include "spec/spec.td"
-
-class MacroDef<string name> {
- string Name = name;
- string Defn = "";
-}
-
-class SimpleMacroDef<string name, string value> : MacroDef<name> {
- let Defn = !strconcat("#define ", name, " ", value);
-}
-
-class MacroDefineIfNot<string name, string value> : MacroDef<name> {
- let Defn = !strconcat("#ifndef ", name, "\n",
- "#define " , name, " ", value, "\n",
- "#endif // ", name);
-}
-
-class PublicAPI<string name> {
- string HeaderName = name;
- list<MacroDef> Macros = [];
- list<string> Types = [];
- list<string> Enumerations = [];
- list<string> Structs = [];
- list<string> Functions = [];
- list<string> Objects = [];
-}
diff --git a/libc/docs/dev/header_generation.rst b/libc/docs/dev/header_generation.rst
index ec4206217ca777..0730b9a40c26a1 100644
--- a/libc/docs/dev/header_generation.rst
+++ b/libc/docs/dev/header_generation.rst
@@ -38,9 +38,6 @@ Required Versions:
``build/projects/libc/include/sys``.
-New Headergen is turned on by default, but if you want to use old Headergen,
-you can include this statement when building: ``-DLIBC_USE_NEW_HEADER_GEN=OFF``
-
To add a function to the YAML files, you can either manually enter it in the
YAML file corresponding to the header it belongs to or add it through the
command line.
diff --git a/libc/docs/gpu/building.rst b/libc/docs/gpu/building.rst
index 37dccdab6dc340..6a2d1f23c0bcdf 100644
--- a/libc/docs/gpu/building.rst
+++ b/libc/docs/gpu/building.rst
@@ -86,16 +86,13 @@ compiler. These tools must all be up-to-date with the libc source.
-DCMAKE_C_COMPILER=$HOST_C_COMPILER \
-DCMAKE_CXX_COMPILER=$HOST_CXX_COMPILER \
-DLLVM_LIBC_FULL_BUILD=ON \
- -DLIBC_HDRGEN_ONLY=ON \ # Only build the 'libc-hdrgen' tool
-DCMAKE_BUILD_TYPE=Release # Release suggested to make "clang" fast
$> ninja # Build the 'clang' compiler
- $> ninja libc-hdrgen # Build the 'libc-hdrgen' tool
-Once this has finished the build directory should contain the ``clang`` compiler
-and the ``libc-hdrgen`` executable. We will use the ``clang`` compiler to build
-the GPU code and the ``libc-hdrgen`` tool to create the necessary headers. We
-use these tools to bootstrap the build out of the runtimes directory targeting a
-GPU architecture.
+Once this has finished the build directory should contain the ``clang``
+compiler executable. We will use the ``clang`` compiler to build the GPU code.
+We use these tools to bootstrap the build out of the runtimes directory
+targeting a GPU architecture.
.. code-block:: sh
@@ -105,7 +102,6 @@ GPU architecture.
$> TARGET_TRIPLE=<amdgcn-amd-amdhsa or nvptx64-nvidia-cuda>
$> TARGET_C_COMPILER=</path/to/clang>
$> TARGET_CXX_COMPILER=</path/to/clang++>
- $> HDRGEN=</path/to/libc-hdrgen>
$> cmake ../runtimes \ # Point to the runtimes build
-G Ninja \
-DLLVM_ENABLE_RUNTIMES=libc \
@@ -113,7 +109,6 @@ GPU architecture.
-DCMAKE_CXX_COMPILER=$TARGET_CXX_COMPILER \
-DLLVM_LIBC_FULL_BUILD=ON \
-DLLVM_RUNTIMES_TARGET=$TARGET_TRIPLE \
- -DLIBC_HDRGEN_EXE=$HDRGEN \
-DCMAKE_BUILD_TYPE=Release
$> ninja install
diff --git a/libc/include/CMakeLists.txt b/libc/include/CMakeLists.txt
index 91611026df105c..483e63da48deae 100644
--- a/libc/include/CMakeLists.txt
+++ b/libc/include/CMakeLists.txt
@@ -18,24 +18,14 @@ add_header(
)
macro(add_header_macro TARGET_NAME YAML_FILE DEF_FILE GEN_HDR DEPENDS)
- if (LIBC_USE_NEW_HEADER_GEN)
- add_gen_header2(
- ${TARGET_NAME}
- YAML_FILE ${YAML_FILE}
- DEF_FILE ${DEF_FILE}
- GEN_HDR ${GEN_HDR}
- ${DEPENDS}
- ${ARGN}
- )
- else()
- add_gen_header(
- ${TARGET_NAME}
- DEF_FILE ${DEF_FILE}
- GEN_HDR ${GEN_HDR}
- ${DEPENDS}
- ${ARGN}
- )
- endif()
+ add_gen_header2(
+ ${TARGET_NAME}
+ YAML_FILE ${YAML_FILE}
+ DEF_FILE ${DEF_FILE}
+ GEN_HDR ${GEN_HDR}
+ ${DEPENDS}
+ ${ARGN}
+ )
endmacro()
add_header_macro(
diff --git a/libc/spec/bsd_ext.td b/libc/spec/bsd_ext.td
deleted file mode 100644
index 2b91324e36db9a..00000000000000
--- a/libc/spec/bsd_ext.td
+++ /dev/null
@@ -1,87 +0,0 @@
-def BsdExtensions : StandardSpec<"BSDExtensions"> {
- HeaderSpec Math = HeaderSpec<
- "math.h",
- [], // Macros
- [], // Types
- [], // Enumerations
- [
- FunctionSpec<"isnan", RetValSpec<IntType>, [ArgSpec<DoubleType>]>,
- FunctionSpec<"isnanf", RetValSpec<IntType>, [ArgSpec<FloatType>]>,
- FunctionSpec<"isnanl", RetValSpec<IntType>, [ArgSpec<LongDoubleType>]>,
- ]
- >;
-
- HeaderSpec String = HeaderSpec<
- "string.h",
- [], // Macros
- [], // Types
- [], // Enumerations
- [
- FunctionSpec<
- "strlcat",
- RetValSpec<SizeTType>,
- [ArgSpec<CharRestrictedPtr>, ArgSpec<ConstCharRestrictedPtr>, ArgSpec<SizeTType>]
- >,
- FunctionSpec<
- "strlcpy",
- RetValSpec<SizeTType>,
- [ArgSpec<CharRestrictedPtr>, ArgSpec<ConstCharRestrictedPtr>, ArgSpec<SizeTType>]
- >,
- FunctionSpec<
- "strsep",
- RetValSpec<CharPtr>,
- [ArgSpec<CharRestrictedPtrPtr>, ArgSpec<ConstCharRestrictedPtr>]
- >,
- ]
- >;
-
- HeaderSpec Strings = HeaderSpec<
- "strings.h",
- [], // Macros
- [], // Types
- [], // Enumerations
- [
- FunctionSpec<
- "strcasecmp",
- RetValSpec<IntType>,
- [ArgSpec<ConstCharPtr>, ArgSpec<ConstCharPtr>]
- >,
- FunctionSpec<
- "strncasecmp",
- RetValSpec<IntType>,
- [ArgSpec<ConstCharPtr>, ArgSpec<ConstCharPtr>, ArgSpec<SizeTType>]
- >,
- FunctionSpec<
- "index",
- RetValSpec<CharPtr>,
- [ArgSpec<ConstCharPtr>, ArgSpec<IntType>]
- >,
- FunctionSpec<
- "rindex",
- RetValSpec<CharPtr>,
- [ArgSpec<ConstCharPtr>, ArgSpec<IntType>]
- >,
- ]
- >;
-
- HeaderSpec SysWait = HeaderSpec<
- "sys/wait.h",
- [], // Macros
- [StructRUsage], // Types
- [], // Enumerations
- [
- FunctionSpec<
- "wait4",
- RetValSpec<PidT>,
- [ArgSpec<PidT>, ArgSpec<IntPtr>, ArgSpec<IntType>, ArgSpec<StructRUsagePtr>]
- >
- ]
- >;
-
- let Headers = [
- Math,
- String,
- Strings,
- SysWait,
- ];
-}
diff --git a/libc/spec/gnu_ext.td b/libc/spec/gnu_ext.td
deleted file mode 100644
index 64121aed9574f2..00000000000000
--- a/libc/spec/gnu_ext.td
+++ /dev/null
@@ -1,316 +0,0 @@
-def CpuSetT : NamedType<"cpu_set_t">;
-def CpuSetPtr : PtrType<CpuSetT>;
-def ConstCpuSetPtr : ConstType<CpuSetPtr>;
-
-def QSortRCompareT : NamedType<"__qsortrcompare_t">;
-def StructHsearchData : NamedType<"struct hsearch_data">;
-def StructHsearchDataPtr : PtrType<StructHsearchData>;
-
-def GnuExtensions : StandardSpec<"GNUExtensions"> {
- NamedType CookieIOFunctionsT = NamedType<"cookie_io_functions_t">;
- HeaderSpec CType = HeaderSpec<
- "ctype.h",
- [], // Macros
- [], // Types
- [], // Enumerations
- [
- FunctionSpec<
- "toascii",
- RetValSpec<IntType>,
- [ArgSpec<IntType>]
- >,
- ]
- >;
-
- HeaderSpec Malloc = HeaderSpec<
- "malloc.h",
- [], // Macros
- [], // Types
- [], // Enumerations
- [
- FunctionSpec<"mallopt", RetValSpec<IntType>, [ArgSpec<IntType>, ArgSpec<IntType>]>,
- ]
- >;
-
- HeaderSpec Math = HeaderSpec<
- "math.h",
- [], // Macros
- [], // Types
- [], // Enumerations
- [
- FunctionSpec<
- "sincosf",
- RetValSpec<VoidType>,
- [ArgSpec<FloatType>, ArgSpec<FloatPtr>, ArgSpec<FloatPtr>]
- >,
- FunctionSpec<
- "lgamma_r",
- RetValSpec<DoubleType>,
- [ArgSpec<DoubleType>, ArgSpec<IntPtr>]
- >,
- FunctionSpec<
- "lgammaf_r",
- RetValSpec<FloatType>,
- [ArgSpec<FloatType>, ArgSpec<IntPtr>]
- >,
- FunctionSpec<
- "lgammal_r",
- RetValSpec<LongDoubleType>,
- [ArgSpec<LongDoubleType>, ArgSpec<IntPtr>]
- >,
- ]
- >;
-
- HeaderSpec Sched = HeaderSpec<
- "sched.h",
- [], // Macros
- [PidT, SizeTType, CpuSetT], // Types
- [], // Enumerations
- [
- FunctionSpec<
- "sched_getaffinity",
- RetValSpec<IntType>,
- [ArgSpec<PidT>, ArgSpec<SizeTType>, ArgSpec<CpuSetPtr>]
- >,
- FunctionSpec<
- "sched_setaffinity",
- RetValSpec<IntType>,
- [ArgSpec<PidT>, ArgSpec<SizeTType>, ArgSpec<ConstCpuSetPtr>]
- >,
- ]
- >;
- HeaderSpec String = HeaderSpec<
- "string.h",
- [], // Macros
- [], // Types
- [], // Enumerations
- [
- FunctionSpec<
- "memmem",
- RetValSpec<VoidPtr>,
- [ArgSpec<ConstVoidPtr>, ArgSpec<SizeTType>, ArgSpec<ConstVoidPtr>, ArgSpec<SizeTType>]
- >,
- FunctionSpec<
- "memrchr",
- RetValSpec<VoidPtr>,
- [ArgSpec<ConstVoidPtr>, ArgSpec<IntType>, ArgSpec<SizeTType>]
- >,
- FunctionSpec<
- "strerror_r",
- RetValSpec<CharPtr>,
- [ArgSpec<IntType>, ArgSpec<CharPtr>, ArgSpec<SizeTType>]
- >,
- FunctionSpec<
- "strcasestr",
- RetValSpec<CharPtr>,
- [ArgSpec<ConstCharPtr>, ArgSpec<ConstCharPtr>]
- >,
- FunctionSpec<
- "strchrnul",
- RetValSpec<CharPtr>,
- [ArgSpec<ConstCharPtr>, ArgSpec<IntType>]
- >,
- ]
- >;
-
- HeaderSpec Search = HeaderSpec<
- "search.h",
- [], // Macros
- [
- StructHsearchData
- ],
- [], // Enumerations
- [
- FunctionSpec<
- "hcreate_r",
- RetValSpec<IntType>,
- [
- ArgSpec<SizeTType>,
- ArgSpec<StructHsearchDataPtr>
- ]
- >,
- FunctionSpec<
- "hdestroy_r",
- RetValSpec<VoidType>,
- [
- ArgSpec<StructHsearchDataPtr>
- ]
- >,
- FunctionSpec<
- "hsearch_r",
- RetValSpec<IntType>,
- [
- ArgSpec<EntryType>,
- ArgSpec<ActionType>,
- ArgSpec<EntryTypePtrPtr>,
- ArgSpec<StructHsearchDataPtr>
- ]
- >,
- ]
- >;
-
- HeaderSpec FEnv = HeaderSpec<
- "fenv.h",
- [], // Macros
- [], // Types
- [], // Enumerations
- [
- FunctionSpec<
- "fedisableexcept",
- RetValSpec<IntType>,
- [ArgSpec<IntType>]
- >,
- FunctionSpec<
- "feenableexcept",
- RetValSpec<IntType>,
- [ArgSpec<IntType>]
- >,
- FunctionSpec<
- "fegetexcept",
- RetValSpec<IntType>,
- []
- >
- ]
- >;
-
- HeaderSpec StdIO = HeaderSpec<
- "stdio.h",
- [], // Macros
- [CookieIOFunctionsT], // Types
- [], // Enumerations
- [
- FunctionSpec<
- "clearerr_unlocked",
- RetValSpec<VoidType>,
- [ArgSpec<FILEPtr>]
- >,
- FunctionSpec<
- "feof_unlocked",
- RetValSpec<IntType>,
- [ArgSpec<FILEPtr>]
- >,
- FunctionSpec<
- "ferror_unlocked",
- RetValSpec<IntType>,
- [ArgSpec<FILEPtr>]
- >,
- FunctionSpec<
- "fopencookie",
- RetValSpec<FILEPtr>,
- [ArgSpec<VoidPtr>, ArgSpec<ConstCharPtr>, ArgSpec<CookieIOFunctionsT>]
- >,
- FunctionSpec<
- "fread_unlocked",
- RetValSpec<SizeTType>,
- [ArgSpec<VoidRestrictedPtr>,
- ArgSpec<SizeTType>,
- ArgSpec<SizeTType>,
- ArgSpec<FILERestrictedPtr>]
- >,
- FunctionSpec<
- "fwrite_unlocked",
- RetValSpec<SizeTType>,
- [ArgSpec<ConstVoidRestrictedPtr>,
- ArgSpec<SizeTType>,
- ArgSpec<SizeTType>,
- ArgSpec<FILERestrictedPtr>]
- >,
- FunctionSpec<
- "fgetc_unlocked",
- RetValSpec<IntType>,
- [ArgSpec<FILEPtr>]
- >,
- ]
- >;
-
- HeaderSpec StdLib = HeaderSpec<
- "stdlib.h",
- [], // Macros
- [QSortRCompareT], // Types
- [], // Enumerations
- [
- FunctionSpec<
- "qsort_r",
- RetValSpec<VoidType>,
- [ArgSpec<VoidPtr>, ArgSpec<SizeTType>, ArgSpec<SizeTType>, ArgSpec<QSortRCompareT>, ArgSpec<VoidPtr>]
- >,
- ]
- >;
-
- HeaderSpec PThread = HeaderSpec<
- "pthread.h",
- [], // Macros
- [], // Types
- [], // Enumerations
- [
- FunctionSpec<
- "pthread_setname_np",
- RetValSpec<IntType>,
- [ArgSpec<PThreadTType>, ArgSpec<ConstCharPtr>]
- >,
- FunctionSpec<
- "pthread_getname_np",
- RetValSpec<IntType>,
- [ArgSpec<PThreadTType>, ArgSpec<CharPtr>, ArgSpec<SizeTType>]
- >,
- ]
- >;
-
- HeaderSpec SysAuxv = HeaderSpec<
- "sys/auxv.h",
- [], // Macros
- [], // Types
- [], // Enumerations
- [
- FunctionSpec<
- "getauxval",
- RetValSpec<UnsignedLongType>,
- [ArgSpec<UnsignedLongType>]
- >,
- ] // Functions
- >;
-
- HeaderSpec SendFile = HeaderSpec<
- "sys/sendfile.h",
- [], // Macros
- [OffTType, SizeTType, SSizeTType,], // Types
- [], // Enumerations
- [
- FunctionSpec<
- "sendfile",
- RetValSpec<SSizeTType>,
- [ArgSpec<IntType>, ArgSpec<IntType>, ArgSpec<OffTPtr>, ArgSpec<SizeTType>]
- >,
- ]
- >;
-
- HeaderSpec UniStd = HeaderSpec<
- "unistd.h",
- [], // Macros
- [], // Types
- [], // Enumerations
- [
- FunctionSpec<
- "dup2",
- RetValSpec<IntType>,
- [ArgSpec<IntType>, ArgSpec<IntType>, ArgSpec<IntType>]
- >,
- ]
- >;
-
- let Headers = [
- CType,
- FEnv,
- Malloc,
- Math,
- PThread,
- Sched,
- SendFile,
- SysAuxv,
- StdIO,
- StdLib,
- String,
- Search,
- UniStd,
- ];
-}
diff --git a/libc/spec/gpu_ext.td b/libc/spec/gpu_ext.td
deleted file mode 100644
index d99531dc06bcd6..00000000000000
--- a/libc/spec/gpu_ext.td
+++ /dev/null
@@ -1,18 +0,0 @@
-def GPUExtensions : StandardSpec<"GPUExtensions"> {
- HeaderSpec RPC = HeaderSpec<
- "gpu/rpc.h",
- [], // Macros
- [], // Types
- [], // Enumerations
- [
- FunctionSpec<
- "rpc_host_call",
- RetValSpec<UnsignedLongLongType>,
- [ArgSpec<VoidPtr>, ArgSpec<VoidPtr>, ArgSpec<SizeTType>]
- >,
- ]
- >;
- let Headers = [
- RPC,
- ];
-}
diff --git a/libc/spec/linux.td b/libc/spec/linux.td
deleted file mode 100644
index 9b5dc8e30c95e4..00000000000000
--- a/libc/spec/linux.td
+++ /dev/null
@@ -1,328 +0,0 @@
-def StructEpollEvent : NamedType<"struct epoll_event">;
-def StructEpollEventPtr : PtrType<StructEpollEvent>;
-
-def StructEpollData : NamedType<"struct epoll_data">;
-
-def Linux : StandardSpec<"Linux"> {
- HeaderSpec Errno = HeaderSpec<
- "errno.h",
- [
- Macro<"ENOMEDIUM">,
- Macro<"ENOTBLK">,
- Macro<"EMEDIUMTYPE">,
- Macro<"EBADSLT">,
- Macro<"ECHRNG">,
- Macro<"ERFKILL">,
- Macro<"EUSERS">,
- Macro<"EBADR">,
- Macro<"EL3HLT">,
- Macro<"ENOTUNIQ">,
- Macro<"EXFULL">,
- Macro<"EHOSTDOWN">,
- Macro<"EL3RST">,
- Macro<"ENOPKG">,
- Macro<"ENOCSI">,
- Macro<"EUNATCH">,
- Macro<"EREMCHG">,
- Macro<"ETOOMANYREFS">,
- Macro<"EL2HLT">,
- Macro<"EBADFD">,
- Macro<"EREMOTEIO">,
- Macro<"ENAVAIL">,
- Macro<"ELIBEXEC">,
- Macro<"ESHUTDOWN">,
- Macro<"ENOKEY">,
- Macro<"ESTRPIPE">,
- Macro<"EKEYREJECTED">,
- Macro<"ESRMNT">,
- Macro<"EKEYREVOKED">,
- Macro<"EBADE">,
- Macro<"ELIBBAD">,
- Macro<"EISNAM">,
- Macro<"EBFONT">,
- Macro<"EPFNOSUPPORT">,
- Macro<"EREMOTE">,
- Macro<"EDEADLOCK">,
- Macro<"ENONET">,
- Macro<"EDOTDOT">,
- Macro<"EKEYEXPIRED">,
- Macro<"ELIBSCN">,
- Macro<"ERESTART">,
- Macro<"EBADRQC">,
- Macro<"EUCLEAN">,
- Macro<"ENOANO">,
- Macro<"ELIBACC">,
- Macro<"EHWPOISON">,
- Macro<"ELIBMAX">,
- Macro<"ESOCKTNOSUPPORT">,
- Macro<"ENOTNAM">,
- Macro<"ELNRNG">,
- Macro<"EL2NSYNC">,
- Macro<"EADV">,
- Macro<"ECOMM">,
- ]
- >;
-
- HeaderSpec Sched = HeaderSpec<
- "sched.h",
- [
- Macro<"SCHED_OTHER">,
- Macro<"SCHED_FIFO">,
- Macro<"SCHED_RR">,
- Macro<"SCHED_BATCH">,
- Macro<"SCHED_ISO">,
- Macro<"SCHED_IDLE">,
- Macro<"SCHED_DEADLINE">,
- ],
- [], // Types
- [], // Enumerations
- [] // Functions
- >;
-
- HeaderSpec SysMMan = HeaderSpec<
- "sys/mman.h",
- [Macro<"MAP_ANONYMOUS">],
- [], // Types
- [], // Enumerations
- [
- FunctionSpec<
- "mincore",
- RetValSpec<IntType>,
- [
- ArgSpec<VoidPtr>,
- ArgSpec<SizeTType>,
- ArgSpec<UnsignedCharPtr>,
- ]
- >,
- FunctionSpec<
- "mlock2",
- RetValSpec<IntType>,
- [
- ArgSpec<VoidPtr>,
- ArgSpec<SizeTType>,
- ArgSpec<UnsignedIntType>,
- ]
- >,
- FunctionSpec<
- "remap_file_pages",
- RetValSpec<IntType>,
- [
- ArgSpec<VoidPtr>,
- ArgSpec<SizeTType>,
- ArgSpec<IntType>,
- ArgSpec<SizeTType>,
- ArgSpec<IntType>,
- ]
- >,
- FunctionSpec<
- "mremap",
- RetValSpec<VoidPtr>,
- [
- ArgSpec<VoidPtr>,
- ArgSpec<SizeTType>,
- ArgSpec<SizeTType>,
- ArgSpec<IntType>,
- ArgSpec<VarArgType>,
- ]
- >,
- ] // Functions
- >;
-
-
- HeaderSpec SysPrctl = HeaderSpec<
- "sys/prctl.h",
- [], // Macros
- [], // Types
- [], // Enumerations
- [
- FunctionSpec<
- "prctl",
- RetValSpec<IntType>,
- [
- ArgSpec<IntType>,
- ArgSpec<UnsignedLongType>,
- ArgSpec<UnsignedLongType>,
- ArgSpec<UnsignedLongType>,
- ArgSpec<UnsignedLongType>,
- ]
- >,
- ] // Functions
- >;
-
- HeaderSpec SysRandom = HeaderSpec<
- "sys/random.h",
- [
- Macro<"GRND_RANDOM">,
- Macro<"GRND_NONBLOCK">,
- Macro<"GRND_INSECURE">,
- ],
- [SizeTType, SSizeTType], // Types
- [], // Enumerations
- [
- FunctionSpec<
- "getrandom",
- RetValSpec<SSizeTType>,
- [
- ArgSpec<VoidPtr>,
- ArgSpec<SizeTType>,
- ArgSpec<UnsignedIntType>
- ]
- >,
- ]
- >;
-
- HeaderSpec SysTime = HeaderSpec<
- "sys/time.h",
- [
- Macro<"timeradd">,
- Macro<"timersub">,
- Macro<"timerclear">,
- Macro<"timerisset">,
- Macro<"timercmp">,
- ],
- [StructTimevalType], // Types
- [], // Enumerations
- [] // Functions
- >;
-
-
- HeaderSpec SysEpoll = HeaderSpec<
- "sys/epoll.h",
- [], // Macros
- [
- StructEpollEvent,
- StructEpollData,
- SigSetType,
- StructTimeSpec,
- ], // Types
- [], // Enumerations
- [
- FunctionSpec<
- "epoll_create",
- RetValSpec<IntType>,
- [
- ArgSpec<IntType>
- ]
- >,
- FunctionSpec<
- "epoll_create1",
- RetValSpec<IntType>,
- [
- ArgSpec<IntType>
- ]
- >,
- FunctionSpec<
- "epoll_ctl",
- RetValSpec<IntType>,
- [
- ArgSpec<IntType>,
- ArgSpec<IntType>,
- ArgSpec<IntType>,
- ArgSpec<StructEpollEventPtr>
- ]
- >,
- FunctionSpec<
- "epoll_wait",
- RetValSpec<IntType>,
- [
- ArgSpec<IntType>,
- ArgSpec<StructEpollEventPtr>,
- ArgSpec<IntType>,
- ArgSpec<IntType>
- ]
- >,
- FunctionSpec<
- "epoll_pwait",
- RetValSpec<IntType>,
- [
- ArgSpec<IntType>,
- ArgSpec<StructEpollEventPtr>,
- ArgSpec<IntType>,
- ArgSpec<IntType>,
- ArgSpec<ConstSigSetPtrType>
- ]
- >,
- FunctionSpec<
- "epoll_pwait2",
- RetValSpec<IntType>,
- [
- ArgSpec<IntType>,
- ArgSpec<StructEpollEventPtr>,
- ArgSpec<IntType>,
- ArgSpec<ConstStructTimeSpecPtr>,
- ArgSpec<ConstSigSetPtrType>
- ]
- >,
- ] // Functions
- >;
-
- HeaderSpec Signal = HeaderSpec<
- "signal.h",
- [
- Macro<"NSIG">,
-
- Macro<"SIGHUP">,
- Macro<"SIGINT">,
- Macro<"SIGQUIT">,
- Macro<"SIGILL">,
- Macro<"SIGTRAP">,
- Macro<"SIGABRT">,
- Macro<"SIGIOT">,
- Macro<"SIGBUS">,
- Macro<"SIGFPE">,
- Macro<"SIGKILL">,
- Macro<"SIGUSR1">,
- Macro<"SIGSEGV">,
- Macro<"SIGUSR2">,
- Macro<"SIGPIPE">,
- Macro<"SIGALRM">,
- Macro<"SIGTERM">,
- Macro<"SIGSTKFLT">,
- Macro<"SIGCHLD">,
- Macro<"SIGCONT">,
- Macro<"SIGSTOP">,
- Macro<"SIGTSTP">,
- Macro<"SIGTTIN">,
- Macro<"SIGTTOU">,
- Macro<"SIGURG">,
- Macro<"SIGXCPU">,
- Macro<"SIGXFSZ">,
- Macro<"SIGVTALRM">,
- Macro<"SIGPROF">,
- Macro<"SIGWINCH">,
- Macro<"SIGIO">,
- Macro<"SIGPOLL">,
- Macro<"SIGPWR">,
- Macro<"SIGSYS">,
- Macro<"SIGUNUSED">,
- ]
- >;
-
-
- HeaderSpec UniStd = HeaderSpec<
- "unistd.h",
- [], // Macros
- [],
- [], // Enumerations
- [
- FunctionSpec<
- "pipe2",
- RetValSpec<IntType>,
- [ArgSpec<IntPtr>, ArgSpec<IntType>] //TODO: make this int[2]
- >,
- ],
- []
- >;
-
-
- let Headers = [
- Errno,
- SysEpoll,
- SysMMan,
- SysPrctl,
- SysRandom,
- SysTime,
- Signal,
- UniStd,
- ];
-}
diff --git a/libc/spec/llvm_libc_ext.td b/libc/spec/llvm_libc_ext.td
deleted file mode 100644
index cd63e34a44ef0a..00000000000000
--- a/libc/spec/llvm_libc_ext.td
+++ /dev/null
@@ -1,116 +0,0 @@
-def LLVMLibcExt : StandardSpec<"llvm_libc_ext"> {
- HeaderSpec Strings = HeaderSpec<
- "strings.h",
- [], // Macros
- [], // Types
- [], // Enumerations
- [
- FunctionSpec<
- "bcopy",
- RetValSpec<VoidType>,
- [ArgSpec<ConstVoidPtr>, ArgSpec<VoidPtr>, ArgSpec<SizeTType>]
- >,
- FunctionSpec<
- "bzero",
- RetValSpec<VoidType>,
- [ArgSpec<VoidPtr>, ArgSpec<SizeTType>]
- >,
- FunctionSpec<
- "bcmp",
- RetValSpec<IntType>,
- [ArgSpec<ConstVoidPtr>, ArgSpec<ConstVoidPtr>, ArgSpec<SizeTType>]
- >,
- ]
- >;
-
- HeaderSpec Assert = HeaderSpec<
- "assert.h",
- [], // Macros
- [], // Types
- [], // Enumerations
- [
- FunctionSpec<
- "__assert_fail",
- RetValSpec<NoReturn>,
- [ArgSpec<ConstCharPtr>, ArgSpec<ConstCharPtr>, ArgSpec<UnsignedType>, ArgSpec<ConstCharPtr>]
- >,
- ]
- >;
-
- HeaderSpec Sched = HeaderSpec<
- "sched.h",
- [], // Macros
- [PidT, SizeTType, CpuSetT], // Types
- [], // Enumerations
- [
- FunctionSpec<
- "__sched_getcpucount",
- RetValSpec<IntType>,
- [ArgSpec<SizeTType>, ArgSpec<ConstCpuSetPtr>]
- >,
- ]
- >;
-
- HeaderSpec Math = HeaderSpec<
- "math.h",
- [], // Macros
- [], // Types
- [], // Enumerations
- [
- GuardedFunctionSpec<"daddf128", RetValSpec<DoubleType>, [ArgSpec<Float128Type>, ArgSpec<Float128Type>], "LIBC_TYPES_HAS_FLOAT128">,
- GuardedFunctionSpec<"ddivf128", RetValSpec<DoubleType>, [ArgSpec<Float128Type>, ArgSpec<Float128Type>], "LIBC_TYPES_HAS_FLOAT128">,
- GuardedFunctionSpec<"dfmaf128", RetValSpec<DoubleType>, [ArgSpec<Float128Type>, ArgSpec<Float128Type>, ArgSpec<Float128Type>], "LIBC_TYPES_HAS_FLOAT128">,
- GuardedFunctionSpec<"dsqrtf128", RetValSpec<DoubleType>, [ArgSpec<Float128Type>], "LIBC_TYPES_HAS_FLOAT128">,
- GuardedFunctionSpec<"dsubf128", RetValSpec<DoubleType>, [ArgSpec<Float128Type>, ArgSpec<Float128Type>], "LIBC_TYPES_HAS_FLOAT128">,
-
-
- GuardedFunctionSpec<"f16add", RetValSpec<Float16Type>, [ArgSpec<DoubleType>, ArgSpec<DoubleType>], "LIBC_TYPES_HAS_FLOAT16">,
- GuardedFunctionSpec<"f16addf", RetValSpec<Float16Type>, [ArgSpec<FloatType>, ArgSpec<FloatType>], "LIBC_TYPES_HAS_FLOAT16">,
- GuardedFunctionSpec<"f16addl", RetValSpec<Float16Type>, [ArgSpec<LongDoubleType>, ArgSpec<LongDoubleType>], "LIBC_TYPES_HAS_FLOAT16">,
-
- GuardedFunctionSpec<"f16sub", RetValSpec<Float16Type>, [ArgSpec<DoubleType>, ArgSpec<DoubleType>], "LIBC_TYPES_HAS_FLOAT16">,
- GuardedFunctionSpec<"f16subf", RetValSpec<Float16Type>, [ArgSpec<FloatType>, ArgSpec<FloatType>], "LIBC_TYPES_HAS_FLOAT16">,
- GuardedFunctionSpec<"f16subl", RetValSpec<Float16Type>, [ArgSpec<LongDoubleType>, ArgSpec<LongDoubleType>], "LIBC_TYPES_HAS_FLOAT16">,
-
- GuardedFunctionSpec<"faddf128", RetValSpec<FloatType>, [ArgSpec<Float128Type>, ArgSpec<Float128Type>], "LIBC_TYPES_HAS_FLOAT128">,
-
- GuardedFunctionSpec<"fdivf128", RetValSpec<FloatType>, [ArgSpec<Float128Type>, ArgSpec<Float128Type>], "LIBC_TYPES_HAS_FLOAT128">,
-
- GuardedFunctionSpec<"ffmaf128", RetValSpec<FloatType>, [ArgSpec<Float128Type>, ArgSpec<Float128Type>, ArgSpec<Float128Type>], "LIBC_TYPES_HAS_FLOAT128">,
-
- GuardedFunctionSpec<"fmulf128", RetValSpec<FloatType>, [ArgSpec<Float128Type>, ArgSpec<Float128Type>], "LIBC_TYPES_HAS_FLOAT128">,
-
- GuardedFunctionSpec<"dmulf128", RetValSpec<DoubleType>, [ArgSpec<Float128Type>, ArgSpec<Float128Type>], "LIBC_TYPES_HAS_FLOAT128">,
-
- GuardedFunctionSpec<"f16mul", RetValSpec<Float16Type>, [ArgSpec<DoubleType>, ArgSpec<DoubleType>], "LIBC_TYPES_HAS_FLOAT16">,
- GuardedFunctionSpec<"f16mulf", RetValSpec<Float16Type>, [ArgSpec<FloatType>, ArgSpec<FloatType>], "LIBC_TYPES_HAS_FLOAT16">,
- GuardedFunctionSpec<"f16mull", RetValSpec<Float16Type>, [ArgSpec<LongDoubleType>, ArgSpec<LongDoubleType>], "LIBC_TYPES_HAS_FLOAT16">,
-
- GuardedFunctionSpec<"f16div", RetValSpec<Float16Type>, [ArgSpec<DoubleType>, ArgSpec<DoubleType>], "LIBC_TYPES_HAS_FLOAT16">,
- GuardedFunctionSpec<"f16divf", RetValSpec<Float16Type>, [ArgSpec<FloatType>, ArgSpec<FloatType>], "LIBC_TYPES_HAS_FLOAT16">,
- GuardedFunctionSpec<"f16divl", RetValSpec<Float16Type>, [ArgSpec<LongDoubleType>, ArgSpec<LongDoubleType>], "LIBC_TYPES_HAS_FLOAT16">,
-
- GuardedFunctionSpec<"f16fma", RetValSpec<Float16Type>, [ArgSpec<DoubleType>, ArgSpec<DoubleType>, ArgSpec<DoubleType>], "LIBC_TYPES_HAS_FLOAT16">,
- GuardedFunctionSpec<"f16fmaf", RetValSpec<Float16Type>, [ArgSpec<FloatType>, ArgSpec<FloatType>, ArgSpec<FloatType>], "LIBC_TYPES_HAS_FLOAT16">,
- GuardedFunctionSpec<"f16fmal", RetValSpec<Float16Type>, [ArgSpec<LongDoubleType>, ArgSpec<LongDoubleType>, ArgSpec<LongDoubleType>], "LIBC_TYPES_HAS_FLOAT16">,
-
- GuardedFunctionSpec<"f16sqrt", RetValSpec<Float16Type>, [ArgSpec<DoubleType>], "LIBC_TYPES_HAS_FLOAT16">,
- GuardedFunctionSpec<"f16sqrtf", RetValSpec<Float16Type>, [ArgSpec<FloatType>], "LIBC_TYPES_HAS_FLOAT16">,
- GuardedFunctionSpec<"f16sqrtl", RetValSpec<Float16Type>, [ArgSpec<LongDoubleType>], "LIBC_TYPES_HAS_FLOAT16">,
-
- GuardedFunctionSpec<"fsqrtf128", RetValSpec<FloatType>, [ArgSpec<Float128Type>], "LIBC_TYPES_HAS_FLOAT128">,
-
- GuardedFunctionSpec<"fsubf128", RetValSpec<FloatType>, [ArgSpec<Float128Type>, ArgSpec<Float128Type>], "LIBC_TYPES_HAS_FLOAT128">,
-
- FunctionSpec<"powi", RetValSpec<DoubleType>, [ArgSpec<DoubleType>, ArgSpec<IntType>]>,
- FunctionSpec<"powif", RetValSpec<FloatType>, [ArgSpec<FloatType>, ArgSpec<IntType>]>,
- ]
- >;
-
- let Headers = [
- Assert,
- Math,
- Sched,
- Strings,
- ];
-}
diff --git a/libc/spec/llvm_libc_stdfix_ext.td b/libc/spec/llvm_libc_stdfix_ext.td
deleted file mode 100644
index 7bc7ec5464081b..00000000000000
--- a/libc/spec/llvm_libc_stdfix_ext.td
+++ /dev/null
@@ -1,27 +0,0 @@
-def LLVMLibcStdfixExt : StandardSpec<"llvm_libc_stdfix_ext"> {
- HeaderSpec StdFix = HeaderSpec<
- "stdfix.h",
- [], // macros
- [], // types
- [], // enums
- [ // functions
- GuardedFunctionSpec<"exphk", RetValSpec<ShortAccumType>, [ArgSpec<ShortAccumType>], "LIBC_COMPILER_HAS_FIXED_POINT">,
- GuardedFunctionSpec<"expk", RetValSpec<AccumType>, [ArgSpec<AccumType>], "LIBC_COMPILER_HAS_FIXED_POINT">,
-
- GuardedFunctionSpec<"sqrtuhr", RetValSpec<UnsignedShortFractType>, [ArgSpec<UnsignedShortFractType>], "LIBC_COMPILER_HAS_FIXED_POINT">,
- GuardedFunctionSpec<"sqrtur", RetValSpec<UnsignedFractType>, [ArgSpec<UnsignedFractType>], "LIBC_COMPILER_HAS_FIXED_POINT">,
- GuardedFunctionSpec<"sqrtulr", RetValSpec<UnsignedLongFractType>, [ArgSpec<UnsignedLongFractType>], "LIBC_COMPILER_HAS_FIXED_POINT">,
-
- GuardedFunctionSpec<"sqrtuhk", RetValSpec<UnsignedShortAccumType>, [ArgSpec<UnsignedShortAccumType>], "LIBC_COMPILER_HAS_FIXED_POINT">,
- GuardedFunctionSpec<"sqrtuk", RetValSpec<UnsignedAccumType>, [ArgSpec<UnsignedAccumType>], "LIBC_COMPILER_HAS_FIXED_POINT">,
- GuardedFunctionSpec<"sqrtulk", RetValSpec<UnsignedLongAccumType>, [ArgSpec<UnsignedLongAccumType>], "LIBC_COMPILER_HAS_FIXED_POINT">,
-
- GuardedFunctionSpec<"uhksqrtus", RetValSpec<UnsignedShortAccumType>, [ArgSpec<UnsignedShortType>], "LIBC_COMPILER_HAS_FIXED_POINT">,
- GuardedFunctionSpec<"uksqrtui", RetValSpec<UnsignedAccumType>, [ArgSpec<UnsignedIntType>], "LIBC_COMPILER_HAS_FIXED_POINT">,
- ]
- >;
-
- let Headers = [
- StdFix,
- ];
-}
diff --git a/libc/spec/posix.td b/libc/spec/posix.td
deleted file mode 100644
index e354deef340f1b..00000000000000
--- a/libc/spec/posix.td
+++ /dev/null
@@ -1,1867 +0,0 @@
-def SigSetType : NamedType<"sigset_t">;
-def SigSetPtrType : PtrType<SigSetType>;
-def ConstSigSetPtrType : ConstType<SigSetPtrType>;
-def RestrictedSigSetType : RestrictedPtrType<SigSetType>;
-def ConstRestrictedSigSetType : ConstType<RestrictedSigSetType>;
-
-def SigInfoType : NamedType<"siginfo_t">;
-def UnionSigVal : NamedType<"union sigval">;
-
-def StructSigaction : NamedType<"struct sigaction">;
-def StructSigactionPtr : PtrType<StructSigaction>;
-def ConstStructSigactionPtr : ConstType<StructSigactionPtr>;
-def RestrictedStructSigactionPtr : RestrictedPtrType<StructSigaction>;
-def ConstRestrictedStructSigactionPtr : ConstType<RestrictedStructSigactionPtr>;
-
-def PThreadStartT : NamedType<"__pthread_start_t">;
-def PThreadTSSDtorT : NamedType<"__pthread_tss_dtor_t">;
-def PThreadKeyT : NamedType<"pthread_key_t">;
-def PThreadKeyTPtr : PtrType<PThreadKeyT>;
-def PThreadOnceT : NamedType<"pthread_once_t">;
-def PThreadOnceTPtr : PtrType<PThreadOnceT>;
-def PThreadOnceCallback : NamedType<"__pthread_once_func_t">;
-
-def InoT : NamedType<"ino_t">;
-def UidT : NamedType<"uid_t">;
-def GidT : NamedType<"gid_t">;
-def DevT : NamedType<"dev_t">;
-def ClockIdT : NamedType<"clockid_t">;
-def RestrictedClockIdTPtr : RestrictedPtrType<ClockIdT>;
-def BlkSizeT : NamedType<"blksize_t">;
-def BlkCntT : NamedType<"blkcnt_t">;
-def NLinkT : NamedType<"nlink_t">;
-
-def StatType : NamedType<"struct stat">;
-def StatTypePtr : PtrType<StatType>;
-def RestrictedStatTypePtr : RestrictedPtrType<StatType>;
-
-def DIR : NamedType<"DIR">;
-def DIRPtr : PtrType<DIR>;
-def DIRRestrictedPtr : RestrictedPtrType<DIR>;
-def StructDirent : NamedType<"struct dirent">;
-def StructDirentPtr : PtrType<StructDirent>;
-def StructDirentPtrPtr : PtrType<StructDirentPtr>;
-def ConstStructDirentPtrPtr : ConstType<StructDirentPtrPtr>;
-
-def StructSchedParam : NamedType<"struct sched_param">;
-def StructSchedParamPtr : PtrType<StructSchedParam>;
-def ConstStructSchedParamPtr : ConstType<StructSchedParamPtr>;
-
-def ExecArgvT : NamedType<"__exec_argv_t">;
-def ExecEnvpT : NamedType<"__exec_envp_t">;
-
-def AtForkCallbackT : NamedType<"__atfork_callback_t">;
-
-def PosixSpawnFileActionsT : NamedType<"posix_spawn_file_actions_t">;
-def PosixSpawnFileActionsTPtr : PtrType<PosixSpawnFileActionsT>;
-def ConstPosixSpawnFileActionsTPtr : ConstType<PosixSpawnFileActionsTPtr>;
-def PosixSpawnFileActionsTRestrictedPtr : RestrictedPtrType<PosixSpawnFileActionsT>;
-
-def PosixSpawnAttrT : NamedType<"posix_spawnattr_t">;
-def RestrictedPosixSpawnAttrTPtrType : RestrictedPtrType<PosixSpawnAttrT>;
-
-def CcT : NamedType<"cc_t">;
-def SpeedT : NamedType<"speed_t">;
-def StructTermios : NamedType<"struct termios">;
-def StructTermiosPtr : PtrType<StructTermios>;
-def ConstStructTermiosPtr : ConstType<StructTermiosPtr>;
-def TcFlagT : NamedType<"tcflag_t">;
-
-def StackT : NamedType<"stack_t">;
-def StackTPtr : PtrType<StackT>;
-def RestrictedStackTPtr : RestrictedPtrType<StackT>;
-def ConstRestrictedStackTPtr : ConstType<RestrictedStackTPtr>;
-
-def FdSet : NamedType<"fd_set">;
-def FdSetPtr : PtrType<FdSet>;
-def RestrictedFdSetPtr : RestrictedPtrType<FdSet>;
-
-def GetoptArgvT : NamedType<"__getoptargv_t">;
-
-def SAFamilyType : NamedType<"sa_family_t">;
-def SocklenType : NamedType<"socklen_t">;
-def SocklenPtr : PtrType<SocklenType>;
-
-def StructSockAddr : NamedType<"struct sockaddr">;
-def StructSockAddrPtr : PtrType<StructSockAddr>;
-def ConstStructSockAddrPtr : ConstType<StructSockAddrPtr>;
-
-def StructMsghdr : NamedType<"struct msghdr">;
-def StructMsghdrPtr : PtrType<StructMsghdr>;
-def ConstStructMsghdrPtr : ConstType<StructMsghdrPtr>;
-
-def StructIovec : NamedType<"struct iovec">;
-def StructIovecPtr : PtrType<StructIovec>;
-def ConstStructIovecPtr : ConstType<StructIovecPtr>;
-
-def StructSockAddrUn : NamedType<"struct sockaddr_un">;
-
-def StructStatvfs : NamedType<"struct statvfs">;
-def StructStatvfsPtr : PtrType<StructStatvfs>;
-def RestrictedStructStatvfsPtr : RestrictedPtrType<StructStatvfs>;
-
-// The function pointer type for the predicate for lsearch, lfind
-def LSearchCompareT : NamedType<"__lsearchcompare_t">;
-
-def POSIX : StandardSpec<"POSIX"> {
- PtrType CharPtr = PtrType<CharType>;
- RestrictedPtrType RestrictedCharPtr = RestrictedPtrType<CharType>;
- RestrictedPtrType CharRestrictedDoublePtr = RestrictedPtrType<CharPtr>;
- ConstType ConstCharPtr = ConstType<CharPtr>;
- ConstType ConstRestrictedCharPtr = ConstType<RestrictedCharPtr>;
-
- NamedType ModeTType = NamedType<"mode_t">;
-
- NamedType PThreadAttrTType = NamedType<"pthread_attr_t">;
- PtrType PThreadAttrTPtr = PtrType<PThreadAttrTType>;
- RestrictedPtrType RestrictedPThreadAttrTPtr = RestrictedPtrType<PThreadAttrTType>;
- ConstType ConstPThreadAttrTPtr = ConstType<PThreadAttrTPtr>;
- ConstType ConstRestrictedPThreadAttrTPtr = ConstType<RestrictedPThreadAttrTPtr>;
-
- NamedType PThreadCondAttrTType = NamedType<"pthread_condattr_t">;
- PtrType PThreadCondAttrTPtr = PtrType<PThreadCondAttrTType>;
- ConstType ConstRestrictedPThreadCondAttrTPtr = ConstType<RestrictedPtrType<PThreadCondAttrTType>>;
-
- NamedType PThreadRWLockAttrTType = NamedType<"pthread_rwlockattr_t">;
- PtrType PThreadRWLockAttrTPtr = PtrType<PThreadRWLockAttrTType>;
- ConstType ConstPThreadRWLockAttrTPtr = ConstType<PThreadRWLockAttrTPtr>;
- RestrictedPtrType RestrictedPThreadRWLockAttrTPtr = RestrictedPtrType<PThreadRWLockAttrTType>;
- ConstType ConstRestrictedPThreadRWLockAttrTPtr = ConstType<RestrictedPThreadRWLockAttrTPtr>;
-
- NamedType PThreadMutexAttrTType = NamedType<"pthread_mutexattr_t">;
- PtrType PThreadMutexAttrTPtr = PtrType<PThreadMutexAttrTType>;
- RestrictedPtrType RestrictedPThreadMutexAttrTPtr = RestrictedPtrType<PThreadMutexAttrTType>;
- ConstType ConstPThreadMutexAttrTPtr = ConstType<PThreadMutexAttrTPtr>;
- ConstType ConstRestrictedPThreadMutexAttrTPtr = ConstType<RestrictedPThreadMutexAttrTPtr>;
-
- NamedType PThreadMutexTType = NamedType<"pthread_mutex_t">;
- PtrType PThreadMutexTPtr = PtrType<PThreadMutexTType>;
- RestrictedPtrType RestrictedPThreadMutexTPtr = RestrictedPtrType<PThreadMutexTType>;
- ConstType ConstPThreadMutexTPtr = ConstType<PThreadMutexTPtr>;
- ConstType ConstRestrictedPThreadMutexTPtr = ConstType<RestrictedPThreadMutexTPtr>;
-
- NamedType PThreadRWLockTType = NamedType<"pthread_rwlock_t">;
- PtrType PThreadRWLockTPtr = PtrType<PThreadRWLockTType>;
- RestrictedPtrType RestrictedPThreadRWLockTPtr = RestrictedPtrType<PThreadRWLockTType>;
-
- NamedType PThreadSpinLockTType = NamedType<"pthread_spinlock_t">;
- PtrType PThreadSpinLockTPtr = PtrType<PThreadSpinLockTType>;
-
- PtrType PThreadTPtr = PtrType<PThreadTType>;
- RestrictedPtrType RestrictedPThreadTPtr = RestrictedPtrType<PThreadTType>;
-
- HeaderSpec Errno = HeaderSpec<
- "errno.h",
- [
- Macro<"E2BIG">,
- Macro<"EACCES">,
- Macro<"EADDRINUSE">,
- Macro<"EADDRNOTAVAIL">,
- Macro<"EAFNOSUPPORT">,
- Macro<"EAGAIN">,
- Macro<"EALREADY">,
- Macro<"EBADF">,
- Macro<"EBADMSG">,
- Macro<"EBUSY">,
- Macro<"ECANCELED">,
- Macro<"ECHILD">,
- Macro<"ECONNABORTED">,
- Macro<"ECONNREFUSED">,
- Macro<"ECONNRESET">,
- Macro<"EDEADLK">,
- Macro<"EDESTADDRREQ">,
- Macro<"EDQUOT">,
- Macro<"EEXIST">,
- Macro<"EFAULT">,
- Macro<"EFBIG">,
- Macro<"EHOSTUNREACH">,
- Macro<"EIDRM">,
- Macro<"EINPROGRESS">,
- Macro<"EINTR">,
- Macro<"EINVAL">,
- Macro<"EIO">,
- Macro<"EISCONN">,
- Macro<"EISDIR">,
- Macro<"ELOOP">,
- Macro<"EMFILE">,
- Macro<"EMLINK">,
- Macro<"EMSGSIZE">,
- Macro<"EMULTIHOP">,
- Macro<"ENAMETOOLONG">,
- Macro<"ENETDOWN">,
- Macro<"ENETRESET">,
- Macro<"ENETUNREACH">,
- Macro<"ENFILE">,
- Macro<"ENOBUFS">,
- Macro<"ENODATA">,
- Macro<"ENODEV">,
- Macro<"ENOENT">,
- Macro<"ENOEXEC">,
- Macro<"ENOLCK">,
- Macro<"ENOLINK">,
- Macro<"ENOMEM">,
- Macro<"ENOMSG">,
- Macro<"ENOPROTOOPT">,
- Macro<"ENOSPC">,
- Macro<"ENOSR">,
- Macro<"ENOSTR">,
- Macro<"ENOSYS">,
- Macro<"ENOTCONN">,
- Macro<"ENOTDIR">,
- Macro<"ENOTEMPTY">,
- Macro<"ENOTRECOVERABLE">,
- Macro<"ENOTSOCK">,
- Macro<"ENOTSUP">,
- Macro<"ENOTTY">,
- Macro<"ENXIO">,
- Macro<"EOPNOTSUPP">,
- Macro<"EOVERFLOW">,
- Macro<"EOWNERDEAD">,
- Macro<"EPERM">,
- Macro<"EPIPE">,
- Macro<"EPROTO">,
- Macro<"EPROTONOSUPPORT">,
- Macro<"EPROTOTYPE">,
- Macro<"EROFS">,
- Macro<"ESPIPE">,
- Macro<"ESRCH">,
- Macro<"ESTALE">,
- Macro<"ETIME">,
- Macro<"ETIMEDOUT">,
- Macro<"ETXTBSY">,
- Macro<"EWOULDBLOCK">,
- Macro<"EXDEV">,
- ],
- [], // Types
- [], // Enumerations
- [] // Functions
- >;
-
- HeaderSpec DlFcn = HeaderSpec<
- "dlfcn.h",
- [
- Macro<"RTLD_LAZY">,
- Macro<"RTLD_NOW">,
- Macro<"RTLD_GLOBAL">,
- Macro<"RTLD_LOCAL">,
- ],
- [], // Types
- [], // Enumerations
- [
- FunctionSpec<
- "dlclose",
- RetValSpec<IntType>,
- [ArgSpec<VoidPtr>]
- >,
- FunctionSpec<
- "dlerror",
- RetValSpec<CharPtr>,
- []
- >,
- FunctionSpec<
- "dlopen",
- RetValSpec<VoidPtr>,
- [ArgSpec<ConstCharPtr>, ArgSpec<IntType>]
- >,
- FunctionSpec<
- "dlsym",
- RetValSpec<VoidPtr>,
- [ArgSpec<VoidRestrictedPtr>, ArgSpec<ConstCharRestrictedPtr>]
- >,
- ]
- >;
-
- HeaderSpec FCntl = HeaderSpec<
- "fcntl.h",
- [], // Macros
- [
- ModeTType,
- OffTType,
- ],
- [], // Enumerations
- [
- FunctionSpec<
- "creat",
- RetValSpec<IntType>,
- [ArgSpec<ConstCharPtr>, ArgSpec<ModeTType>]
- >,
- FunctionSpec<
- "fcntl",
- RetValSpec<IntType>,
- [ArgSpec<IntType>, ArgSpec<IntType>, ArgSpec<VarArgType>]
- >,
- FunctionSpec<
- "open",
- RetValSpec<IntType>,
- [ArgSpec<ConstCharPtr>, ArgSpec<IntType>, ArgSpec<VarArgType>]
- >,
- FunctionSpec<
- "openat",
- RetValSpec<IntType>,
- [ArgSpec<IntType>, ArgSpec<ConstCharPtr>, ArgSpec<IntType>, ArgSpec<VarArgType>]
- >,
- ]
- >;
-
- HeaderSpec SysMMan = HeaderSpec<
- "sys/mman.h",
- [
- // TODO: Add a facility to bunch macros into bitwise-or-able groups.
- // POSIX requires it, so such thing should be captured in this spec.
- Macro<"PROT_EXEC">,
- Macro<"PROT_NONE">,
- Macro<"PROT_READ">,
- Macro<"PROT_WRITE">,
-
- Macro<"MAP_FIXED">,
- Macro<"MAP_PRIVATE">,
- Macro<"MAP_SHARED">,
-
- Macro<"MAP_FAILED">,
- ],
- [
- SizeTType,
- OffTType,
- ModeTType,
- ],
- [], // Enumerations
- [
- FunctionSpec<
- "madvise",
- RetValSpec<IntType>,
- [ArgSpec<VoidPtr>,
- ArgSpec<SizeTType>,
- ArgSpec<IntType>]
- >,
- FunctionSpec<
- "mmap",
- RetValSpec<VoidPtr>,
- [ArgSpec<VoidPtr>,
- ArgSpec<SizeTType>,
- ArgSpec<IntType>,
- ArgSpec<IntType>,
- ArgSpec<IntType>,
- ArgSpec<OffTType>]
- >,
- FunctionSpec<
- "mprotect",
- RetValSpec<IntType>,
- [ArgSpec<VoidPtr>,
- ArgSpec<SizeTType>,
- ArgSpec<IntType>]
- >,
- FunctionSpec<
- "munmap",
- RetValSpec<IntType>,
- [ArgSpec<VoidPtr>, ArgSpec<SizeTType>]
- >,
- FunctionSpec<
- "posix_madvise",
- RetValSpec<IntType>,
- [ArgSpec<VoidPtr>,
- ArgSpec<SizeTType>,
- ArgSpec<IntType>]
- >,
- FunctionSpec<
- "mlock",
- RetValSpec<IntType>,
- [ArgSpec<VoidPtr>, ArgSpec<SizeTType>]
- >,
- FunctionSpec<
- "munlock",
- RetValSpec<IntType>,
- [ArgSpec<VoidPtr>, ArgSpec<SizeTType>]
- >,
- FunctionSpec<
- "mlockall",
- RetValSpec<IntType>,
- [ArgSpec<IntType>]
- >,
- FunctionSpec<
- "munlockall",
- RetValSpec<IntType>,
- [ArgSpec<VoidType>]
- >,
- FunctionSpec<
- "msync",
- RetValSpec<IntType>,
- [ArgSpec<VoidPtr>, ArgSpec<SizeTType>, ArgSpec<IntType>]
- >,
- FunctionSpec<
- "shm_open",
- RetValSpec<IntType>,
- [ArgSpec<ConstCharPtr>, ArgSpec<IntType>, ArgSpec<ModeTType>]
- >,
- FunctionSpec<
- "shm_unlink",
- RetValSpec<IntType>,
- [ArgSpec<ConstCharPtr>]
- >,
- ]
- >;
-
- HeaderSpec Signal = HeaderSpec<
- "signal.h",
- [], // Macros
- [
- SigInfoType,
- SigSetType,
- StackT,
- StructSigaction,
- UnionSigVal,
- PidT,
- ],
- [], // Enumerations
- [
- FunctionSpec<
- "kill",
- RetValSpec<IntType>,
- [ArgSpec<PidT>,
- ArgSpec<IntType>]
- >,
- FunctionSpec<
- "sigaction",
- RetValSpec<IntType>,
- [ArgSpec<IntType>,
- ArgSpec<ConstRestrictedStructSigactionPtr>,
- ArgSpec<RestrictedStructSigactionPtr>]
- >,
- FunctionSpec<
- "sigaltstack",
- RetValSpec<IntType>,
- [ArgSpec<ConstRestrictedStackTPtr>, ArgSpec<RestrictedStackTPtr>]
- >,
- FunctionSpec<
- "sigdelset",
- RetValSpec<IntType>,
- [ArgSpec<SigSetPtrType>,
- ArgSpec<IntType>]
- >,
- FunctionSpec<
- "sigprocmask",
- RetValSpec<IntType>,
- [ArgSpec<IntType>, ArgSpec<ConstRestrictedSigSetType>, ArgSpec<RestrictedSigSetType>]
- >,
- FunctionSpec<
- "sigemptyset",
- RetValSpec<IntType>,
- [ArgSpec<SigSetPtrType>]
- >,
- FunctionSpec<
- "sigaddset",
- RetValSpec<IntType>,
- [ArgSpec<SigSetPtrType>,
- ArgSpec<IntType>]
- >,
- FunctionSpec<
- "sigfillset",
- RetValSpec<IntType>,
- [ArgSpec<SigSetPtrType>]
- >,
- ]
- >;
-
- HeaderSpec UniStd = HeaderSpec<
- "unistd.h",
- [], // Macros
- [
- ExecArgvT,
- ExecEnvpT,
- OffTType,
- SSizeTType,
- SizeTType,
- PidT,
- UidT,
- GetoptArgvT,
- ],
- [], // Enumerations
- [
- FunctionSpec<
- "_exit",
- RetValSpec<NoReturn>,
- [ArgSpec<IntType>]
- >,
- FunctionSpec<
- "access",
- RetValSpec<IntType>,
- [ArgSpec<ConstCharPtr>, ArgSpec<IntType>]
- >,
- FunctionSpec<
- "chdir",
- RetValSpec<IntType>,
- [ArgSpec<ConstCharPtr>]
- >,
- FunctionSpec<
- "dup",
- RetValSpec<IntType>,
- [ArgSpec<IntType>]
- >,
- FunctionSpec<
- "dup2",
- RetValSpec<IntType>,
- [ArgSpec<IntType>, ArgSpec<IntType>]
- >,
- FunctionSpec<
- "dup3",
- RetValSpec<IntType>,
- [ArgSpec<IntType>, ArgSpec<IntType>, ArgSpec<IntType>]
- >,
- FunctionSpec<
- "fchdir",
- RetValSpec<IntType>,
- [ArgSpec<IntType>]
- >,
- FunctionSpec<
- "getcwd",
- RetValSpec<CharPtr>,
- [ArgSpec<CharPtr>, ArgSpec<SizeTType>]
- >,
- FunctionSpec<
- "close",
- RetValSpec<IntType>,
- [ArgSpec<IntType>]
- >,
- FunctionSpec<
- "execv",
- RetValSpec<IntType>,
- [ArgSpec<ConstCharPtr>, ArgSpec<ExecArgvT>]
- >,
- FunctionSpec<
- "execve",
- RetValSpec<IntType>,
- [ArgSpec<ConstCharPtr>, ArgSpec<ExecArgvT>, ArgSpec<ExecEnvpT>]
- >,
- FunctionSpec<
- "fork",
- RetValSpec<PidT>,
- [ArgSpec<VoidType>]
- >,
- FunctionSpec<
- "fsync",
- RetValSpec<IntType>,
- [ArgSpec<IntType>]
- >,
- FunctionSpec<
- "ftruncate",
- RetValSpec<IntType>,
- [ArgSpec<IntType>, ArgSpec<OffTType>]
- >,
- FunctionSpec<
- "geteuid",
- RetValSpec<UidT>,
- [ArgSpec<VoidType>]
- >,
- FunctionSpec<
- "getpid",
- RetValSpec<PidT>,
- [ArgSpec<VoidType>]
- >,
- FunctionSpec<
- "getppid",
- RetValSpec<PidT>,
- [ArgSpec<VoidType>]
- >,
- FunctionSpec<
- "gettid",
- RetValSpec<PidT>,
- [ArgSpec<VoidType>]
- >,
- FunctionSpec<
- "getuid",
- RetValSpec<UidT>,
- [ArgSpec<VoidType>]
- >,
- FunctionSpec<
- "isatty",
- RetValSpec<IntType>,
- [ArgSpec<IntType>]
- >,
- FunctionSpec<
- "link",
- RetValSpec<IntType>,
- [ArgSpec<ConstCharPtr>, ArgSpec<ConstCharPtr>]
- >,
- FunctionSpec<
- "linkat",
- RetValSpec<IntType>,
- [ArgSpec<IntType>, ArgSpec<ConstCharPtr>, ArgSpec<IntType>, ArgSpec<ConstCharPtr>, ArgSpec<IntType>]
- >,
- FunctionSpec<
- "lseek",
- RetValSpec<OffTType>,
- [ArgSpec<IntType>, ArgSpec<OffTType>, ArgSpec<IntType>]
- >,
- FunctionSpec<
- "pread",
- RetValSpec<SSizeTType>,
- [ArgSpec<IntType>, ArgSpec<VoidPtr>, ArgSpec<SizeTType>, ArgSpec<OffTType>]
- >,
- FunctionSpec<
- "pwrite",
- RetValSpec<SSizeTType>,
- [ArgSpec<IntType>, ArgSpec<ConstVoidPtr>, ArgSpec<SizeTType>, ArgSpec<OffTType>]
- >,
- FunctionSpec<
- "read",
- RetValSpec<SSizeTType>,
- [ArgSpec<IntType>, ArgSpec<VoidPtr>, ArgSpec<SizeTType>]
- >,
- FunctionSpec<
- "readlink",
- RetValSpec<SSizeTType>,
- [ArgSpec<ConstCharRestrictedPtr>, ArgSpec<CharRestrictedPtr>, ArgSpec<SizeTType>]
- >,
- FunctionSpec<
- "readlinkat",
- RetValSpec<SSizeTType>,
- [ArgSpec<ConstCharRestrictedPtr>, ArgSpec<CharRestrictedPtr>, ArgSpec<SizeTType>]
- >,
- FunctionSpec<
- "rmdir",
- RetValSpec<IntType>,
- [ArgSpec<ConstCharPtr>]
- >,
- FunctionSpec<
- "getpid",
- RetValSpec<IntType>,
- [ArgSpec<VoidType>]
- >,
- FunctionSpec<
- "getppid",
- RetValSpec<IntType>,
- [ArgSpec<VoidType>]
- >,
- FunctionSpec<
- "link",
- RetValSpec<IntType>,
- [ArgSpec<ConstCharPtr>, ArgSpec<ConstCharPtr>]
- >,
- FunctionSpec<
- "linkat",
- RetValSpec<IntType>,
- [ArgSpec<IntType>, ArgSpec<ConstCharPtr>, ArgSpec<IntType>, ArgSpec<ConstCharPtr>, ArgSpec<IntType>]
- >,
- FunctionSpec<
- "lseek",
- RetValSpec<OffTType>,
- [ArgSpec<IntType>, ArgSpec<OffTType>, ArgSpec<IntType>]
- >,
- FunctionSpec<
- "pipe",
- RetValSpec<IntType>,
- [ArgSpec<IntPtr>] //TODO: make this int[2]
- >,
- FunctionSpec<
- "pread",
- RetValSpec<SSizeTType>,
- [ArgSpec<IntType>, ArgSpec<VoidPtr>, ArgSpec<SizeTType>, ArgSpec<OffTType>]
- >,
- FunctionSpec<
- "pwrite",
- RetValSpec<SSizeTType>,
- [ArgSpec<IntType>, ArgSpec<ConstVoidPtr>, ArgSpec<SizeTType>, ArgSpec<OffTType>]
- >,
- FunctionSpec<
- "read",
- RetValSpec<SSizeTType>,
- [ArgSpec<IntType>, ArgSpec<VoidPtr>, ArgSpec<SizeTType>]
- >,
- FunctionSpec<
- "readlink",
- RetValSpec<SSizeTType>,
- [ArgSpec<ConstCharRestrictedPtr>, ArgSpec<CharRestrictedPtr>, ArgSpec<SizeTType>]
- >,
- FunctionSpec<
- "readlinkat",
- RetValSpec<SSizeTType>,
- [ArgSpec<ConstCharRestrictedPtr>, ArgSpec<CharRestrictedPtr>, ArgSpec<SizeTType>]
- >,
- FunctionSpec<
- "rmdir",
- RetValSpec<IntType>,
- [ArgSpec<ConstCharPtr>]
- >,
- FunctionSpec<
- "swab",
- RetValSpec<VoidType>,
- [ArgSpec<ConstVoidRestrictedPtr>, ArgSpec<VoidPtr>, ArgSpec<SSizeTType>]
- >,
- FunctionSpec<
- "symlink",
- RetValSpec<IntType>,
- [ArgSpec<ConstCharPtr>, ArgSpec<ConstCharPtr>]
- >,
- FunctionSpec<
- "symlinkat",
- RetValSpec<IntType>,
- [ArgSpec<IntType>, ArgSpec<ConstCharPtr>, ArgSpec<IntType>, ArgSpec<ConstCharPtr>]
- >,
- FunctionSpec<
- "sysconf",
- RetValSpec<IntType>,
- [ArgSpec<IntType>]
- >,
- FunctionSpec<
- "__llvm_libc_syscall",
- RetValSpec<LongType>,
- [ArgSpec<LongType>,ArgSpec<LongType>,ArgSpec<LongType>,ArgSpec<LongType>,ArgSpec<LongType>,ArgSpec<LongType>,ArgSpec<LongType>]
- >,
- FunctionSpec<
- "truncate",
- RetValSpec<IntType>,
- [ArgSpec<ConstCharPtr>, ArgSpec<OffTType>]
- >,
- FunctionSpec<
- "unlink",
- RetValSpec<IntType>,
- [ArgSpec<ConstCharPtr>]
- >,
- FunctionSpec<
- "unlinkat",
- RetValSpec<IntType>,
- [ArgSpec<IntType>, ArgSpec<ConstCharPtr>, ArgSpec<IntType>]
- >,
- FunctionSpec<
- "write",
- RetValSpec<SSizeTType>,
- [ArgSpec<IntType>, ArgSpec<ConstVoidPtr>, ArgSpec<SizeTType>]
- >,
- FunctionSpec<
- "getopt",
- RetValSpec<IntType>,
- [ArgSpec<IntType>, ArgSpec<GetoptArgvT>, ArgSpec<ConstCharPtr>]
- >,
- ],
- [
- ObjectSpec<"environ", "char **">,
- ObjectSpec<
- "optarg",
- "char *"
- >,
- ObjectSpec<
- "optind",
- "int"
- >,
- ObjectSpec<
- "opterr",
- "int"
- >,
- ObjectSpec<
- "optopt",
- "int"
- >,
- ]
- >;
-
- HeaderSpec StdLib = HeaderSpec<
- "stdlib.h",
- [], // Macros
- [], // Types
- [], // Enumerations
- [
- FunctionSpec<
- "getenv",
- RetValSpec<CharPtr>,
- [ArgSpec<ConstCharPtr>]
- >,
- ]
- >;
-
- HeaderSpec Sched = HeaderSpec<
- "sched.h",
- [], // Macros
- [PidT, TimeTType, StructTimeSpec, StructSchedParam], // Types
- [], // Enumerations
- [
- FunctionSpec<
- "sched_yield",
- RetValSpec<IntType>,
- [ArgSpec<VoidType>]
- >,
- FunctionSpec<
- "sched_setparam",
- RetValSpec<IntType>,
- [ArgSpec<PidT>, ArgSpec<ConstStructSchedParamPtr>]
- >,
-
- FunctionSpec<
- "sched_getparam",
- RetValSpec<IntType>,
- [ArgSpec<PidT>, ArgSpec<StructSchedParamPtr>]
- >,
-
- FunctionSpec<
- "sched_setscheduler",
- RetValSpec<IntType>,
- [ArgSpec<PidT>]
- >,
-
- FunctionSpec<
- "sched_getscheduler",
- RetValSpec<IntType>,
- [ArgSpec<PidT>, ArgSpec<IntType>, ArgSpec<ConstStructSchedParamPtr>]
- >,
-
- FunctionSpec<
- "sched_get_priority_min",
- RetValSpec<IntType>,
- [ArgSpec<IntType>]
- >,
-
- FunctionSpec<
- "sched_get_priority_max",
- RetValSpec<IntType>,
- [ArgSpec<IntType>]
- >,
-
- FunctionSpec<
- "sched_rr_get_interval",
- RetValSpec<IntType>,
- [ArgSpec<PidT>, ArgSpec<StructTimeSpecPtr>]
- >,
- ]
- >;
-
- HeaderSpec String = HeaderSpec<
- "string.h",
- [
- Macro<"NULL">,
- ],
- [
- SizeTType,
- ],
- [], // Enumerations
- [
- FunctionSpec<
- "memccpy",
- RetValSpec<VoidPtr>,
- [ArgSpec<VoidRestrictedPtr>,
- ArgSpec<ConstVoidRestrictedPtr>,
- ArgSpec<IntType>,
- ArgSpec<SizeTType>]
- >,
- FunctionSpec<
- "mempcpy",
- RetValSpec<VoidPtr>,
- [ArgSpec<VoidRestrictedPtr>,
- ArgSpec<ConstVoidRestrictedPtr>,
- ArgSpec<SizeTType>]
- >,
- FunctionSpec<
- "stpcpy",
- RetValSpec<CharPtr>,
- [ArgSpec<RestrictedCharPtr>,
- ArgSpec<ConstRestrictedCharPtr>]
- >,
- FunctionSpec<
- "stpncpy",
- RetValSpec<CharPtr>,
- [ArgSpec<RestrictedCharPtr>,
- ArgSpec<ConstRestrictedCharPtr>,
- ArgSpec<SizeTType>]
- >,
- FunctionSpec<
- "strnlen",
- RetValSpec<SizeTType>,
- [ArgSpec<ConstCharPtr>, ArgSpec<SizeTType>]
- >,
- FunctionSpec<
- "strtok_r",
- RetValSpec<CharPtr>,
- [ArgSpec<RestrictedCharPtr>,
- ArgSpec<ConstRestrictedCharPtr>,
- ArgSpec<CharRestrictedDoublePtr>]
- >,
- FunctionSpec<
- "strsignal",
- RetValSpec<CharPtr>,
- [ArgSpec<IntType>]
- >,
- ]
- >;
-
- HeaderSpec CType = HeaderSpec<
- "ctype.h",
- [], // Macros
- [], // Types
- [], // Enumerations
- [
- FunctionSpec<
- "isascii",
- RetValSpec<IntType>,
- [ArgSpec<IntType>]
- >,
- ]
- >;
-
- NamedType RLimTType = NamedType<"rlim_t">;
- NamedType StructRLimitType = NamedType<"struct rlimit">;
- PtrType StructRLimitPtr = PtrType<StructRLimitType>;
- ConstType ConstStructRLimitPtr = ConstType<StructRLimitType>;
- HeaderSpec SysResource = HeaderSpec<
- "sys/resource.h",
- [], // Macros
- [RLimTType, StructRLimitType], // Types
- [], // Enumerations
- [
- FunctionSpec<
- "getrlimit",
- RetValSpec<IntType>,
- [ArgSpec<StructRLimitPtr>]
- >,
- FunctionSpec<
- "setrlimit",
- RetValSpec<IntType>,
- [ArgSpec<ConstStructRLimitPtr>]
- >,
- ]
- >;
-
- HeaderSpec SysStat = HeaderSpec<
- "sys/stat.h",
- [], // Macros
- [
- ModeTType,
- DevT,
- InoT,
- UidT,
- GidT,
- StructTimeSpec,
- StructTimevalType,
- BlkSizeT,
- BlkCntT,
- OffTType,
- NLinkT,
- StatType,
- ], // Types
- [], // Enumerations
- [
- FunctionSpec<
- "chmod",
- RetValSpec<IntType>,
- [ArgSpec<ConstCharPtr>, ArgSpec<ModeTType>]
- >,
- FunctionSpec<
- "fchmod",
- RetValSpec<IntType>,
- [ArgSpec<IntType>, ArgSpec<ModeTType>]
- >,
- FunctionSpec<
- "fchmodat",
- RetValSpec<IntType>,
- [ArgSpec<IntType>, ArgSpec<ConstCharPtr>, ArgSpec<ModeTType>, ArgSpec<IntType>]
- >,
- FunctionSpec<
- "fstat",
- RetValSpec<IntType>,
- [ArgSpec<IntType>, ArgSpec<StatTypePtr>]
- >,
- FunctionSpec<
- "lstat",
- RetValSpec<IntType>,
- [ArgSpec<ConstRestrictedCharPtr>, ArgSpec<RestrictedStatTypePtr>]
- >,
- FunctionSpec<
- "mkdir",
- RetValSpec<IntType>,
- [ArgSpec<ConstCharPtr>, ArgSpec<ModeTType>]
- >,
- FunctionSpec<
- "mkdirat",
- RetValSpec<IntType>,
- [ArgSpec<IntType>, ArgSpec<ConstCharPtr>, ArgSpec<ModeTType>]
- >,
- FunctionSpec<
- "stat",
- RetValSpec<IntType>,
- [ArgSpec<ConstRestrictedCharPtr>, ArgSpec<RestrictedStatTypePtr>]
- >,
- ]
- >;
-
- HeaderSpec SysStatvfs = HeaderSpec<
- "sys/statvfs.h",
- [], // Macros
- [StructStatvfs], // Types
- [], // Enumerations
- [
- FunctionSpec<
- "statvfs",
- RetValSpec<IntType>,
- [
- ArgSpec<ConstRestrictedCharPtr>,
- ArgSpec<RestrictedStructStatvfsPtr>
- ]
- >,
- FunctionSpec<
- "fstatvfs",
- RetValSpec<IntType>,
- [
- ArgSpec<IntType>,
- ArgSpec<StructStatvfsPtr>
- ]
- >,
- ] // Functions
- >;
-
- NamedType StructUtsName = NamedType<"struct utsname">;
- PtrType StructUtsNamePtr = PtrType<StructUtsName>;
- HeaderSpec SysUtsName = HeaderSpec<
- "sys/utsname.h",
- [], // Macros
- [StructUtsName], // Types
- [], // Enumerations
- [
- FunctionSpec<
- "uname",
- RetValSpec<IntType>,
- [ArgSpec<StructUtsNamePtr>]
- >,
- ]
- >;
-
- HeaderSpec ArpaInet = HeaderSpec<
- "arpa/inet.h",
- [], // Macros
- [], // Types
- [], // Enumerations
- [
- FunctionSpec<
- "htonl",
- RetValSpec<UInt32Type>,
- [ArgSpec<UInt32Type>]
- >,
- FunctionSpec<
- "htons",
- RetValSpec<UInt16Type>,
- [ArgSpec<UInt16Type>]
- >,
- FunctionSpec<
- "ntohl",
- RetValSpec<UInt32Type>,
- [ArgSpec<UInt32Type>]
- >,
- FunctionSpec<
- "ntohs",
- RetValSpec<UInt16Type>,
- [ArgSpec<UInt16Type>]
- >,
- ]
- >;
-
- HeaderSpec PThread = HeaderSpec<
- "pthread.h",
- [], // Macros
- [
- AtForkCallbackT,
- ClockIdT,
- PThreadAttrTType,
- PThreadCondAttrTType,
- PThreadKeyT,
- PThreadMutexAttrTType,
- PThreadMutexTType,
- PThreadOnceCallback,
- PThreadOnceT,
- PThreadRWLockAttrTType,
- PThreadRWLockTType,
- PThreadSpinLockTType,
- PThreadStartT,
- PThreadTSSDtorT,
- PThreadTType,
- ], // Types
- [], // Enumerations
- [
- FunctionSpec<
- "pthread_atfork",
- RetValSpec<IntType>,
- [ArgSpec<AtForkCallbackT>, ArgSpec<AtForkCallbackT>, ArgSpec<AtForkCallbackT>]
- >,
- FunctionSpec<
- "pthread_attr_init",
- RetValSpec<IntType>,
- [ArgSpec<PThreadAttrTPtr>]
- >,
- FunctionSpec<
- "pthread_attr_destroy",
- RetValSpec<IntType>,
- [ArgSpec<PThreadAttrTPtr>]
- >,
- FunctionSpec<
- "pthread_attr_getdetachstate",
- RetValSpec<IntType>,
- [ArgSpec<ConstPThreadAttrTPtr>, ArgSpec<IntPtr>]
- >,
- FunctionSpec<
- "pthread_attr_setdetachstate",
- RetValSpec<IntType>,
- [ArgSpec<PThreadAttrTPtr>, ArgSpec<IntType>]
- >,
- FunctionSpec<
- "pthread_attr_getguardsize",
- RetValSpec<IntType>,
- [ArgSpec<ConstRestrictedPThreadAttrTPtr>, ArgSpec<RestrictedSizeTPtr>]
- >,
- FunctionSpec<
- "pthread_attr_setguardsize",
- RetValSpec<IntType>,
- [ArgSpec<PThreadAttrTPtr>, ArgSpec<SizeTType>]
- >,
- FunctionSpec<
- "pthread_attr_getstacksize",
- RetValSpec<IntType>,
- [ArgSpec<ConstRestrictedPThreadAttrTPtr>, ArgSpec<RestrictedSizeTPtr>]
- >,
- FunctionSpec<
- "pthread_attr_setstacksize",
- RetValSpec<IntType>,
- [ArgSpec<PThreadAttrTPtr>, ArgSpec<SizeTType>]
- >,
- FunctionSpec<
- "pthread_attr_getstack",
- RetValSpec<IntType>,
- [ArgSpec<ConstRestrictedPThreadAttrTPtr>, ArgSpec<RestrictedVoidPtrPtr>, ArgSpec<RestrictedSizeTPtr>]
- >,
- FunctionSpec<
- "pthread_attr_setstack",
- RetValSpec<IntType>,
- [ArgSpec<PThreadAttrTPtr>, ArgSpec<VoidPtr>, ArgSpec<SizeTType>]
- >,
- FunctionSpec<
- "pthread_condattr_destroy",
- RetValSpec<IntType>,
- [ArgSpec<PThreadCondAttrTPtr>]
- >,
- FunctionSpec<
- "pthread_condattr_getclock",
- RetValSpec<IntType>,
- [ArgSpec<ConstRestrictedPThreadCondAttrTPtr>, ArgSpec<RestrictedClockIdTPtr>]
- >,
- FunctionSpec<
- "pthread_condattr_getpshared",
- RetValSpec<IntType>,
- [ArgSpec<ConstRestrictedPThreadCondAttrTPtr>, ArgSpec<RestrictedIntPtr>]
- >,
- FunctionSpec<
- "pthread_condattr_init",
- RetValSpec<IntType>,
- [ArgSpec<PThreadCondAttrTPtr>]
- >,
- FunctionSpec<
- "pthread_condattr_setclock",
- RetValSpec<IntType>,
- [ArgSpec<PThreadCondAttrTPtr>, ArgSpec<ClockIdT>]
- >,
- FunctionSpec<
- "pthread_condattr_setpshared",
- RetValSpec<IntType>,
- [ArgSpec<PThreadCondAttrTPtr>, ArgSpec<IntType>]
- >,
- FunctionSpec<
- "pthread_create",
- RetValSpec<IntType>,
- [ArgSpec<RestrictedPThreadTPtr>, ArgSpec<ConstRestrictedPThreadAttrTPtr>, ArgSpec<PThreadStartT>, ArgSpec<VoidPtr>]
- >,
- FunctionSpec<
- "pthread_join",
- RetValSpec<IntType>,
- [ArgSpec<PThreadTType>, ArgSpec<VoidPtrPtr>]
- >,
- FunctionSpec<
- "pthread_detach",
- RetValSpec<IntType>,
- [ArgSpec<PThreadTType>]
- >,
- FunctionSpec<
- "pthread_exit",
- RetValSpec<NoReturn>,
- [ArgSpec<VoidPtr>]
- >,
- FunctionSpec<
- "pthread_self",
- RetValSpec<PThreadTType>,
- [ArgSpec<VoidType>]
- >,
- FunctionSpec<
- "pthread_equal",
- RetValSpec<IntType>,
- [ArgSpec<PThreadTType>, ArgSpec<PThreadTType>]
- >,
- FunctionSpec<
- "pthread_mutexattr_init",
- RetValSpec<IntType>,
- [ArgSpec<PThreadMutexAttrTPtr>]
- >,
- FunctionSpec<
- "pthread_mutexattr_destroy",
- RetValSpec<IntType>,
- [ArgSpec<PThreadMutexAttrTPtr>]
- >,
- FunctionSpec<
- "pthread_mutexattr_gettype",
- RetValSpec<IntType>,
- [ArgSpec<ConstRestrictedPThreadMutexAttrTPtr>, ArgSpec<RestrictedIntPtr>]
- >,
- FunctionSpec<
- "pthread_mutexattr_settype",
- RetValSpec<IntType>,
- [ArgSpec<RestrictedPThreadMutexAttrTPtr>, ArgSpec<IntType>]
- >,
- FunctionSpec<
- "pthread_mutexattr_getrobust",
- RetValSpec<IntType>,
- [ArgSpec<ConstRestrictedPThreadMutexAttrTPtr>, ArgSpec<RestrictedIntPtr>]
- >,
- FunctionSpec<
- "pthread_mutexattr_setrobust",
- RetValSpec<IntType>,
- [ArgSpec<RestrictedPThreadMutexAttrTPtr>, ArgSpec<IntType>]
- >,
- FunctionSpec<
- "pthread_mutexattr_getpshared",
- RetValSpec<IntType>,
- [ArgSpec<ConstRestrictedPThreadMutexAttrTPtr>, ArgSpec<RestrictedIntPtr>]
- >,
- FunctionSpec<
- "pthread_mutexattr_setpshared",
- RetValSpec<IntType>,
- [ArgSpec<RestrictedPThreadMutexAttrTPtr>, ArgSpec<IntType>]
- >,
- FunctionSpec<
- "pthread_mutexattr_getprotocol",
- RetValSpec<IntType>,
- [ArgSpec<ConstRestrictedPThreadMutexAttrTPtr>, ArgSpec<RestrictedIntPtr>]
- >,
- FunctionSpec<
- "pthread_mutexattr_setprotocol",
- RetValSpec<IntType>,
- [ArgSpec<RestrictedPThreadMutexAttrTPtr>, ArgSpec<IntType>]
- >,
- FunctionSpec<
- "pthread_mutexattr_getprioceiling",
- RetValSpec<IntType>,
- [ArgSpec<ConstRestrictedPThreadMutexAttrTPtr>, ArgSpec<RestrictedIntPtr>]
- >,
- FunctionSpec<
- "pthread_mutexattr_setprioceiling",
- RetValSpec<IntType>,
- [ArgSpec<RestrictedPThreadMutexAttrTPtr>, ArgSpec<IntType>]
- >,
- FunctionSpec<
- "pthread_mutex_init",
- RetValSpec<IntType>,
- [ArgSpec<RestrictedPThreadMutexTPtr>, ArgSpec<ConstRestrictedPThreadMutexAttrTPtr>]
- >,
- FunctionSpec<
- "pthread_mutex_destroy",
- RetValSpec<IntType>,
- [ArgSpec<PThreadMutexTPtr>]
- >,
- FunctionSpec<
- "pthread_mutex_lock",
- RetValSpec<IntType>,
- [ArgSpec<PThreadMutexTPtr>]
- >,
- FunctionSpec<
- "pthread_mutex_unlock",
- RetValSpec<IntType>,
- [ArgSpec<PThreadMutexTPtr>]
- >,
- FunctionSpec<
- "pthread_key_create",
- RetValSpec<IntType>,
- [ArgSpec<PThreadKeyTPtr>, ArgSpec<PThreadTSSDtorT>]
- >,
- FunctionSpec<
- "pthread_key_delete",
- RetValSpec<IntType>,
- [ArgSpec<PThreadKeyT>]
- >,
- FunctionSpec<
- "pthread_getspecific",
- RetValSpec<VoidPtr>,
- [ArgSpec<PThreadKeyT>]
- >,
- FunctionSpec<
- "pthread_setspecific",
- RetValSpec<VoidPtr>,
- [ArgSpec<PThreadKeyT>, ArgSpec<ConstVoidPtr>]
- >,
- FunctionSpec<
- "pthread_once",
- RetValSpec<IntType>,
- [ArgSpec<PThreadOnceTPtr>, ArgSpec<PThreadOnceCallback>]
- >,
- FunctionSpec<
- "pthread_rwlockattr_destroy",
- RetValSpec<IntType>,
- [ArgSpec<PThreadRWLockAttrTPtr>]
- >,
- FunctionSpec<
- "pthread_rwlockattr_getkind_np",
- RetValSpec<IntType>,
- [ArgSpec<PThreadRWLockAttrTPtr>, ArgSpec<IntPtr>]
- >,
- FunctionSpec<
- "pthread_rwlockattr_getpshared",
- RetValSpec<IntType>,
- [ArgSpec<ConstPThreadRWLockAttrTPtr>, ArgSpec<IntPtr>]
- >,
- FunctionSpec<
- "pthread_rwlockattr_init",
- RetValSpec<IntType>,
- [ArgSpec<PThreadRWLockAttrTPtr>]
- >,
- FunctionSpec<
- "pthread_rwlockattr_setkind_np",
- RetValSpec<IntType>,
- [ArgSpec<PThreadRWLockAttrTPtr>, ArgSpec<IntType>]
- >,
- FunctionSpec<
- "pthread_rwlockattr_setpshared",
- RetValSpec<IntType>,
- [ArgSpec<PThreadRWLockAttrTPtr>, ArgSpec<IntType>]
- >,
- FunctionSpec<
- "pthread_rwlock_init",
- RetValSpec<IntType>,
- [ArgSpec<PThreadRWLockTPtr>, ArgSpec<ConstRestrictedPThreadRWLockAttrTPtr>]
- >,
- FunctionSpec<
- "pthread_rwlock_tryrdlock",
- RetValSpec<IntType>,
- [ArgSpec<PThreadRWLockTPtr>]
- >,
- FunctionSpec<
- "pthread_rwlock_trywrlock",
- RetValSpec<IntType>,
- [ArgSpec<PThreadRWLockTPtr>]
- >,
- FunctionSpec<
- "pthread_rwlock_timedrdlock",
- RetValSpec<IntType>,
- [ArgSpec<RestrictedPThreadRWLockTPtr>, ArgSpec<ConstRestrictStructTimeSpecPtr>]
- >,
- FunctionSpec<
- "pthread_rwlock_timedwrlock",
- RetValSpec<IntType>,
- [ArgSpec<RestrictedPThreadRWLockTPtr>, ArgSpec<ConstRestrictStructTimeSpecPtr>]
- >,
- FunctionSpec<
- "pthread_rwlock_clockrdlock",
- RetValSpec<IntType>,
- [ArgSpec<RestrictedPThreadRWLockTPtr>, ArgSpec<ClockIdT>, ArgSpec<ConstRestrictStructTimeSpecPtr>]
- >,
- FunctionSpec<
- "pthread_rwlock_clockwrlock",
- RetValSpec<IntType>,
- [ArgSpec<RestrictedPThreadRWLockTPtr>, ArgSpec<ClockIdT>, ArgSpec<ConstRestrictStructTimeSpecPtr>]
- >,
- FunctionSpec<
- "pthread_rwlock_rdlock",
- RetValSpec<IntType>,
- [ArgSpec<PThreadRWLockTPtr>]
- >,
- FunctionSpec<
- "pthread_rwlock_wrlock",
- RetValSpec<IntType>,
- [ArgSpec<PThreadRWLockTPtr>]
- >,
- FunctionSpec<
- "pthread_rwlock_unlock",
- RetValSpec<IntType>,
- [ArgSpec<PThreadRWLockTPtr>]
- >,
- FunctionSpec<
- "pthread_rwlock_destroy",
- RetValSpec<IntType>,
- [ArgSpec<PThreadRWLockTPtr>]
- >,
- FunctionSpec<
- "pthread_spin_init",
- RetValSpec<IntType>,
- [ArgSpec<PThreadSpinLockTPtr>, ArgSpec<IntType>]
- >,
- FunctionSpec<
- "pthread_spin_destroy",
- RetValSpec<IntType>,
- [ArgSpec<PThreadSpinLockTPtr>]
- >,
- FunctionSpec<
- "pthread_spin_lock",
- RetValSpec<IntType>,
- [ArgSpec<PThreadSpinLockTPtr>]
- >,
- FunctionSpec<
- "pthread_spin_trylock",
- RetValSpec<IntType>,
- [ArgSpec<PThreadSpinLockTPtr>]
- >,
- FunctionSpec<
- "pthread_spin_unlock",
- RetValSpec<IntType>,
- [ArgSpec<PThreadSpinLockTPtr>]
- >
- ]
- >;
-
- HeaderSpec StdIO = HeaderSpec<
- "stdio.h",
- [], // Macros
- [OffTType], // Types
- [], // Enumerations
- [
- FunctionSpec<
- "flockfile",
- RetValSpec<VoidType>,
- [ArgSpec<FILEPtr>]
- >,
- FunctionSpec<
- "funlockfile",
- RetValSpec<VoidType>,
- [ArgSpec<FILEPtr>]
- >,
- FunctionSpec<
- "getc_unlocked",
- RetValSpec<IntType>,
- [ArgSpec<FILEPtr>]
- >,
- FunctionSpec<
- "getchar_unlocked",
- RetValSpec<IntType>,
- [ArgSpec<VoidType>]
- >,
- FunctionSpec<
- "fileno",
- RetValSpec<IntType>,
- [ArgSpec<FILEPtr>]
- >,
- FunctionSpec<
- "fdopen",
- RetValSpec<FILEPtr>,
- [ArgSpec<IntType>, ArgSpec<ConstCharPtr>]
- >,
- ]
- >;
-
- HeaderSpec Dirent = HeaderSpec<
- "dirent.h",
- [], // Macros
- [InoT, StructDirent, DIR], // Types
- [], // Enumerations
- [
- FunctionSpec<
- "alphasort",
- RetValSpec<IntType>,
- [ArgSpec<ConstStructDirentPtrPtr>, ArgSpec<ConstStructDirentPtrPtr>]
- >,
- FunctionSpec<
- "closedir",
- RetValSpec<IntType>,
- [ArgSpec<DIRPtr>]
- >,
- FunctionSpec<
- "dirfd",
- RetValSpec<IntType>,
- [ArgSpec<DIRPtr>]
- >,
- FunctionSpec<
- "fdopendir",
- RetValSpec<DIRPtr>,
- [ArgSpec<IntType>]
- >,
- FunctionSpec<
- "opendir",
- RetValSpec<DIRPtr>,
- [ArgSpec<ConstCharPtr>]
- >,
- FunctionSpec<
- "readdir",
- RetValSpec<StructDirentPtr>,
- [ArgSpec<DIRPtr>]
- >,
- ]
- >;
-
- HeaderSpec Time = HeaderSpec<
- "time.h",
- [], // Macros
- [ClockIdT, StructTimeSpec, StructTimevalType], // Types
- [], // Enumerations
- [
- FunctionSpec<
- "clock_gettime",
- RetValSpec<IntType>,
- [ArgSpec<ClockIdT>, ArgSpec<StructTimeSpecPtr>]
- >,
- FunctionSpec<
- "gettimeofday",
- RetValSpec<IntType>,
- [ArgSpec<StructTimevalPtr>, ArgSpec<VoidPtr>]
- >,
- FunctionSpec<
- "nanosleep",
- RetValSpec<IntType>,
- [ArgSpec<ConstStructTimeSpecPtr>, ArgSpec<StructTimeSpecPtr>]
- >,
- ]
- >;
-
- HeaderSpec SysWait = HeaderSpec<
- "sys/wait.h",
- [], // Macros
- [PidT, StructRUsage, SigInfoType],
- [], // Enumerations
- [
- FunctionSpec<
- "wait",
- RetValSpec<PidT>,
- [ArgSpec<IntPtr>]
- >,
- FunctionSpec<
- "waitpid",
- RetValSpec<PidT>,
- [ArgSpec<PidT>, ArgSpec<IntPtr>, ArgSpec<IntType>]
- >
- ]
- >;
-
- HeaderSpec SysIOctl = HeaderSpec<
- "sys/ioctl.h",
- [
- Macro<"TIOCGETD">,
- ], // Macros
- [], // Types
- [], // Enumerations
- [] // Functions
- >;
-
- HeaderSpec Spawn = HeaderSpec<
- "spawn.h",
- [], // Macros
- [ModeTType, PosixSpawnAttrT, PidT, PosixSpawnFileActionsT],
- [], // Enumerations
- [
- FunctionSpec<
- "posix_spawn_file_actions_addclose",
- RetValSpec<IntType>,
- [ArgSpec<PosixSpawnFileActionsTPtr>, ArgSpec<IntType>]
- >,
- FunctionSpec<
- "posix_spawn_file_actions_adddup2",
- RetValSpec<IntType>,
- [ArgSpec<PosixSpawnFileActionsTPtr>, ArgSpec<IntType>, ArgSpec<IntType>]
- >,
- FunctionSpec<
- "posix_spawn_file_actions_addopen",
- RetValSpec<IntType>,
- [ArgSpec<PosixSpawnFileActionsTRestrictedPtr>, ArgSpec<IntType>,
- ArgSpec<ConstCharRestrictedPtr>, ArgSpec<IntType>, ArgSpec<ModeTType>]
- >,
- FunctionSpec<
- "posix_spawn_file_actions_destroy",
- RetValSpec<IntType>,
- [ArgSpec<PosixSpawnFileActionsTPtr>]
- >,
- FunctionSpec<
- "posix_spawn_file_actions_init",
- RetValSpec<IntType>,
- [ArgSpec<PosixSpawnFileActionsTPtr>]
- >,
- FunctionSpec<
- "posix_spawn",
- RetValSpec<IntType>,
- [ArgSpec<RestrictedPidTPtr>, ArgSpec<ConstCharRestrictedPtr>,
- ArgSpec<PosixSpawnFileActionsTPtr>, ArgSpec<RestrictedPosixSpawnAttrTPtrType>,
- ArgSpec<ConstCharRestrictedPtrPtr>, ArgSpec<ConstCharRestrictedPtrPtr>]
- >,
- ]
- >;
-
- HeaderSpec Search = HeaderSpec<
- "search.h",
- [], // Macros
- [
- ActionType,
- EntryType,
- LSearchCompareT,
- ], // Types
- [], // Enumerations
- [
- FunctionSpec<
- "hcreate",
- RetValSpec<IntType>,
- [
- ArgSpec<SizeTType>
- ]
- >,
- FunctionSpec<
- "hdestroy",
- RetValSpec<VoidType>,
- [] // Args
- >,
- FunctionSpec<
- "hsearch",
- RetValSpec<EntryTypePtr>,
- [
- ArgSpec<EntryType>,
- ArgSpec<ActionType>
- ]
- >,
- FunctionSpec<
- "insque",
- RetValSpec<VoidType>,
- [
- ArgSpec<VoidPtr>,
- ArgSpec<VoidPtr>
- ]
- >,
- FunctionSpec<
- "remque",
- RetValSpec<VoidType>,
- [
- ArgSpec<VoidPtr>
- ]
- >,
- FunctionSpec<
- "lfind",
- RetValSpec<VoidPtr>,
- [
- ArgSpec<ConstVoidPtr>,
- ArgSpec<ConstVoidPtr>,
- ArgSpec<SizeTPtr>,
- ArgSpec<SizeTType>,
- ArgSpec<LSearchCompareT>
- ]
- >
- ]
- >;
-
- HeaderSpec Termios = HeaderSpec<
- "termios.h",
- [
- Macro<"NCCS">,
- ],
- [CcT, PidT, SpeedT, StructTermios, TcFlagT], // Types
- [], // Enumerations
- [
- FunctionSpec<
- "cfgetispeed",
- RetValSpec<SpeedT>,
- [ArgSpec<ConstStructTermiosPtr>]
- >,
- FunctionSpec<
- "cfgetospeed",
- RetValSpec<SpeedT>,
- [ArgSpec<ConstStructTermiosPtr>]
- >,
- FunctionSpec<
- "cfsetispeed",
- RetValSpec<SpeedT>,
- [ArgSpec<StructTermiosPtr>, ArgSpec<SpeedT>]
- >,
- FunctionSpec<
- "cfsetospeed",
- RetValSpec<SpeedT>,
- [ArgSpec<StructTermiosPtr>, ArgSpec<SpeedT>]
- >,
- FunctionSpec<
- "tcdrain",
- RetValSpec<IntType>,
- [ArgSpec<IntType>]
- >,
- FunctionSpec<
- "tcflow",
- RetValSpec<IntType>,
- [ArgSpec<IntType>, ArgSpec<IntType>]
- >,
- FunctionSpec<
- "tcflush",
- RetValSpec<IntType>,
- [ArgSpec<IntType>, ArgSpec<IntType>]
- >,
- FunctionSpec<
- "tcgetattr",
- RetValSpec<IntType>,
- [ArgSpec<IntType>, ArgSpec<StructTermiosPtr>]
- >,
- FunctionSpec<
- "tcgetsid",
- RetValSpec<PidT>,
- [ArgSpec<IntType>]
- >,
- FunctionSpec<
- "tcsendbreak",
- RetValSpec<IntType>,
- [ArgSpec<IntType>, ArgSpec<IntType>]
- >,
- FunctionSpec<
- "tcsetattr",
- RetValSpec<IntType>,
- [ArgSpec<IntType>, ArgSpec<IntType>, ArgSpec<StructTermiosPtr>]
- >,
- ]
- >;
-
- HeaderSpec SysSelect = HeaderSpec<
- "sys/select.h",
- [], // Macros
- [FdSet, SigSetType, StructTimevalType, StructTimeSpec, SuSecondsT, TimeTType],
- [], // Enumerations
- [
- FunctionSpec<
- "select",
- RetValSpec<IntType>,
- [
- ArgSpec<IntType>, ArgSpec<RestrictedFdSetPtr>, ArgSpec<RestrictedFdSetPtr>,
- ArgSpec<RestrictedFdSetPtr>, ArgSpec<RestrictedStructTimevalPtr>
- ]
- >
- ]
- >;
-
- HeaderSpec SysSocket = HeaderSpec<
- "sys/socket.h",
- [
- Macro<"AF_UNSPEC">,
- Macro<"AF_UNIX">,
- Macro<"AF_LOCAL">,
- Macro<"AF_INET">,
- Macro<"AF_INET6">,
- Macro<"SOCK_STREAM">,
- Macro<"SOCK_DGRAM">,
- Macro<"SOCK_RAW">,
- Macro<"SOCK_RDM">,
- Macro<"SOCK_SEQPACKET">,
- Macro<"SOCK_PACKET">,
- ], // Macros
- [
- SizeTType,
- SSizeTType,
- SAFamilyType,
- StructSockAddr,
- StructSockAddrUn,
- SocklenType,
- StructIovec,
- StructMsghdr,
- ], // Types
- [], // Enumerations
- [
- FunctionSpec<
- "socket",
- RetValSpec<IntType>,
- [ArgSpec<IntType>, ArgSpec<IntType>, ArgSpec<IntType>]
- >,
- FunctionSpec<
- "socketpair",
- RetValSpec<IntType>,
- [ArgSpec<IntType>, ArgSpec<IntType>, ArgSpec<IntType>, ArgSpec<IntPtr>]
- >,
- FunctionSpec<
- "bind",
- RetValSpec<IntType>,
- [ArgSpec<IntType>, ArgSpec<ConstStructSockAddrPtr>, ArgSpec<SocklenType>]
- >,
- FunctionSpec<
- "send",
- RetValSpec<SSizeTType>,
- [ArgSpec<IntType>, ArgSpec<ConstVoidPtr>, ArgSpec<SizeTType>, ArgSpec<IntType>]
- >,
- FunctionSpec<
- "sendto",
- RetValSpec<SSizeTType>,
- [
- ArgSpec<IntType>, ArgSpec<ConstVoidPtr>, ArgSpec<SizeTType>,
- ArgSpec<IntType>, ArgSpec<ConstStructSockAddrPtr>,
- ArgSpec<SocklenType>
- ]
- >,
- FunctionSpec<
- "sendmsg",
- RetValSpec<SSizeTType>,
- [ArgSpec<IntType>, ArgSpec<ConstStructMsghdrPtr>, ArgSpec<IntType>]
- >,
- FunctionSpec<
- "recv",
- RetValSpec<SSizeTType>,
- [ArgSpec<IntType>, ArgSpec<VoidPtr>, ArgSpec<SizeTType>, ArgSpec<IntType>]
- >,
- FunctionSpec<
- "recvfrom",
- RetValSpec<SSizeTType>,
- [
- ArgSpec<IntType>, ArgSpec<VoidPtr>, ArgSpec<SizeTType>,
- ArgSpec<IntType>, ArgSpec<StructSockAddrPtr>,
- ArgSpec<SocklenPtr>
- ]
- >,
- FunctionSpec<
- "recvmsg",
- RetValSpec<SSizeTType>,
- [ArgSpec<IntType>, ArgSpec<StructMsghdrPtr>, ArgSpec<IntType>]
- >,
- ] // Functions
- >;
-
- HeaderSpec SysTypes = HeaderSpec<
- "sys/types.h",
- [], // Macros
- [
- BlkCntT,
- BlkSizeT,
- ClockIdT,
- DevT,
- GidT,
- InoT,
- ModeTType,
- NLinkT,
- OffTType,
- PThreadAttrTType,
- PThreadCondAttrTType,
- PThreadKeyT,
- PThreadMutexAttrTType,
- PThreadMutexTType,
- PThreadOnceT,
- PThreadRWLockAttrTType,
- PThreadRWLockTType,
- PThreadTType,
- PidT,
- SSizeTType,
- SizeTType,
- SuSecondsT,
- TimeTType,
- UidT
- ], // Types
- [], // Enumerations
- [] // Functions
- >;
-
- let Headers = [
- ArpaInet,
- CType,
- Dirent,
- DlFcn,
- Errno,
- FCntl,
- PThread,
- Sched,
- Signal,
- Spawn,
- StdIO,
- StdLib,
- SysIOctl,
- SysMMan,
- SysResource,
- SysSelect,
- SysSocket,
- SysStat,
- SysStatvfs,
- SysTypes,
- SysUtsName,
- SysWait,
- Time,
- Termios,
- UniStd,
- String,
- Search,
- ];
-}
diff --git a/libc/spec/spec.td b/libc/spec/spec.td
deleted file mode 100644
index ad9ca76846c280..00000000000000
--- a/libc/spec/spec.td
+++ /dev/null
@@ -1,253 +0,0 @@
-class Type {}
-
-class NamedType<string name> : Type {
- string Name = name;
-}
-
-class Field<string name, Type type> {
- string Name = name;
- Type FieldType = type;
-}
-
-// Class to describe concrete structs specified by a standard.
-class Struct<string name> : NamedType<name> {
- list<Field> Fields;
-}
-
-class EnumNameValue<string name, string value = "__default_enum_value__"> {
- string Name = name;
- string Value = value;
-}
-
-class Enum<string name, list<EnumNameValue> enumerations> : NamedType<name> {
- list<EnumNameValue> Enumerations = enumerations;
-}
-
-class PtrType<Type type> : Type {
- Type PointeeType = type;
-}
-
-class ConstType<Type type> : Type {
- Type UnqualifiedType = type;
-}
-
-class RestrictedPtrType<Type type> : Type {
- Type PointeeType = type;
-}
-
-// Builtin types.
-def VarArgType : NamedType<"...">;
-def VaListType : NamedType<"va_list">;
-def VoidType : NamedType<"void">;
-def IntType : NamedType<"int">;
-def UnsignedIntType : NamedType<"unsigned int">;
-def LongType : NamedType<"long">;
-def UnsignedLongType : NamedType<"unsigned long">;
-def LongLongType : NamedType<"long long">;
-def UnsignedLongLongType : NamedType<"unsigned long long">;
-def FloatType : NamedType<"float">;
-def DoubleType : NamedType<"double">;
-def LongDoubleType : NamedType<"long double">;
-def CharType : NamedType<"char">;
-def UnsignedCharType : NamedType<"unsigned char">;
-def UnsignedShortType : NamedType<"unsigned short">;
-def BoolType : NamedType<"bool">;
-
-def Float16Type : NamedType<"_Float16">;
-def Float128Type : NamedType<"float128">;
-
-// Common types
-def VoidPtr : PtrType<VoidType>;
-def VoidPtrPtr : PtrType<VoidPtr>;
-def RestrictedVoidPtrPtr : RestrictedPtrType<VoidPtr>;
-def ConstVoidPtr : ConstType<VoidPtr>;
-
-def SizeTType : NamedType<"size_t">;
-def SizeTPtr : PtrType<SizeTType>;
-def RestrictedSizeTPtr : RestrictedPtrType<SizeTType>;
-
-def Char8TType : NamedType<"char8_t">;
-def Char16TType : NamedType<"char16_t">;
-def Char32TType : NamedType<"char32_t">;
-def WCharType : NamedType<"wchar_t">;
-def WIntType : NamedType<"wint_t">;
-
-def LongDoublePtr : PtrType<LongDoubleType>;
-
-def IntMaxTType : NamedType<"intmax_t">;
-def UIntMaxTType : NamedType<"uintmax_t">;
-
-def UInt16Type : NamedType<"uint16_t">;
-def UInt32Type : NamedType<"uint32_t">;
-
-def OffTType : NamedType<"off_t">;
-def OffTPtr : PtrType<OffTType>;
-def SSizeTType : NamedType<"ssize_t">;
-
-// _Noreturn is really not a type, but it is convenient to treat it as a type.
-def NoReturn : NamedType<"_Noreturn void">;
-
-//types moved from stdc.td
-def VoidRestrictedPtr : RestrictedPtrType<VoidType>;
-def ConstVoidRestrictedPtr : ConstType<VoidRestrictedPtr>;
-
-def CharPtr : PtrType<CharType>;
-def ConstCharPtr : ConstType<CharPtr>;
-def CharRestrictedPtr : RestrictedPtrType<CharType>;
-def CharRestrictedPtrPtr : RestrictedPtrType<CharPtr>;
-def ConstCharRestrictedPtr : ConstType<CharRestrictedPtr>;
-def ConstCharRestrictedPtrPtr : PtrType<ConstCharRestrictedPtr>;
-
-def OnceFlagType : NamedType<"once_flag">;
-def OnceFlagTypePtr : PtrType<OnceFlagType>;
-// TODO(sivachandra): Remove this non-standard type when a formal
-// way to describe callable types is available.
-def CallOnceFuncType : NamedType<"__call_once_func_t">;
-def MtxTType : NamedType<"mtx_t">;
-def MtxTTypePtr : PtrType<MtxTType>;
-def CndTType : NamedType<"cnd_t">;
-def CndTTypePtr : PtrType<CndTType>;
-def ThrdStartTType : NamedType<"thrd_start_t">;
-def ThrdTType : NamedType<"thrd_t">;
-def ThrdTTypePtr : PtrType<ThrdTType>;
-
-def IntPtr : PtrType<IntType>;
-def RestrictedIntPtr : RestrictedPtrType<IntType>;
-def FloatPtr : PtrType<FloatType>;
-def DoublePtr : PtrType<DoubleType>;
-def Float16Ptr : PtrType<Float16Type>;
-def Float128Ptr : PtrType<Float128Type>;
-def UnsignedCharPtr : PtrType<UnsignedCharType>;
-
-def ConstDoublePtr : ConstType<DoublePtr>;
-def ConstFloatPtr : ConstType<FloatPtr>;
-def ConstLongDoublePtr : ConstType<LongDoublePtr>;
-def ConstFloat16Ptr : ConstType<Float16Ptr>;
-def ConstFloat128Ptr : ConstType<Float128Ptr>;
-
-def SigHandlerT : NamedType<"__sighandler_t">;
-
-def TimeTType : NamedType<"time_t">;
-
-def StructTimeSpec : NamedType<"struct timespec">;
-def StructTimeSpecPtr : PtrType<StructTimeSpec>;
-def ConstStructTimeSpecPtr : ConstType<StructTimeSpecPtr>;
-def RestrictStructTimeSpecPtr : RestrictedPtrType<StructTimeSpec>;
-def ConstRestrictStructTimeSpecPtr : ConstType<RestrictStructTimeSpecPtr>;
-
-def BSearchCompareT : NamedType<"__bsearchcompare_t">;
-def QSortCompareT : NamedType<"__qsortcompare_t">;
-
-def AtexitHandlerT : NamedType<"__atexithandler_t">;
-
-def FILE : NamedType<"FILE">;
-def FILEPtr : PtrType<FILE>;
-def FILERestrictedPtr : RestrictedPtrType<FILE>;
-
-def PThreadTType : NamedType<"pthread_t">;
-
-def PidT : NamedType<"pid_t">;
-def RestrictedPidTPtr : RestrictedPtrType<PidT>;
-
-def StructRUsage : NamedType<"struct rusage">;
-def StructRUsagePtr : PtrType<StructRUsage>;
-
-def StructTimevalType : NamedType<"struct timeval">;
-def StructTimevalPtr : PtrType<StructTimevalType>;
-def RestrictedStructTimevalPtr : RestrictedPtrType<StructTimevalType>;
-
-def SuSecondsT : NamedType<"suseconds_t">;
-
-//added because __assert_fail needs it.
-def UnsignedType : NamedType<"unsigned">;
-
-def ActionType : NamedType<"ACTION">;
-def EntryType : NamedType<"ENTRY">;
-def EntryTypePtr : PtrType<EntryType>;
-def EntryTypePtrPtr : PtrType<EntryTypePtr>;
-
-def MBStateTType : NamedType<"mbstate_t">;
-
-class Macro<string name> {
- string Name = name;
-}
-
-class EnumeratedNameValue<string name, string value = "__default__"> {
- string Name = name;
- string Value = value;
-}
-
-class Annotation {}
-
-class RetValSpec<Type type, list<Annotation> annotations = []> {
- Type ReturnType = type;
- list<Annotation> Annotations = annotations;
-}
-
-class ArgSpec<Type type, list<Annotation> annotations = [], string name = ""> {
- Type ArgType = type;
- list<Annotation> Annotations = annotations;
- string Name = name;
-}
-
-// The following classes are used to describe function attributes.
-// In the future, we may consider supporting parameter attributes as well.
-// https://clang.llvm.org/docs/AttributeReference.html
-class FunctionAttr<string style, string attr> {
- string Attr = attr;
- // The style of the attribute, e.g. "gnu", "cxx11", "declspec".
- // - "gnu" is for GNU-style attributes: __attribute__((...))
- // - "cxx11" is for C++11-style attributes: [[...]]
- // - "declspec" is for Microsoft-style attributes: __declspec(...)
- string Style = style;
-
- // For the time being, we are only interested in identifer-like attributes.
- // We can extend this to support function-like attributes if needed.
- // For example, in the future, we can #define __LIBC_ATTRIBUTE_NODISCARD(...) [[nodiscard(__VA_ARGS__)]]
- // int FunctionLike = 0;
-}
-class GnuFunctionAttr<string attr> : FunctionAttr<"gnu", attr> {}
-class Cxx11FunctionAttr<string attr, string namespace> : FunctionAttr<"cxx11", attr> {
- // The namespace of the attribute, e.g. "gnu" or "clang". Empty string means there is no namespace.
- string Namespace = namespace;
-}
-class DeclspecFunctionAttr<string attr> : FunctionAttr<"declspec", attr> {}
-class FunctionAttrSpec<string macro, list<FunctionAttr> instances> {
- list<FunctionAttr> Instances = instances;
- string Macro = macro;
-}
-
-class FunctionSpec<string name, RetValSpec return, list<ArgSpec> args, list<FunctionAttrSpec> attrs = []> {
- string Name = name;
- RetValSpec Return = return;
- list<ArgSpec> Args = args;
- list<FunctionAttrSpec> Attributes = attrs;
-}
-
-class GuardedFunctionSpec<string name, RetValSpec return, list<ArgSpec> args, string guard_macro> : FunctionSpec<name, return, args> {
- string Guard = guard_macro;
-}
-
-class ObjectSpec<string name, string type> {
- string Name = name;
- string Type = type;
-}
-
-class HeaderSpec<string name,
- list<Macro> macros = [],
- list<Type> types = [],
- list<EnumeratedNameValue> enumerations = [],
- list<FunctionSpec> functions = [],
- list<ObjectSpec> objects = []> {
- string Name = name;
- list<FunctionSpec> Functions = functions;
- list<Type> Types = types;
- list<Macro> Macros = macros;
- list<EnumeratedNameValue> Enumerations = enumerations;
- list<ObjectSpec> Objects = objects;
-}
-
-class StandardSpec<string name> {
- string Name = name;
- list<HeaderSpec> Headers;
-}
diff --git a/libc/spec/stdc.td b/libc/spec/stdc.td
deleted file mode 100644
index 4fa057da1cf133..00000000000000
--- a/libc/spec/stdc.td
+++ /dev/null
@@ -1,1819 +0,0 @@
-def StdC : StandardSpec<"stdc"> {
-
- NamedType StructTmType = NamedType<"struct tm">;
- PtrType StructTmPtr = PtrType<StructTmType>;
- PtrType TimeTTypePtr = PtrType<TimeTType>;
- NamedType ClockT = NamedType<"clock_t">;
- NamedType LocaleT = NamedType<"locale_t">;
-
- NamedType DivTType = NamedType<"div_t">;
- NamedType LDivTType = NamedType<"ldiv_t">;
- NamedType LLDivTType = NamedType<"lldiv_t">;
-
- NamedType JmpBuf = NamedType<"jmp_buf">;
-
- NamedType TssTType = NamedType<"tss_t">;
- PtrType TssTPtr = PtrType<TssTType>;
- NamedType TssDtorTType = NamedType<"tss_dtor_t">;
-
- HeaderSpec Assert = HeaderSpec<
- "assert.h",
- [
- Macro<"static_assert">,
- Macro<"assert">,
- ],
- [], // Types
- [], // Enumerations
- []
- >;
-
- FunctionAttrSpec ConstAttr = FunctionAttrSpec<"__LIBC_CONST_ATTR", [
- Cxx11FunctionAttr<"const", "gnu">,
- GnuFunctionAttr<"const">,
- ]>;
-
- HeaderSpec CType = HeaderSpec<
- "ctype.h",
- [], // Macros
- [
- LocaleT
- ], // Types
- [], // Enumerations
- [
- FunctionSpec<
- "isalnum",
- RetValSpec<IntType>,
- [ArgSpec<IntType>]
- >,
- FunctionSpec<
- "isalpha",
- RetValSpec<IntType>,
- [ArgSpec<IntType>]
- >,
- FunctionSpec<
- "isblank",
- RetValSpec<IntType>,
- [ArgSpec<IntType>]
- >,
- FunctionSpec<
- "iscntrl",
- RetValSpec<IntType>,
- [ArgSpec<IntType>]
- >,
- FunctionSpec<
- "isdigit",
- RetValSpec<IntType>,
- [ArgSpec<IntType>]
- >,
- FunctionSpec<
- "isgraph",
- RetValSpec<IntType>,
- [ArgSpec<IntType>]
- >,
- FunctionSpec<
- "islower",
- RetValSpec<IntType>,
- [ArgSpec<IntType>]
- >,
- FunctionSpec<
- "isprint",
- RetValSpec<IntType>,
- [ArgSpec<IntType>]
- >,
- FunctionSpec<
- "ispunct",
- RetValSpec<IntType>,
- [ArgSpec<IntType>]
- >,
- FunctionSpec<
- "isspace",
- RetValSpec<IntType>,
- [ArgSpec<IntType>]
- >,
- FunctionSpec<
- "isupper",
- RetValSpec<IntType>,
- [ArgSpec<IntType>]
- >,
- FunctionSpec<
- "isxdigit",
- RetValSpec<IntType>,
- [ArgSpec<IntType>]
- >,
- FunctionSpec<
- "tolower",
- RetValSpec<IntType>,
- [ArgSpec<IntType>]
- >,
- FunctionSpec<
- "toupper",
- RetValSpec<IntType>,
- [ArgSpec<IntType>]
- >,
- FunctionSpec<
- "isalnum_l",
- RetValSpec<IntType>,
- [ArgSpec<IntType>, ArgSpec<LocaleT>]
- >,
- FunctionSpec<
- "isalpha_l",
- RetValSpec<IntType>,
- [ArgSpec<IntType>, ArgSpec<LocaleT>]
- >,
- FunctionSpec<
- "isblank_l",
- RetValSpec<IntType>,
- [ArgSpec<IntType>, ArgSpec<LocaleT>]
- >,
- FunctionSpec<
- "iscntrl_l",
- RetValSpec<IntType>,
- [ArgSpec<IntType>, ArgSpec<LocaleT>]
- >,
- FunctionSpec<
- "isdigit_l",
- RetValSpec<IntType>,
- [ArgSpec<IntType>, ArgSpec<LocaleT>]
- >,
- FunctionSpec<
- "isgraph_l",
- RetValSpec<IntType>,
- [ArgSpec<IntType>, ArgSpec<LocaleT>]
- >,
- FunctionSpec<
- "islower_l",
- RetValSpec<IntType>,
- [ArgSpec<IntType>, ArgSpec<LocaleT>]
- >,
- FunctionSpec<
- "isprint_l",
- RetValSpec<IntType>,
- [ArgSpec<IntType>, ArgSpec<LocaleT>]
- >,
- FunctionSpec<
- "ispunct_l",
- RetValSpec<IntType>,
- [ArgSpec<IntType>, ArgSpec<LocaleT>]
- >,
- FunctionSpec<
- "isspace_l",
- RetValSpec<IntType>,
- [ArgSpec<IntType>, ArgSpec<LocaleT>]
- >,
- FunctionSpec<
- "isupper_l",
- RetValSpec<IntType>,
- [ArgSpec<IntType>, ArgSpec<LocaleT>]
- >,
- FunctionSpec<
- "isxdigit_l",
- RetValSpec<IntType>,
- [ArgSpec<IntType>, ArgSpec<LocaleT>]
- >,
- FunctionSpec<
- "tolower_l",
- RetValSpec<IntType>,
- [ArgSpec<IntType>, ArgSpec<LocaleT>]
- >,
- FunctionSpec<
- "toupper_l",
- RetValSpec<IntType>,
- [ArgSpec<IntType>, ArgSpec<LocaleT>]
- >,
- ]
- >;
-
- NamedType FEnvT = NamedType<"fenv_t">;
- PtrType FEnvTPtr = PtrType<FEnvT>;
- ConstType ConstFEnvTPtr = ConstType<FEnvTPtr>;
- NamedType FExceptT = NamedType<"fexcept_t">;
- PtrType FExceptTPtr = PtrType<FExceptT>;
- ConstType ConstFExceptTPtr = ConstType<FExceptTPtr>;
- HeaderSpec Fenv = HeaderSpec<
- "fenv.h",
- [
- Macro<"FE_DIVBYZERO">,
- Macro<"FE_INEXACT">,
- Macro<"FE_INVALID">,
- Macro<"FE_OVERFLOW">,
- Macro<"FE_UNDERFLOW">,
- Macro<"FE_ALL_EXCEPT">,
-
- Macro<"FE_DOWNWARD">,
- Macro<"FE_TONEAREST">,
- Macro<"FE_TOWARDZERO">,
- Macro<"FE_UPWARD">,
-
- Macro<"FE_DFL_ENV">
- ],
- [
- FEnvT,
- FExceptT,
- ], // Types
- [], // Enumerations
- [
- FunctionSpec<
- "feclearexcept",
- RetValSpec<IntType>,
- [ArgSpec<IntType>]
- >,
- FunctionSpec<
- "fetestexcept",
- RetValSpec<IntType>,
- [ArgSpec<IntType>]
- >,
- FunctionSpec<
- "fetestexceptflag",
- RetValSpec<IntType>,
- [ArgSpec<ConstFExceptTPtr>, ArgSpec<IntType>]
- >,
- FunctionSpec<
- "feraiseexcept",
- RetValSpec<IntType>,
- [ArgSpec<IntType>]
- >,
- FunctionSpec<
- "fesetround",
- RetValSpec<IntType>,
- [ArgSpec<IntType>]
- >,
- FunctionSpec<
- "fegetround",
- RetValSpec<IntType>,
- []
- >,
- FunctionSpec<
- "fegetenv",
- RetValSpec<IntType>,
- [ArgSpec<FEnvTPtr>]
- >,
- FunctionSpec<
- "fesetenv",
- RetValSpec<IntType>,
- [ArgSpec<ConstFEnvTPtr>]
- >,
- FunctionSpec<
- "fegetexceptflag",
- RetValSpec<IntType>,
- [ArgSpec<FExceptTPtr>, ArgSpec<IntType>]
- >,
- FunctionSpec<
- "fesetexcept",
- RetValSpec<IntType>,
- [ArgSpec<IntType>]
- >,
- FunctionSpec<
- "fesetexceptflag",
- RetValSpec<IntType>,
- [ArgSpec<ConstFExceptTPtr>, ArgSpec<IntType>]
- >,
- FunctionSpec<
- "feholdexcept",
- RetValSpec<IntType>,
- [ArgSpec<FEnvTPtr>]
- >,
- FunctionSpec<
- "feupdateenv",
- RetValSpec<IntType>,
- [ArgSpec<ConstFEnvTPtr>]
- >,
- ]
- >;
-
- HeaderSpec String = HeaderSpec<
- "string.h",
- [
- Macro<"NULL">,
- ],
- [
- SizeTType,
- ],
- [], // Enumerations
- [
- FunctionSpec<
- "memcpy",
- RetValSpec<VoidPtr>,
- [ArgSpec<VoidRestrictedPtr>,
- ArgSpec<ConstVoidRestrictedPtr>,
- ArgSpec<SizeTType>]
- >,
- FunctionSpec<
- "memmove",
- RetValSpec<VoidPtr>,
- [ArgSpec<VoidPtr>, ArgSpec<ConstVoidPtr>, ArgSpec<SizeTType>]
- >,
- FunctionSpec<
- "memcmp",
- RetValSpec<IntType>,
- [ArgSpec<ConstVoidPtr>, ArgSpec<ConstVoidPtr>, ArgSpec<SizeTType>]
- >,
- FunctionSpec<
- "memchr",
- RetValSpec<VoidPtr>,
- [ArgSpec<ConstVoidPtr>, ArgSpec<IntType>, ArgSpec<SizeTType>]
- >,
- FunctionSpec<
- "memset",
- RetValSpec<VoidPtr>,
- [ArgSpec<VoidPtr>, ArgSpec<IntType>, ArgSpec<SizeTType>]
- >,
- FunctionSpec<
- "memset_explicit",
- RetValSpec<VoidPtr>,
- [ArgSpec<VoidPtr>, ArgSpec<IntType>, ArgSpec<SizeTType>]
- >,
- FunctionSpec<
- "strcpy",
- RetValSpec<CharPtr>,
- [ArgSpec<CharRestrictedPtr>, ArgSpec<ConstCharRestrictedPtr>]
- >,
- FunctionSpec<
- "strncpy",
- RetValSpec<CharPtr>,
- [ArgSpec<CharRestrictedPtr>,
- ArgSpec<ConstCharRestrictedPtr>,
- ArgSpec<SizeTType>]
- >,
- FunctionSpec<
- "strcat",
- RetValSpec<CharPtr>,
- [ArgSpec<CharRestrictedPtr>, ArgSpec<ConstCharRestrictedPtr>]
- >,
- FunctionSpec<
- "strncat",
- RetValSpec<CharPtr>,
- [ArgSpec<CharPtr>, ArgSpec<ConstCharPtr>, ArgSpec<SizeTType>]
- >,
- FunctionSpec<
- "strcmp",
- RetValSpec<IntType>,
- [ArgSpec<ConstCharPtr>, ArgSpec<ConstCharPtr>]
- >,
- FunctionSpec<
- "strcoll",
- RetValSpec<IntType>,
- [ArgSpec<ConstCharPtr>, ArgSpec<ConstCharPtr>]
- >,
- FunctionSpec<
- "strcoll_l",
- RetValSpec<IntType>,
- [ArgSpec<ConstCharPtr>, ArgSpec<ConstCharPtr>, ArgSpec<LocaleT>]
- >,
- FunctionSpec<
- "strncmp",
- RetValSpec<IntType>,
- [ArgSpec<ConstCharPtr>, ArgSpec<ConstCharPtr>, ArgSpec<SizeTType>]
- >,
- FunctionSpec<
- "strxfrm",
- RetValSpec<SizeTType>,
- [ArgSpec<CharRestrictedPtr>,
- ArgSpec<ConstCharRestrictedPtr>,
- ArgSpec<SizeTType>]
- >,
- FunctionSpec<
- "strxfrm_l",
- RetValSpec<SizeTType>,
- [ArgSpec<CharRestrictedPtr>,
- ArgSpec<ConstCharRestrictedPtr>,
- ArgSpec<SizeTType>,
- ArgSpec<LocaleT>]
- >,
- FunctionSpec<
- "strchr",
- RetValSpec<CharPtr>,
- [ArgSpec<ConstCharPtr>, ArgSpec<IntType>]
- >,
- FunctionSpec<
- "strcspn",
- RetValSpec<SizeTType>,
- [ArgSpec<ConstCharPtr>, ArgSpec<ConstCharPtr>]
- >,
- FunctionSpec<
- "strdup",
- RetValSpec<CharPtr>,
- [ArgSpec<ConstCharPtr>]
- >,
- FunctionSpec<
- "strndup",
- RetValSpec<CharPtr>,
- [ArgSpec<ConstCharPtr>,ArgSpec<SizeTType>]
- >,
- FunctionSpec<
- "strpbrk",
- RetValSpec<CharPtr>,
- [ArgSpec<ConstCharPtr>, ArgSpec<ConstCharPtr>]
- >,
- FunctionSpec<
- "strrchr",
- RetValSpec<CharPtr>,
- [ArgSpec<ConstCharPtr>, ArgSpec<IntType>]
- >,
- FunctionSpec<
- "strspn",
- RetValSpec<SizeTType>,
- [ArgSpec<ConstCharPtr>, ArgSpec<ConstCharPtr>]
- >,
- FunctionSpec<
- "strstr",
- RetValSpec<CharPtr>,
- [ArgSpec<ConstCharPtr>, ArgSpec<ConstCharPtr>]
- >,
- FunctionSpec<
- "strtok",
- RetValSpec<CharPtr>,
- [ArgSpec<CharRestrictedPtr>, ArgSpec<ConstCharRestrictedPtr>]
- >,
- FunctionSpec<
- "strerror",
- RetValSpec<CharPtr>,
- [ArgSpec<IntType>]
- >,
- FunctionSpec<
- "strlen",
- RetValSpec<SizeTType>,
- [ArgSpec<ConstCharPtr>]
- >,
- ]
- >;
-
- HeaderSpec Math = HeaderSpec<
- "math.h",
- [
- Macro<"MATH_ERRNO">,
- Macro<"MATH_ERREXCEPT">,
- Macro<"math_errhandling">,
-
- Macro<"HUGE_VAL">,
- Macro<"INFINITY">,
- Macro<"NAN">,
-
- Macro<"FP_INT_UPWARD">,
- Macro<"FP_INT_DOWNWARD">,
- Macro<"FP_INT_TOWARDZERO">,
- Macro<"FP_INT_TONEARESTFROMZERO">,
- Macro<"FP_INT_TONEAREST">,
-
- Macro<"FP_ILOGB0">,
- Macro<"FP_ILOGBNAN">,
-
- Macro<"isfinite">,
- Macro<"isinf">,
- Macro<"isnan">,
- ],
- [
- NamedType<"float_t">,
- NamedType<"double_t">,
- NamedType<"float128">,
- ],
- [], // Enumerations
- [
- FunctionSpec<"cbrt", RetValSpec<DoubleType>, [ArgSpec<DoubleType>]>,
- FunctionSpec<"cbrtf", RetValSpec<FloatType>, [ArgSpec<FloatType>]>,
-
- FunctionSpec<"copysign", RetValSpec<DoubleType>, [ArgSpec<DoubleType>, ArgSpec<DoubleType>]>,
- FunctionSpec<"copysignf", RetValSpec<FloatType>, [ArgSpec<FloatType>, ArgSpec<FloatType>]>,
- FunctionSpec<"copysignl", RetValSpec<LongDoubleType>, [ArgSpec<LongDoubleType>, ArgSpec<LongDoubleType>]>,
- GuardedFunctionSpec<"copysignf16", RetValSpec<Float16Type>, [ArgSpec<Float16Type>, ArgSpec<Float16Type>], "LIBC_TYPES_HAS_FLOAT16">,
- GuardedFunctionSpec<"copysignf128", RetValSpec<Float128Type>, [ArgSpec<Float128Type>, ArgSpec<Float128Type>], "LIBC_TYPES_HAS_FLOAT128">,
-
- FunctionSpec<"ceil", RetValSpec<DoubleType>, [ArgSpec<DoubleType>]>,
- FunctionSpec<"ceilf", RetValSpec<FloatType>, [ArgSpec<FloatType>]>,
- FunctionSpec<"ceill", RetValSpec<LongDoubleType>, [ArgSpec<LongDoubleType>]>,
- GuardedFunctionSpec<"ceilf16", RetValSpec<Float16Type>, [ArgSpec<Float16Type>], "LIBC_TYPES_HAS_FLOAT16">,
- GuardedFunctionSpec<"ceilf128", RetValSpec<Float128Type>, [ArgSpec<Float128Type>], "LIBC_TYPES_HAS_FLOAT128">,
-
- FunctionSpec<"daddl", RetValSpec<DoubleType>, [ArgSpec<LongDoubleType>, ArgSpec<LongDoubleType>]>,
- FunctionSpec<"ddivl", RetValSpec<DoubleType>, [ArgSpec<LongDoubleType>, ArgSpec<LongDoubleType>]>,
- FunctionSpec<"dfmal", RetValSpec<DoubleType>, [ArgSpec<LongDoubleType>, ArgSpec<LongDoubleType>, ArgSpec<LongDoubleType>]>,
- FunctionSpec<"dsubl", RetValSpec<DoubleType>, [ArgSpec<LongDoubleType>, ArgSpec<LongDoubleType>]>,
-
- FunctionSpec<"fabs", RetValSpec<DoubleType>, [ArgSpec<DoubleType>], [ConstAttr]>,
- FunctionSpec<"fabsf", RetValSpec<FloatType>, [ArgSpec<FloatType>]>,
- FunctionSpec<"fabsl", RetValSpec<LongDoubleType>, [ArgSpec<LongDoubleType>]>,
- GuardedFunctionSpec<"fabsf16", RetValSpec<Float16Type>, [ArgSpec<Float16Type>], "LIBC_TYPES_HAS_FLOAT16">,
- GuardedFunctionSpec<"fabsf128", RetValSpec<Float128Type>, [ArgSpec<Float128Type>], "LIBC_TYPES_HAS_FLOAT128">,
-
- FunctionSpec<"fadd", RetValSpec<FloatType>, [ArgSpec<DoubleType>, ArgSpec<DoubleType>]>,
- FunctionSpec<"faddl", RetValSpec<FloatType>, [ArgSpec<LongDoubleType>, ArgSpec<LongDoubleType>]>,
-
- FunctionSpec<"fdim", RetValSpec<DoubleType>, [ArgSpec<DoubleType>, ArgSpec<DoubleType>]>,
- FunctionSpec<"fdimf", RetValSpec<FloatType>, [ArgSpec<FloatType>, ArgSpec<FloatType>]>,
- FunctionSpec<"fdiml", RetValSpec<LongDoubleType>, [ArgSpec<LongDoubleType>, ArgSpec<LongDoubleType>]>,
- GuardedFunctionSpec<"fdimf16", RetValSpec<Float16Type>, [ArgSpec<Float16Type>, ArgSpec<Float16Type>], "LIBC_TYPES_HAS_FLOAT16">,
- GuardedFunctionSpec<"fdimf128", RetValSpec<Float128Type>, [ArgSpec<Float128Type>, ArgSpec<Float128Type>], "LIBC_TYPES_HAS_FLOAT128">,
-
- FunctionSpec<"fdiv", RetValSpec<FloatType>, [ArgSpec<DoubleType>, ArgSpec<DoubleType>]>,
- FunctionSpec<"fdivl", RetValSpec<FloatType>, [ArgSpec<LongDoubleType>, ArgSpec<LongDoubleType>]>,
-
- FunctionSpec<"ffma", RetValSpec<FloatType>, [ArgSpec<DoubleType>, ArgSpec<DoubleType>, ArgSpec<DoubleType>]>,
- FunctionSpec<"ffmal", RetValSpec<FloatType>, [ArgSpec<LongDoubleType>, ArgSpec<LongDoubleType>, ArgSpec<LongDoubleType>]>,
-
- FunctionSpec<"floor", RetValSpec<DoubleType>, [ArgSpec<DoubleType>]>,
- FunctionSpec<"floorf", RetValSpec<FloatType>, [ArgSpec<FloatType>]>,
- FunctionSpec<"floorl", RetValSpec<LongDoubleType>, [ArgSpec<LongDoubleType>]>,
- GuardedFunctionSpec<"floorf16", RetValSpec<Float16Type>, [ArgSpec<Float16Type>], "LIBC_TYPES_HAS_FLOAT16">,
- GuardedFunctionSpec<"floorf128", RetValSpec<Float128Type>, [ArgSpec<Float128Type>], "LIBC_TYPES_HAS_FLOAT128">,
-
- FunctionSpec<"fmin", RetValSpec<DoubleType>, [ArgSpec<DoubleType>, ArgSpec<DoubleType>]>,
- FunctionSpec<"fminf", RetValSpec<FloatType>, [ArgSpec<FloatType>, ArgSpec<FloatType>]>,
- FunctionSpec<"fminl", RetValSpec<LongDoubleType>, [ArgSpec<LongDoubleType>, ArgSpec<LongDoubleType>]>,
- GuardedFunctionSpec<"fminf128", RetValSpec<Float128Type>, [ArgSpec<Float128Type>, ArgSpec<Float128Type>], "LIBC_TYPES_HAS_FLOAT128">,
- GuardedFunctionSpec<"fminf16", RetValSpec<Float16Type>, [ArgSpec<Float16Type>, ArgSpec<Float16Type>], "LIBC_TYPES_HAS_FLOAT16">,
-
- FunctionSpec<"fmax", RetValSpec<DoubleType>, [ArgSpec<DoubleType>, ArgSpec<DoubleType>]>,
- FunctionSpec<"fmaxf", RetValSpec<FloatType>, [ArgSpec<FloatType>, ArgSpec<FloatType>]>,
- FunctionSpec<"fmaxl", RetValSpec<LongDoubleType>, [ArgSpec<LongDoubleType>, ArgSpec<LongDoubleType>]>,
- GuardedFunctionSpec<"fmaxf128", RetValSpec<Float128Type>, [ArgSpec<Float128Type>, ArgSpec<Float128Type>], "LIBC_TYPES_HAS_FLOAT128">,
- GuardedFunctionSpec<"fmaxf16", RetValSpec<Float16Type>, [ArgSpec<Float16Type>, ArgSpec<Float16Type>], "LIBC_TYPES_HAS_FLOAT16">,
-
- FunctionSpec<"fmaximum", RetValSpec<DoubleType>, [ArgSpec<DoubleType>, ArgSpec<DoubleType>]>,
- FunctionSpec<"fmaximumf", RetValSpec<FloatType>, [ArgSpec<FloatType>, ArgSpec<FloatType>]>,
- FunctionSpec<"fmaximuml", RetValSpec<LongDoubleType>, [ArgSpec<LongDoubleType>, ArgSpec<LongDoubleType>]>,
- GuardedFunctionSpec<"fmaximumf16", RetValSpec<Float16Type>, [ArgSpec<Float16Type>, ArgSpec<Float16Type>], "LIBC_TYPES_HAS_FLOAT16">,
- GuardedFunctionSpec<"fmaximumf128", RetValSpec<Float128Type>, [ArgSpec<Float128Type>, ArgSpec<Float128Type>], "LIBC_TYPES_HAS_FLOAT128">,
-
- FunctionSpec<"fmaximum_num", RetValSpec<DoubleType>, [ArgSpec<DoubleType>, ArgSpec<DoubleType>]>,
- FunctionSpec<"fmaximum_numf", RetValSpec<FloatType>, [ArgSpec<FloatType>, ArgSpec<FloatType>]>,
- FunctionSpec<"fmaximum_numl", RetValSpec<LongDoubleType>, [ArgSpec<LongDoubleType>, ArgSpec<LongDoubleType>]>,
- GuardedFunctionSpec<"fmaximum_numf16", RetValSpec<Float16Type>, [ArgSpec<Float16Type>, ArgSpec<Float16Type>], "LIBC_TYPES_HAS_FLOAT16">,
- GuardedFunctionSpec<"fmaximum_numf128", RetValSpec<Float128Type>, [ArgSpec<Float128Type>, ArgSpec<Float128Type>], "LIBC_TYPES_HAS_FLOAT128">,
-
- FunctionSpec<"fmaximum_mag", RetValSpec<DoubleType>, [ArgSpec<DoubleType>, ArgSpec<DoubleType>]>,
- FunctionSpec<"fmaximum_magf", RetValSpec<FloatType>, [ArgSpec<FloatType>, ArgSpec<FloatType>]>,
- FunctionSpec<"fmaximum_magl", RetValSpec<LongDoubleType>, [ArgSpec<LongDoubleType>, ArgSpec<LongDoubleType>]>,
- GuardedFunctionSpec<"fmaximum_magf16", RetValSpec<Float16Type>, [ArgSpec<Float16Type>, ArgSpec<Float16Type>], "LIBC_TYPES_HAS_FLOAT16">,
- GuardedFunctionSpec<"fmaximum_magf128", RetValSpec<Float128Type>, [ArgSpec<Float128Type>, ArgSpec<Float128Type>], "LIBC_TYPES_HAS_FLOAT128">,
-
- FunctionSpec<"fmaximum_mag_num", RetValSpec<DoubleType>, [ArgSpec<DoubleType>, ArgSpec<DoubleType>]>,
- FunctionSpec<"fmaximum_mag_numf", RetValSpec<FloatType>, [ArgSpec<FloatType>, ArgSpec<FloatType>]>,
- FunctionSpec<"fmaximum_mag_numl", RetValSpec<LongDoubleType>, [ArgSpec<LongDoubleType>, ArgSpec<LongDoubleType>]>,
- GuardedFunctionSpec<"fmaximum_mag_numf16", RetValSpec<Float16Type>, [ArgSpec<Float16Type>, ArgSpec<Float16Type>], "LIBC_TYPES_HAS_FLOAT16">,
- GuardedFunctionSpec<"fmaximum_mag_numf128", RetValSpec<Float128Type>, [ArgSpec<Float128Type>, ArgSpec<Float128Type>], "LIBC_TYPES_HAS_FLOAT128">,
-
- FunctionSpec<"fminimum", RetValSpec<DoubleType>, [ArgSpec<DoubleType>, ArgSpec<DoubleType>]>,
- FunctionSpec<"fminimumf", RetValSpec<FloatType>, [ArgSpec<FloatType>, ArgSpec<FloatType>]>,
- FunctionSpec<"fminimuml", RetValSpec<LongDoubleType>, [ArgSpec<LongDoubleType>, ArgSpec<LongDoubleType>]>,
- GuardedFunctionSpec<"fminimumf16", RetValSpec<Float16Type>, [ArgSpec<Float16Type>, ArgSpec<Float16Type>], "LIBC_TYPES_HAS_FLOAT16">,
- GuardedFunctionSpec<"fminimumf128", RetValSpec<Float128Type>, [ArgSpec<Float128Type>, ArgSpec<Float128Type>], "LIBC_TYPES_HAS_FLOAT128">,
-
- FunctionSpec<"fminimum_num", RetValSpec<DoubleType>, [ArgSpec<DoubleType>, ArgSpec<DoubleType>]>,
- FunctionSpec<"fminimum_numf", RetValSpec<FloatType>, [ArgSpec<FloatType>, ArgSpec<FloatType>]>,
- FunctionSpec<"fmaximum_numl", RetValSpec<LongDoubleType>, [ArgSpec<LongDoubleType>, ArgSpec<LongDoubleType>]>,
- GuardedFunctionSpec<"fminimum_numf16", RetValSpec<Float16Type>, [ArgSpec<Float16Type>, ArgSpec<Float16Type>], "LIBC_TYPES_HAS_FLOAT16">,
- GuardedFunctionSpec<"fminimum_numf128", RetValSpec<Float128Type>, [ArgSpec<Float128Type>, ArgSpec<Float128Type>], "LIBC_TYPES_HAS_FLOAT128">,
-
- FunctionSpec<"fminimum_mag", RetValSpec<DoubleType>, [ArgSpec<DoubleType>, ArgSpec<DoubleType>]>,
- FunctionSpec<"fminimum_magf", RetValSpec<FloatType>, [ArgSpec<FloatType>, ArgSpec<FloatType>]>,
- FunctionSpec<"fminimum_magl", RetValSpec<LongDoubleType>, [ArgSpec<LongDoubleType>, ArgSpec<LongDoubleType>]>,
- GuardedFunctionSpec<"fminimum_magf16", RetValSpec<Float16Type>, [ArgSpec<Float16Type>, ArgSpec<Float16Type>], "LIBC_TYPES_HAS_FLOAT16">,
- GuardedFunctionSpec<"fminimum_magf128", RetValSpec<Float128Type>, [ArgSpec<Float128Type>, ArgSpec<Float128Type>], "LIBC_TYPES_HAS_FLOAT128">,
-
- FunctionSpec<"fminimum_mag_num", RetValSpec<DoubleType>, [ArgSpec<DoubleType>, ArgSpec<DoubleType>]>,
- FunctionSpec<"fminimum_mag_numf", RetValSpec<FloatType>, [ArgSpec<FloatType>, ArgSpec<FloatType>]>,
- FunctionSpec<"fminimum_mag_numl", RetValSpec<LongDoubleType>, [ArgSpec<LongDoubleType>, ArgSpec<LongDoubleType>]>,
- GuardedFunctionSpec<"fminimum_mag_numf16", RetValSpec<Float16Type>, [ArgSpec<Float16Type>, ArgSpec<Float16Type>], "LIBC_TYPES_HAS_FLOAT16">,
- GuardedFunctionSpec<"fminimum_mag_numf128", RetValSpec<Float128Type>, [ArgSpec<Float128Type>, ArgSpec<Float128Type>], "LIBC_TYPES_HAS_FLOAT128">,
-
- FunctionSpec<"fma", RetValSpec<DoubleType>, [ArgSpec<DoubleType>, ArgSpec<DoubleType>, ArgSpec<DoubleType>]>,
- FunctionSpec<"fmaf", RetValSpec<FloatType>, [ArgSpec<FloatType>, ArgSpec<FloatType>, ArgSpec<FloatType>]>,
-
- GuardedFunctionSpec<"f16fmaf128", RetValSpec<Float16Type>, [ArgSpec<Float128Type>, ArgSpec<Float128Type>, ArgSpec<Float128Type>], "LIBC_TYPES_HAS_FLOAT16_AND_FLOAT128">,
-
- FunctionSpec<"fmod", RetValSpec<DoubleType>, [ArgSpec<DoubleType>, ArgSpec<DoubleType>]>,
- FunctionSpec<"fmodf", RetValSpec<FloatType>, [ArgSpec<FloatType>, ArgSpec<FloatType>]>,
- FunctionSpec<"fmodl", RetValSpec<LongDoubleType>, [ArgSpec<LongDoubleType>, ArgSpec<LongDoubleType>]>,
- GuardedFunctionSpec<"fmodf16", RetValSpec<Float16Type>, [ArgSpec<Float16Type>, ArgSpec<Float16Type>], "LIBC_TYPES_HAS_FLOAT16">,
- GuardedFunctionSpec<"fmodf128", RetValSpec<Float128Type>, [ArgSpec<Float128Type>, ArgSpec<Float128Type>], "LIBC_TYPES_HAS_FLOAT128">,
-
- FunctionSpec<"frexp", RetValSpec<DoubleType>, [ArgSpec<DoubleType>, ArgSpec<IntPtr>]>,
- FunctionSpec<"frexpf", RetValSpec<FloatType>, [ArgSpec<FloatType>, ArgSpec<IntPtr>]>,
- FunctionSpec<"frexpl", RetValSpec<LongDoubleType>, [ArgSpec<LongDoubleType>, ArgSpec<IntPtr>]>,
- GuardedFunctionSpec<"frexpf16", RetValSpec<Float16Type>, [ArgSpec<Float16Type>, ArgSpec<IntPtr>], "LIBC_TYPES_HAS_FLOAT16">,
- GuardedFunctionSpec<"frexpf128", RetValSpec<Float128Type>, [ArgSpec<Float128Type>, ArgSpec<IntPtr>], "LIBC_TYPES_HAS_FLOAT128">,
-
- FunctionSpec<"fromfp", RetValSpec<DoubleType>, [ArgSpec<DoubleType>, ArgSpec<IntType>, ArgSpec<UnsignedIntType>]>,
- FunctionSpec<"fromfpf", RetValSpec<FloatType>, [ArgSpec<FloatType>, ArgSpec<IntType>, ArgSpec<UnsignedIntType>]>,
- FunctionSpec<"fromfpl", RetValSpec<LongDoubleType>, [ArgSpec<LongDoubleType>, ArgSpec<IntType>, ArgSpec<UnsignedIntType>]>,
- GuardedFunctionSpec<"fromfpf16", RetValSpec<Float16Type>, [ArgSpec<Float16Type>, ArgSpec<IntType>, ArgSpec<UnsignedIntType>], "LIBC_TYPES_HAS_FLOAT16">,
- GuardedFunctionSpec<"fromfpf128", RetValSpec<Float128Type>, [ArgSpec<Float128Type>, ArgSpec<IntType>, ArgSpec<UnsignedIntType>], "LIBC_TYPES_HAS_FLOAT128">,
-
- FunctionSpec<"fromfpx", RetValSpec<DoubleType>, [ArgSpec<DoubleType>, ArgSpec<IntType>, ArgSpec<UnsignedIntType>]>,
- FunctionSpec<"fromfpxf", RetValSpec<FloatType>, [ArgSpec<FloatType>, ArgSpec<IntType>, ArgSpec<UnsignedIntType>]>,
- FunctionSpec<"fromfpxl", RetValSpec<LongDoubleType>, [ArgSpec<LongDoubleType>, ArgSpec<IntType>, ArgSpec<UnsignedIntType>]>,
- GuardedFunctionSpec<"fromfpxf16", RetValSpec<Float16Type>, [ArgSpec<Float16Type>, ArgSpec<IntType>, ArgSpec<UnsignedIntType>], "LIBC_TYPES_HAS_FLOAT16">,
- GuardedFunctionSpec<"fromfpxf128", RetValSpec<Float128Type>, [ArgSpec<Float128Type>, ArgSpec<IntType>, ArgSpec<UnsignedIntType>], "LIBC_TYPES_HAS_FLOAT128">,
-
- FunctionSpec<"fsub", RetValSpec<FloatType>, [ArgSpec<DoubleType>, ArgSpec<DoubleType>]>,
- FunctionSpec<"fsubl", RetValSpec<FloatType>, [ArgSpec<LongDoubleType>, ArgSpec<LongDoubleType>]>,
-
- FunctionSpec<"ufromfp", RetValSpec<DoubleType>, [ArgSpec<DoubleType>, ArgSpec<IntType>, ArgSpec<UnsignedIntType>]>,
- FunctionSpec<"ufromfpf", RetValSpec<FloatType>, [ArgSpec<FloatType>, ArgSpec<IntType>, ArgSpec<UnsignedIntType>]>,
- FunctionSpec<"ufromfpl", RetValSpec<LongDoubleType>, [ArgSpec<LongDoubleType>, ArgSpec<IntType>, ArgSpec<UnsignedIntType>]>,
- GuardedFunctionSpec<"ufromfpf16", RetValSpec<Float16Type>, [ArgSpec<Float16Type>, ArgSpec<IntType>, ArgSpec<UnsignedIntType>], "LIBC_TYPES_HAS_FLOAT16">,
- GuardedFunctionSpec<"ufromfpf128", RetValSpec<Float128Type>, [ArgSpec<Float128Type>, ArgSpec<IntType>, ArgSpec<UnsignedIntType>], "LIBC_TYPES_HAS_FLOAT128">,
-
- FunctionSpec<"ufromfpx", RetValSpec<DoubleType>, [ArgSpec<DoubleType>, ArgSpec<IntType>, ArgSpec<UnsignedIntType>]>,
- FunctionSpec<"ufromfpxf", RetValSpec<FloatType>, [ArgSpec<FloatType>, ArgSpec<IntType>, ArgSpec<UnsignedIntType>]>,
- FunctionSpec<"ufromfpxl", RetValSpec<LongDoubleType>, [ArgSpec<LongDoubleType>, ArgSpec<IntType>, ArgSpec<UnsignedIntType>]>,
- GuardedFunctionSpec<"ufromfpxf16", RetValSpec<Float16Type>, [ArgSpec<Float16Type>, ArgSpec<IntType>, ArgSpec<UnsignedIntType>], "LIBC_TYPES_HAS_FLOAT16">,
- GuardedFunctionSpec<"ufromfpxf128", RetValSpec<Float128Type>, [ArgSpec<Float128Type>, ArgSpec<IntType>, ArgSpec<UnsignedIntType>], "LIBC_TYPES_HAS_FLOAT128">,
-
- FunctionSpec<"hypot", RetValSpec<DoubleType>, [ArgSpec<DoubleType>, ArgSpec<DoubleType>]>,
- FunctionSpec<"hypotf", RetValSpec<FloatType>, [ArgSpec<FloatType>, ArgSpec<FloatType>]>,
-
- FunctionSpec<"ilogb", RetValSpec<IntType>, [ArgSpec<DoubleType>]>,
- FunctionSpec<"ilogbf", RetValSpec<IntType>, [ArgSpec<FloatType>]>,
- FunctionSpec<"ilogbl", RetValSpec<IntType>, [ArgSpec<LongDoubleType>]>,
- GuardedFunctionSpec<"ilogbf16", RetValSpec<IntType>, [ArgSpec<Float16Type>], "LIBC_TYPES_HAS_FLOAT16">,
- GuardedFunctionSpec<"ilogbf128", RetValSpec<IntType>, [ArgSpec<Float128Type>], "LIBC_TYPES_HAS_FLOAT128">,
-
- FunctionSpec<"llogb", RetValSpec<LongType>, [ArgSpec<DoubleType>]>,
- FunctionSpec<"llogbf", RetValSpec<LongType>, [ArgSpec<FloatType>]>,
- FunctionSpec<"llogbl", RetValSpec<LongType>, [ArgSpec<LongDoubleType>]>,
- GuardedFunctionSpec<"llogbf16", RetValSpec<LongType>, [ArgSpec<Float16Type>], "LIBC_TYPES_HAS_FLOAT16">,
- GuardedFunctionSpec<"llogbf128", RetValSpec<LongType>, [ArgSpec<Float128Type>], "LIBC_TYPES_HAS_FLOAT128">,
-
- FunctionSpec<"ldexp", RetValSpec<DoubleType>, [ArgSpec<DoubleType>, ArgSpec<IntType>]>,
- FunctionSpec<"ldexpf", RetValSpec<FloatType>, [ArgSpec<FloatType>, ArgSpec<IntType>]>,
- FunctionSpec<"ldexpl", RetValSpec<LongDoubleType>, [ArgSpec<LongDoubleType>, ArgSpec<IntType>]>,
- GuardedFunctionSpec<"ldexpf16", RetValSpec<Float16Type>, [ArgSpec<Float16Type>, ArgSpec<IntType>], "LIBC_TYPES_HAS_FLOAT16">,
- GuardedFunctionSpec<"ldexpf128", RetValSpec<Float128Type>, [ArgSpec<Float128Type>, ArgSpec<IntType>], "LIBC_TYPES_HAS_FLOAT128">,
-
- FunctionSpec<"log10", RetValSpec<DoubleType>, [ArgSpec<DoubleType>]>,
- FunctionSpec<"log10f", RetValSpec<FloatType>, [ArgSpec<FloatType>]>,
- GuardedFunctionSpec<"log10f16", RetValSpec<Float16Type>, [ArgSpec<Float16Type>], "LIBC_TYPES_HAS_FLOAT16">,
-
- FunctionSpec<"log1p", RetValSpec<DoubleType>, [ArgSpec<DoubleType>]>,
- FunctionSpec<"log1pf", RetValSpec<FloatType>, [ArgSpec<FloatType>]>,
-
- FunctionSpec<"log2", RetValSpec<DoubleType>, [ArgSpec<DoubleType>]>,
- FunctionSpec<"log2f", RetValSpec<FloatType>, [ArgSpec<FloatType>]>,
- GuardedFunctionSpec<"log2f16", RetValSpec<Float16Type>, [ArgSpec<Float16Type>], "LIBC_TYPES_HAS_FLOAT16">,
-
- FunctionSpec<"log", RetValSpec<DoubleType>, [ArgSpec<DoubleType>]>,
- FunctionSpec<"logf", RetValSpec<FloatType>, [ArgSpec<FloatType>]>,
- GuardedFunctionSpec<"logf16", RetValSpec<Float16Type>, [ArgSpec<Float16Type>], "LIBC_TYPES_HAS_FLOAT16">,
-
- FunctionSpec<"logb", RetValSpec<DoubleType>, [ArgSpec<DoubleType>]>,
- FunctionSpec<"logbf", RetValSpec<FloatType>, [ArgSpec<FloatType>]>,
- FunctionSpec<"logbl", RetValSpec<LongDoubleType>, [ArgSpec<LongDoubleType>]>,
- GuardedFunctionSpec<"logbf16", RetValSpec<Float16Type>, [ArgSpec<Float16Type>], "LIBC_TYPES_HAS_FLOAT16">,
- GuardedFunctionSpec<"logbf128", RetValSpec<Float128Type>, [ArgSpec<Float128Type>], "LIBC_TYPES_HAS_FLOAT128">,
-
- FunctionSpec<"modf", RetValSpec<DoubleType>, [ArgSpec<DoubleType>, ArgSpec<DoublePtr>]>,
- FunctionSpec<"modff", RetValSpec<FloatType>, [ArgSpec<FloatType>, ArgSpec<FloatPtr>]>,
- FunctionSpec<"modfl", RetValSpec<LongDoubleType>, [ArgSpec<LongDoubleType>, ArgSpec<LongDoublePtr>]>,
- GuardedFunctionSpec<"modff16", RetValSpec<Float16Type>, [ArgSpec<Float16Type>, ArgSpec<Float16Ptr>], "LIBC_TYPES_HAS_FLOAT16">,
- GuardedFunctionSpec<"modff128", RetValSpec<Float128Type>, [ArgSpec<Float128Type>, ArgSpec<Float128Ptr>], "LIBC_TYPES_HAS_FLOAT128">,
-
- FunctionSpec<"cos", RetValSpec<DoubleType>, [ArgSpec<DoubleType>]>,
- FunctionSpec<"cosf", RetValSpec<FloatType>, [ArgSpec<FloatType>]>,
- FunctionSpec<"sin", RetValSpec<DoubleType>, [ArgSpec<DoubleType>]>,
- FunctionSpec<"sinf", RetValSpec<FloatType>, [ArgSpec<FloatType>]>,
- FunctionSpec<"tan", RetValSpec<DoubleType>, [ArgSpec<DoubleType>]>,
- FunctionSpec<"tanf", RetValSpec<FloatType>, [ArgSpec<FloatType>]>,
-
- FunctionSpec<"erff", RetValSpec<FloatType>, [ArgSpec<FloatType>]>,
-
- FunctionSpec<"exp", RetValSpec<DoubleType>, [ArgSpec<DoubleType>]>,
- FunctionSpec<"expf", RetValSpec<FloatType>, [ArgSpec<FloatType>]>,
- GuardedFunctionSpec<"expf16", RetValSpec<Float16Type>, [ArgSpec<Float16Type>], "LIBC_TYPES_HAS_FLOAT16">,
-
- FunctionSpec<"exp2", RetValSpec<DoubleType>, [ArgSpec<DoubleType>]>,
- FunctionSpec<"exp2f", RetValSpec<FloatType>, [ArgSpec<FloatType>]>,
- GuardedFunctionSpec<"exp2f16", RetValSpec<Float16Type>, [ArgSpec<Float16Type>], "LIBC_TYPES_HAS_FLOAT16">,
-
- FunctionSpec<"exp2m1f", RetValSpec<FloatType>, [ArgSpec<FloatType>]>,
- GuardedFunctionSpec<"exp2m1f16", RetValSpec<Float16Type>, [ArgSpec<Float16Type>], "LIBC_TYPES_HAS_FLOAT16">,
-
- FunctionSpec<"expm1", RetValSpec<DoubleType>, [ArgSpec<DoubleType>]>,
- FunctionSpec<"expm1f", RetValSpec<FloatType>, [ArgSpec<FloatType>]>,
- GuardedFunctionSpec<"expm1f16", RetValSpec<Float16Type>, [ArgSpec<Float16Type>], "LIBC_TYPES_HAS_FLOAT16">,
-
- FunctionSpec<"exp10", RetValSpec<DoubleType>, [ArgSpec<DoubleType>]>,
- FunctionSpec<"exp10f", RetValSpec<FloatType>, [ArgSpec<FloatType>]>,
- GuardedFunctionSpec<"exp10f16", RetValSpec<Float16Type>, [ArgSpec<Float16Type>], "LIBC_TYPES_HAS_FLOAT16">,
-
- FunctionSpec<"exp10m1f", RetValSpec<FloatType>, [ArgSpec<FloatType>]>,
- GuardedFunctionSpec<"exp10m1f16", RetValSpec<Float16Type>, [ArgSpec<Float16Type>], "LIBC_TYPES_HAS_FLOAT16">,
-
- FunctionSpec<"remainder", RetValSpec<DoubleType>, [ArgSpec<DoubleType>, ArgSpec<DoubleType>]>,
- FunctionSpec<"remainderf", RetValSpec<FloatType>, [ArgSpec<FloatType>, ArgSpec<FloatType>]>,
- FunctionSpec<"remainderl", RetValSpec<LongDoubleType>, [ArgSpec<LongDoubleType>, ArgSpec<LongDoubleType>]>,
- GuardedFunctionSpec<"remainderf16", RetValSpec<Float16Type>, [ArgSpec<Float16Type>, ArgSpec<Float16Type>], "LIBC_TYPES_HAS_FLOAT16">,
- GuardedFunctionSpec<"remainderf128", RetValSpec<Float128Type>, [ArgSpec<Float128Type>, ArgSpec<Float128Type>], "LIBC_TYPES_HAS_FLOAT128">,
-
- FunctionSpec<"remquo", RetValSpec<DoubleType>, [ArgSpec<DoubleType>, ArgSpec<DoubleType>, ArgSpec<IntPtr>]>,
- FunctionSpec<"remquof", RetValSpec<FloatType>, [ArgSpec<FloatType>, ArgSpec<FloatType>, ArgSpec<IntPtr>]>,
- FunctionSpec<"remquol", RetValSpec<LongDoubleType>, [ArgSpec<LongDoubleType>, ArgSpec<LongDoubleType>, ArgSpec<IntPtr>]>,
- GuardedFunctionSpec<"remquof16", RetValSpec<Float16Type>, [ArgSpec<Float16Type>, ArgSpec<Float16Type>, ArgSpec<IntPtr>], "LIBC_TYPES_HAS_FLOAT16">,
- GuardedFunctionSpec<"remquof128", RetValSpec<Float128Type>, [ArgSpec<Float128Type>, ArgSpec<Float128Type>, ArgSpec<IntPtr>], "LIBC_TYPES_HAS_FLOAT128">,
-
- FunctionSpec<"round", RetValSpec<DoubleType>, [ArgSpec<DoubleType>]>,
- FunctionSpec<"roundf", RetValSpec<FloatType>, [ArgSpec<FloatType>]>,
- FunctionSpec<"roundl", RetValSpec<LongDoubleType>, [ArgSpec<LongDoubleType>]>,
- GuardedFunctionSpec<"roundf16", RetValSpec<Float16Type>, [ArgSpec<Float16Type>], "LIBC_TYPES_HAS_FLOAT16">,
- GuardedFunctionSpec<"roundf128", RetValSpec<Float128Type>, [ArgSpec<Float128Type>], "LIBC_TYPES_HAS_FLOAT128">,
-
- FunctionSpec<"roundeven", RetValSpec<DoubleType>, [ArgSpec<DoubleType>]>,
- FunctionSpec<"roundevenf", RetValSpec<FloatType>, [ArgSpec<FloatType>]>,
- FunctionSpec<"roundevenl", RetValSpec<LongDoubleType>, [ArgSpec<LongDoubleType>]>,
- GuardedFunctionSpec<"roundevenf16", RetValSpec<Float16Type>, [ArgSpec<Float16Type>], "LIBC_TYPES_HAS_FLOAT16">,
- GuardedFunctionSpec<"roundevenf128", RetValSpec<Float128Type>, [ArgSpec<Float128Type>], "LIBC_TYPES_HAS_FLOAT128">,
-
- FunctionSpec<"lround", RetValSpec<LongType>, [ArgSpec<DoubleType>]>,
- FunctionSpec<"lroundf", RetValSpec<LongType>, [ArgSpec<FloatType>]>,
- FunctionSpec<"lroundl", RetValSpec<LongType>, [ArgSpec<LongDoubleType>]>,
- GuardedFunctionSpec<"lroundf16", RetValSpec<LongType>, [ArgSpec<Float16Type>], "LIBC_TYPES_HAS_FLOAT16">,
- GuardedFunctionSpec<"lroundf128", RetValSpec<LongType>, [ArgSpec<Float128Type>], "LIBC_TYPES_HAS_FLOAT128">,
-
- FunctionSpec<"llround", RetValSpec<LongLongType>, [ArgSpec<DoubleType>]>,
- FunctionSpec<"llroundf", RetValSpec<LongLongType>, [ArgSpec<FloatType>]>,
- FunctionSpec<"llroundl", RetValSpec<LongLongType>, [ArgSpec<LongDoubleType>]>,
- GuardedFunctionSpec<"llroundf16", RetValSpec<LongLongType>, [ArgSpec<Float16Type>], "LIBC_TYPES_HAS_FLOAT16">,
- GuardedFunctionSpec<"llroundf128", RetValSpec<LongLongType>, [ArgSpec<Float128Type>], "LIBC_TYPES_HAS_FLOAT128">,
-
- FunctionSpec<"rint", RetValSpec<DoubleType>, [ArgSpec<DoubleType>]>,
- FunctionSpec<"rintf", RetValSpec<FloatType>, [ArgSpec<FloatType>]>,
- FunctionSpec<"rintl", RetValSpec<LongDoubleType>, [ArgSpec<LongDoubleType>]>,
- GuardedFunctionSpec<"rintf16", RetValSpec<Float16Type>, [ArgSpec<Float16Type>], "LIBC_TYPES_HAS_FLOAT16">,
- GuardedFunctionSpec<"rintf128", RetValSpec<Float128Type>, [ArgSpec<Float128Type>], "LIBC_TYPES_HAS_FLOAT128">,
-
- FunctionSpec<"lrint", RetValSpec<LongType>, [ArgSpec<DoubleType>]>,
- FunctionSpec<"lrintf", RetValSpec<LongType>, [ArgSpec<FloatType>]>,
- FunctionSpec<"lrintl", RetValSpec<LongType>, [ArgSpec<LongDoubleType>]>,
- GuardedFunctionSpec<"lrintf16", RetValSpec<LongType>, [ArgSpec<Float16Type>], "LIBC_TYPES_HAS_FLOAT16">,
- GuardedFunctionSpec<"lrintf128", RetValSpec<LongType>, [ArgSpec<Float128Type>], "LIBC_TYPES_HAS_FLOAT128">,
-
- FunctionSpec<"llrint", RetValSpec<LongLongType>, [ArgSpec<DoubleType>]>,
- FunctionSpec<"llrintf", RetValSpec<LongLongType>, [ArgSpec<FloatType>]>,
- FunctionSpec<"llrintl", RetValSpec<LongLongType>, [ArgSpec<LongDoubleType>]>,
- GuardedFunctionSpec<"llrintf16", RetValSpec<LongLongType>, [ArgSpec<Float16Type>], "LIBC_TYPES_HAS_FLOAT16">,
- GuardedFunctionSpec<"llrintf128", RetValSpec<LongLongType>, [ArgSpec<Float128Type>], "LIBC_TYPES_HAS_FLOAT128">,
-
- FunctionSpec<"sqrt", RetValSpec<DoubleType>, [ArgSpec<DoubleType>]>,
- FunctionSpec<"sqrtf", RetValSpec<FloatType>, [ArgSpec<FloatType>]>,
- FunctionSpec<"sqrtl", RetValSpec<LongDoubleType>, [ArgSpec<LongDoubleType>]>,
- GuardedFunctionSpec<"sqrtf16", RetValSpec<Float16Type>, [ArgSpec<Float16Type>], "LIBC_TYPES_HAS_FLOAT16">,
- GuardedFunctionSpec<"sqrtf128", RetValSpec<Float128Type>, [ArgSpec<Float128Type>], "LIBC_TYPES_HAS_FLOAT128">,
-
- FunctionSpec<"trunc", RetValSpec<DoubleType>, [ArgSpec<DoubleType>]>,
- FunctionSpec<"truncf", RetValSpec<FloatType>, [ArgSpec<FloatType>]>,
- FunctionSpec<"truncl", RetValSpec<LongDoubleType>, [ArgSpec<LongDoubleType>]>,
- GuardedFunctionSpec<"truncf16", RetValSpec<Float16Type>, [ArgSpec<Float16Type>], "LIBC_TYPES_HAS_FLOAT16">,
- GuardedFunctionSpec<"truncf128", RetValSpec<Float128Type>, [ArgSpec<Float128Type>], "LIBC_TYPES_HAS_FLOAT128">,
-
- FunctionSpec<"nearbyint", RetValSpec<DoubleType>, [ArgSpec<DoubleType>]>,
- FunctionSpec<"nearbyintf", RetValSpec<FloatType>, [ArgSpec<FloatType>]>,
- FunctionSpec<"nearbyintl", RetValSpec<LongDoubleType>, [ArgSpec<LongDoubleType>]>,
- GuardedFunctionSpec<"nearbyintf16", RetValSpec<Float16Type>, [ArgSpec<Float16Type>], "LIBC_TYPES_HAS_FLOAT16">,
- GuardedFunctionSpec<"nearbyintf128", RetValSpec<Float128Type>, [ArgSpec<Float128Type>], "LIBC_TYPES_HAS_FLOAT128">,
-
- FunctionSpec<"nextafterf", RetValSpec<FloatType>, [ArgSpec<FloatType>, ArgSpec<FloatType>]>,
- FunctionSpec<"nextafter", RetValSpec<DoubleType>, [ArgSpec<DoubleType>, ArgSpec<DoubleType>]>,
- FunctionSpec<"nextafterl", RetValSpec<LongDoubleType>, [ArgSpec<LongDoubleType>, ArgSpec<LongDoubleType>]>,
- GuardedFunctionSpec<"nextafterf16", RetValSpec<Float16Type>, [ArgSpec<Float16Type>, ArgSpec<Float16Type>], "LIBC_TYPES_HAS_FLOAT16">,
- GuardedFunctionSpec<"nextafterf128", RetValSpec<Float128Type>, [ArgSpec<Float128Type>, ArgSpec<Float128Type>], "LIBC_TYPES_HAS_FLOAT128">,
-
- FunctionSpec<"nexttowardf", RetValSpec<FloatType>, [ArgSpec<FloatType>, ArgSpec<LongDoubleType>]>,
- FunctionSpec<"nexttoward", RetValSpec<DoubleType>, [ArgSpec<DoubleType>, ArgSpec<LongDoubleType>]>,
- FunctionSpec<"nexttowardl", RetValSpec<LongDoubleType>, [ArgSpec<LongDoubleType>, ArgSpec<LongDoubleType>]>,
- GuardedFunctionSpec<"nexttowardf16", RetValSpec<Float16Type>, [ArgSpec<Float16Type>, ArgSpec<Float16Type>], "LIBC_TYPES_HAS_FLOAT16">,
-
- FunctionSpec<"nextdown", RetValSpec<DoubleType>, [ArgSpec<DoubleType>]>,
- FunctionSpec<"nextdownf", RetValSpec<FloatType>, [ArgSpec<FloatType>]>,
- FunctionSpec<"nextdownl", RetValSpec<LongDoubleType>, [ArgSpec<LongDoubleType>]>,
- GuardedFunctionSpec<"nextdownf16", RetValSpec<Float16Type>, [ArgSpec<Float16Type>], "LIBC_TYPES_HAS_FLOAT16">,
- GuardedFunctionSpec<"nextdownf128", RetValSpec<Float128Type>, [ArgSpec<Float128Type>], "LIBC_TYPES_HAS_FLOAT128">,
-
- FunctionSpec<"nextup", RetValSpec<DoubleType>, [ArgSpec<DoubleType>]>,
- FunctionSpec<"nextupf", RetValSpec<FloatType>, [ArgSpec<FloatType>]>,
- FunctionSpec<"nextupl", RetValSpec<LongDoubleType>, [ArgSpec<LongDoubleType>]>,
- GuardedFunctionSpec<"nextupf16", RetValSpec<Float16Type>, [ArgSpec<Float16Type>], "LIBC_TYPES_HAS_FLOAT16">,
- GuardedFunctionSpec<"nextupf128", RetValSpec<Float128Type>, [ArgSpec<Float128Type>], "LIBC_TYPES_HAS_FLOAT128">,
-
- FunctionSpec<"powf", RetValSpec<FloatType>, [ArgSpec<FloatType>, ArgSpec<FloatType>]>,
- FunctionSpec<"pow", RetValSpec<DoubleType>, [ArgSpec<DoubleType>, ArgSpec<DoubleType>]>,
-
- FunctionSpec<"coshf", RetValSpec<FloatType>, [ArgSpec<FloatType>]>,
- GuardedFunctionSpec<"coshf16", RetValSpec<Float16Type>, [ArgSpec<Float16Type>], "LIBC_TYPES_HAS_FLOAT16">,
-
- FunctionSpec<"sinhf", RetValSpec<FloatType>, [ArgSpec<FloatType>]>,
- GuardedFunctionSpec<"sinhf16", RetValSpec<Float16Type>, [ArgSpec<Float16Type>], "LIBC_TYPES_HAS_FLOAT16">,
-
- FunctionSpec<"tanhf", RetValSpec<FloatType>, [ArgSpec<FloatType>]>,
- GuardedFunctionSpec<"tanhf16", RetValSpec<Float16Type>, [ArgSpec<Float16Type>], "LIBC_TYPES_HAS_FLOAT16">,
-
- FunctionSpec<"acosf", RetValSpec<FloatType>, [ArgSpec<FloatType>]>,
-
- FunctionSpec<"asinf", RetValSpec<FloatType>, [ArgSpec<FloatType>]>,
- FunctionSpec<"asin", RetValSpec<DoubleType>, [ArgSpec<DoubleType>]>,
-
- FunctionSpec<"atanf", RetValSpec<FloatType>, [ArgSpec<FloatType>]>,
-
- FunctionSpec<"atan2", RetValSpec<DoubleType>, [ArgSpec<DoubleType>, ArgSpec<DoubleType>]>,
- FunctionSpec<"atan2f", RetValSpec<FloatType>, [ArgSpec<FloatType>, ArgSpec<FloatType>]>,
- FunctionSpec<"atan2l", RetValSpec<LongDoubleType>, [ArgSpec<LongDoubleType>, ArgSpec<LongDoubleType>]>,
-
- FunctionSpec<"acoshf", RetValSpec<FloatType>, [ArgSpec<FloatType>]>,
- FunctionSpec<"asinhf", RetValSpec<FloatType>, [ArgSpec<FloatType>]>,
- FunctionSpec<"atanhf", RetValSpec<FloatType>, [ArgSpec<FloatType>]>,
-
- FunctionSpec<"scalbln", RetValSpec<DoubleType>, [ArgSpec<DoubleType>, ArgSpec<LongType>]>,
- FunctionSpec<"scalblnf", RetValSpec<FloatType>, [ArgSpec<FloatType>, ArgSpec<LongType>]>,
- FunctionSpec<"scalblnl", RetValSpec<LongDoubleType>, [ArgSpec<LongDoubleType>, ArgSpec<LongType>]>,
- GuardedFunctionSpec<"scalblnf16", RetValSpec<Float16Type>, [ArgSpec<Float16Type>, ArgSpec<LongType>], "LIBC_TYPES_HAS_FLOAT16">,
- GuardedFunctionSpec<"scalblnf128", RetValSpec<Float128Type>, [ArgSpec<Float128Type>, ArgSpec<LongType>], "LIBC_TYPES_HAS_FLOAT128">,
-
- FunctionSpec<"scalbn", RetValSpec<DoubleType>, [ArgSpec<DoubleType>, ArgSpec<IntType>]>,
- FunctionSpec<"scalbnf", RetValSpec<FloatType>, [ArgSpec<FloatType>, ArgSpec<IntType>]>,
- FunctionSpec<"scalbnl", RetValSpec<LongDoubleType>, [ArgSpec<LongDoubleType>, ArgSpec<IntType>]>,
- GuardedFunctionSpec<"scalbnf16", RetValSpec<Float16Type>, [ArgSpec<Float16Type>, ArgSpec<IntType>], "LIBC_TYPES_HAS_FLOAT16">,
- GuardedFunctionSpec<"scalbnf128", RetValSpec<Float128Type>, [ArgSpec<Float128Type>, ArgSpec<IntType>], "LIBC_TYPES_HAS_FLOAT128">,
-
- FunctionSpec<"nanf", RetValSpec<FloatType>, [ArgSpec<ConstCharPtr>]>,
- FunctionSpec<"nan", RetValSpec<DoubleType>, [ArgSpec<ConstCharPtr>]>,
- FunctionSpec<"nanl", RetValSpec<LongDoubleType>, [ArgSpec<ConstCharPtr>]>,
- GuardedFunctionSpec<"nanf16", RetValSpec<Float16Type>, [ArgSpec<ConstCharPtr>], "LIBC_TYPES_HAS_FLOAT16">,
- GuardedFunctionSpec<"nanf128", RetValSpec<Float128Type>, [ArgSpec<ConstCharPtr>], "LIBC_TYPES_HAS_FLOAT128">,
-
- FunctionSpec<"issignaling", RetValSpec<IntType>, [ArgSpec<DoubleType>]>,
- FunctionSpec<"issignalingf", RetValSpec<IntType>, [ArgSpec<FloatType>]>,
- FunctionSpec<"issignalingl", RetValSpec<IntType>, [ArgSpec<LongDoubleType>]>,
- GuardedFunctionSpec<"issignalingf16", RetValSpec<IntType>, [ArgSpec<Float16Type>], "LIBC_TYPES_HAS_FLOAT16">,
- GuardedFunctionSpec<"issignalingf128", RetValSpec<IntType>, [ArgSpec<Float128Type>], "LIBC_TYPES_HAS_FLOAT128">,
-
- FunctionSpec<"canonicalize", RetValSpec<IntType>, [ArgSpec<DoubleType>, ArgSpec<DoubleType>]>,
- FunctionSpec<"canonicalizef", RetValSpec<IntType>, [ArgSpec<FloatType>, ArgSpec<FloatType>]>,
- FunctionSpec<"canonicalizel", RetValSpec<IntType>, [ArgSpec<LongDoubleType>, ArgSpec<LongDoubleType>]>,
- GuardedFunctionSpec<"canonicalizef16", RetValSpec<IntType>, [ArgSpec<Float16Type>, ArgSpec<Float16Type>], "LIBC_TYPES_HAS_FLOAT16">,
- GuardedFunctionSpec<"canonicalizef128", RetValSpec<IntType>, [ArgSpec<Float128Type>, ArgSpec<Float128Type>], "LIBC_TYPES_HAS_FLOAT128">,
-
- FunctionSpec<"iscanonical", RetValSpec<IntType>, [ArgSpec<DoubleType>]>,
- FunctionSpec<"iscanonicalf", RetValSpec<IntType>, [ArgSpec<FloatType>]>,
- FunctionSpec<"iscanonicall", RetValSpec<IntType>, [ArgSpec<LongDoubleType>]>,
- GuardedFunctionSpec<"iscanonicalf16", RetValSpec<IntType>, [ArgSpec<Float16Type>], "LIBC_TYPES_HAS_FLOAT16">,
- GuardedFunctionSpec<"iscanonicalf128", RetValSpec<IntType>, [ArgSpec<Float128Type>], "LIBC_TYPES_HAS_FLOAT128">,
-
- FunctionSpec<"dsqrtl", RetValSpec<DoubleType>, [ArgSpec<LongDoubleType>]>,
-
- FunctionSpec<"totalorder", RetValSpec<IntType>, [ArgSpec<ConstDoublePtr>, ArgSpec<ConstDoublePtr>]>,
- FunctionSpec<"totalorderf", RetValSpec<IntType>, [ArgSpec<ConstFloatPtr>, ArgSpec<ConstFloatPtr>]>,
- FunctionSpec<"totalorderl", RetValSpec<IntType>, [ArgSpec<ConstLongDoublePtr>, ArgSpec<ConstLongDoublePtr>]>,
- GuardedFunctionSpec<"totalorderf16", RetValSpec<IntType>, [ArgSpec<ConstFloat16Ptr>, ArgSpec<ConstFloat16Ptr>], "LIBC_TYPES_HAS_FLOAT16">,
- GuardedFunctionSpec<"totalorderf128", RetValSpec<IntType>, [ArgSpec<ConstFloat128Ptr>, ArgSpec<ConstFloat128Ptr>], "LIBC_TYPES_HAS_FLOAT128">,
-
- FunctionSpec<"totalordermag", RetValSpec<IntType>, [ArgSpec<ConstDoublePtr>, ArgSpec<ConstDoublePtr>]>,
- FunctionSpec<"totalordermagf", RetValSpec<IntType>, [ArgSpec<ConstFloatPtr>, ArgSpec<ConstFloatPtr>]>,
- FunctionSpec<"totalordermagl", RetValSpec<IntType>, [ArgSpec<ConstLongDoublePtr>, ArgSpec<ConstLongDoublePtr>]>,
- GuardedFunctionSpec<"totalordermagf16", RetValSpec<IntType>, [ArgSpec<ConstFloat16Ptr>, ArgSpec<ConstFloat16Ptr>], "LIBC_TYPES_HAS_FLOAT16">,
- GuardedFunctionSpec<"totalordermagf128", RetValSpec<IntType>, [ArgSpec<ConstFloat128Ptr>, ArgSpec<ConstFloat128Ptr>], "LIBC_TYPES_HAS_FLOAT128">,
-
- FunctionSpec<"getpayload", RetValSpec<DoubleType>, [ArgSpec<DoublePtr>]>,
- FunctionSpec<"getpayloadf", RetValSpec<FloatType>, [ArgSpec<FloatPtr>]>,
- FunctionSpec<"getpayloadl", RetValSpec<LongDoubleType>, [ArgSpec<LongDoublePtr>]>,
- GuardedFunctionSpec<"getpayloadf16", RetValSpec<Float16Type>, [ArgSpec<Float16Ptr>], "LIBC_TYPES_HAS_FLOAT16">,
- GuardedFunctionSpec<"getpayloadf128", RetValSpec<Float128Type>, [ArgSpec<Float128Ptr>], "LIBC_TYPES_HAS_FLOAT128">,
-
- FunctionSpec<"setpayload", RetValSpec<IntType>, [ArgSpec<DoublePtr>, ArgSpec<DoubleType>]>,
- FunctionSpec<"setpayloadf", RetValSpec<IntType>, [ArgSpec<FloatPtr>, ArgSpec<FloatType>]>,
- FunctionSpec<"setpayloadl", RetValSpec<IntType>, [ArgSpec<LongDoublePtr>, ArgSpec<LongDoubleType>]>,
- GuardedFunctionSpec<"setpayloadf16", RetValSpec<IntType>, [ArgSpec<Float16Ptr>, ArgSpec<Float16Type>], "LIBC_TYPES_HAS_FLOAT16">,
- GuardedFunctionSpec<"setpayloadf128", RetValSpec<IntType>, [ArgSpec<Float128Ptr>, ArgSpec<Float128Type>], "LIBC_TYPES_HAS_FLOAT128">,
-
- FunctionSpec<"setpayloadsig", RetValSpec<IntType>, [ArgSpec<DoublePtr>, ArgSpec<DoubleType>]>,
- FunctionSpec<"setpayloadsigf", RetValSpec<IntType>, [ArgSpec<FloatPtr>, ArgSpec<FloatType>]>,
- FunctionSpec<"setpayloadsigl", RetValSpec<IntType>, [ArgSpec<LongDoublePtr>, ArgSpec<LongDoubleType>]>,
- GuardedFunctionSpec<"setpayloadsigf16", RetValSpec<IntType>, [ArgSpec<Float16Ptr>, ArgSpec<Float16Type>], "LIBC_TYPES_HAS_FLOAT16">,
- GuardedFunctionSpec<"setpayloadsigf128", RetValSpec<IntType>, [ArgSpec<Float128Ptr>, ArgSpec<Float128Type>], "LIBC_TYPES_HAS_FLOAT128">,
-
- GuardedFunctionSpec<"f16addf128", RetValSpec<Float16Type>, [ArgSpec<Float128Type>, ArgSpec<Float128Type>], "LIBC_TYPES_HAS_FLOAT16_AND_FLOAT128">,
-
- GuardedFunctionSpec<"f16subf128", RetValSpec<Float16Type>, [ArgSpec<Float128Type>, ArgSpec<Float128Type>], "LIBC_TYPES_HAS_FLOAT16_AND_FLOAT128">,
-
- FunctionSpec<"fmul", RetValSpec<FloatType>, [ArgSpec<DoubleType>, ArgSpec<DoubleType>]>,
- FunctionSpec<"fmull", RetValSpec<FloatType>, [ArgSpec<LongDoubleType>, ArgSpec<LongDoubleType>]>,
-
- FunctionSpec<"dmull", RetValSpec<DoubleType>, [ArgSpec<LongDoubleType>, ArgSpec<LongDoubleType>]>,
-
- GuardedFunctionSpec<"f16mulf128", RetValSpec<Float16Type>, [ArgSpec<Float128Type>, ArgSpec<Float128Type>], "LIBC_TYPES_HAS_FLOAT16_AND_FLOAT128">,
-
- FunctionSpec<"fsqrt", RetValSpec<FloatType>, [ArgSpec<DoubleType>]>,
- FunctionSpec<"fsqrtl", RetValSpec<FloatType>, [ArgSpec<LongDoubleType>]>,
-
- GuardedFunctionSpec<"f16divf128", RetValSpec<Float16Type>, [ArgSpec<Float128Type>, ArgSpec<Float128Type>], "LIBC_TYPES_HAS_FLOAT16_AND_FLOAT128">,
-
- GuardedFunctionSpec<"f16sqrtf128", RetValSpec<Float16Type>, [ArgSpec<Float128Type>], "LIBC_TYPES_HAS_FLOAT16_AND_FLOAT128">,
-
- FunctionSpec<"lgamma", RetValSpec<DoubleType>, [ArgSpec<DoubleType>]>,
- FunctionSpec<"lgammaf", RetValSpec<FloatType>, [ArgSpec<FloatType>]>,
- FunctionSpec<"lgammal", RetValSpec<LongDoubleType>, [ArgSpec<LongDoubleType>]>,
- ]
- >;
-
- HeaderSpec StdIO = HeaderSpec<
- "stdio.h",
- [
- Macro<"stdin">,
- Macro<"stderr">,
- Macro<"stdout">,
- Macro<"_IOFBF">,
- Macro<"_IOLBF">,
- Macro<"_IONBF">,
- Macro<"EOF">,
- ], // Macros
- [ // Types
- SizeTType,
- FILE,
- ],
- [], // Enumerations
- [
- FunctionSpec<
- "clearerr",
- RetValSpec<VoidType>,
- [ArgSpec<FILEPtr>]
- >,
- FunctionSpec<
- "fclose",
- RetValSpec<IntType>,
- [ArgSpec<FILEPtr>]
- >,
- FunctionSpec<
- "feof",
- RetValSpec<IntType>,
- [ArgSpec<FILEPtr>]
- >,
- FunctionSpec<
- "ferror",
- RetValSpec<IntType>,
- [ArgSpec<FILEPtr>]
- >,
- FunctionSpec<
- "fgetc",
- RetValSpec<IntType>,
- [ArgSpec<FILEPtr>]
- >,
- FunctionSpec<
- "fgets",
- RetValSpec<CharPtr>,
- [
- ArgSpec<CharRestrictedPtr>,
- ArgSpec<IntType>,
- ArgSpec<FILERestrictedPtr>,
- ]
- >,
- FunctionSpec<
- "fflush",
- RetValSpec<IntType>,
- [ArgSpec<FILEPtr>]
- >,
- FunctionSpec<
- "fopen",
- RetValSpec<FILEPtr>,
- [ArgSpec<ConstCharPtr>,
- ArgSpec<ConstCharPtr>]
- >,
- FunctionSpec<
- "fputc",
- RetValSpec<IntType>,
- [ArgSpec<IntType>,
- ArgSpec<FILEPtr>]
- >,
- FunctionSpec<
- "ftell",
- RetValSpec<LongType>,
- [ArgSpec<FILEPtr>]
- >,
- FunctionSpec<
- "getc",
- RetValSpec<IntType>,
- [ArgSpec<FILEPtr>]
- >,
- FunctionSpec<
- "getchar",
- RetValSpec<IntType>,
- [ArgSpec<VoidType>]
- >,
- FunctionSpec<
- "putc",
- RetValSpec<IntType>,
- [ArgSpec<IntType>,
- ArgSpec<FILEPtr>]
- >,
- FunctionSpec<
- "putchar",
- RetValSpec<IntType>,
- [ArgSpec<IntType>]
- >,
- FunctionSpec<
- "fputs",
- RetValSpec<IntType>,
- [ArgSpec<ConstCharRestrictedPtr>,
- ArgSpec<FILERestrictedPtr>]
- >,
- FunctionSpec<
- "puts",
- RetValSpec<IntType>,
- [ArgSpec<ConstCharRestrictedPtr>]
- >,
- FunctionSpec<
- "fread",
- RetValSpec<SizeTType>,
- [ArgSpec<VoidRestrictedPtr>,
- ArgSpec<SizeTType>,
- ArgSpec<SizeTType>,
- ArgSpec<FILERestrictedPtr>]
- >,
- FunctionSpec<
- "fseek",
- RetValSpec<IntType>,
- [ArgSpec<FILEPtr>,
- ArgSpec<LongType>,
- ArgSpec<IntType>]
- >,
- FunctionSpec<
- "fwrite",
- RetValSpec<SizeTType>,
- [ArgSpec<ConstVoidRestrictedPtr>,
- ArgSpec<SizeTType>,
- ArgSpec<SizeTType>,
- ArgSpec<FILERestrictedPtr>]
- >,
- FunctionSpec<
- "remove",
- RetValSpec<IntType>,
- [ArgSpec<ConstCharPtr>]
- >,
- FunctionSpec<
- "rename",
- RetValSpec<IntType>,
- [ArgSpec<ConstCharPtr>, ArgSpec<ConstCharPtr>]
- >,
- FunctionSpec<
- "setbuf",
- RetValSpec<VoidType>,
- [ArgSpec<FILERestrictedPtr>, ArgSpec<CharRestrictedPtr>]
- >,
- FunctionSpec<
- "setvbuf",
- RetValSpec<IntType>,
- [ArgSpec<FILERestrictedPtr>, ArgSpec<CharRestrictedPtr>, ArgSpec<IntType>, ArgSpec<SizeTType>]
- >,
- FunctionSpec<
- "sscanf",
- RetValSpec<IntType>,
- [ArgSpec<ConstCharRestrictedPtr>,
- ArgSpec<ConstCharRestrictedPtr>,
- ArgSpec<VarArgType>]
- >,
- FunctionSpec<
- "vsscanf",
- RetValSpec<IntType>,
- [ArgSpec<ConstCharRestrictedPtr>,
- ArgSpec<ConstCharRestrictedPtr>,
- ArgSpec<VaListType>]
- >,
- FunctionSpec<
- "scanf",
- RetValSpec<IntType>,
- [ArgSpec<ConstCharRestrictedPtr>,
- ArgSpec<VarArgType>]
- >,
- FunctionSpec<
- "vscanf",
- RetValSpec<IntType>,
- [ArgSpec<ConstCharRestrictedPtr>,
- ArgSpec<VaListType>]
- >,
- FunctionSpec<
- "fscanf",
- RetValSpec<IntType>,
- [ArgSpec<FILERestrictedPtr>,
- ArgSpec<ConstCharRestrictedPtr>,
- ArgSpec<VarArgType>]
- >,
- FunctionSpec<
- "vfscanf",
- RetValSpec<IntType>,
- [ArgSpec<FILERestrictedPtr>,
- ArgSpec<ConstCharRestrictedPtr>,
- ArgSpec<VaListType>]
- >,
- FunctionSpec<
- "sprintf",
- RetValSpec<IntType>,
- [ArgSpec<CharRestrictedPtr>,
- ArgSpec<ConstCharRestrictedPtr>,
- ArgSpec<VarArgType>]
- >,
- FunctionSpec<
- "snprintf",
- RetValSpec<IntType>,
- [ArgSpec<CharRestrictedPtr>,
- ArgSpec<SizeTType>,
- ArgSpec<ConstCharRestrictedPtr>,
- ArgSpec<VarArgType>]
- >,
- FunctionSpec<
- "printf",
- RetValSpec<IntType>,
- [ArgSpec<ConstCharRestrictedPtr>,
- ArgSpec<VarArgType>]
- >,
- FunctionSpec<
- "fprintf",
- RetValSpec<IntType>,
- [ArgSpec<FILERestrictedPtr>,
- ArgSpec<ConstCharRestrictedPtr>,
- ArgSpec<VarArgType>]
- >,
- FunctionSpec<
- "asprintf",
- RetValSpec<IntType>,
- [ArgSpec<CharRestrictedPtrPtr>,
- ArgSpec<ConstCharRestrictedPtr>,
- ArgSpec<VarArgType>]
- >,
- FunctionSpec<
- "vsprintf",
- RetValSpec<IntType>,
- [ArgSpec<CharRestrictedPtr>,
- ArgSpec<ConstCharRestrictedPtr>,
- ArgSpec<VaListType>]
- >,
- FunctionSpec<
- "vsnprintf",
- RetValSpec<IntType>,
- [ArgSpec<CharRestrictedPtr>,
- ArgSpec<SizeTType>,
- ArgSpec<ConstCharRestrictedPtr>,
- ArgSpec<VaListType>]
- >,
- FunctionSpec<
- "vprintf",
- RetValSpec<IntType>,
- [ArgSpec<ConstCharRestrictedPtr>,
- ArgSpec<VaListType>]
- >,
- FunctionSpec<
- "vfprintf",
- RetValSpec<IntType>,
- [ArgSpec<FILERestrictedPtr>,
- ArgSpec<ConstCharRestrictedPtr>,
- ArgSpec<VaListType>]
- >,
- FunctionSpec<
- "ungetc",
- RetValSpec<IntType>,
- [ArgSpec<IntType>, ArgSpec<FILEPtr>]
- >,
- FunctionSpec<
- "vasprintf",
- RetValSpec<IntType>,
- [ArgSpec<CharRestrictedPtrPtr>,
- ArgSpec<ConstCharRestrictedPtr>,
- ArgSpec<VaListType>]
- >,
- ],
- [
- ObjectSpec<
- "stdin",
- "FILE *"
- >,
- ObjectSpec<
- "stdout",
- "FILE *"
- >,
- ObjectSpec<
- "stderr",
- "FILE *"
- >,
- ]
- >;
-
- HeaderSpec StdBit = HeaderSpec<
- "stdbit.h",
- [
- Macro<"__STDC_VERSION_STDBIT_H__">,
- Macro<"__STDC_ENDIAN_LITTLE__">,
- Macro<"__STDC_ENDIAN_BIG__">,
- Macro<"__STDC_ENDIAN_NATIVE__">,
- Macro<"stdc_leading_zeros">,
- Macro<"stdc_leading_ones">,
- Macro<"stdc_trailing_zeros">,
- Macro<"stdc_trailing_ones">,
- Macro<"stdc_first_leading_zero">,
- Macro<"stdc_first_leading_one">,
- Macro<"stdc_first_trailing_zero">,
- Macro<"stdc_first_trailing_one">,
- Macro<"stdc_count_zeros">,
- Macro<"stdc_count_ones">,
- Macro<"stdc_has_single_bit">,
- Macro<"stdc_bit_width">,
- Macro<"stdc_bit_floor">,
- Macro<"stdc_bit_ceil">
- ], // Macros
- [], // Types
- [], // Enumerations
- [
- FunctionSpec<"stdc_leading_zeros_uc", RetValSpec<UnsignedIntType>, [ArgSpec<UnsignedCharType>]>,
- FunctionSpec<"stdc_leading_zeros_us", RetValSpec<UnsignedIntType>, [ArgSpec<UnsignedShortType>]>,
- FunctionSpec<"stdc_leading_zeros_ui", RetValSpec<UnsignedIntType>, [ArgSpec<UnsignedIntType>]>,
- FunctionSpec<"stdc_leading_zeros_ul", RetValSpec<UnsignedIntType>, [ArgSpec<UnsignedLongType>]>,
- FunctionSpec<"stdc_leading_zeros_ull", RetValSpec<UnsignedIntType>, [ArgSpec<UnsignedLongLongType>]>,
- FunctionSpec<"stdc_leading_ones_uc", RetValSpec<UnsignedIntType>, [ArgSpec<UnsignedCharType>]>,
- FunctionSpec<"stdc_leading_ones_us", RetValSpec<UnsignedIntType>, [ArgSpec<UnsignedShortType>]>,
- FunctionSpec<"stdc_leading_ones_ui", RetValSpec<UnsignedIntType>, [ArgSpec<UnsignedIntType>]>,
- FunctionSpec<"stdc_leading_ones_ul", RetValSpec<UnsignedIntType>, [ArgSpec<UnsignedLongType>]>,
- FunctionSpec<"stdc_leading_ones_ull", RetValSpec<UnsignedIntType>, [ArgSpec<UnsignedLongLongType>]>,
- FunctionSpec<"stdc_trailing_zeros_uc", RetValSpec<UnsignedIntType>, [ArgSpec<UnsignedCharType>]>,
- FunctionSpec<"stdc_trailing_zeros_us", RetValSpec<UnsignedIntType>, [ArgSpec<UnsignedShortType>]>,
- FunctionSpec<"stdc_trailing_zeros_ui", RetValSpec<UnsignedIntType>, [ArgSpec<UnsignedIntType>]>,
- FunctionSpec<"stdc_trailing_zeros_ul", RetValSpec<UnsignedIntType>, [ArgSpec<UnsignedLongType>]>,
- FunctionSpec<"stdc_trailing_zeros_ull", RetValSpec<UnsignedIntType>, [ArgSpec<UnsignedLongLongType>]>,
- FunctionSpec<"stdc_trailing_ones_uc", RetValSpec<UnsignedIntType>, [ArgSpec<UnsignedCharType>]>,
- FunctionSpec<"stdc_trailing_ones_us", RetValSpec<UnsignedIntType>, [ArgSpec<UnsignedShortType>]>,
- FunctionSpec<"stdc_trailing_ones_ui", RetValSpec<UnsignedIntType>, [ArgSpec<UnsignedIntType>]>,
- FunctionSpec<"stdc_trailing_ones_ul", RetValSpec<UnsignedIntType>, [ArgSpec<UnsignedLongType>]>,
- FunctionSpec<"stdc_trailing_ones_ull", RetValSpec<UnsignedIntType>, [ArgSpec<UnsignedLongLongType>]>,
- FunctionSpec<"stdc_first_leading_zero_uc", RetValSpec<UnsignedIntType>, [ArgSpec<UnsignedCharType>]>,
- FunctionSpec<"stdc_first_leading_zero_us", RetValSpec<UnsignedIntType>, [ArgSpec<UnsignedShortType>]>,
- FunctionSpec<"stdc_first_leading_zero_ui", RetValSpec<UnsignedIntType>, [ArgSpec<UnsignedIntType>]>,
- FunctionSpec<"stdc_first_leading_zero_ul", RetValSpec<UnsignedIntType>, [ArgSpec<UnsignedLongType>]>,
- FunctionSpec<"stdc_first_leading_zero_ull", RetValSpec<UnsignedIntType>, [ArgSpec<UnsignedLongLongType>]>,
- FunctionSpec<"stdc_first_leading_one_uc", RetValSpec<UnsignedIntType>, [ArgSpec<UnsignedCharType>]>,
- FunctionSpec<"stdc_first_leading_one_us", RetValSpec<UnsignedIntType>, [ArgSpec<UnsignedShortType>]>,
- FunctionSpec<"stdc_first_leading_one_ui", RetValSpec<UnsignedIntType>, [ArgSpec<UnsignedIntType>]>,
- FunctionSpec<"stdc_first_leading_one_ul", RetValSpec<UnsignedIntType>, [ArgSpec<UnsignedLongType>]>,
- FunctionSpec<"stdc_first_leading_one_ull", RetValSpec<UnsignedIntType>, [ArgSpec<UnsignedLongLongType>]>,
- FunctionSpec<"stdc_first_trailing_one_uc", RetValSpec<UnsignedIntType>, [ArgSpec<UnsignedCharType>]>,
- FunctionSpec<"stdc_first_trailing_one_us", RetValSpec<UnsignedIntType>, [ArgSpec<UnsignedShortType>]>,
- FunctionSpec<"stdc_first_trailing_one_ui", RetValSpec<UnsignedIntType>, [ArgSpec<UnsignedIntType>]>,
- FunctionSpec<"stdc_first_trailing_one_ul", RetValSpec<UnsignedIntType>, [ArgSpec<UnsignedLongType>]>,
- FunctionSpec<"stdc_first_trailing_one_ull", RetValSpec<UnsignedIntType>, [ArgSpec<UnsignedLongLongType>]>,
- FunctionSpec<"stdc_count_zeros_uc", RetValSpec<UnsignedIntType>, [ArgSpec<UnsignedCharType>]>,
- FunctionSpec<"stdc_count_zeros_us", RetValSpec<UnsignedIntType>, [ArgSpec<UnsignedShortType>]>,
- FunctionSpec<"stdc_count_zeros_ui", RetValSpec<UnsignedIntType>, [ArgSpec<UnsignedIntType>]>,
- FunctionSpec<"stdc_count_zeros_ul", RetValSpec<UnsignedIntType>, [ArgSpec<UnsignedLongType>]>,
- FunctionSpec<"stdc_count_zeros_ull", RetValSpec<UnsignedIntType>, [ArgSpec<UnsignedLongLongType>]>,
- FunctionSpec<"stdc_count_ones_uc", RetValSpec<UnsignedIntType>, [ArgSpec<UnsignedCharType>]>,
- FunctionSpec<"stdc_count_ones_us", RetValSpec<UnsignedIntType>, [ArgSpec<UnsignedShortType>]>,
- FunctionSpec<"stdc_count_ones_ui", RetValSpec<UnsignedIntType>, [ArgSpec<UnsignedIntType>]>,
- FunctionSpec<"stdc_count_ones_ul", RetValSpec<UnsignedIntType>, [ArgSpec<UnsignedLongType>]>,
- FunctionSpec<"stdc_count_ones_ull", RetValSpec<UnsignedIntType>, [ArgSpec<UnsignedLongLongType>]>,
- FunctionSpec<"stdc_has_single_bit_uc", RetValSpec<BoolType>, [ArgSpec<UnsignedCharType>]>,
- FunctionSpec<"stdc_has_single_bit_us", RetValSpec<BoolType>, [ArgSpec<UnsignedShortType>]>,
- FunctionSpec<"stdc_has_single_bit_ui", RetValSpec<BoolType>, [ArgSpec<UnsignedIntType>]>,
- FunctionSpec<"stdc_has_single_bit_ul", RetValSpec<BoolType>, [ArgSpec<UnsignedLongType>]>,
- FunctionSpec<"stdc_has_single_bit_ull", RetValSpec<BoolType>, [ArgSpec<UnsignedLongLongType>]>,
- FunctionSpec<"stdc_bit_width_uc", RetValSpec<UnsignedIntType>, [ArgSpec<UnsignedCharType>]>,
- FunctionSpec<"stdc_bit_width_us", RetValSpec<UnsignedIntType>, [ArgSpec<UnsignedShortType>]>,
- FunctionSpec<"stdc_bit_width_ui", RetValSpec<UnsignedIntType>, [ArgSpec<UnsignedIntType>]>,
- FunctionSpec<"stdc_bit_width_ul", RetValSpec<UnsignedIntType>, [ArgSpec<UnsignedLongType>]>,
- FunctionSpec<"stdc_bit_width_ull", RetValSpec<UnsignedIntType>, [ArgSpec<UnsignedLongLongType>]>,
- FunctionSpec<"stdc_bit_floor_uc", RetValSpec<UnsignedCharType>, [ArgSpec<UnsignedCharType>]>,
- FunctionSpec<"stdc_bit_floor_us", RetValSpec<UnsignedShortType>, [ArgSpec<UnsignedShortType>]>,
- FunctionSpec<"stdc_bit_floor_ui", RetValSpec<UnsignedIntType>, [ArgSpec<UnsignedIntType>]>,
- FunctionSpec<"stdc_bit_floor_ul", RetValSpec<UnsignedLongType>, [ArgSpec<UnsignedLongType>]>,
- FunctionSpec<"stdc_bit_floor_ull", RetValSpec<UnsignedLongLongType>, [ArgSpec<UnsignedLongLongType>]>,
- FunctionSpec<"stdc_bit_ceil_uc", RetValSpec<UnsignedCharType>, [ArgSpec<UnsignedCharType>]>,
- FunctionSpec<"stdc_bit_ceil_us", RetValSpec<UnsignedShortType>, [ArgSpec<UnsignedShortType>]>,
- FunctionSpec<"stdc_bit_ceil_ui", RetValSpec<UnsignedIntType>, [ArgSpec<UnsignedIntType>]>,
- FunctionSpec<"stdc_bit_ceil_ul", RetValSpec<UnsignedLongType>, [ArgSpec<UnsignedLongType>]>,
- FunctionSpec<"stdc_bit_ceil_ull", RetValSpec<UnsignedLongLongType>, [ArgSpec<UnsignedLongLongType>]>
- ] // Functions
- >;
-
- HeaderSpec StdCkdInt = HeaderSpec<
- "stdckdint.h",
- [
- Macro<"__STDC_VERSION_STDCKDINT_H__">,
- Macro<"ckd_add">,
- Macro<"ckd_sub">,
- Macro<"ckd_mul">
- ], // Macros
- [], // Types
- [], // Enumerations
- [] // Functions
- >;
-
- HeaderSpec StdLib = HeaderSpec<
- "stdlib.h",
- [], // Macros
- [
- DivTType,
- LDivTType,
- LLDivTType,
- SizeTType,
- BSearchCompareT,
- QSortCompareT,
- AtexitHandlerT,
- ], // Types
- [], // Enumerations
- [
- FunctionSpec<"abort", RetValSpec<NoReturn>, [ArgSpec<VoidType>]>,
-
- FunctionSpec<"bsearch", RetValSpec<VoidPtr>, [ArgSpec<ConstVoidPtr>, ArgSpec<ConstVoidPtr>, ArgSpec<SizeTType>, ArgSpec<SizeTType>, ArgSpec<BSearchCompareT>]>,
-
- FunctionSpec<"abs", RetValSpec<IntType>, [ArgSpec<IntType>]>,
- FunctionSpec<"labs", RetValSpec<LongType>, [ArgSpec<LongType>]>,
- FunctionSpec<"llabs", RetValSpec<LongLongType>, [ArgSpec<LongLongType>]>,
-
- FunctionSpec<"atof", RetValSpec<DoubleType>, [ArgSpec<ConstCharRestrictedPtr>]>,
- FunctionSpec<"atoi", RetValSpec<IntType>, [ArgSpec<ConstCharPtr>]>,
- FunctionSpec<"atol", RetValSpec<LongType>, [ArgSpec<ConstCharPtr>]>,
- FunctionSpec<"atoll", RetValSpec<LongLongType>, [ArgSpec<ConstCharPtr>]>,
-
- FunctionSpec<"div", RetValSpec<DivTType>, [ArgSpec<IntType>, ArgSpec<IntType>]>,
- FunctionSpec<"ldiv", RetValSpec<LDivTType>, [ArgSpec<LongType>, ArgSpec<LongType>]>,
- FunctionSpec<"lldiv", RetValSpec<LLDivTType>, [ArgSpec<LongLongType>, ArgSpec<LongLongType>]>,
-
- FunctionSpec<"qsort", RetValSpec<VoidType>, [ArgSpec<VoidPtr>, ArgSpec<SizeTType>, ArgSpec<SizeTType>, ArgSpec<QSortCompareT>]>,
-
- FunctionSpec<"rand", RetValSpec<IntType>, [ArgSpec<VoidType>]>,
- FunctionSpec<"srand", RetValSpec<VoidType>, [ArgSpec<UnsignedIntType>]>,
-
- FunctionSpec<"strfromf", RetValSpec<IntType>, [ArgSpec<CharRestrictedPtr>, ArgSpec<SizeTType>, ArgSpec<ConstCharRestrictedPtr>, ArgSpec<FloatType>]>,
- FunctionSpec<"strfromd", RetValSpec<IntType>, [ArgSpec<CharRestrictedPtr>, ArgSpec<SizeTType>, ArgSpec<ConstCharRestrictedPtr>, ArgSpec<DoubleType>]>,
- FunctionSpec<"strfroml", RetValSpec<IntType>, [ArgSpec<CharRestrictedPtr>, ArgSpec<SizeTType>, ArgSpec<ConstCharRestrictedPtr>, ArgSpec<LongDoubleType>]>,
-
- FunctionSpec<"strtof", RetValSpec<FloatType>, [ArgSpec<ConstCharRestrictedPtr>, ArgSpec<CharRestrictedPtrPtr>]>,
- FunctionSpec<"strtod", RetValSpec<DoubleType>, [ArgSpec<ConstCharRestrictedPtr>, ArgSpec<CharRestrictedPtrPtr>]>,
- FunctionSpec<"strtold", RetValSpec<LongDoubleType>, [ArgSpec<ConstCharRestrictedPtr>, ArgSpec<CharRestrictedPtrPtr>]>,
- FunctionSpec<"strtol", RetValSpec<LongType>, [ArgSpec<ConstCharRestrictedPtr>, ArgSpec<CharRestrictedPtrPtr>, ArgSpec<IntType>]>,
- FunctionSpec<"strtoll", RetValSpec<LongLongType>, [ArgSpec<ConstCharRestrictedPtr>, ArgSpec<CharRestrictedPtrPtr>, ArgSpec<IntType>]>,
- FunctionSpec<"strtoul", RetValSpec<UnsignedLongType>, [ArgSpec<ConstCharRestrictedPtr>, ArgSpec<CharRestrictedPtrPtr>, ArgSpec<IntType>]>,
- FunctionSpec<"strtoull", RetValSpec<UnsignedLongLongType>, [ArgSpec<ConstCharRestrictedPtr>, ArgSpec<CharRestrictedPtrPtr>, ArgSpec<IntType>]>,
-
- FunctionSpec<"strtof_l", RetValSpec<FloatType>, [ArgSpec<ConstCharRestrictedPtr>, ArgSpec<CharRestrictedPtrPtr>, ArgSpec<LocaleT>]>,
- FunctionSpec<"strtod_l", RetValSpec<DoubleType>, [ArgSpec<ConstCharRestrictedPtr>, ArgSpec<CharRestrictedPtrPtr>, ArgSpec<LocaleT>]>,
- FunctionSpec<"strtold_l", RetValSpec<LongDoubleType>, [ArgSpec<ConstCharRestrictedPtr>, ArgSpec<CharRestrictedPtrPtr>, ArgSpec<LocaleT>]>,
- FunctionSpec<"strtol_l", RetValSpec<LongType>, [ArgSpec<ConstCharRestrictedPtr>, ArgSpec<CharRestrictedPtrPtr>, ArgSpec<IntType>, ArgSpec<LocaleT>]>,
- FunctionSpec<"strtoll_l", RetValSpec<LongLongType>, [ArgSpec<ConstCharRestrictedPtr>, ArgSpec<CharRestrictedPtrPtr>, ArgSpec<IntType>, ArgSpec<LocaleT>]>,
- FunctionSpec<"strtoul_l", RetValSpec<UnsignedLongType>, [ArgSpec<ConstCharRestrictedPtr>, ArgSpec<CharRestrictedPtrPtr>, ArgSpec<IntType>, ArgSpec<LocaleT>]>,
- FunctionSpec<"strtoull_l", RetValSpec<UnsignedLongLongType>, [ArgSpec<ConstCharRestrictedPtr>, ArgSpec<CharRestrictedPtrPtr>, ArgSpec<IntType>, ArgSpec<LocaleT>]>,
-
- FunctionSpec<"malloc", RetValSpec<VoidPtr>, [ArgSpec<SizeTType>]>,
- FunctionSpec<"calloc", RetValSpec<VoidPtr>, [ArgSpec<SizeTType>, ArgSpec<SizeTType>]>,
- FunctionSpec<"realloc", RetValSpec<VoidPtr>, [ArgSpec<VoidPtr>, ArgSpec<SizeTType>]>,
- FunctionSpec<"aligned_alloc", RetValSpec<VoidPtr>, [ArgSpec<SizeTType>, ArgSpec<SizeTType>]>,
- FunctionSpec<"free", RetValSpec<VoidType>, [ArgSpec<VoidPtr>]>,
-
- FunctionSpec<"_Exit", RetValSpec<NoReturn>, [ArgSpec<IntType>]>,
- FunctionSpec<"at_quick_exit", RetValSpec<IntType>, [ArgSpec<AtexitHandlerT>]>,
- FunctionSpec<"atexit", RetValSpec<IntType>, [ArgSpec<AtexitHandlerT>]>,
- FunctionSpec<"exit", RetValSpec<NoReturn>, [ArgSpec<IntType>]>,
- FunctionSpec<"quick_exit", RetValSpec<NoReturn>, [ArgSpec<IntType>]>,
-
- FunctionSpec<"system", RetValSpec<IntType>, [ArgSpec<ConstCharPtr>]>,
- ]
- >;
-
- NamedType IMaxDivTType = NamedType<"imaxdiv_t">;
-
- HeaderSpec IntTypes = HeaderSpec<
- "inttypes.h",
- [
- Macro<"__STDC_VERSION_INTTYPES_H__">,
- ], // Macros
- [
- IMaxDivTType,
- ], // Types
- [], // Enumerations
- [
- FunctionSpec<"imaxabs", RetValSpec<IntMaxTType>, [ArgSpec<IntMaxTType>]>,
- FunctionSpec<"imaxdiv", RetValSpec<IMaxDivTType>, [ArgSpec<IntMaxTType>, ArgSpec<IntMaxTType>]>,
- FunctionSpec<"strtoimax", RetValSpec<IntMaxTType>, [ArgSpec<ConstCharRestrictedPtr>, ArgSpec<CharRestrictedPtrPtr>, ArgSpec<IntType>]>,
- FunctionSpec<"strtoumax", RetValSpec<UIntMaxTType>, [ArgSpec<ConstCharRestrictedPtr>, ArgSpec<CharRestrictedPtrPtr>, ArgSpec<IntType>]>,
- ]
- >;
-
- HeaderSpec Errno = HeaderSpec<
- "errno.h",
- [
- Macro<"errno">,
- Macro<"EDOM">,
- Macro<"EILSEQ">,
- Macro<"ERANGE">,
- ]
- >;
-
- HeaderSpec Float = HeaderSpec<
- "float.h",
- [
- Macro<"FLT_MANT_DIG">,
- Macro<"DBL_MANT_DIG">,
- Macro<"LDBL_MANT_DIG">,
- ]
- >;
-
- HeaderSpec StdInt = HeaderSpec<"StdInt.h">;
-
- HeaderSpec Limits = HeaderSpec<"limits.h">;
-
- NamedType SigAtomicT = NamedType<"sig_atomic_t">;
- HeaderSpec Signal = HeaderSpec<
- "signal.h",
- [
- Macro<"SIG_BLOCK">,
- Macro<"SIG_UNBLOCK">,
- Macro<"SIG_SETMASK">,
-
- Macro<"SIGABRT">,
- Macro<"SIGFPE">,
- Macro<"SIGILL">,
- Macro<"SIGINT">,
- Macro<"SIGSEGV">,
- Macro<"SIGTERM">
- ],
- [
- SizeTType,
- SigAtomicT,
- SigHandlerT,
- ],
- [], // Enumerations
- [
- FunctionSpec<"raise", RetValSpec<IntType>, [ArgSpec<IntType>]>,
- FunctionSpec<
- "signal",
- RetValSpec<SigHandlerT>,
- [ArgSpec<IntType>, ArgSpec<SigHandlerT>]
- >,
- ]
- >;
-
- HeaderSpec Threads = HeaderSpec<
- "threads.h",
- [
- Macro<"ONCE_FLAG_INIT">,
- ],
- [
- OnceFlagType,
- CallOnceFuncType,
- CndTType,
- MtxTType,
- ThrdStartTType,
- ThrdTType,
- TssTType,
- TssDtorTType,
- ],
- [
- EnumeratedNameValue<"mtx_plain">,
- EnumeratedNameValue<"mtx_recursive">,
- EnumeratedNameValue<"mtx_timed">,
- EnumeratedNameValue<"thrd_timedout">,
- EnumeratedNameValue<"thrd_success">,
- EnumeratedNameValue<"thrd_busy">,
- EnumeratedNameValue<"thrd_error">,
- EnumeratedNameValue<"thrd_nomem">,
- ],
- [
- FunctionSpec<
- "call_once",
- RetValSpec<VoidType>,
- [
- ArgSpec<OnceFlagTypePtr>,
- ArgSpec<CallOnceFuncType>,
- ]
- >,
- FunctionSpec<
- "cnd_broadcast",
- RetValSpec<IntType>,
- [
- ArgSpec<CndTTypePtr>,
- ]
- >,
- FunctionSpec<
- "cnd_destroy",
- RetValSpec<VoidType>,
- [
- ArgSpec<CndTTypePtr>,
- ]
- >,
- FunctionSpec<
- "cnd_init",
- RetValSpec<IntType>,
- [
- ArgSpec<CndTTypePtr>,
- ]
- >,
- FunctionSpec<
- "cnd_signal",
- RetValSpec<IntType>,
- [
- ArgSpec<CndTTypePtr>,
- ]
- >,
- FunctionSpec<
- "cnd_wait",
- RetValSpec<IntType>,
- [
- ArgSpec<CndTTypePtr>,
- ArgSpec<MtxTTypePtr>,
- ]
- >,
- FunctionSpec<
- "mtx_init",
- RetValSpec<IntType>,
- [
- ArgSpec<MtxTTypePtr>,
- ArgSpec<IntType>,
- ]
- >,
- FunctionSpec<
- "mtx_destroy",
- RetValSpec<IntType>,
- [
- ArgSpec<VoidType>,
- ]
- >,
- FunctionSpec<
- "mtx_lock",
- RetValSpec<IntType>,
- [
- ArgSpec<MtxTTypePtr>,
- ]
- >,
- FunctionSpec<
- "mtx_unlock",
- RetValSpec<IntType>,
- [
- ArgSpec<MtxTTypePtr>,
- ]
- >,
- FunctionSpec<
- "thrd_create",
- RetValSpec<IntType>,
- [
- ArgSpec<ThrdTTypePtr>,
- ArgSpec<ThrdStartTType>,
- ArgSpec<VoidPtr>,
- ]
- >,
- FunctionSpec<
- "thrd_join",
- RetValSpec<IntType>,
- [
- ArgSpec<ThrdTType>,
- ArgSpec<IntPtr>,
- ]
- >,
- FunctionSpec<
- "thrd_detach",
- RetValSpec<IntType>,
- [ArgSpec<ThrdTType>]
- >,
- FunctionSpec<
- "thrd_current",
- RetValSpec<ThrdTType>,
- [ArgSpec<VoidType>]
- >,
- FunctionSpec<
- "thrd_equal",
- RetValSpec<IntType>,
- [ArgSpec<ThrdTType>, ArgSpec<ThrdTType>]
- >,
- FunctionSpec<
- "thrd_exit",
- RetValSpec<VoidType>,
- [ArgSpec<IntType>]
- >,
- FunctionSpec<
- "tss_create",
- RetValSpec<IntType>,
- [ArgSpec<TssTPtr>, ArgSpec<TssDtorTType>]
- >,
- FunctionSpec<
- "tss_delete",
- RetValSpec<IntType>,
- [ArgSpec<TssTType>]
- >,
- FunctionSpec<
- "tss_get",
- RetValSpec<VoidPtr>,
- [ArgSpec<TssTType>]
- >,
- FunctionSpec<
- "tss_set",
- RetValSpec<IntType>,
- [ArgSpec<TssTType>, ArgSpec<VoidPtr>]
- >,
- ]
- >;
-
- HeaderSpec Time = HeaderSpec<
- "time.h",
- [], // Macros
- [ // Types
- ClockT,
- StructTmType,
- StructTimeSpec,
- TimeTType,
- SizeTType,
- ],
- [], // Enumerations
- [
- FunctionSpec<
- "asctime",
- RetValSpec<CharPtr>,
- [ArgSpec<StructTmPtr>]
- >,
- FunctionSpec<
- "asctime_r",
- RetValSpec<CharPtr>,
- [
- ArgSpec<StructTmPtr>,
- ArgSpec<CharPtr>,
- ]
- >,
- FunctionSpec<
- "ctime",
- RetValSpec<CharPtr>,
- [ArgSpec<TimeTTypePtr>]
- >,
- FunctionSpec<
- "ctime_r",
- RetValSpec<CharPtr>,
- [
- ArgSpec<TimeTTypePtr>,
- ArgSpec<CharPtr>,
- ]
- >,
- FunctionSpec<
- "clock",
- RetValSpec<ClockT>,
- [ArgSpec<VoidType>]
- >,
- FunctionSpec<
- "difftime",
- RetValSpec<DoubleType>,
- [
- ArgSpec<TimeTType>,
- ArgSpec<TimeTType>,
- ]
- >,
- FunctionSpec<
- "gmtime",
- RetValSpec<StructTmPtr>,
- [ArgSpec<TimeTTypePtr>]
- >,
- FunctionSpec<
- "gmtime_r",
- RetValSpec<StructTmPtr>,
- [
- ArgSpec<TimeTTypePtr>,
- ArgSpec<StructTmPtr>,
- ]
- >,
- FunctionSpec<
- "mktime",
- RetValSpec<TimeTType>,
- [ArgSpec<StructTmPtr>]
- >,
- FunctionSpec<
- "time",
- RetValSpec<TimeTType>,
- [ArgSpec<TimeTTypePtr>]
- >,
- ]
- >;
-
- HeaderSpec SetJmp = HeaderSpec<
- "setjmp.h",
- [], // Macros
- [JmpBuf],
- [], // Enumerations
- [
- FunctionSpec<
- "longjmp",
- RetValSpec<NoReturn>,
- [ArgSpec<JmpBuf>, ArgSpec<IntType>]
- >,
- FunctionSpec<
- "setjmp",
- RetValSpec<IntType>,
- [ArgSpec<JmpBuf>]
- >,
- FunctionSpec<
- "longjmp",
- RetValSpec<VoidType>,
- [ArgSpec<JmpBuf>, ArgSpec<IntType>]
- >,
- ]
- >;
-
- HeaderSpec UChar = HeaderSpec<
- "uchar.h",
- [], // Macros
- [ //Types
- MBStateTType,
- Char8TType,
- Char16TType,
- Char32TType,
- SizeTType,
- ],
- [], // Enumerations
- []
- >;
-
- HeaderSpec WChar = HeaderSpec<
- "wchar.h",
- [ // Macros
- Macro<"WEOF">,
- ],
- [ //Types
- MBStateTType,
- SizeTType,
- WIntType,
- WCharType,
- ],
- [], // Enumerations
- [
- FunctionSpec<
- "wctob",
- RetValSpec<IntType>,
- [ArgSpec<WIntType>]
- >,
- ]
- >;
-
- NamedType StructLconv = NamedType<"struct lconv">;
- PtrType StructLconvPtr = PtrType<StructLconv>;
-
- HeaderSpec Locale = HeaderSpec<
- "locale.h",
- [], // Macros
- [LocaleT, StructLconv], // Types
- [], // Enumerations
- [
- FunctionSpec<
- "duplocale",
- RetValSpec<LocaleT>,
- [
- ArgSpec<LocaleT>
- ]
- >,
- FunctionSpec<
- "freelocale",
- RetValSpec<VoidType>,
- [
- ArgSpec<LocaleT>
- ]
- >,
- FunctionSpec<
- "localeconv",
- RetValSpec<StructLconvPtr>,
- []
- >,
- FunctionSpec<
- "newlocale",
- RetValSpec<LocaleT>,
- [
- ArgSpec<IntType>,
- ArgSpec<ConstCharPtr>,
- ArgSpec<LocaleT>
- ]
- >,
- FunctionSpec<
- "setlocale",
- RetValSpec<CharPtr>,
- [
- ArgSpec<IntType>,
- ArgSpec<ConstCharPtr>
- ]
- >,
- FunctionSpec<
- "uselocale",
- RetValSpec<LocaleT>,
- [
- ArgSpec<LocaleT>
- ]
- >
- ] // Functions
- >;
-
- let Headers = [
- Assert,
- CType,
- Errno,
- Fenv,
- Float,
- StdInt,
- Limits,
- Math,
- String,
- StdBit,
- StdCkdInt,
- StdIO,
- StdLib,
- IntTypes,
- SetJmp,
- Signal,
- Threads,
- Time,
- UChar,
- WChar,
- Locale,
- ];
-}
diff --git a/libc/spec/stdc_ext.td b/libc/spec/stdc_ext.td
deleted file mode 100644
index dee3b8bdf6feeb..00000000000000
--- a/libc/spec/stdc_ext.td
+++ /dev/null
@@ -1,82 +0,0 @@
-// Fixed point types.
-// From ISO/IEC TR 18037:2008 standard:
-// https://standards.iso.org/ittf/PubliclyAvailableStandards/c051126_ISO_IEC_TR_18037_2008.zip
-def ShortFractType : NamedType<"short fract">;
-def FractType : NamedType<"fract">;
-def LongFractType : NamedType<"long fract">;
-def UnsignedShortFractType : NamedType<"unsigned short fract">;
-def UnsignedFractType : NamedType<"unsigned fract">;
-def UnsignedLongFractType : NamedType<"unsigned long fract">;
-
-def ShortAccumType : NamedType<"short accum">;
-def AccumType : NamedType<"accum">;
-def LongAccumType : NamedType<"long accum">;
-def UnsignedShortAccumType : NamedType<"unsigned short accum">;
-def UnsignedAccumType : NamedType<"unsigned accum">;
-def UnsignedLongAccumType : NamedType<"unsigned long accum">;
-
-def IntHrT : NamedType <"int_hr_t">;
-def IntRT : NamedType<"int_r_t">;
-def IntLrT : NamedType<"int_lr_t">;
-def IntHkT : NamedType<"int_hk_t">;
-def IntKT : NamedType<"int_k_t">;
-def IntLkT : NamedType<"int_lk_t">;
-def UIntUhrT : NamedType<"uint_uhr_t">;
-def UIntUrT : NamedType<"uint_ur_t">;
-def UIntUlrT : NamedType<"uint_ulr_t">;
-def UIntUhkT : NamedType<"uint_uhk_t">;
-def UIntUkT : NamedType<"uint_uk_t">;
-def UIntUlkT : NamedType<"uint_ulk_t">;
-
-def StdcExt : StandardSpec<"stdc_ext"> {
- // From ISO/IEC TR 18037:2008 standard:
- // https://standards.iso.org/ittf/PubliclyAvailableStandards/c051126_ISO_IEC_TR_18037_2008.zip
- HeaderSpec StdFix = HeaderSpec<
- "stdfix.h",
- [], // macros
- [IntHrT,IntRT, IntLrT, IntHkT, IntKT, IntLkT, UIntUhrT, UIntUrT, UIntUlrT, UIntUhkT, UIntUkT, UIntUlkT], // types
- [], // enums
- [ // functions
- GuardedFunctionSpec<"abshr", RetValSpec<ShortFractType>, [ArgSpec<ShortFractType>], "LIBC_COMPILER_HAS_FIXED_POINT">,
- GuardedFunctionSpec<"absr", RetValSpec<FractType>, [ArgSpec<FractType>], "LIBC_COMPILER_HAS_FIXED_POINT">,
- GuardedFunctionSpec<"abslr", RetValSpec<LongFractType>, [ArgSpec<LongFractType>], "LIBC_COMPILER_HAS_FIXED_POINT">,
-
- GuardedFunctionSpec<"abshk", RetValSpec<ShortAccumType>, [ArgSpec<ShortAccumType>], "LIBC_COMPILER_HAS_FIXED_POINT">,
- GuardedFunctionSpec<"absk", RetValSpec<AccumType>, [ArgSpec<AccumType>], "LIBC_COMPILER_HAS_FIXED_POINT">,
- GuardedFunctionSpec<"abslk", RetValSpec<LongAccumType>, [ArgSpec<LongAccumType>], "LIBC_COMPILER_HAS_FIXED_POINT">,
-
- GuardedFunctionSpec<"roundhr", RetValSpec<ShortFractType>, [ArgSpec<ShortFractType>, ArgSpec<IntType>], "LIBC_COMPILER_HAS_FIXED_POINT">,
- GuardedFunctionSpec<"roundr", RetValSpec<FractType>, [ArgSpec<FractType>, ArgSpec<IntType>], "LIBC_COMPILER_HAS_FIXED_POINT">,
- GuardedFunctionSpec<"roundlr", RetValSpec<LongFractType>, [ArgSpec<LongFractType>, ArgSpec<IntType>], "LIBC_COMPILER_HAS_FIXED_POINT">,
-
- GuardedFunctionSpec<"roundhk", RetValSpec<ShortAccumType>, [ArgSpec<ShortAccumType>, ArgSpec<IntType>], "LIBC_COMPILER_HAS_FIXED_POINT">,
- GuardedFunctionSpec<"roundk", RetValSpec<AccumType>, [ArgSpec<AccumType>, ArgSpec<IntType>], "LIBC_COMPILER_HAS_FIXED_POINT">,
- GuardedFunctionSpec<"roundlk", RetValSpec<LongAccumType>, [ArgSpec<LongAccumType>, ArgSpec<IntType>], "LIBC_COMPILER_HAS_FIXED_POINT">,
-
- GuardedFunctionSpec<"rounduhr", RetValSpec<UnsignedShortFractType>, [ArgSpec<UnsignedShortFractType>, ArgSpec<IntType>], "LIBC_COMPILER_HAS_FIXED_POINT">,
- GuardedFunctionSpec<"roundur", RetValSpec<UnsignedFractType>, [ArgSpec<UnsignedFractType>, ArgSpec<IntType>], "LIBC_COMPILER_HAS_FIXED_POINT">,
- GuardedFunctionSpec<"roundulr", RetValSpec<UnsignedLongFractType>, [ArgSpec<UnsignedLongFractType>, ArgSpec<IntType>], "LIBC_COMPILER_HAS_FIXED_POINT">,
-
- GuardedFunctionSpec<"rounduhk", RetValSpec<UnsignedShortAccumType>, [ArgSpec<UnsignedShortAccumType>, ArgSpec<IntType>], "LIBC_COMPILER_HAS_FIXED_POINT">,
- GuardedFunctionSpec<"rounduk", RetValSpec<UnsignedAccumType>, [ArgSpec<UnsignedAccumType>, ArgSpec<IntType>], "LIBC_COMPILER_HAS_FIXED_POINT">,
- GuardedFunctionSpec<"roundulk", RetValSpec<UnsignedLongAccumType>, [ArgSpec<UnsignedLongAccumType>, ArgSpec<IntType>], "LIBC_COMPILER_HAS_FIXED_POINT">,
-
- GuardedFunctionSpec<"hrbits", RetValSpec<ShortFractType>, [ArgSpec<IntHrT>], "LIBC_COMPILER_HAS_FIXED_POINT">,
- GuardedFunctionSpec<"rbits", RetValSpec<FractType>, [ArgSpec<IntRT>], "LIBC_COMPILER_HAS_FIXED_POINT">,
- GuardedFunctionSpec<"lrbits", RetValSpec<LongFractType>, [ArgSpec<IntLrT>], "LIBC_COMPILER_HAS_FIXED_POINT">,
- GuardedFunctionSpec<"hkbits", RetValSpec<ShortAccumType>, [ArgSpec<IntHkT>], "LIBC_COMPILER_HAS_FIXED_POINT">,
- GuardedFunctionSpec<"kbits", RetValSpec<AccumType>, [ArgSpec<IntKT>], "LIBC_COMPILER_HAS_FIXED_POINT">,
- GuardedFunctionSpec<"lkbits", RetValSpec<LongAccumType>, [ArgSpec<IntLkT>], "LIBC_COMPILER_HAS_FIXED_POINT">,
- GuardedFunctionSpec<"uhrbits", RetValSpec<UnsignedShortFractType>, [ArgSpec<UIntUhrT>], "LIBC_COMPILER_HAS_FIXED_POINT">,
- GuardedFunctionSpec<"urbits", RetValSpec<UnsignedFractType>, [ArgSpec<UIntUrT>], "LIBC_COMPILER_HAS_FIXED_POINT">,
- GuardedFunctionSpec<"ukbits", RetValSpec<UnsignedAccumType>, [ArgSpec<UIntUkT>], "LIBC_COMPILER_HAS_FIXED_POINT">,
- GuardedFunctionSpec<"ulrbits", RetValSpec<UnsignedLongFractType>, [ArgSpec<UIntUlrT>], "LIBC_COMPILER_HAS_FIXED_POINT">,
- GuardedFunctionSpec<"uhkbits", RetValSpec<UnsignedShortAccumType>, [ArgSpec<UIntUhkT>], "LIBC_COMPILER_HAS_FIXED_POINT">,
- GuardedFunctionSpec<"ulkbits", RetValSpec<UnsignedLongAccumType>, [ArgSpec<UIntUlkT>], "LIBC_COMPILER_HAS_FIXED_POINT">,
- ]
- >;
-
- let Headers = [
- StdFix,
- ];
-}
diff --git a/libc/test/src/CMakeLists.txt b/libc/test/src/CMakeLists.txt
index e121555bd60a9f..8ac8f91e98d4cc 100644
--- a/libc/test/src/CMakeLists.txt
+++ b/libc/test/src/CMakeLists.txt
@@ -88,81 +88,3 @@ add_subdirectory(locale)
if(${LIBC_TARGET_OS} STREQUAL "linux")
add_subdirectory(pthread)
endif()
-
-if(LLVM_RUNTIMES_BUILD OR LIBC_HDRGEN_EXE)
- # The public API test below uses tablegen to generate the test
- # source file. Since tablegen is not available during a runtimes
- # build, we will skip the test.
- # If a different libc-hdrgen binary is being used, then also we
- # skip the api-test as we cannot generate the test source file.
- return()
-endif()
-
-set(public_test ${CMAKE_CURRENT_BINARY_DIR}/public_api_test.cpp)
-
-set(entrypoints_name_list "")
-foreach(entry IN LISTS TARGET_LLVMLIBC_ENTRYPOINTS)
- get_target_property(entry_name ${entry} "ENTRYPOINT_NAME")
- list(APPEND entrypoints_name_list ${entry_name})
-endforeach()
-
-# TODO: Remove these when they are added to the TableGen.
-list(REMOVE_ITEM entrypoints_name_list "__assert_fail" "__errno_location")
-list(TRANSFORM entrypoints_name_list PREPEND "-e=")
-
-file(GLOB spec_files ${LIBC_SOURCE_DIR}/spec/*.td)
-
-# Generate api test souce code.
-add_custom_command(
- OUTPUT ${public_test}
- COMMAND $<TARGET_FILE:libc-prototype-testgen> -o ${public_test}
- ${entrypoints_name_list}
- -I ${LIBC_SOURCE_DIR}
- ${LIBC_SOURCE_DIR}/config/${LIBC_TARGET_OS}/api.td
-
- DEPENDS ${LIBC_SOURCE_DIR}/config/${LIBC_TARGET_OS}/api.td ${spec_files}
- libc-prototype-testgen ${TARGET_PUBLIC_HEADERS}
- ${LIBC_TARGET}
-)
-
-add_custom_target(libc-api-test)
-add_dependencies(check-libc libc-api-test)
-
-set(
- allocator_entrypoints
- libc.src.stdlib.malloc
- libc.src.stdlib.calloc
- libc.src.stdlib.realloc
- libc.src.stdlib.aligned_alloc
- libc.src.stdlib.free
-)
-set(api-test-entrypoints ${TARGET_LLVMLIBC_ENTRYPOINTS})
-list(REMOVE_ITEM api-test-entrypoints ${allocator_entrypoints})
-add_integration_test(
- api-test
- SUITE
- libc-api-test
- SRCS
- ${public_test}
- DEPENDS
- ${api-test-entrypoints}
-)
-
-if(COMPILER_RESOURCE_DIR AND LLVM_LIBC_ENABLE_LINTING)
- add_custom_target(
- libc-api-test-tidy
- VERBATIM
- COMMAND ${LLVM_LIBC_CLANG_TIDY} --system-headers
- --checks=-*,llvmlibc-restrict-system-libc-headers
- "--extra-arg=-resource-dir=${COMPILER_RESOURCE_DIR}"
- --header-filter=.*
- --warnings-as-errors=llvmlibc-*
- "-config={CheckOptions: [{key: llvmlibc-restrict-system-libc-headers.Includes, value: '-*, linux/*, asm/*.h, asm-generic/*.h'}]}"
- --quiet
- -p ${PROJECT_BINARY_DIR}
- ${public_test}
- DEPENDS
- clang-tidy ${public_test}
- )
- add_dependencies(libc-api-test libc-api-test-tidy)
-endif()
diff --git a/libc/utils/HdrGen/CMakeLists.txt b/libc/utils/HdrGen/CMakeLists.txt
deleted file mode 100644
index 47f845b9f9a5bb..00000000000000
--- a/libc/utils/HdrGen/CMakeLists.txt
+++ /dev/null
@@ -1,22 +0,0 @@
-include(TableGen)
-
-if (NOT LLVM_LINK_LLVM_DYLIB)
- set(LLVM_LINK_COMPONENTS Support)
-endif()
-
-add_tablegen(libc-hdrgen LIBC
- Command.h
- Command.cpp
- Generator.cpp
- Generator.h
- IncludeFileCommand.cpp
- IncludeFileCommand.h
- Main.cpp
- PublicAPICommand.cpp
- PublicAPICommand.h
-)
-
-target_include_directories(libc-hdrgen PRIVATE ${LLVM_INCLUDE_DIR} ${LLVM_MAIN_INCLUDE_DIR})
-target_link_libraries(libc-hdrgen PRIVATE LibcTableGenUtil)
-
-add_subdirectory(PrototypeTestGen)
diff --git a/libc/utils/HdrGen/Command.cpp b/libc/utils/HdrGen/Command.cpp
deleted file mode 100644
index 04462c18aac3f0..00000000000000
--- a/libc/utils/HdrGen/Command.cpp
+++ /dev/null
@@ -1,15 +0,0 @@
-//===-- Base class for header generation commands -------------------------===//
-//
-// 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
-//
-//===----------------------------------------------------------------------===//
-
-#include "Command.h"
-
-namespace llvm_libc {
-
-Command::~Command() {}
-
-} // namespace llvm_libc
diff --git a/libc/utils/HdrGen/Command.h b/libc/utils/HdrGen/Command.h
deleted file mode 100644
index 42516798ffaec0..00000000000000
--- a/libc/utils/HdrGen/Command.h
+++ /dev/null
@@ -1,54 +0,0 @@
-//===-- Base class for header generation commands ---------------*- C++ -*-===//
-//
-// 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_UTILS_HDRGEN_COMMAND_H
-#define LLVM_LIBC_UTILS_HDRGEN_COMMAND_H
-
-#include "llvm/ADT/SmallVector.h"
-#include "llvm/ADT/StringRef.h"
-#include "llvm/ADT/Twine.h"
-#include "llvm/Support/SourceMgr.h"
-
-#include <cstdlib>
-
-namespace llvm {
-
-class raw_ostream;
-class RecordKeeper;
-
-} // namespace llvm
-
-namespace llvm_libc {
-
-typedef llvm::SmallVector<llvm::StringRef, 4> ArgVector;
-
-class Command {
-public:
- class ErrorReporter {
- llvm::SMLoc Loc;
- const llvm::SourceMgr &SrcMgr;
-
- public:
- ErrorReporter(llvm::SMLoc L, llvm::SourceMgr &SM) : Loc(L), SrcMgr(SM) {}
-
- [[noreturn]] void printFatalError(llvm::Twine Msg) const {
- SrcMgr.PrintMessage(Loc, llvm::SourceMgr::DK_Error, Msg);
- std::exit(1);
- }
- };
-
- virtual ~Command();
-
- virtual void run(llvm::raw_ostream &OS, const ArgVector &Args,
- llvm::StringRef StdHeader, const llvm::RecordKeeper &Records,
- const ErrorReporter &Reporter) const = 0;
-};
-
-} // namespace llvm_libc
-
-#endif // LLVM_LIBC_UTILS_HDRGEN_COMMAND_H
diff --git a/libc/utils/HdrGen/Generator.cpp b/libc/utils/HdrGen/Generator.cpp
deleted file mode 100644
index b4e1166b1a37b2..00000000000000
--- a/libc/utils/HdrGen/Generator.cpp
+++ /dev/null
@@ -1,203 +0,0 @@
-//===-- Implementation of the main header generation class ----------------===//
-//
-// 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
-//
-//===----------------------------------------------------------------------===//
-
-#include "Generator.h"
-
-#include "IncludeFileCommand.h"
-#include "PublicAPICommand.h"
-#include "utils/LibcTableGenUtil/APIIndexer.h"
-
-#include "llvm/ADT/StringRef.h"
-#include "llvm/Support/MemoryBuffer.h"
-#include "llvm/Support/SourceMgr.h"
-#include "llvm/Support/raw_ostream.h"
-
-#include <cstdlib>
-#include <memory>
-
-static const char CommandPrefix[] = "%%";
-static const size_t CommandPrefixSize = llvm::StringRef(CommandPrefix).size();
-
-static const char CommentPrefix[] = "<!>";
-
-static const char ParamNamePrefix[] = "${";
-static const size_t ParamNamePrefixSize =
- llvm::StringRef(ParamNamePrefix).size();
-static const char ParamNameSuffix[] = "}";
-static const size_t ParamNameSuffixSize =
- llvm::StringRef(ParamNameSuffix).size();
-
-namespace llvm_libc {
-
-Command *Generator::getCommandHandler(llvm::StringRef CommandName) {
- if (CommandName == IncludeFileCommand::Name) {
- if (!IncludeFileCmd)
- IncludeFileCmd = std::make_unique<IncludeFileCommand>();
- return IncludeFileCmd.get();
- } else if (CommandName == PublicAPICommand::Name) {
- if (!PublicAPICmd)
- PublicAPICmd = std::make_unique<PublicAPICommand>(EntrypointNameList);
- return PublicAPICmd.get();
- } else {
- return nullptr;
- }
-}
-
-void Generator::parseCommandArgs(llvm::StringRef ArgStr, ArgVector &Args) {
- if (!ArgStr.contains(',') && ArgStr.trim(' ').trim('\t').size() == 0) {
- // If it is just space between the parenthesis
- return;
- }
-
- ArgStr.split(Args, ",");
- for (llvm::StringRef &A : Args) {
- A = A.trim(' ');
- if (A.starts_with(ParamNamePrefix) && A.ends_with(ParamNameSuffix)) {
- A = A.drop_front(ParamNamePrefixSize).drop_back(ParamNameSuffixSize);
- A = ArgMap[std::string(A)];
- }
- }
-}
-
-void Generator::generate(llvm::raw_ostream &OS,
- const llvm::RecordKeeper &Records) {
- auto DefFileBuffer = llvm::MemoryBuffer::getFile(HeaderDefFile);
- if (!DefFileBuffer) {
- llvm::errs() << "Unable to open " << HeaderDefFile << ".\n";
- std::exit(1);
- }
- llvm::SourceMgr SrcMgr;
- unsigned DefFileID = SrcMgr.AddNewSourceBuffer(
- std::move(DefFileBuffer.get()), llvm::SMLoc::getFromPointer(nullptr));
-
- llvm::StringRef Content = SrcMgr.getMemoryBuffer(DefFileID)->getBuffer();
- while (true) {
- std::pair<llvm::StringRef, llvm::StringRef> P = Content.split('\n');
- Content = P.second;
-
- llvm::StringRef Line = P.first.trim(' ');
- if (Line.starts_with(CommandPrefix)) {
- Line = Line.drop_front(CommandPrefixSize);
-
- P = Line.split("(");
- // It's possible that we have windows line endings, so strip off the extra
- // CR.
- P.second = P.second.trim();
- if (P.second.empty() || P.second[P.second.size() - 1] != ')') {
- SrcMgr.PrintMessage(llvm::SMLoc::getFromPointer(P.second.data()),
- llvm::SourceMgr::DK_Error,
- "Command argument list should begin with '(' "
- "and end with ')'.");
- SrcMgr.PrintMessage(llvm::SMLoc::getFromPointer(P.second.data()),
- llvm::SourceMgr::DK_Error, P.second.data());
- SrcMgr.PrintMessage(llvm::SMLoc::getFromPointer(P.second.data()),
- llvm::SourceMgr::DK_Error,
- std::to_string(P.second.size()));
- std::exit(1);
- }
- llvm::StringRef CommandName = P.first;
- Command *Cmd = getCommandHandler(CommandName);
- if (Cmd == nullptr) {
- SrcMgr.PrintMessage(llvm::SMLoc::getFromPointer(CommandName.data()),
- llvm::SourceMgr::DK_Error,
- "Unknown command '%%" + CommandName + "'.");
- std::exit(1);
- }
-
- llvm::StringRef ArgStr = P.second.drop_back(1);
- ArgVector Args;
- parseCommandArgs(ArgStr, Args);
-
- Command::ErrorReporter Reporter(
- llvm::SMLoc::getFromPointer(CommandName.data()), SrcMgr);
- Cmd->run(OS, Args, StdHeader, Records, Reporter);
- } else if (!Line.starts_with(CommentPrefix)) {
- // There is no comment or command on this line so we just write it as is.
- OS << P.first << "\n";
- }
-
- if (P.second.empty())
- break;
- }
-}
-
-void Generator::generateDecls(llvm::raw_ostream &OS,
- const llvm::RecordKeeper &Records) {
-
- OS << "//===-- C standard declarations for " << StdHeader << " "
- << std::string(80 - (42 + StdHeader.size()), '-') << "===//\n"
- << "//\n"
- << "// Part of the LLVM Project, under the Apache License v2.0 with LLVM "
- "Exceptions.\n"
- << "// See https://llvm.org/LICENSE.txt for license information.\n"
- << "// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception\n"
- << "//\n"
- << "//"
- "===-------------------------------------------------------------------"
- "---===//\n\n";
-
- std::string HeaderGuard(StdHeader.size(), '\0');
- llvm::transform(StdHeader, HeaderGuard.begin(), [](const char C) -> char {
- return !isalnum(C) ? '_' : llvm::toUpper(C);
- });
- OS << "#ifndef __LLVM_LIBC_DECLARATIONS_" << HeaderGuard << "\n"
- << "#define __LLVM_LIBC_DECLARATIONS_" << HeaderGuard << "\n\n";
-
- OS << "#ifndef __LIBC_ATTRS\n"
- << "#define __LIBC_ATTRS\n"
- << "#endif\n\n";
-
- OS << "#ifdef __cplusplus\n"
- << "extern \"C\" {\n"
- << "#endif\n\n";
-
- APIIndexer G(StdHeader, Records);
- for (auto &Name : EntrypointNameList) {
- // Filter out functions not exported by this header.
- if (G.FunctionSpecMap.find(Name) == G.FunctionSpecMap.end())
- continue;
-
- const llvm::Record *FunctionSpec = G.FunctionSpecMap[Name];
- const llvm::Record *RetValSpec = FunctionSpec->getValueAsDef("Return");
- const llvm::Record *ReturnType = RetValSpec->getValueAsDef("ReturnType");
-
- OS << G.getTypeAsString(ReturnType) << " " << Name << "(";
-
- auto ArgsList = FunctionSpec->getValueAsListOfDefs("Args");
- for (size_t i = 0; i < ArgsList.size(); ++i) {
- const llvm::Record *ArgType = ArgsList[i]->getValueAsDef("ArgType");
- OS << G.getTypeAsString(ArgType);
- if (i < ArgsList.size() - 1)
- OS << ", ";
- }
-
- OS << ") __LIBC_ATTRS;\n\n";
- }
-
- // Make another pass over entrypoints to emit object declarations.
- for (const auto &Name : EntrypointNameList) {
- if (G.ObjectSpecMap.find(Name) == G.ObjectSpecMap.end())
- continue;
- const llvm::Record *ObjectSpec = G.ObjectSpecMap[Name];
- auto Type = ObjectSpec->getValueAsString("Type");
- OS << "extern " << Type << " " << Name << " __LIBC_ATTRS;\n";
- }
-
- // Emit a final newline if we emitted any object declarations.
- if (llvm::any_of(EntrypointNameList, [&](const std::string &Name) {
- return G.ObjectSpecMap.find(Name) != G.ObjectSpecMap.end();
- }))
- OS << "\n";
-
- OS << "#ifdef __cplusplus\n"
- << "}\n"
- << "#endif\n\n";
- OS << "#endif\n";
-}
-
-} // namespace llvm_libc
diff --git a/libc/utils/HdrGen/Generator.h b/libc/utils/HdrGen/Generator.h
deleted file mode 100644
index 1c149d21156407..00000000000000
--- a/libc/utils/HdrGen/Generator.h
+++ /dev/null
@@ -1,60 +0,0 @@
-//===-- The main header generation class ------------------------*- C++ -*-===//
-//
-// 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_UTILS_HDRGEN_GENERATOR_H
-#define LLVM_LIBC_UTILS_HDRGEN_GENERATOR_H
-
-#include "Command.h"
-
-#include "llvm/ADT/SmallVector.h"
-#include "llvm/ADT/StringRef.h"
-
-#include <memory>
-#include <string>
-#include <unordered_map>
-
-namespace llvm {
-
-class raw_ostream;
-class RecordKeeper;
-
-} // namespace llvm
-
-namespace llvm_libc {
-
-class Command;
-
-class Generator {
- llvm::StringRef HeaderDefFile;
- const std::vector<std::string> &EntrypointNameList;
- llvm::StringRef StdHeader;
- std::unordered_map<std::string, std::string> &ArgMap;
-
- std::unique_ptr<Command> IncludeFileCmd;
- std::unique_ptr<Command> PublicAPICmd;
-
- Command *getCommandHandler(llvm::StringRef CommandName);
-
- void parseCommandArgs(llvm::StringRef ArgStr, ArgVector &Args);
-
- void printError(llvm::StringRef Msg);
-
-public:
- Generator(const std::string &DefFile, const std::vector<std::string> &EN,
- const std::string &Header,
- std::unordered_map<std::string, std::string> &Map)
- : HeaderDefFile(DefFile), EntrypointNameList(EN), StdHeader(Header),
- ArgMap(Map) {}
-
- void generate(llvm::raw_ostream &OS, const llvm::RecordKeeper &Records);
- void generateDecls(llvm::raw_ostream &OS, const llvm::RecordKeeper &Records);
-};
-
-} // namespace llvm_libc
-
-#endif // LLVM_LIBC_UTILS_HDRGEN_GENERATOR_H
diff --git a/libc/utils/HdrGen/IncludeFileCommand.cpp b/libc/utils/HdrGen/IncludeFileCommand.cpp
deleted file mode 100644
index 43efe43585eb20..00000000000000
--- a/libc/utils/HdrGen/IncludeFileCommand.cpp
+++ /dev/null
@@ -1,50 +0,0 @@
-//===-- Implementation of IncludeFileCommand ------------------------------===//
-//
-// 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
-//
-//===----------------------------------------------------------------------===//
-
-#include "IncludeFileCommand.h"
-
-#include "llvm/Support/MemoryBuffer.h"
-#include "llvm/Support/SourceMgr.h"
-
-#include <cstdlib>
-
-namespace llvm_libc {
-
-const char IncludeFileCommand::Name[] = "include_file";
-
-void IncludeFileCommand::run(llvm::raw_ostream &OS, const ArgVector &Args,
- llvm::StringRef StdHeader,
- const llvm::RecordKeeper &Records,
- const Command::ErrorReporter &Reporter) const {
- if (Args.size() != 1) {
- Reporter.printFatalError(
- "%%include_file command takes exactly 1 argument.");
- }
-
- llvm::StringRef IncludeFile = Args[0];
- auto Buffer = llvm::MemoryBuffer::getFileAsStream(IncludeFile);
- if (!Buffer)
- Reporter.printFatalError(llvm::StringRef("Unable to open ") + IncludeFile);
-
- llvm::StringRef Content = Buffer.get()->getBuffer();
-
- // If the included file has %%begin() command listed, then we want to write
- // only the content after the begin command.
- // TODO: The way the content is split below does not allow space within the
- // the parentheses and, before and after the command. This probably is too
- // strict and should be relaxed.
- auto P = Content.split("\n%%begin()\n");
- if (P.second.empty()) {
- // There was no %%begin in the content.
- OS << P.first;
- } else {
- OS << P.second;
- }
-}
-
-} // namespace llvm_libc
diff --git a/libc/utils/HdrGen/IncludeFileCommand.h b/libc/utils/HdrGen/IncludeFileCommand.h
deleted file mode 100644
index b3a6ff5462ded0..00000000000000
--- a/libc/utils/HdrGen/IncludeFileCommand.h
+++ /dev/null
@@ -1,32 +0,0 @@
-//===-- Class which implements the %%include_file command -------*- C++ -*-===//
-//
-// 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_UTILS_HDRGEN_INCLUDE_COMMAND_H
-#define LLVM_LIBC_UTILS_HDRGEN_INCLUDE_COMMAND_H
-
-#include "Command.h"
-
-#include "llvm/ADT/SmallVector.h"
-#include "llvm/ADT/StringRef.h"
-
-#include <string>
-
-namespace llvm_libc {
-
-class IncludeFileCommand : public Command {
-public:
- static const char Name[];
-
- void run(llvm::raw_ostream &OS, const ArgVector &Args,
- llvm::StringRef StdHeader, const llvm::RecordKeeper &Records,
- const Command::ErrorReporter &Reporter) const override;
-};
-
-} // namespace llvm_libc
-
-#endif // LLVM_LIBC_UTILS_HDRGEN_INCLUDE_COMMAND_H
diff --git a/libc/utils/HdrGen/Main.cpp b/libc/utils/HdrGen/Main.cpp
deleted file mode 100644
index f795e96e45c57a..00000000000000
--- a/libc/utils/HdrGen/Main.cpp
+++ /dev/null
@@ -1,62 +0,0 @@
-//===-- "main" function of libc-hdrgen ------------------------------------===//
-//
-// 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
-//
-//===----------------------------------------------------------------------===//
-
-#include "Generator.h"
-
-#include "llvm/ADT/StringRef.h"
-#include "llvm/Support/CommandLine.h"
-#include "llvm/TableGen/Main.h"
-
-#include <string>
-#include <unordered_map>
-
-static llvm::cl::opt<std::string>
- HeaderDefFile("def", llvm::cl::desc("Path to the .h.def file."),
- llvm::cl::value_desc("<filename>"), llvm::cl::Required);
-static llvm::cl::opt<std::string> StandardHeader(
- "header",
- llvm::cl::desc("The standard header file which is to be generated."),
- llvm::cl::value_desc("<header file>"));
-static llvm::cl::list<std::string> EntrypointNamesOption(
- "e", llvm::cl::value_desc("<list of entrypoints>"),
- llvm::cl::desc(
- "Each --e is one entrypoint (generated from entrypoints.txt)"),
- llvm::cl::OneOrMore);
-static llvm::cl::list<std::string> ReplacementValues(
- "args", llvm::cl::desc("Command separated <argument name>=<value> pairs."),
- llvm::cl::value_desc("<name=value>[,name=value]"));
-static llvm::cl::opt<bool> ExportDecls(
- "export-decls",
- llvm::cl::desc("Output a new header containing only the entrypoints."));
-
-static void
-ParseArgValuePairs(std::unordered_map<std::string, std::string> &Map) {
- for (std::string &R : ReplacementValues) {
- auto Pair = llvm::StringRef(R).split('=');
- Map[std::string(Pair.first)] = std::string(Pair.second);
- }
-}
-
-static bool HeaderGeneratorMain(llvm::raw_ostream &OS,
- const llvm::RecordKeeper &Records) {
- std::unordered_map<std::string, std::string> ArgMap;
- ParseArgValuePairs(ArgMap);
- llvm_libc::Generator G(HeaderDefFile, EntrypointNamesOption, StandardHeader,
- ArgMap);
- if (ExportDecls)
- G.generateDecls(OS, Records);
- else
- G.generate(OS, Records);
-
- return false;
-}
-
-int main(int argc, char *argv[]) {
- llvm::cl::ParseCommandLineOptions(argc, argv);
- return TableGenMain(argv[0], &HeaderGeneratorMain);
-}
diff --git a/libc/utils/HdrGen/PrototypeTestGen/CMakeLists.txt b/libc/utils/HdrGen/PrototypeTestGen/CMakeLists.txt
deleted file mode 100644
index 9e25c21c6b3593..00000000000000
--- a/libc/utils/HdrGen/PrototypeTestGen/CMakeLists.txt
+++ /dev/null
@@ -1,5 +0,0 @@
-add_tablegen(libc-prototype-testgen LLVM_LIBC
- PrototypeTestGen.cpp
-)
-target_link_libraries(libc-prototype-testgen PRIVATE LibcTableGenUtil)
-target_include_directories(libc-prototype-testgen PRIVATE ${LIBC_SOURCE_DIR})
diff --git a/libc/utils/HdrGen/PrototypeTestGen/PrototypeTestGen.cpp b/libc/utils/HdrGen/PrototypeTestGen/PrototypeTestGen.cpp
deleted file mode 100644
index 7acaf75c4c1c8b..00000000000000
--- a/libc/utils/HdrGen/PrototypeTestGen/PrototypeTestGen.cpp
+++ /dev/null
@@ -1,106 +0,0 @@
-//===-- PrototypeTestGen.cpp ----------------------------------------------===//
-//
-// 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
-//
-//===----------------------------------------------------------------------===//
-
-#include "utils/LibcTableGenUtil/APIIndexer.h"
-
-#include "llvm/ADT/StringRef.h"
-#include "llvm/Support/CommandLine.h"
-#include "llvm/TableGen/Main.h"
-#include "llvm/TableGen/Record.h"
-
-namespace {
-
-llvm::cl::list<std::string>
- EntrypointNamesOption("e", llvm::cl::desc("<list of entrypoints>"),
- llvm::cl::OneOrMore);
-
-} // anonymous namespace
-
-bool TestGeneratorMain(llvm::raw_ostream &OS,
- const llvm::RecordKeeper &records) {
- OS << "#include \"src/__support/CPP/type_traits.h\"\n";
- llvm_libc::APIIndexer G(records);
- std::unordered_set<std::string> headerFileSet;
- for (const auto &entrypoint : EntrypointNamesOption) {
- if (entrypoint == "errno")
- continue;
- auto match = G.FunctionToHeaderMap.find(entrypoint);
- if (match == G.FunctionToHeaderMap.end()) {
- auto objectMatch = G.ObjectToHeaderMap.find(entrypoint);
- if (objectMatch != G.ObjectToHeaderMap.end()) {
- headerFileSet.insert(objectMatch->second);
- continue;
- }
-
- llvm::errs() << "ERROR: entrypoint '" << entrypoint
- << "' could not be found in spec in any public header\n";
- return true;
- }
- headerFileSet.insert(match->second);
- }
- for (const auto &header : headerFileSet)
- OS << "#include <" << header << ">\n";
-
- OS << '\n';
-
- OS << "extern \"C\" int main() {\n";
- for (const auto &entrypoint : EntrypointNamesOption) {
- if (entrypoint == "errno")
- continue;
- auto match = G.FunctionSpecMap.find(entrypoint);
- if (match == G.FunctionSpecMap.end()) {
- auto objectMatch = G.ObjectSpecMap.find(entrypoint);
- if (objectMatch != G.ObjectSpecMap.end()) {
- auto entrypointPtr = entrypoint + "_ptr";
- llvm::Record *objectSpec = G.ObjectSpecMap[entrypoint];
- auto objectType = objectSpec->getValueAsString("Type");
- // We just make sure that the global object is present.
- OS << " " << objectType << " *" << entrypointPtr << " = &"
- << entrypoint << ";\n";
- OS << " ++" << entrypointPtr << ";\n"; // To avoid unused var warning.
- continue;
- }
- llvm::errs() << "ERROR: entrypoint '" << entrypoint
- << "' could not be found in spec in any public header\n";
- return true;
- }
- llvm::Record *functionSpec = match->second;
- llvm::Record *retValSpec = functionSpec->getValueAsDef("Return");
- std::string returnType =
- G.getTypeAsString(retValSpec->getValueAsDef("ReturnType"));
- // _Noreturn is an indication for the compiler that a function
- // doesn't return, and isn't a type understood by c++ templates.
- if (llvm::StringRef(returnType).contains("_Noreturn"))
- returnType = "void";
-
- OS << " static_assert(LIBC_NAMESPACE::cpp::is_same_v<" << returnType
- << '(';
- auto args = functionSpec->getValueAsListOfDefs("Args");
- for (size_t i = 0, size = args.size(); i < size; ++i) {
- llvm::Record *argType = args[i]->getValueAsDef("ArgType");
- OS << G.getTypeAsString(argType);
- if (i < size - 1)
- OS << ", ";
- }
- OS << ") __NOEXCEPT, decltype(" << entrypoint << ")>, ";
- OS << '"' << entrypoint
- << " prototype in TableGen does not match public header" << '"';
- OS << ");\n";
- }
-
- OS << '\n';
- OS << " return 0;\n";
- OS << "}\n\n";
-
- return false;
-}
-
-int main(int argc, char *argv[]) {
- llvm::cl::ParseCommandLineOptions(argc, argv);
- return TableGenMain(argv[0], TestGeneratorMain);
-}
diff --git a/libc/utils/HdrGen/PublicAPICommand.cpp b/libc/utils/HdrGen/PublicAPICommand.cpp
deleted file mode 100644
index 5c46c82a238534..00000000000000
--- a/libc/utils/HdrGen/PublicAPICommand.cpp
+++ /dev/null
@@ -1,331 +0,0 @@
-//===-- Implementation of PublicAPICommand --------------------------------===//
-//
-// 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
-//
-//===----------------------------------------------------------------------===//
-
-#include "PublicAPICommand.h"
-
-#include "utils/LibcTableGenUtil/APIIndexer.h"
-
-#include "llvm/ADT/STLExtras.h"
-#include "llvm/ADT/SmallVector.h"
-#include "llvm/ADT/StringExtras.h"
-#include "llvm/ADT/StringRef.h"
-#include "llvm/ADT/StringSwitch.h"
-#include "llvm/Support/SourceMgr.h"
-#include "llvm/TableGen/Record.h"
-#include <algorithm>
-#include <vector>
-
-// Text blocks for macro definitions and type decls can be indented to
-// suit the surrounding tablegen listing. We need to dedent such blocks
-// before writing them out.
-static void dedentAndWrite(llvm::StringRef Text, llvm::raw_ostream &OS) {
- llvm::SmallVector<llvm::StringRef, 10> Lines;
- llvm::SplitString(Text, Lines, "\n");
- size_t shortest_indent = 1024;
- for (llvm::StringRef L : Lines) {
- llvm::StringRef Indent = L.take_while([](char c) { return c == ' '; });
- size_t IndentSize = Indent.size();
- if (Indent.size() == L.size()) {
- // Line is all spaces so no point noting the indent.
- continue;
- }
- if (IndentSize < shortest_indent)
- shortest_indent = IndentSize;
- }
- for (llvm::StringRef L : Lines) {
- if (L.size() >= shortest_indent)
- OS << L.drop_front(shortest_indent) << '\n';
- }
-}
-
-static std::string getTypeHdrName(const std::string &Name) {
- llvm::SmallVector<llvm::StringRef> Parts;
- llvm::SplitString(llvm::StringRef(Name), Parts);
- return llvm::join(Parts.begin(), Parts.end(), "_");
-}
-
-namespace llvm_libc {
-
-static bool isAsciiStart(char C) {
- return (C >= 'A' && C <= 'Z') || (C >= 'a' && C <= 'z') || C == '_';
-}
-
-static bool isAsciiContinue(char C) {
- return isAsciiStart(C) || (C >= '0' && C <= '9');
-}
-
-static bool isAsciiIdentifier(llvm::StringRef S) {
- if (S.empty())
- return false;
- if (!isAsciiStart(S[0]))
- return false;
- for (char C : S.drop_front())
- if (!isAsciiContinue(C))
- return false;
- return true;
-}
-
-static AttributeStyle getAttributeStyle(const llvm::Record *Instance) {
- llvm::StringRef Style = Instance->getValueAsString("Style");
- return llvm::StringSwitch<AttributeStyle>(Style)
- .Case("cxx11", AttributeStyle::Cxx11)
- .Case("gnu", AttributeStyle::Gnu)
- .Case("declspec", AttributeStyle::Declspec)
- .Default(AttributeStyle::Gnu);
-}
-
-static AttributeNamespace getAttributeNamespace(const llvm::Record *Instance) {
- llvm::StringRef Namespace = Instance->getValueAsString("Namespace");
- return llvm::StringSwitch<AttributeNamespace>(Namespace)
- .Case("clang", AttributeNamespace::Clang)
- .Case("gnu", AttributeNamespace::Gnu)
- .Default(AttributeNamespace::None);
-}
-
-using AttributeMap = llvm::DenseMap<llvm::StringRef, const llvm::Record *>;
-
-template <class SpecMap, class FuncList>
-static AttributeMap collectAttributeMacros(const SpecMap &Spec,
- const FuncList &Funcs) {
- llvm::DenseMap<llvm::StringRef, const llvm::Record *> MacroAttr;
- for (const auto &Name : Funcs) {
- auto Iter = Spec.find(Name);
- if (Iter == Spec.end())
- continue;
-
- const llvm::Record *FunctionSpec = Iter->second;
- for (const llvm::Record *Attr :
- FunctionSpec->getValueAsListOfDefs("Attributes"))
- MacroAttr[Attr->getValueAsString("Macro")] = Attr;
- }
- return MacroAttr;
-}
-
-static void emitAttributeMacroDecls(const AttributeMap &MacroAttr,
- llvm::raw_ostream &OS) {
- for (auto &[Macro, Attr] : MacroAttr) {
- std::vector<const llvm::Record *> Instances =
- Attr->getValueAsListOfDefs("Instances");
- llvm::SmallVector<std::pair<AttributeStyle, const llvm::Record *>> Styles;
- std::transform(Instances.begin(), Instances.end(),
- std::back_inserter(Styles),
- [&](const llvm::Record *Instance)
- -> std::pair<AttributeStyle, const llvm::Record *> {
- auto Style = getAttributeStyle(Instance);
- return {Style, Instance};
- });
- // 1. If __cplusplus is defined and cxx11 style is provided, define the
- // macro using cxx11 version with the following priority:
- // 1a. If there is no namespace (so the macro is supposed to be
- // compiler-independent), use this version first. This macro will be
- // tested via __has_cpp_attribute.
- // 1b. If the attribute is a clang attribute, check for __clang__.
- // 1c. If the attribute is a gnu attribute, check for __GNUC__.
- // 2. Otherwise, if __GNUC__ is defined and gnu style is provided,
- // define the macro using gnu version;
- // 3. Otherwise, if _MSC_VER is defined and __declspec is provided, define
- // the macro using __declspec version;
- // 4. Fallback to empty macro.
- std::sort(Styles.begin(), Styles.end(), [&](auto &a, auto &b) {
- if (a.first == AttributeStyle::Cxx11 && b.first == AttributeStyle::Cxx11)
- return getAttributeNamespace(a.second) <
- getAttributeNamespace(b.second);
- return a.first < b.first;
- });
- for (auto &[Style, Instance] : Styles) {
- llvm::StringRef Attr = Instance->getValueAsString("Attr");
- if (Style == AttributeStyle::Cxx11) {
- OS << "#if !defined(" << Macro << ") && defined(__cplusplus)";
- AttributeNamespace Namespace = getAttributeNamespace(Instance);
- if (Namespace == AttributeNamespace::Clang)
- OS << " && defined(__clang__)\n";
- else if (Namespace == AttributeNamespace::Gnu)
- OS << " && defined(__GNUC__)\n";
- else
- OS << '\n';
- if (isAsciiIdentifier(Attr) && Namespace != AttributeNamespace::None)
- OS << "#if __has_attribute(" << Attr << ")\n";
- else
- OS << "#if __has_cpp_attribute(" << Attr << ")\n";
- OS << "#define " << Macro << " [[";
- if (Namespace == AttributeNamespace::Clang)
- OS << "clang::";
- else if (Namespace == AttributeNamespace::Gnu)
- OS << "gnu::";
- OS << Attr << "]]\n";
- if (isAsciiIdentifier(Attr))
- OS << "#endif\n";
- OS << "#endif\n";
- }
- if (Style == AttributeStyle::Gnu) {
- OS << "#if !defined(" << Macro << ") && defined(__GNUC__)\n";
- if (isAsciiIdentifier(Attr))
- OS << "#if __has_attribute(" << Attr << ")\n";
- OS << "#define " << Macro << " __attribute__((";
- OS << Attr << "))\n";
- if (isAsciiIdentifier(Attr))
- OS << "#endif\n";
- OS << "#endif\n";
- }
- if (Style == AttributeStyle::Declspec) {
- OS << "#if !defined(" << Macro << ") && defined(_MSC_VER)\n";
- OS << "#define " << Macro << " __declspec(";
- OS << Attr << ")\n";
- OS << "#endif\n";
- }
- }
- OS << "#if !defined(" << Macro << ")\n";
- OS << "#define " << Macro << '\n';
- OS << "#endif\n";
- }
-
- if (!MacroAttr.empty())
- OS << '\n';
-}
-
-static void emitAttributeMacroForFunction(const llvm::Record *FunctionSpec,
- llvm::raw_ostream &OS) {
- std::vector<const llvm::Record *> Attributes =
- FunctionSpec->getValueAsListOfDefs("Attributes");
- llvm::interleave(
- Attributes.begin(), Attributes.end(),
- [&](const llvm::Record *Attr) { OS << Attr->getValueAsString("Macro"); },
- [&]() { OS << ' '; });
- if (!Attributes.empty())
- OS << ' ';
-}
-
-static void emitUndefsForAttributeMacros(const AttributeMap &MacroAttr,
- llvm::raw_ostream &OS) {
- if (!MacroAttr.empty())
- OS << '\n';
- for (auto &[Macro, Attr] : MacroAttr)
- OS << "#undef " << Macro << '\n';
-}
-
-static void writeAPIFromIndex(APIIndexer &G,
- std::vector<std::string> EntrypointNameList,
- llvm::raw_ostream &OS) {
- for (auto &Pair : G.MacroDefsMap) {
- const std::string &Name = Pair.first;
- if (!G.MacroSpecMap.count(Name))
- llvm::PrintFatalError(Name + " not found in any standard spec.\n");
-
- const llvm::Record *MacroDef = Pair.second;
- dedentAndWrite(MacroDef->getValueAsString("Defn"), OS);
-
- OS << '\n';
- }
-
- for (auto &TypeName : G.RequiredTypes) {
- if (!G.TypeSpecMap.count(TypeName))
- llvm::PrintFatalError(TypeName + " not found in any standard spec.\n");
- OS << "#include <llvm-libc-types/" << getTypeHdrName(TypeName) << ".h>\n";
- }
- OS << '\n';
-
- if (G.Enumerations.size() != 0)
- OS << "enum {" << '\n';
- for (const auto &Name : G.Enumerations) {
- if (!G.EnumerationSpecMap.count(Name))
- llvm::PrintFatalError(
- Name + " is not listed as an enumeration in any standard spec.\n");
-
- const llvm::Record *EnumerationSpec = G.EnumerationSpecMap[Name];
- OS << " " << EnumerationSpec->getValueAsString("Name");
- auto Value = EnumerationSpec->getValueAsString("Value");
- if (Value == "__default__") {
- OS << ",\n";
- } else {
- OS << " = " << Value << ",\n";
- }
- }
- if (G.Enumerations.size() != 0)
- OS << "};\n\n";
-
- // Collect and declare macros for attributes
- AttributeMap MacroAttr =
- collectAttributeMacros(G.FunctionSpecMap, EntrypointNameList);
- emitAttributeMacroDecls(MacroAttr, OS);
-
- OS << "__BEGIN_C_DECLS\n\n";
- for (auto &Name : EntrypointNameList) {
- auto Iter = G.FunctionSpecMap.find(Name);
-
- // Functions that aren't in this header file are skipped as
- // opposed to erroring out because the list of functions being
- // iterated over is the complete list of functions with
- // entrypoints. Thus this is filtering out the functions that
- // don't go to this header file, whereas the other, similar
- // conditionals above are more of a sanity check.
- if (Iter == G.FunctionSpecMap.end())
- continue;
-
- const llvm::Record *FunctionSpec = Iter->second;
- const llvm::Record *RetValSpec = FunctionSpec->getValueAsDef("Return");
- const llvm::Record *ReturnType = RetValSpec->getValueAsDef("ReturnType");
-
- // TODO: https://github.com/llvm/llvm-project/issues/81208
- // Ideally, we should group functions based on their guarding macros.
- bool Guarded =
- (FunctionSpec->getType()->getAsString() == "GuardedFunctionSpec");
-
- if (Guarded)
- OS << "#ifdef " << FunctionSpec->getValueAsString("Guard") << "\n";
-
- // Emit attribute macros for the function. Space is automatically added.
- emitAttributeMacroForFunction(FunctionSpec, OS);
- OS << G.getTypeAsString(ReturnType) << " " << Name << "(";
-
- auto ArgsList = FunctionSpec->getValueAsListOfDefs("Args");
- for (size_t i = 0; i < ArgsList.size(); ++i) {
- const llvm::Record *ArgType = ArgsList[i]->getValueAsDef("ArgType");
- OS << G.getTypeAsString(ArgType);
- if (i < ArgsList.size() - 1)
- OS << ", ";
- }
-
- OS << ") __NOEXCEPT;\n";
-
- if (Guarded)
- OS << "#endif // " << FunctionSpec->getValueAsString("Guard") << "\n";
-
- OS << "\n";
- }
-
- // Make another pass over entrypoints to emit object declarations.
- for (const auto &Name : EntrypointNameList) {
- auto Iter = G.ObjectSpecMap.find(Name);
- if (Iter == G.ObjectSpecMap.end())
- continue;
- const llvm::Record *ObjectSpec = Iter->second;
- auto Type = ObjectSpec->getValueAsString("Type");
- OS << "extern " << Type << " " << Name << ";\n";
- }
- OS << "__END_C_DECLS\n";
-
- // Undef file-level attribute macros.
- emitUndefsForAttributeMacros(MacroAttr, OS);
-}
-
-void writePublicAPI(llvm::raw_ostream &OS, const llvm::RecordKeeper &Records) {}
-
-const char PublicAPICommand::Name[] = "public_api";
-
-void PublicAPICommand::run(llvm::raw_ostream &OS, const ArgVector &Args,
- llvm::StringRef StdHeader,
- const llvm::RecordKeeper &Records,
- const Command::ErrorReporter &Reporter) const {
- if (Args.size() != 0)
- Reporter.printFatalError("public_api command does not take any arguments.");
-
- APIIndexer G(StdHeader, Records);
- writeAPIFromIndex(G, EntrypointNameList, OS);
-}
-
-} // namespace llvm_libc
diff --git a/libc/utils/HdrGen/PublicAPICommand.h b/libc/utils/HdrGen/PublicAPICommand.h
deleted file mode 100644
index 49078f4857f900..00000000000000
--- a/libc/utils/HdrGen/PublicAPICommand.h
+++ /dev/null
@@ -1,48 +0,0 @@
-//===-- Implementation of PublicAPICommand ----------------------*- C++ -*-===//
-//
-// 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_UTILS_HDRGEN_PUBLICAPICOMMAND_H
-#define LLVM_LIBC_UTILS_HDRGEN_PUBLICAPICOMMAND_H
-
-#include "Command.h"
-
-#include "llvm/ADT/StringRef.h"
-#include "llvm/TableGen/Error.h"
-#include "llvm/TableGen/Record.h"
-
-namespace llvm {
-
-class raw_ostream;
-class Record;
-class RecordKeeper;
-
-} // namespace llvm
-
-namespace llvm_libc {
-
-enum class AttributeStyle { Cxx11 = 0, Gnu = 1, Declspec = 2 };
-enum class AttributeNamespace { None = 0, Clang = 1, Gnu = 2 };
-
-class PublicAPICommand : public Command {
-private:
- const std::vector<std::string> &EntrypointNameList;
-
-public:
- static const char Name[];
-
- PublicAPICommand(const std::vector<std::string> &EntrypointNames)
- : EntrypointNameList(EntrypointNames) {}
-
- void run(llvm::raw_ostream &OS, const ArgVector &Args,
- llvm::StringRef StdHeader, const llvm::RecordKeeper &Records,
- const Command::ErrorReporter &Reporter) const override;
-};
-
-} // namespace llvm_libc
-
-#endif // LLVM_LIBC_UTILS_HDRGEN_PUBLICAPICOMMAND_H
diff --git a/libc/utils/HdrGen/README.md b/libc/utils/HdrGen/README.md
deleted file mode 100644
index a61cf3bacbb0ee..00000000000000
--- a/libc/utils/HdrGen/README.md
+++ /dev/null
@@ -1,5 +0,0 @@
-# The LLVM libc header generation system
-
-LLVM libc uses a header generation scheme to generate public as well as internal
-header files. This directory contains the implementation of the header generator
-which drives this header generation scheme.
diff --git a/libc/utils/LibcTableGenUtil/APIIndexer.cpp b/libc/utils/LibcTableGenUtil/APIIndexer.cpp
deleted file mode 100644
index cf66d0a7aef6e9..00000000000000
--- a/libc/utils/LibcTableGenUtil/APIIndexer.cpp
+++ /dev/null
@@ -1,173 +0,0 @@
-//===-- Implementation of APIIndexer class --------------------------------===//
-//
-// 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
-//
-//===----------------------------------------------------------------------===//
-
-#include "APIIndexer.h"
-
-#include "llvm/ADT/StringExtras.h"
-#include "llvm/ADT/StringRef.h"
-#include "llvm/TableGen/Error.h"
-#include "llvm/TableGen/Record.h"
-
-namespace llvm_libc {
-
-static const char NamedTypeClassName[] = "NamedType";
-static const char PtrTypeClassName[] = "PtrType";
-static const char RestrictedPtrTypeClassName[] = "RestrictedPtrType";
-static const char ConstTypeClassName[] = "ConstType";
-static const char StructTypeClassName[] = "Struct";
-
-static const char StandardSpecClassName[] = "StandardSpec";
-static const char PublicAPIClassName[] = "PublicAPI";
-
-static bool isa(const llvm::Record *Def, const llvm::Record *TypeClass) {
- const llvm::RecordRecTy *RecordType = Def->getType();
- llvm::ArrayRef<const llvm::Record *> Classes = RecordType->getClasses();
- // We want exact types. That is, we don't want the classes listed in
- // spec.td to be subclassed. Hence, we do not want the record |Def|
- // to be of more than one class type..
- if (Classes.size() != 1)
- return false;
- return Classes[0] == TypeClass;
-}
-
-bool APIIndexer::isaNamedType(const llvm::Record *Def) {
- return isa(Def, NamedTypeClass);
-}
-
-bool APIIndexer::isaStructType(const llvm::Record *Def) {
- return isa(Def, StructClass);
-}
-
-bool APIIndexer::isaPtrType(const llvm::Record *Def) {
- return isa(Def, PtrTypeClass);
-}
-
-bool APIIndexer::isaConstType(const llvm::Record *Def) {
- return isa(Def, ConstTypeClass);
-}
-
-bool APIIndexer::isaRestrictedPtrType(const llvm::Record *Def) {
- return isa(Def, RestrictedPtrTypeClass);
-}
-
-bool APIIndexer::isaStandardSpec(const llvm::Record *Def) {
- return isa(Def, StandardSpecClass);
-}
-
-bool APIIndexer::isaPublicAPI(const llvm::Record *Def) {
- return isa(Def, PublicAPIClass);
-}
-
-std::string APIIndexer::getTypeAsString(const llvm::Record *TypeRecord) {
- if (isaNamedType(TypeRecord) || isaStructType(TypeRecord)) {
- return std::string(TypeRecord->getValueAsString("Name"));
- } else if (isaPtrType(TypeRecord)) {
- return getTypeAsString(TypeRecord->getValueAsDef("PointeeType")) + " *";
- } else if (isaConstType(TypeRecord)) {
- return std::string("const ") +
- getTypeAsString(TypeRecord->getValueAsDef("UnqualifiedType"));
- } else if (isaRestrictedPtrType(TypeRecord)) {
- return getTypeAsString(TypeRecord->getValueAsDef("PointeeType")) +
- " *__restrict";
- } else {
- llvm::PrintFatalError(TypeRecord->getLoc(), "Invalid type.\n");
- }
-}
-
-void APIIndexer::indexStandardSpecDef(const llvm::Record *StandardSpec) {
- auto HeaderSpecList = StandardSpec->getValueAsListOfDefs("Headers");
- for (const llvm::Record *HeaderSpec : HeaderSpecList) {
- llvm::StringRef Header = HeaderSpec->getValueAsString("Name");
- if (!StdHeader.has_value() || Header == StdHeader) {
- PublicHeaders.emplace(Header);
- auto MacroSpecList = HeaderSpec->getValueAsListOfDefs("Macros");
- // TODO: Trigger a fatal error on duplicate specs.
- for (const llvm::Record *MacroSpec : MacroSpecList)
- MacroSpecMap[std::string(MacroSpec->getValueAsString("Name"))] =
- MacroSpec;
-
- auto TypeSpecList = HeaderSpec->getValueAsListOfDefs("Types");
- for (const llvm::Record *TypeSpec : TypeSpecList)
- TypeSpecMap[std::string(TypeSpec->getValueAsString("Name"))] = TypeSpec;
-
- auto FunctionSpecList = HeaderSpec->getValueAsListOfDefs("Functions");
- for (const llvm::Record *FunctionSpec : FunctionSpecList) {
- auto FunctionName = std::string(FunctionSpec->getValueAsString("Name"));
- FunctionSpecMap[FunctionName] = FunctionSpec;
- FunctionToHeaderMap[FunctionName] = std::string(Header);
- }
-
- auto EnumerationSpecList =
- HeaderSpec->getValueAsListOfDefs("Enumerations");
- for (const llvm::Record *EnumerationSpec : EnumerationSpecList) {
- EnumerationSpecMap[std::string(
- EnumerationSpec->getValueAsString("Name"))] = EnumerationSpec;
- }
-
- auto ObjectSpecList = HeaderSpec->getValueAsListOfDefs("Objects");
- for (const llvm::Record *ObjectSpec : ObjectSpecList) {
- auto ObjectName = std::string(ObjectSpec->getValueAsString("Name"));
- ObjectSpecMap[ObjectName] = ObjectSpec;
- ObjectToHeaderMap[ObjectName] = std::string(Header);
- }
- }
- }
-}
-
-void APIIndexer::indexPublicAPIDef(const llvm::Record *PublicAPI) {
- // While indexing the public API, we do not check if any of the entities
- // requested is from an included standard. Such a check is done while
- // generating the API.
- auto MacroDefList = PublicAPI->getValueAsListOfDefs("Macros");
- for (const llvm::Record *MacroDef : MacroDefList)
- MacroDefsMap[std::string(MacroDef->getValueAsString("Name"))] = MacroDef;
-
- auto TypeList = PublicAPI->getValueAsListOfStrings("Types");
- for (llvm::StringRef TypeName : TypeList)
- RequiredTypes.insert(std::string(TypeName));
-
- auto StructList = PublicAPI->getValueAsListOfStrings("Structs");
- for (llvm::StringRef StructName : StructList)
- Structs.insert(std::string(StructName));
-
- auto FunctionList = PublicAPI->getValueAsListOfStrings("Functions");
- for (llvm::StringRef FunctionName : FunctionList)
- Functions.insert(std::string(FunctionName));
-
- auto EnumerationList = PublicAPI->getValueAsListOfStrings("Enumerations");
- for (llvm::StringRef EnumerationName : EnumerationList)
- Enumerations.insert(std::string(EnumerationName));
-
- auto ObjectList = PublicAPI->getValueAsListOfStrings("Objects");
- for (llvm::StringRef ObjectName : ObjectList)
- Objects.insert(std::string(ObjectName));
-}
-
-void APIIndexer::index(const llvm::RecordKeeper &Records) {
- NamedTypeClass = Records.getClass(NamedTypeClassName);
- PtrTypeClass = Records.getClass(PtrTypeClassName);
- RestrictedPtrTypeClass = Records.getClass(RestrictedPtrTypeClassName);
- StructClass = Records.getClass(StructTypeClassName);
- ConstTypeClass = Records.getClass(ConstTypeClassName);
- StandardSpecClass = Records.getClass(StandardSpecClassName);
- PublicAPIClass = Records.getClass(PublicAPIClassName);
-
- const auto &DefsMap = Records.getDefs();
- for (auto &Pair : DefsMap) {
- const llvm::Record *Def = Pair.second.get();
- if (isaStandardSpec(Def))
- indexStandardSpecDef(Def);
- if (isaPublicAPI(Def)) {
- if (!StdHeader.has_value() ||
- Def->getValueAsString("HeaderName") == StdHeader)
- indexPublicAPIDef(Def);
- }
- }
-}
-
-} // namespace llvm_libc
diff --git a/libc/utils/LibcTableGenUtil/APIIndexer.h b/libc/utils/LibcTableGenUtil/APIIndexer.h
deleted file mode 100644
index b8bca15ba131c1..00000000000000
--- a/libc/utils/LibcTableGenUtil/APIIndexer.h
+++ /dev/null
@@ -1,86 +0,0 @@
-//===-- A class to index libc API listed in tablegen files ------*- C++ -*-===//
-//
-// 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_UTILS_LIBC_TABLE_GEN_UTILS_API_INDEXER_H
-#define LLVM_LIBC_UTILS_LIBC_TABLE_GEN_UTILS_API_INDEXER_H
-
-#include "llvm/ADT/StringRef.h"
-#include "llvm/TableGen/Record.h"
-
-#include <optional>
-#include <string>
-#include <unordered_map>
-#include <unordered_set>
-
-namespace llvm_libc {
-
-class APIIndexer {
-private:
- std::optional<llvm::StringRef> StdHeader;
-
- // TableGen classes in spec.td.
- const llvm::Record *NamedTypeClass;
- const llvm::Record *PtrTypeClass;
- const llvm::Record *RestrictedPtrTypeClass;
- const llvm::Record *ConstTypeClass;
- const llvm::Record *StructClass;
- const llvm::Record *StandardSpecClass;
- const llvm::Record *PublicAPIClass;
-
- bool isaNamedType(const llvm::Record *Def);
- bool isaStructType(const llvm::Record *Def);
- bool isaPtrType(const llvm::Record *Def);
- bool isaConstType(const llvm::Record *Def);
- bool isaRestrictedPtrType(const llvm::Record *Def);
- bool isaStandardSpec(const llvm::Record *Def);
- bool isaPublicAPI(const llvm::Record *Def);
-
- void indexStandardSpecDef(const llvm::Record *StandardSpec);
- void indexPublicAPIDef(const llvm::Record *PublicAPI);
- void index(const llvm::RecordKeeper &Records);
-
-public:
- using NameToRecordMapping =
- std::unordered_map<std::string, const llvm::Record *>;
- using NameSet = std::unordered_set<std::string>;
-
- // This indexes all headers, not just a specified one.
- explicit APIIndexer(const llvm::RecordKeeper &Records)
- : StdHeader(std::nullopt) {
- index(Records);
- }
-
- APIIndexer(llvm::StringRef Header, const llvm::RecordKeeper &Records)
- : StdHeader(Header) {
- index(Records);
- }
-
- // Mapping from names to records defining them.
- NameToRecordMapping MacroSpecMap;
- NameToRecordMapping TypeSpecMap;
- NameToRecordMapping EnumerationSpecMap;
- NameToRecordMapping FunctionSpecMap;
- NameToRecordMapping MacroDefsMap;
- NameToRecordMapping ObjectSpecMap;
-
- std::unordered_map<std::string, std::string> FunctionToHeaderMap;
- std::unordered_map<std::string, std::string> ObjectToHeaderMap;
-
- NameSet RequiredTypes;
- NameSet Structs;
- NameSet Enumerations;
- NameSet Functions;
- NameSet Objects;
- NameSet PublicHeaders;
-
- std::string getTypeAsString(const llvm::Record *TypeRecord);
-};
-
-} // namespace llvm_libc
-
-#endif // LLVM_LIBC_UTILS_LIBC_TABLE_GEN_UTILS_API_INDEXER_H
diff --git a/libc/utils/LibcTableGenUtil/CMakeLists.txt b/libc/utils/LibcTableGenUtil/CMakeLists.txt
deleted file mode 100644
index 9421383394a359..00000000000000
--- a/libc/utils/LibcTableGenUtil/CMakeLists.txt
+++ /dev/null
@@ -1,13 +0,0 @@
-if (NOT LLVM_LINK_LLVM_DYLIB)
- set(flags "DISABLE_LLVM_LINK_LLVM_DYLIB;LINK_COMPONENTS;Support;TableGen")
-else()
- set(flags "LINK_COMPONENTS;TableGen")
-endif()
-add_llvm_library(
- LibcTableGenUtil
- APIIndexer.cpp
- APIIndexer.h
- ${flags}
-)
-target_include_directories(LibcTableGenUtil PUBLIC ${LIBC_SOURCE_DIR})
-target_include_directories(LibcTableGenUtil PRIVATE ${LLVM_INCLUDE_DIR} ${LLVM_MAIN_INCLUDE_DIR})
>From 46251c628e4e4aee38f15419fcc67cc8b6c4d827 Mon Sep 17 00:00:00 2001
From: Nick Desaulniers <ndesaulniers at google.com>
Date: Thu, 21 Nov 2024 13:07:27 -0800
Subject: [PATCH 2/5] clean up llvm/runtimes/CMakeList.txt
---
llvm/runtimes/CMakeLists.txt | 18 ------------------
1 file changed, 18 deletions(-)
diff --git a/llvm/runtimes/CMakeLists.txt b/llvm/runtimes/CMakeLists.txt
index 57a56c6a604153..40fdb14e813332 100644
--- a/llvm/runtimes/CMakeLists.txt
+++ b/llvm/runtimes/CMakeLists.txt
@@ -520,24 +520,6 @@ if(build_runtimes)
endif()
endforeach()
endif()
- if("libc" IN_LIST LLVM_ENABLE_PROJECTS AND
- (LLVM_LIBC_FULL_BUILD OR LLVM_LIBC_GPU_BUILD))
- if(LIBC_HDRGEN_EXE)
- set(hdrgen_exe ${LIBC_HDRGEN_EXE})
- else()
- if(TARGET ${LIBC_TABLEGEN_EXE})
- set(hdrgen_exe $<TARGET_FILE:${LIBC_TABLEGEN_EXE}>)
- else()
- set(hdrgen_exe ${LIBC_TABLEGEN_EXE})
- endif()
- set(hdrgen_deps ${LIBC_TABLEGEN_TARGET})
- endif()
- if(NOT hdrgen_exe)
- message(FATAL_ERROR "libc-hdrgen executable missing")
- endif()
- list(APPEND extra_cmake_args "-DLIBC_HDRGEN_EXE=${hdrgen_exe}")
- list(APPEND extra_deps ${hdrgen_deps})
- endif()
if(LLVM_LIBC_GPU_BUILD)
list(APPEND extra_cmake_args "-DLLVM_LIBC_GPU_BUILD=ON")
if("libc" IN_LIST RUNTIMES_amdgcn-amd-amdhsa_LLVM_ENABLE_RUNTIMES)
>From a649bf044a2a2c2cea571ab3271530e2a6f44fe8 Mon Sep 17 00:00:00 2001
From: Nick Desaulniers <ndesaulniers at google.com>
Date: Thu, 21 Nov 2024 13:15:06 -0800
Subject: [PATCH 3/5] clean up more of llvm/runtimes/CMakeList.txt
---
llvm/CMakeLists.txt | 25 -------------------------
1 file changed, 25 deletions(-)
diff --git a/llvm/CMakeLists.txt b/llvm/CMakeLists.txt
index cfcf1404d82b7c..03c1486c45eebc 100644
--- a/llvm/CMakeLists.txt
+++ b/llvm/CMakeLists.txt
@@ -179,13 +179,8 @@ if(LIBC_GPU_BUILD)
list(APPEND RUNTIMES_amdgcn-amd-amdhsa_LLVM_ENABLE_RUNTIMES "libc")
endif()
-set(NEED_LIBC_HDRGEN FALSE)
-if("libc" IN_LIST LLVM_ENABLE_RUNTIMES)
- set(NEED_LIBC_HDRGEN TRUE)
-endif()
foreach(_name ${LLVM_RUNTIME_TARGETS})
if("libc" IN_LIST RUNTIMES_${_name}_LLVM_ENABLE_RUNTIMES)
- set(NEED_LIBC_HDRGEN TRUE)
if("${_name}" STREQUAL "amdgcn-amd-amdhsa" OR "${_name}" STREQUAL "nvptx64-nvidia-cuda")
set(LLVM_LIBC_GPU_BUILD ON)
endif()
@@ -195,26 +190,6 @@ if("${LIBC_TARGET_TRIPLE}" STREQUAL "amdgcn-amd-amdhsa" OR
"${LIBC_TARGET_TRIPLE}" STREQUAL "nvptx64-nvidia-cuda")
set(LLVM_LIBC_GPU_BUILD ON)
endif()
-if(NEED_LIBC_HDRGEN)
- # To build the libc runtime, we need to be able to build few libc build
- # tools from the "libc" project. So, we add it to the list of enabled
- # projects.
- if (NOT "libc" IN_LIST LLVM_ENABLE_PROJECTS)
- message(STATUS "Enabling libc project to build libc build tools")
- list(APPEND LLVM_ENABLE_PROJECTS "libc")
- endif()
-endif()
-
-foreach(proj IN LISTS LLVM_ENABLE_RUNTIMES)
- if("${proj}" IN_LIST LLVM_ENABLE_PROJECTS)
- # The 'libc' project bootstraps a few executables via the project build and
- # should not emit an error currently.
- if(NOT (NEED_LIBC_HDRGEN AND "${proj}" STREQUAL "libc"))
- message(FATAL_ERROR "Runtime project \"${proj}\" found in LLVM_ENABLE_PROJECTS and LLVM_ENABLE_RUNTIMES. It must only appear in one of them and that one should almost always be LLVM_ENABLE_RUNTIMES.")
- endif()
- endif()
-endforeach()
-unset(NEED_LIBC_HDRGEN)
# LLVM_ENABLE_PROJECTS_USED is `ON` if the user has ever used the
# `LLVM_ENABLE_PROJECTS` CMake cache variable. This exists for
>From 1c11706f118143d12b85608d07ce8e83db8511e7 Mon Sep 17 00:00:00 2001
From: Nick Desaulniers <ndesaulniers at google.com>
Date: Thu, 21 Nov 2024 13:20:06 -0800
Subject: [PATCH 4/5] remove NEED_LIBC_HDRGEN from libc/CMakeLists.txt
---
libc/CMakeLists.txt | 21 ---------------------
1 file changed, 21 deletions(-)
diff --git a/libc/CMakeLists.txt b/libc/CMakeLists.txt
index d00888b8801dc5..834d5719ce4de4 100644
--- a/libc/CMakeLists.txt
+++ b/libc/CMakeLists.txt
@@ -60,27 +60,6 @@ if(LIBC_BUILD_GPU_LOADER OR (LLVM_LIBC_GPU_BUILD AND NOT LLVM_RUNTIMES_BUILD))
add_subdirectory(utils/gpu)
endif()
-set(NEED_LIBC_HDRGEN FALSE)
-if(NOT LLVM_RUNTIMES_BUILD)
- if("libc" IN_LIST LLVM_ENABLE_RUNTIMES)
- set(NEED_LIBC_HDRGEN TRUE)
- else()
- foreach(_name ${LLVM_RUNTIME_TARGETS})
- if("libc" IN_LIST RUNTIMES_${_name}_LLVM_ENABLE_RUNTIMES)
- set(NEED_LIBC_HDRGEN TRUE)
- break()
- endif()
- endforeach()
- endif()
-endif()
-if(NEED_LIBC_HDRGEN)
- # When libc is build as part of the runtimes/bootstrap build's CMake run, we
- # only need to build the host tools to build the libc. So, we just do enough
- # to build libc-hdrgen and return.
- return()
-endif()
-unset(NEED_LIBC_HDRGEN)
-
option(LIBC_CMAKE_VERBOSE_LOGGING
"Log details warnings and notifications during CMake configuration." OFF)
>From ae75b6b1c9b90bdc1335cfdd96b38accc47f248e Mon Sep 17 00:00:00 2001
From: Nick Desaulniers <ndesaulniers at google.com>
Date: Thu, 21 Nov 2024 15:01:55 -0800
Subject: [PATCH 5/5] remove now unused add_gen_header, rename add_gen_header2
to add_gen_header
---
libc/cmake/modules/LLVMLibCHeaderRules.cmake | 126 +++----------------
libc/include/CMakeLists.txt | 4 +-
2 files changed, 19 insertions(+), 111 deletions(-)
diff --git a/libc/cmake/modules/LLVMLibCHeaderRules.cmake b/libc/cmake/modules/LLVMLibCHeaderRules.cmake
index 766225cbeab404..8f24cd4b3023bd 100644
--- a/libc/cmake/modules/LLVMLibCHeaderRules.cmake
+++ b/libc/cmake/modules/LLVMLibCHeaderRules.cmake
@@ -71,9 +71,9 @@ function(add_header target_name)
)
endfunction(add_header)
-function(add_gen_header2 target_name)
+function(add_gen_header target_name)
cmake_parse_arguments(
- "ADD_GEN_HDR2"
+ "ADD_GEN_HDR"
"PUBLIC" # No optional arguments
"YAML_FILE;DEF_FILE;GEN_HDR" # Single value arguments
"DEPENDS" # Multi value arguments
@@ -84,25 +84,25 @@ function(add_gen_header2 target_name)
add_library(${fq_target_name} INTERFACE)
return()
endif()
- if(NOT ADD_GEN_HDR2_DEF_FILE)
- message(FATAL_ERROR "`add_gen_hdr2` rule requires DEF_FILE to be specified.")
+ if(NOT ADD_GEN_HDR_DEF_FILE)
+ message(FATAL_ERROR "`add_gen_hdr` rule requires DEF_FILE to be specified.")
endif()
- if(NOT ADD_GEN_HDR2_GEN_HDR)
- message(FATAL_ERROR "`add_gen_hdr2` rule requires GEN_HDR to be specified.")
+ if(NOT ADD_GEN_HDR_GEN_HDR)
+ message(FATAL_ERROR "`add_gen_hdr` rule requires GEN_HDR to be specified.")
endif()
- if(NOT ADD_GEN_HDR2_YAML_FILE)
- message(FATAL_ERROR "`add_gen_hdr2` rule requires YAML_FILE to be specified.")
+ if(NOT ADD_GEN_HDR_YAML_FILE)
+ message(FATAL_ERROR "`add_gen_hdr` rule requires YAML_FILE to be specified.")
endif()
- set(absolute_path ${CMAKE_CURRENT_SOURCE_DIR}/${ADD_GEN_HDR2_GEN_HDR})
+ set(absolute_path ${CMAKE_CURRENT_SOURCE_DIR}/${ADD_GEN_HDR_GEN_HDR})
file(RELATIVE_PATH relative_path ${LIBC_INCLUDE_SOURCE_DIR} ${absolute_path})
set(out_file ${LIBC_INCLUDE_DIR}/${relative_path})
- set(yaml_file ${CMAKE_SOURCE_DIR}/${ADD_GEN_HDR2_YAML_FILE})
- set(def_file ${CMAKE_CURRENT_SOURCE_DIR}/${ADD_GEN_HDR2_DEF_FILE})
+ set(yaml_file ${CMAKE_SOURCE_DIR}/${ADD_GEN_HDR_YAML_FILE})
+ set(def_file ${CMAKE_CURRENT_SOURCE_DIR}/${ADD_GEN_HDR_DEF_FILE})
set(fq_data_files "")
- if(ADD_GEN_HDR2_DATA_FILES)
- foreach(data_file IN LISTS ADD_GEN_HDR2_DATA_FILES)
+ if(ADD_GEN_HDR_DATA_FILES)
+ foreach(data_file IN LISTS ADD_GEN_HDR_DATA_FILES)
list(APPEND fq_data_files "${CMAKE_CURRENT_SOURCE_DIR}/${data_file}")
endforeach(data_file)
endif()
@@ -118,7 +118,7 @@ function(add_gen_header2 target_name)
${entry_points}
--output_dir ${out_file}
DEPENDS ${yaml_file} ${def_file} ${fq_data_files}
- COMMENT "Generating header ${ADD_GEN_HDR2_GEN_HDR} from ${yaml_file} and ${def_file}"
+ COMMENT "Generating header ${ADD_GEN_HDR_GEN_HDR} from ${yaml_file} and ${def_file}"
)
if(LIBC_TARGET_OS_IS_GPU)
file(MAKE_DIRECTORY ${LIBC_INCLUDE_DIR}/llvm-libc-decls)
@@ -136,99 +136,6 @@ function(add_gen_header2 target_name)
)
endif()
- if(ADD_GEN_HDR2_DEPENDS)
- get_fq_deps_list(fq_deps_list ${ADD_GEN_HDR2_DEPENDS})
- # Dependencies of a add_header target can only be another add_gen_header target
- # or an add_header target.
- foreach(dep IN LISTS fq_deps_list)
- get_target_property(header_file ${dep} HEADER_FILE_PATH)
- if(NOT header_file)
- message(FATAL_ERROR "Invalid dependency '${dep}' for '${fq_target_name}'.")
- endif()
- endforeach()
- endif()
- set(generated_hdr_target ${fq_target_name}.__generated_hdr__)
- add_custom_target(
- ${generated_hdr_target}
- DEPENDS ${out_file} ${fq_deps_list} ${decl_out_file}
- )
-
- add_header_library(
- ${target_name}
- HDRS
- ${out_file}
- )
-
- add_dependencies(${fq_target_name} ${generated_hdr_target})
-
- set_target_properties(
- ${fq_target_name}
- PROPERTIES
- HEADER_FILE_PATH ${out_file}
- DECLS_FILE_PATH "${decl_out_file}"
- DEPS "${fq_deps_list}"
- )
-
-
-endfunction(add_gen_header2)
-
-# Usage:
-# add_gen_header(
-# <target name>
-# DEF_FILE <.h.def file>
-# GEN_HDR <generated header file name>
-# PARAMS <list of name=value pairs>
-# DATA_FILES <list input data files>
-# )
-function(add_gen_header target_name)
- cmake_parse_arguments(
- "ADD_GEN_HDR"
- "PUBLIC" # No optional arguments
- "DEF_FILE;GEN_HDR" # Single value arguments
- "PARAMS;DATA_FILES;DEPENDS" # Multi value arguments
- ${ARGN}
- )
- get_fq_target_name(${target_name} fq_target_name)
- if(NOT LLVM_LIBC_FULL_BUILD)
- # We don't want to use generated headers if we are doing a non-full-build.
- add_library(${fq_target_name} INTERFACE)
- return()
- endif()
- if(NOT ADD_GEN_HDR_DEF_FILE)
- message(FATAL_ERROR "`add_gen_hdr` rule requires DEF_FILE to be specified.")
- endif()
- if(NOT ADD_GEN_HDR_GEN_HDR)
- message(FATAL_ERROR "`add_gen_hdr` rule requires GEN_HDR to be specified.")
- endif()
-
- set(absolute_path ${CMAKE_CURRENT_SOURCE_DIR}/${ADD_GEN_HDR_GEN_HDR})
- file(RELATIVE_PATH relative_path ${LIBC_INCLUDE_SOURCE_DIR} ${absolute_path})
- set(out_file ${LIBC_INCLUDE_DIR}/${relative_path})
- set(in_file ${CMAKE_CURRENT_SOURCE_DIR}/${ADD_GEN_HDR_DEF_FILE})
-
- set(fq_data_files "")
- if(ADD_GEN_HDR_DATA_FILES)
- foreach(data_file IN LISTS ADD_GEN_HDR_DATA_FILES)
- list(APPEND fq_data_files "${CMAKE_CURRENT_SOURCE_DIR}/${data_file}")
- endforeach(data_file)
- endif()
-
- set(replacement_params "")
- if(ADD_GEN_HDR_PARAMS)
- list(APPEND replacement_params "--args" ${ADD_GEN_HDR_PARAMS})
- endif()
-
- set(gen_hdr_script "${LIBC_BUILD_SCRIPTS_DIR}/gen_hdr.py")
-
- set(ENTRYPOINT_NAME_LIST_ARG ${TARGET_ENTRYPOINT_NAME_LIST})
- list(TRANSFORM ENTRYPOINT_NAME_LIST_ARG PREPEND "--e=")
-
- if(LIBC_TARGET_OS_IS_GPU)
- file(MAKE_DIRECTORY ${LIBC_INCLUDE_DIR}/llvm-libc-decls)
- file(MAKE_DIRECTORY ${LIBC_INCLUDE_DIR}/llvm-libc-decls/gpu)
- set(decl_out_file ${LIBC_INCLUDE_DIR}/llvm-libc-decls/${relative_path})
- endif()
-
if(ADD_GEN_HDR_DEPENDS)
get_fq_deps_list(fq_deps_list ${ADD_GEN_HDR_DEPENDS})
# Dependencies of a add_header target can only be another add_gen_header target
@@ -252,9 +159,6 @@ function(add_gen_header target_name)
${out_file}
)
- # We add the dependencies separately and not list under add_header_library's
- # DEPENDS option above. This is because, deps of add_header_library are
- # used with target_link_libraries.
add_dependencies(${fq_target_name} ${generated_hdr_target})
set_target_properties(
@@ -264,4 +168,6 @@ function(add_gen_header target_name)
DECLS_FILE_PATH "${decl_out_file}"
DEPS "${fq_deps_list}"
)
+
+
endfunction(add_gen_header)
diff --git a/libc/include/CMakeLists.txt b/libc/include/CMakeLists.txt
index 483e63da48deae..2fad29450990ff 100644
--- a/libc/include/CMakeLists.txt
+++ b/libc/include/CMakeLists.txt
@@ -17,8 +17,10 @@ add_header(
__llvm-libc-common.h
)
+# TODO: Can we simplify this macro expansion?
+# https://github.com/llvm/llvm-project/issues/117254
macro(add_header_macro TARGET_NAME YAML_FILE DEF_FILE GEN_HDR DEPENDS)
- add_gen_header2(
+ add_gen_header(
${TARGET_NAME}
YAML_FILE ${YAML_FILE}
DEF_FILE ${DEF_FILE}
More information about the libc-commits
mailing list