[libc-commits] [libc] [libc] newheadergen: configured cmake (PR #98828)
via libc-commits
libc-commits at lists.llvm.org
Wed Jul 17 16:18:42 PDT 2024
https://github.com/RoseZhang03 updated https://github.com/llvm/llvm-project/pull/98828
>From c4bf58e2099b26fda230c227d4b120ad50765a8d Mon Sep 17 00:00:00 2001
From: Aaryan Shukla <aaryanshukla at google.com>
Date: Sun, 14 Jul 2024 18:20:08 +0000
Subject: [PATCH 01/18] [libc] newheadergen: configured cmake
- all headers in the build system are generated by newheadergen
- tested on gpu-build
---
libc/cmake/modules/LLVMLibCHeaderRules.cmake | 131 ++++++++++++++--
libc/include/CMakeLists.txt | 155 ++++++++++++-------
2 files changed, 217 insertions(+), 69 deletions(-)
diff --git a/libc/cmake/modules/LLVMLibCHeaderRules.cmake b/libc/cmake/modules/LLVMLibCHeaderRules.cmake
index 7fc6860f23eb2..1bcca5f19577c 100644
--- a/libc/cmake/modules/LLVMLibCHeaderRules.cmake
+++ b/libc/cmake/modules/LLVMLibCHeaderRules.cmake
@@ -66,7 +66,106 @@ function(add_header target_name)
)
endfunction(add_header)
-# A rule for generated header file targets.
+function(add_gen_header2 target_name)
+ cmake_parse_arguments(
+ "ADD_GEN_HDR2"
+ "PUBLIC" # No optional arguments
+ "YAML_FILE;DEF_FILE;GEN_HDR" # Single value arguments
+ "DEPENDS" # Multi value arguments
+ ${ARGN}
+ )
+ get_fq_target_name(${target_name} fq_target_name)
+ if(NOT LLVM_LIBC_FULL_BUILD)
+ add_library(${fq_target_name} INTERFACE)
+ return()
+ endif()
+ if(NOT ADD_GEN_HDR2_DEF_FILE)
+ mesage(FATAL_ERROR "`add_gen_hdr2` 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.")
+ endif()
+ if(NOT ADD_GEN_HDR2_YAML_FILE)
+ message(FATAL_ERROR "`add_gen_hdr2` rule requires YAML_FILE to be specified.")
+ endif()
+
+ set(absolute_path ${CMAKE_CURRENT_SOURCE_DIR}/${ADD_GEN_HDR2_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(fq_data_files "")
+ if(ADD_GEN_HDR2_DATA_FILES)
+ foreach(data_file IN 2LISTS ADD_GEN_HDR2_DATA_FILES)
+ list(APPEND fq_data_files "${CMAKE_CURRENT_SOURCE_DIR}/${data_file}")
+ endforeach(data_file)
+ endif()
+
+ set(entry_points "${TARGET_ENTRYPOINT_NAME_LIST}")
+ list(TRANSFORM entry_points PREPEND "--e=")
+
+ add_custom_command(
+ OUTPUT ${out_file}
+ COMMAND ${Python3_EXECUTABLE} ${LIBC_SOURCE_DIR}/newhdrgen/yaml_to_classes.py
+ ${yaml_file}
+ --h_def_file ${def_file}
+ ${entry_points}
+ --output_dir ${out_file}
+ DEPENDS ${yaml_file} ${def_file} ${fq_data_files}
+ COMMENT "Generating header ${ADD_GEN_HDR2_GE2N_HDR} from ${yaml_file} and ${def_file}"
+ )
+ 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 ${Python3_EXECUTABLE} ${LIBC_SOURCE_DIR}/newhdrgen/yaml_to_classes.py
+ ${yaml_file}
+ --export-decls
+ ${entry_points}
+ --output_dir ${decl_out_file}
+ WORKING_DIRECTORY ${CMAKE_CURRENT_SOURCE_DIR}
+ DEPENDS ${yaml_file} ${fq_data_files}
+ )
+ endif()
+ 2
+ if(ADD_GEN_HDR2_DEPENDS)
+ get_fq_deps_list(f2q_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}
+ DEPS "${fq_deps_list}"
+ )
+
+
+endfunction(add_gen_header2)
+
# Usage:
# add_gen_header(
# <target name>
@@ -140,22 +239,22 @@ function(add_gen_header target_name)
)
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
+ 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()
+ 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)
get_fq_deps_list(fq_deps_list ${ADD_GEN_HDR_DEPENDS})
diff --git a/libc/include/CMakeLists.txt b/libc/include/CMakeLists.txt
index 2cf7206f3a625..8e9942fac69e1 100644
--- a/libc/include/CMakeLists.txt
+++ b/libc/include/CMakeLists.txt
@@ -17,16 +17,18 @@ add_header(
__llvm-libc-common.h
)
-add_gen_header(
+add_gen_header2(
ctype
+ YAML_FILE ../libc/newhdrgen/yaml/ctype.yaml
DEF_FILE ctype.h.def
GEN_HDR ctype.h
DEPENDS
.llvm_libc_common_h
)
-add_gen_header(
+add_gen_header2(
dirent
+ YAML_FILE ../libc/newhdrgen/yaml/dirent.yaml
DEF_FILE dirent.h.def
GEN_HDR dirent.h
DEPENDS
@@ -36,8 +38,9 @@ add_gen_header(
.llvm-libc-types.struct_dirent
)
-add_gen_header(
+add_gen_header2(
fcntl
+ YAML_FILE ../libc/newhdrgen/yaml/fcntl.yaml
DEF_FILE fcntl.h.def
GEN_HDR fcntl.h
DEPENDS
@@ -51,8 +54,9 @@ add_gen_header(
.llvm_libc_common_h
)
-add_gen_header(
+add_gen_header2(
dlfcn
+ YAML_FILE ../libc/newhdrgen/yaml/dlfcn.yaml
DEF_FILE dlfcn.h.def
GEN_HDR dlfcn.h
DEPENDS
@@ -60,8 +64,9 @@ add_gen_header(
.llvm_libc_common_h
)
-add_gen_header(
+add_gen_header2(
features
+ YAML_FILE ../libc/newhdrgen/yaml/features.yaml
DEF_FILE features.h.def
GEN_HDR features.h
DEPENDS
@@ -69,8 +74,9 @@ add_gen_header(
.llvm-libc-macros.features_macros
)
-add_gen_header(
+add_gen_header2(
fenv
+ YAML_FILE ../libc/newhdrgen/yaml/fenv.yaml
DEF_FILE fenv.h.def
GEN_HDR fenv.h
DEPENDS
@@ -80,8 +86,9 @@ add_gen_header(
.llvm-libc-types.fexcept_t
)
-add_gen_header(
+add_gen_header2(
inttypes
+ YAML_FILE ../libc/newhdrgen/yaml/inttypes.yaml
DEF_FILE inttypes.h.def
GEN_HDR inttypes.h
DEPENDS
@@ -90,46 +97,50 @@ add_gen_header(
.llvm-libc-macros.inttypes_macros
)
-add_gen_header(
+add_gen_header2(
float
+ YAML_FILE ../libc/newhdrgen/yaml/float.yaml
DEF_FILE float.h.def
GEN_HDR float.h
DEPENDS
.llvm-libc-macros.float_macros
)
-add_gen_header(
+add_gen_header2(
stdint
+ YAML_FILE ../libc/newhdrgen/yaml/stdint.yaml
DEF_FILE stdint.h.def
GEN_HDR stdint.h
DEPENDS
.llvm-libc-macros.stdint_macros
)
-add_gen_header(
+add_gen_header2(
limits
+ YAML_FILE ../libc/newhdrgen/yaml/limits.yaml
DEF_FILE limits.h.def
GEN_HDR limits.h
DEPENDS
.llvm-libc-macros.limits_macros
)
-add_gen_header(
+add_gen_header2(
math
+ YAML_FILE ../libc/newhdrgen/yaml/math.yaml
DEF_FILE math.h.def
GEN_HDR math.h
DEPENDS
.llvm_libc_common_h
.llvm-libc-macros.float16_macros
.llvm-libc-macros.math_macros
- .llvm-libc-macros.math_function_macros
.llvm-libc-types.double_t
.llvm-libc-types.float_t
.llvm-libc-types.float128
)
-add_gen_header(
+add_gen_header2(
stdfix
+ YAML_FILE ../libc/newhdrgen/yaml/stdfix.yaml
DEF_FILE stdfix.h.def
GEN_HDR stdfix.h
DEPENDS
@@ -139,15 +150,16 @@ add_gen_header(
# TODO: This should be conditional on POSIX networking being included.
file(MAKE_DIRECTORY ${LIBC_INCLUDE_DIR}/arpa)
-add_gen_header(
+add_gen_header2(
arpa_inet
+ YAML_FILE ../libc/newhdrgen/yaml/arpa_inet.yaml
DEF_FILE arpa/inet.h.def
GEN_HDR arpa/inet.h
DEPENDS
.llvm_libc_common_h
)
-add_gen_header(
+add_gen_header2(
assert
DEF_FILE assert.h.def
GEN_HDR assert.h
@@ -156,8 +168,9 @@ add_gen_header(
.llvm-libc-macros.assert_macros
)
-add_gen_header(
+add_gen_header2(
setjmp
+ YAML_FILE ../libc/newhdrgen/yaml/setjmp.yaml
DEF_FILE setjmp.h.def
GEN_HDR setjmp.h
DEPENDS
@@ -165,8 +178,9 @@ add_gen_header(
.llvm-libc-types.jmp_buf
)
-add_gen_header(
+add_gen_header2(
string
+ YAML_FILE ../libc/newhdrgen/yaml/string.yaml
DEF_FILE string.h.def
GEN_HDR string.h
DEPENDS
@@ -175,8 +189,9 @@ add_gen_header(
.llvm-libc-types.size_t
)
-add_gen_header(
+add_gen_header2(
strings
+ YAML_FILE ../libc/newhdrgen/yaml/strings.yaml
DEF_FILE strings.h.def
GEN_HDR strings.h
DEPENDS
@@ -184,8 +199,9 @@ add_gen_header(
.llvm-libc-types.size_t
)
-add_gen_header(
+add_gen_header2(
search
+ YAML_FILE ../libc/newhdrgen/yaml/search.yaml
DEF_FILE search.h.def
GEN_HDR search.h
DEPENDS
@@ -196,8 +212,9 @@ add_gen_header(
.llvm-libc-types.size_t
)
-add_gen_header(
+add_gen_header2(
time
+ YAML_FILE ../libc/newhdrgen/yaml/time.yaml
DEF_FILE time.h.def
GEN_HDR time.h
DEPENDS
@@ -211,8 +228,9 @@ add_gen_header(
.llvm-libc-types.clockid_t
)
-add_gen_header(
+add_gen_header2(
threads
+ YAML_FILE ../libc/newhdrgen/yaml/threads.yaml
DEF_FILE threads.h.def
GEN_HDR threads.h
DEPENDS
@@ -227,8 +245,9 @@ add_gen_header(
.llvm-libc-types.tss_dtor_t
)
-add_gen_header(
+add_gen_header2(
errno
+ YAML_FILE ../libc/newhdrgen/yaml/errno.yaml
DEF_FILE errno.h.def
GEN_HDR errno.h
DEPENDS
@@ -236,8 +255,9 @@ add_gen_header(
.llvm-libc-macros.error_number_macros
)
-add_gen_header(
+add_gen_header2(
signal
+ YAML_FILE ../libc/newhdrgen/yaml/signal.yaml
DEF_FILE signal.h.def
GEN_HDR signal.h
DEPENDS
@@ -251,8 +271,9 @@ add_gen_header(
.llvm-libc-types.pid_t
)
-add_gen_header(
+add_gen_header2(
stdbit
+ YAML_FILE ../libc/newhdrgen/yaml/stdbit.yaml
DEF_FILE stdbit.h.def
GEN_HDR stdbit.h
DEPENDS
@@ -260,8 +281,9 @@ add_gen_header(
.llvm-libc-macros.stdbit_macros
)
-add_gen_header(
+add_gen_header2(
stdckdint
+ YAML_FILE ../libc/newhdrgen/yaml/stdckdint.yaml
DEF_FILE stdckdint.h.def
GEN_HDR stdckdint.h
DEPENDS
@@ -269,8 +291,9 @@ add_gen_header(
.llvm-libc-macros.stdckdint_macros
)
-add_gen_header(
+add_gen_header2(
stdio
+ YAML_FILE ../libc/newhdrgen/yaml/stdio.yaml
DEF_FILE stdio.h.def
GEN_HDR stdio.h
DEPENDS
@@ -284,8 +307,9 @@ add_gen_header(
.llvm_libc_common_h
)
-add_gen_header(
+add_gen_header2(
stdlib
+ YAML_FILE ../libc/newhdrgen/yaml/stdlib.yaml
DEF_FILE stdlib.h.def
GEN_HDR stdlib.h
DEPENDS
@@ -301,8 +325,9 @@ add_gen_header(
.llvm-libc-types.__atexithandler_t
)
-add_gen_header(
+add_gen_header2(
unistd
+ YAML_FILE ../libc/newhdrgen/yaml/unistd.yaml
DEF_FILE unistd.h.def
GEN_HDR unistd.h
DEPENDS
@@ -319,8 +344,9 @@ add_gen_header(
.llvm-libc-types.__getoptargv_t
)
-add_gen_header(
+add_gen_header2(
pthread
+ YAML_FILE ../libc/newhdrgen/yaml/pthread.yaml
DEF_FILE pthread.h.def
GEN_HDR pthread.h
DEPENDS
@@ -340,8 +366,9 @@ add_gen_header(
.llvm-libc-types.pthread_t
)
-add_gen_header(
+add_gen_header2(
sched
+ YAML_FILE ../libc/newhdrgen/yaml/sched.yaml
DEF_FILE sched.h.def
GEN_HDR sched.h
DEPENDS
@@ -356,8 +383,9 @@ add_gen_header(
.llvm-libc-types.struct_timespec
)
-add_gen_header(
+add_gen_header2(
spawn
+ YAML_FILE ../libc/newhdrgen/yaml/spawn.yaml
DEF_FILE spawn.h.def
GEN_HDR spawn.h
DEPENDS
@@ -373,8 +401,9 @@ add_gen_header(
# them.
file(MAKE_DIRECTORY ${LIBC_INCLUDE_DIR}/sys)
-add_gen_header(
+add_gen_header2(
sys_auxv
+ YAML_FILE ../libc/newhdrgen/yaml/sys/sys_auxv.yaml
DEF_FILE sys/auxv.h.def
GEN_HDR sys/auxv.h
DEPENDS
@@ -382,8 +411,9 @@ add_gen_header(
.llvm-libc-macros.sys_auxv_macros
)
-add_gen_header(
+add_gen_header2(
sys_epoll
+ YAML_FILE ../libc/newhdrgen/yaml/sys/sys_epoll.yaml
DEF_FILE sys/epoll.h.def
GEN_HDR sys/epoll.h
DEPENDS
@@ -394,8 +424,9 @@ add_gen_header(
.llvm-libc-macros.sys_epoll_macros
)
-add_gen_header(
+add_gen_header2(
sys_ioctl
+ YAML_FILE ../libc/newhdrgen/yaml/sys/sys_ioctl.yaml
DEF_FILE sys/ioctl.h.def
GEN_HDR sys/ioctl.h
DEPENDS
@@ -403,8 +434,9 @@ add_gen_header(
.llvm-libc-macros.sys_ioctl_macros
)
-add_gen_header(
+add_gen_header2(
sys_mman
+ YAML_FILE ../libc/newhdrgen/yaml/sys/sys_mman.yaml
DEF_FILE sys/mman.h.def
GEN_HDR sys/mman.h
DEPENDS
@@ -415,8 +447,9 @@ add_gen_header(
.llvm-libc-types.ssize_t
)
-add_gen_header(
+add_gen_header2(
sys_prctl
+ YAML_FILE ../libc/newhdrgen/yaml/sys_prctl.yaml
DEF_FILE sys/prctl.h.def
GEN_HDR sys/prctl.h
DEPENDS
@@ -431,8 +464,9 @@ add_header(
.llvm-libc-macros.sys_queue_macros
)
-add_gen_header(
+add_gen_header2(
sys_random
+ YAML_FILE ../libc/newhdrgen/yaml/sys/sys_random.yaml
DEF_FILE sys/random.h.def
GEN_HDR sys/random.h
DEPENDS
@@ -442,8 +476,9 @@ add_gen_header(
.llvm-libc-types.ssize_t
)
-add_gen_header(
+add_gen_header2(
sys_resource
+ YAML_FILE ../libc/newhdrgen/yaml/sys/sys_resource.yaml
DEF_FILE sys/resource.h.def
GEN_HDR sys/resource.h
DEPENDS
@@ -453,8 +488,9 @@ add_gen_header(
.llvm-libc-types.struct_rlimit
)
-add_gen_header(
+add_gen_header2(
sys_stat
+ YAML_FILE ../libc/newhdrgen/yaml/sys/sys_stat.yaml
DEF_FILE sys/stat.h.def
GEN_HDR sys/stat.h
DEPENDS
@@ -474,8 +510,9 @@ add_gen_header(
.llvm-libc-types.struct_stat
)
-add_gen_header(
+add_gen_header2(
sys_select
+ YAML_FILE ../libc/newhdrgen/yaml/sys/sys_select.yaml
DEF_FILE sys/select.h.def
GEN_HDR sys/select.h
DEPENDS
@@ -489,8 +526,9 @@ add_gen_header(
.llvm-libc-types.struct_timeval
)
-add_gen_header(
+add_gen_header2(
sys_sendfile
+ YAML_FILE ../libc/newhdrgen/yaml/sys/sys_sendfile.yaml
DEF_FILE sys/sendfile.h.def
GEN_HDR sys/sendfile.h
DEPENDS
@@ -500,8 +538,9 @@ add_gen_header(
.llvm-libc-types.ssize_t
)
-add_gen_header(
+add_gen_header2(
sys_socket
+ YAML_FILE ../libc/newhdrgen/yaml/sys/sys_socket.yaml
DEF_FILE sys/socket.h.def
GEN_HDR sys/socket.h
DEPENDS
@@ -513,8 +552,9 @@ add_gen_header(
.llvm-libc-types.struct_sockaddr_un
)
-add_gen_header(
+add_gen_header2(
sys_statvfs
+ YAML_FILE ../libc/newhdrgen/yaml/sys/sys_statvfs.yaml
DEF_FILE sys/statvfs.h.def
GEN_HDR sys/statvfs.h
DEPENDS
@@ -522,14 +562,16 @@ add_gen_header(
.llvm-libc-types.struct_statvfs
)
-add_gen_header(
+add_gen_header2(
sys_syscall
+ YAML_FILE ../libc/newhdrgen/yaml/sys/sys_syscall.yaml
DEF_FILE sys/syscall.h.def
GEN_HDR sys/syscall.h
)
-add_gen_header(
+add_gen_header2(
sys_time
+ YAML_FILE ../libc/newhdrgen/yaml/sys/sys_time.yaml
DEF_FILE sys/time.h.def
GEN_HDR sys/time.h
DEPENDS
@@ -538,8 +580,9 @@ add_gen_header(
.llvm-libc-macros.sys_time_macros
)
-add_gen_header(
+add_gen_header2(
sys_types
+ YAML_FILE ../libc/newhdrgen/yaml/sys/sys_types.yaml
DEF_FILE sys/types.h.def
GEN_HDR sys/types.h
DEPENDS
@@ -567,8 +610,9 @@ add_gen_header(
.llvm-libc-types.uid_t
)
-add_gen_header(
+add_gen_header2(
sys_utsname
+ YAML_FILE ../libc/newhdrgen/yaml/sys/sys_utsname.yaml
DEF_FILE sys/utsname.h.def
GEN_HDR sys/utsname.h
DEPENDS
@@ -576,8 +620,9 @@ add_gen_header(
.llvm-libc-types.struct_utsname
)
-add_gen_header(
+add_gen_header2(
sys_wait
+ YAML_FILE ../libc/newhdrgen/yaml/sys/sys_wait.yaml
DEF_FILE sys/wait.h.def
GEN_HDR sys/wait.h
DEPENDS
@@ -588,8 +633,9 @@ add_gen_header(
.llvm-libc-types.siginfo_t
)
-add_gen_header(
+add_gen_header2(
termios
+ YAML_FILE ../libc/newhdrgen/yaml/termios.yaml
DEF_FILE termios.h.def
GEN_HDR termios.h
DEPENDS
@@ -602,8 +648,9 @@ add_gen_header(
.llvm-libc-types.tcflag_t
)
-add_gen_header(
+add_gen_header2(
uchar
+ YAML_FILE ../libc/newhdrgen/yaml/uchar.yaml
DEF_FILE uchar.h.def
GEN_HDR uchar.h
DEPENDS
@@ -614,8 +661,9 @@ add_gen_header(
.llvm-libc-types.char32_t
)
-add_gen_header(
+add_gen_header2(
wchar
+ YAML_FILE ../libc/newhdrgen/yaml/wchar.yaml
DEF_FILE wchar.h.def
GEN_HDR wchar.h
DEPENDS
@@ -630,8 +678,9 @@ add_gen_header(
if(LIBC_TARGET_OS_IS_GPU)
file(MAKE_DIRECTORY ${LIBC_INCLUDE_DIR}/gpu)
- add_gen_header(
+ add_gen_header2(
gpu_rpc
+ YAML_FILE ../libc/newhdrgen/yaml/rpc.yaml
DEF_FILE gpu/rpc.h.def
GEN_HDR gpu/rpc.h
DEPENDS
@@ -703,4 +752,4 @@ if(LLVM_LIBC_FULL_BUILD)
-P "${CMAKE_BINARY_DIR}/cmake_install.cmake")
# Stripping is a no-op for headers
add_custom_target(install-libc-headers-stripped DEPENDS install-libc-headers)
-endif()
+endif()
\ No newline at end of file
>From 3e81ec5ad990db71a4b4d0ae4ddcff3462b4f137 Mon Sep 17 00:00:00 2001
From: Aaryan Shukla <aaryanshukla at google.com>
Date: Sun, 14 Jul 2024 18:27:42 +0000
Subject: [PATCH 02/18] added sys path for prctl
---
libc/include/CMakeLists.txt | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/libc/include/CMakeLists.txt b/libc/include/CMakeLists.txt
index 8e9942fac69e1..0d59f21e0fffa 100644
--- a/libc/include/CMakeLists.txt
+++ b/libc/include/CMakeLists.txt
@@ -449,7 +449,7 @@ add_gen_header2(
add_gen_header2(
sys_prctl
- YAML_FILE ../libc/newhdrgen/yaml/sys_prctl.yaml
+ YAML_FILE ../libc/newhdrgen/yaml/sys/sys_prctl.yaml
DEF_FILE sys/prctl.h.def
GEN_HDR sys/prctl.h
DEPENDS
>From a4aa40903cd068773b185bd800288d4f4a96fd00 Mon Sep 17 00:00:00 2001
From: Aaryan Shukla <aaryanshukla at google.com>
Date: Sun, 14 Jul 2024 18:28:34 +0000
Subject: [PATCH 03/18] added newline for CMakeLists.txt
---
libc/include/CMakeLists.txt | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/libc/include/CMakeLists.txt b/libc/include/CMakeLists.txt
index 0d59f21e0fffa..7bb15371c91b0 100644
--- a/libc/include/CMakeLists.txt
+++ b/libc/include/CMakeLists.txt
@@ -752,4 +752,4 @@ if(LLVM_LIBC_FULL_BUILD)
-P "${CMAKE_BINARY_DIR}/cmake_install.cmake")
# Stripping is a no-op for headers
add_custom_target(install-libc-headers-stripped DEPENDS install-libc-headers)
-endif()
\ No newline at end of file
+endif()
>From d70d4848d4fea3cbe702ee153a586ad9f9bde933 Mon Sep 17 00:00:00 2001
From: Aaryan Shukla <aaryanshukla at google.com>
Date: Sun, 14 Jul 2024 18:30:45 +0000
Subject: [PATCH 04/18] spacing and nits
---
libc/cmake/modules/LLVMLibCHeaderRules.cmake | 10 +++++-----
1 file changed, 5 insertions(+), 5 deletions(-)
diff --git a/libc/cmake/modules/LLVMLibCHeaderRules.cmake b/libc/cmake/modules/LLVMLibCHeaderRules.cmake
index 1bcca5f19577c..b87137c5f1a0d 100644
--- a/libc/cmake/modules/LLVMLibCHeaderRules.cmake
+++ b/libc/cmake/modules/LLVMLibCHeaderRules.cmake
@@ -130,7 +130,7 @@ function(add_gen_header2 target_name)
DEPENDS ${yaml_file} ${fq_data_files}
)
endif()
- 2
+
if(ADD_GEN_HDR2_DEPENDS)
get_fq_deps_list(f2q_deps_list ${ADD_GEN_HDR2_DEPENDS})
# Dependencies of a add_header target can only be another add_gen_header target
@@ -239,10 +239,10 @@ function(add_gen_header target_name)
)
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(
+ 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
>From ab22a55e6bdf467de1602a81e8c8f9defcf49244 Mon Sep 17 00:00:00 2001
From: Rose Zhang <rosezhang at google.com>
Date: Mon, 15 Jul 2024 22:09:36 +0000
Subject: [PATCH 05/18] added switch for using old versus new headergen in
CMakeLists
---
libc/include/CMakeLists.txt | 1853 +++++++++++++++++++++++------------
1 file changed, 1239 insertions(+), 614 deletions(-)
diff --git a/libc/include/CMakeLists.txt b/libc/include/CMakeLists.txt
index 7bb15371c91b0..3a9f511d47d77 100644
--- a/libc/include/CMakeLists.txt
+++ b/libc/include/CMakeLists.txt
@@ -17,676 +17,1301 @@ add_header(
__llvm-libc-common.h
)
-add_gen_header2(
- ctype
- YAML_FILE ../libc/newhdrgen/yaml/ctype.yaml
- DEF_FILE ctype.h.def
- GEN_HDR ctype.h
- DEPENDS
- .llvm_libc_common_h
-)
-
-add_gen_header2(
- dirent
- YAML_FILE ../libc/newhdrgen/yaml/dirent.yaml
- DEF_FILE dirent.h.def
- GEN_HDR dirent.h
- DEPENDS
- .llvm_libc_common_h
- .llvm-libc-types.ino_t
- .llvm-libc-types.DIR
- .llvm-libc-types.struct_dirent
-)
+if (USE_NEW_HEADER_GEN)
+ add_gen_header2(
+ ctype
+ YAML_FILE ../libc/newhdrgen/yaml/ctype.yaml
+ DEF_FILE ctype.h.def
+ GEN_HDR ctype.h
+ DEPENDS
+ .llvm_libc_common_h
+ )
-add_gen_header2(
- fcntl
- YAML_FILE ../libc/newhdrgen/yaml/fcntl.yaml
- DEF_FILE fcntl.h.def
- GEN_HDR fcntl.h
- DEPENDS
- .llvm-libc-macros.fcntl_macros
- .llvm-libc-types.mode_t
- .llvm-libc-types.struct_flock
- .llvm-libc-types.struct_flock64
- .llvm-libc-types.off64_t
- .llvm-libc-types.pid_t
- .llvm-libc-types.off_t
- .llvm_libc_common_h
-)
+ add_gen_header2(
+ dirent
+ YAML_FILE ../libc/newhdrgen/yaml/dirent.yaml
+ DEF_FILE dirent.h.def
+ GEN_HDR dirent.h
+ DEPENDS
+ .llvm_libc_common_h
+ .llvm-libc-types.ino_t
+ .llvm-libc-types.DIR
+ .llvm-libc-types.struct_dirent
+ )
-add_gen_header2(
- dlfcn
- YAML_FILE ../libc/newhdrgen/yaml/dlfcn.yaml
- DEF_FILE dlfcn.h.def
- GEN_HDR dlfcn.h
- DEPENDS
- .llvm-libc-macros.dlfcn_macros
- .llvm_libc_common_h
-)
+ add_gen_header2(
+ fcntl
+ YAML_FILE ../libc/newhdrgen/yaml/fcntl.yaml
+ DEF_FILE fcntl.h.def
+ GEN_HDR fcntl.h
+ DEPENDS
+ .llvm-libc-macros.fcntl_macros
+ .llvm-libc-types.mode_t
+ .llvm-libc-types.struct_flock
+ .llvm-libc-types.struct_flock64
+ .llvm-libc-types.off64_t
+ .llvm-libc-types.pid_t
+ .llvm-libc-types.off_t
+ .llvm_libc_common_h
+ )
-add_gen_header2(
- features
- YAML_FILE ../libc/newhdrgen/yaml/features.yaml
- DEF_FILE features.h.def
- GEN_HDR features.h
- DEPENDS
- .llvm_libc_common_h
- .llvm-libc-macros.features_macros
-)
+ add_gen_header2(
+ dlfcn
+ YAML_FILE ../libc/newhdrgen/yaml/dlfcn.yaml
+ DEF_FILE dlfcn.h.def
+ GEN_HDR dlfcn.h
+ DEPENDS
+ .llvm-libc-macros.dlfcn_macros
+ .llvm_libc_common_h
+ )
-add_gen_header2(
- fenv
- YAML_FILE ../libc/newhdrgen/yaml/fenv.yaml
- DEF_FILE fenv.h.def
- GEN_HDR fenv.h
- DEPENDS
- .llvm_libc_common_h
- .llvm-libc-macros.fenv_macros
- .llvm-libc-types.fenv_t
- .llvm-libc-types.fexcept_t
-)
+ add_gen_header2(
+ features
+ YAML_FILE ../libc/newhdrgen/yaml/features.yaml
+ DEF_FILE features.h.def
+ GEN_HDR features.h
+ DEPENDS
+ .llvm_libc_common_h
+ .llvm-libc-macros.features_macros
+ )
-add_gen_header2(
- inttypes
- YAML_FILE ../libc/newhdrgen/yaml/inttypes.yaml
- DEF_FILE inttypes.h.def
- GEN_HDR inttypes.h
- DEPENDS
- .llvm_libc_common_h
- .llvm-libc-types.imaxdiv_t
- .llvm-libc-macros.inttypes_macros
-)
+ add_gen_header2(
+ fenv
+ YAML_FILE ../libc/newhdrgen/yaml/fenv.yaml
+ DEF_FILE fenv.h.def
+ GEN_HDR fenv.h
+ DEPENDS
+ .llvm_libc_common_h
+ .llvm-libc-macros.fenv_macros
+ .llvm-libc-types.fenv_t
+ .llvm-libc-types.fexcept_t
+ )
-add_gen_header2(
- float
- YAML_FILE ../libc/newhdrgen/yaml/float.yaml
- DEF_FILE float.h.def
- GEN_HDR float.h
- DEPENDS
- .llvm-libc-macros.float_macros
-)
+ add_gen_header2(
+ inttypes
+ YAML_FILE ../libc/newhdrgen/yaml/inttypes.yaml
+ DEF_FILE inttypes.h.def
+ GEN_HDR inttypes.h
+ DEPENDS
+ .llvm_libc_common_h
+ .llvm-libc-types.imaxdiv_t
+ .llvm-libc-macros.inttypes_macros
+ )
-add_gen_header2(
- stdint
- YAML_FILE ../libc/newhdrgen/yaml/stdint.yaml
- DEF_FILE stdint.h.def
- GEN_HDR stdint.h
- DEPENDS
- .llvm-libc-macros.stdint_macros
-)
+ add_gen_header2(
+ float
+ YAML_FILE ../libc/newhdrgen/yaml/float.yaml
+ DEF_FILE float.h.def
+ GEN_HDR float.h
+ DEPENDS
+ .llvm-libc-macros.float_macros
+ )
-add_gen_header2(
- limits
- YAML_FILE ../libc/newhdrgen/yaml/limits.yaml
- DEF_FILE limits.h.def
- GEN_HDR limits.h
- DEPENDS
- .llvm-libc-macros.limits_macros
-)
+ add_gen_header2(
+ stdint
+ YAML_FILE ../libc/newhdrgen/yaml/stdint.yaml
+ DEF_FILE stdint.h.def
+ GEN_HDR stdint.h
+ DEPENDS
+ .llvm-libc-macros.stdint_macros
+ )
-add_gen_header2(
- math
- YAML_FILE ../libc/newhdrgen/yaml/math.yaml
- DEF_FILE math.h.def
- GEN_HDR math.h
- DEPENDS
- .llvm_libc_common_h
- .llvm-libc-macros.float16_macros
- .llvm-libc-macros.math_macros
- .llvm-libc-types.double_t
- .llvm-libc-types.float_t
- .llvm-libc-types.float128
-)
+ add_gen_header2(
+ limits
+ YAML_FILE ../libc/newhdrgen/yaml/limits.yaml
+ DEF_FILE limits.h.def
+ GEN_HDR limits.h
+ DEPENDS
+ .llvm-libc-macros.limits_macros
+ )
-add_gen_header2(
- stdfix
- YAML_FILE ../libc/newhdrgen/yaml/stdfix.yaml
- DEF_FILE stdfix.h.def
- GEN_HDR stdfix.h
- DEPENDS
- .llvm-libc-macros.stdfix_macros
-)
+ add_gen_header2(
+ math
+ YAML_FILE ../libc/newhdrgen/yaml/math.yaml
+ DEF_FILE math.h.def
+ GEN_HDR math.h
+ DEPENDS
+ .llvm_libc_common_h
+ .llvm-libc-macros.float16_macros
+ .llvm-libc-macros.math_macros
+ .llvm-libc-types.double_t
+ .llvm-libc-types.float_t
+ .llvm-libc-types.float128
+ )
-# TODO: This should be conditional on POSIX networking being included.
-file(MAKE_DIRECTORY ${LIBC_INCLUDE_DIR}/arpa)
+ add_gen_header2(
+ stdfix
+ YAML_FILE ../libc/newhdrgen/yaml/stdfix.yaml
+ DEF_FILE stdfix.h.def
+ GEN_HDR stdfix.h
+ DEPENDS
+ .llvm-libc-macros.stdfix_macros
+ )
-add_gen_header2(
- arpa_inet
- YAML_FILE ../libc/newhdrgen/yaml/arpa_inet.yaml
- DEF_FILE arpa/inet.h.def
- GEN_HDR arpa/inet.h
- DEPENDS
- .llvm_libc_common_h
-)
+ # TODO: This should be conditional on POSIX networking being included.
+ file(MAKE_DIRECTORY ${LIBC_INCLUDE_DIR}/arpa)
-add_gen_header2(
- assert
- DEF_FILE assert.h.def
- GEN_HDR assert.h
- DEPENDS
- .llvm_libc_common_h
- .llvm-libc-macros.assert_macros
-)
+ add_gen_header2(
+ arpa_inet
+ YAML_FILE ../libc/newhdrgen/yaml/arpa_inet.yaml
+ DEF_FILE arpa/inet.h.def
+ GEN_HDR arpa/inet.h
+ DEPENDS
+ .llvm_libc_common_h
+ )
-add_gen_header2(
- setjmp
- YAML_FILE ../libc/newhdrgen/yaml/setjmp.yaml
- DEF_FILE setjmp.h.def
- GEN_HDR setjmp.h
- DEPENDS
- .llvm_libc_common_h
- .llvm-libc-types.jmp_buf
-)
+ add_gen_header2(
+ assert
+ DEF_FILE assert.h.def
+ GEN_HDR assert.h
+ DEPENDS
+ .llvm_libc_common_h
+ .llvm-libc-macros.assert_macros
+ )
-add_gen_header2(
- string
- YAML_FILE ../libc/newhdrgen/yaml/string.yaml
- DEF_FILE string.h.def
- GEN_HDR string.h
- DEPENDS
- .llvm_libc_common_h
- .llvm-libc-macros.null_macro
- .llvm-libc-types.size_t
-)
+ add_gen_header2(
+ setjmp
+ YAML_FILE ../libc/newhdrgen/yaml/setjmp.yaml
+ DEF_FILE setjmp.h.def
+ GEN_HDR setjmp.h
+ DEPENDS
+ .llvm_libc_common_h
+ .llvm-libc-types.jmp_buf
+ )
-add_gen_header2(
- strings
- YAML_FILE ../libc/newhdrgen/yaml/strings.yaml
- DEF_FILE strings.h.def
- GEN_HDR strings.h
- DEPENDS
- .llvm_libc_common_h
- .llvm-libc-types.size_t
-)
+ add_gen_header2(
+ string
+ YAML_FILE ../libc/newhdrgen/yaml/string.yaml
+ DEF_FILE string.h.def
+ GEN_HDR string.h
+ DEPENDS
+ .llvm_libc_common_h
+ .llvm-libc-macros.null_macro
+ .llvm-libc-types.size_t
+ )
-add_gen_header2(
- search
- YAML_FILE ../libc/newhdrgen/yaml/search.yaml
- DEF_FILE search.h.def
- GEN_HDR search.h
- DEPENDS
- .llvm_libc_common_h
- .llvm-libc-types.ACTION
- .llvm-libc-types.ENTRY
- .llvm-libc-types.struct_hsearch_data
- .llvm-libc-types.size_t
-)
+ add_gen_header2(
+ strings
+ YAML_FILE ../libc/newhdrgen/yaml/strings.yaml
+ DEF_FILE strings.h.def
+ GEN_HDR strings.h
+ DEPENDS
+ .llvm_libc_common_h
+ .llvm-libc-types.size_t
+ )
-add_gen_header2(
- time
- YAML_FILE ../libc/newhdrgen/yaml/time.yaml
- DEF_FILE time.h.def
- GEN_HDR time.h
- DEPENDS
- .llvm_libc_common_h
- .llvm-libc-macros.time_macros
- .llvm-libc-types.clock_t
- .llvm-libc-types.time_t
- .llvm-libc-types.struct_tm
- .llvm-libc-types.struct_timespec
- .llvm-libc-types.struct_timeval
- .llvm-libc-types.clockid_t
-)
+ add_gen_header2(
+ search
+ YAML_FILE ../libc/newhdrgen/yaml/search.yaml
+ DEF_FILE search.h.def
+ GEN_HDR search.h
+ DEPENDS
+ .llvm_libc_common_h
+ .llvm-libc-types.ACTION
+ .llvm-libc-types.ENTRY
+ .llvm-libc-types.struct_hsearch_data
+ .llvm-libc-types.size_t
+ )
-add_gen_header2(
- threads
- YAML_FILE ../libc/newhdrgen/yaml/threads.yaml
- DEF_FILE threads.h.def
- GEN_HDR threads.h
- DEPENDS
- .llvm_libc_common_h
- .llvm-libc-types.__call_once_func_t
- .llvm-libc-types.once_flag
- .llvm-libc-types.cnd_t
- .llvm-libc-types.mtx_t
- .llvm-libc-types.thrd_t
- .llvm-libc-types.thrd_start_t
- .llvm-libc-types.tss_t
- .llvm-libc-types.tss_dtor_t
-)
+ add_gen_header2(
+ time
+ YAML_FILE ../libc/newhdrgen/yaml/time.yaml
+ DEF_FILE time.h.def
+ GEN_HDR time.h
+ DEPENDS
+ .llvm_libc_common_h
+ .llvm-libc-macros.time_macros
+ .llvm-libc-types.clock_t
+ .llvm-libc-types.time_t
+ .llvm-libc-types.struct_tm
+ .llvm-libc-types.struct_timespec
+ .llvm-libc-types.struct_timeval
+ .llvm-libc-types.clockid_t
+ )
-add_gen_header2(
- errno
- YAML_FILE ../libc/newhdrgen/yaml/errno.yaml
- DEF_FILE errno.h.def
- GEN_HDR errno.h
- DEPENDS
- .llvm-libc-macros.generic_error_number_macros
- .llvm-libc-macros.error_number_macros
-)
+ add_gen_header2(
+ threads
+ YAML_FILE ../libc/newhdrgen/yaml/threads.yaml
+ DEF_FILE threads.h.def
+ GEN_HDR threads.h
+ DEPENDS
+ .llvm_libc_common_h
+ .llvm-libc-types.__call_once_func_t
+ .llvm-libc-types.once_flag
+ .llvm-libc-types.cnd_t
+ .llvm-libc-types.mtx_t
+ .llvm-libc-types.thrd_t
+ .llvm-libc-types.thrd_start_t
+ .llvm-libc-types.tss_t
+ .llvm-libc-types.tss_dtor_t
+ )
-add_gen_header2(
- signal
- YAML_FILE ../libc/newhdrgen/yaml/signal.yaml
- DEF_FILE signal.h.def
- GEN_HDR signal.h
- DEPENDS
- .llvm-libc-macros.signal_macros
- .llvm-libc-types.sig_atomic_t
- .llvm-libc-types.sigset_t
- .llvm-libc-types.struct_sigaction
- .llvm-libc-types.union_sigval
- .llvm-libc-types.siginfo_t
- .llvm-libc-types.stack_t
- .llvm-libc-types.pid_t
-)
+ add_gen_header2(
+ errno
+ YAML_FILE ../libc/newhdrgen/yaml/errno.yaml
+ DEF_FILE errno.h.def
+ GEN_HDR errno.h
+ DEPENDS
+ .llvm-libc-macros.generic_error_number_macros
+ .llvm-libc-macros.error_number_macros
+ )
-add_gen_header2(
- stdbit
- YAML_FILE ../libc/newhdrgen/yaml/stdbit.yaml
- DEF_FILE stdbit.h.def
- GEN_HDR stdbit.h
- DEPENDS
- .llvm_libc_common_h
- .llvm-libc-macros.stdbit_macros
-)
+ add_gen_header2(
+ signal
+ YAML_FILE ../libc/newhdrgen/yaml/signal.yaml
+ DEF_FILE signal.h.def
+ GEN_HDR signal.h
+ DEPENDS
+ .llvm-libc-macros.signal_macros
+ .llvm-libc-types.sig_atomic_t
+ .llvm-libc-types.sigset_t
+ .llvm-libc-types.struct_sigaction
+ .llvm-libc-types.union_sigval
+ .llvm-libc-types.siginfo_t
+ .llvm-libc-types.stack_t
+ .llvm-libc-types.pid_t
+ )
-add_gen_header2(
- stdckdint
- YAML_FILE ../libc/newhdrgen/yaml/stdckdint.yaml
- DEF_FILE stdckdint.h.def
- GEN_HDR stdckdint.h
- DEPENDS
- .llvm_libc_common_h
- .llvm-libc-macros.stdckdint_macros
-)
+ add_gen_header2(
+ stdbit
+ YAML_FILE ../libc/newhdrgen/yaml/stdbit.yaml
+ DEF_FILE stdbit.h.def
+ GEN_HDR stdbit.h
+ DEPENDS
+ .llvm_libc_common_h
+ .llvm-libc-macros.stdbit_macros
+ )
-add_gen_header2(
- stdio
- YAML_FILE ../libc/newhdrgen/yaml/stdio.yaml
- DEF_FILE stdio.h.def
- GEN_HDR stdio.h
- DEPENDS
- .llvm-libc-macros.file_seek_macros
- .llvm-libc-macros.stdio_macros
- .llvm-libc-types.FILE
- .llvm-libc-types.cookie_io_functions_t
- .llvm-libc-types.off_t
- .llvm-libc-types.size_t
- .llvm-libc-types.ssize_t
- .llvm_libc_common_h
-)
+ add_gen_header2(
+ stdckdint
+ YAML_FILE ../libc/newhdrgen/yaml/stdckdint.yaml
+ DEF_FILE stdckdint.h.def
+ GEN_HDR stdckdint.h
+ DEPENDS
+ .llvm_libc_common_h
+ .llvm-libc-macros.stdckdint_macros
+ )
-add_gen_header2(
- stdlib
- YAML_FILE ../libc/newhdrgen/yaml/stdlib.yaml
- DEF_FILE stdlib.h.def
- GEN_HDR stdlib.h
- DEPENDS
- .llvm_libc_common_h
- .llvm-libc-macros.stdlib_macros
- .llvm-libc-types.div_t
- .llvm-libc-types.ldiv_t
- .llvm-libc-types.lldiv_t
- .llvm-libc-types.size_t
- .llvm-libc-types.__bsearchcompare_t
- .llvm-libc-types.__qsortcompare_t
- .llvm-libc-types.__qsortrcompare_t
- .llvm-libc-types.__atexithandler_t
-)
+ add_gen_header2(
+ stdio
+ YAML_FILE ../libc/newhdrgen/yaml/stdio.yaml
+ DEF_FILE stdio.h.def
+ GEN_HDR stdio.h
+ DEPENDS
+ .llvm-libc-macros.file_seek_macros
+ .llvm-libc-macros.stdio_macros
+ .llvm-libc-types.FILE
+ .llvm-libc-types.cookie_io_functions_t
+ .llvm-libc-types.off_t
+ .llvm-libc-types.size_t
+ .llvm-libc-types.ssize_t
+ .llvm_libc_common_h
+ )
-add_gen_header2(
- unistd
- YAML_FILE ../libc/newhdrgen/yaml/unistd.yaml
- DEF_FILE unistd.h.def
- GEN_HDR unistd.h
- DEPENDS
- .llvm_libc_common_h
- .llvm-libc-macros.file_seek_macros
- .llvm-libc-macros.unistd_macros
- .llvm-libc-types.__exec_argv_t
- .llvm-libc-types.__exec_envp_t
- .llvm-libc-types.off_t
- .llvm-libc-types.pid_t
- .llvm-libc-types.size_t
- .llvm-libc-types.ssize_t
- .llvm-libc-types.uid_t
- .llvm-libc-types.__getoptargv_t
-)
+ add_gen_header2(
+ stdlib
+ YAML_FILE ../libc/newhdrgen/yaml/stdlib.yaml
+ DEF_FILE stdlib.h.def
+ GEN_HDR stdlib.h
+ DEPENDS
+ .llvm_libc_common_h
+ .llvm-libc-macros.stdlib_macros
+ .llvm-libc-types.div_t
+ .llvm-libc-types.ldiv_t
+ .llvm-libc-types.lldiv_t
+ .llvm-libc-types.size_t
+ .llvm-libc-types.__bsearchcompare_t
+ .llvm-libc-types.__qsortcompare_t
+ .llvm-libc-types.__qsortrcompare_t
+ .llvm-libc-types.__atexithandler_t
+ )
-add_gen_header2(
- pthread
- YAML_FILE ../libc/newhdrgen/yaml/pthread.yaml
- DEF_FILE pthread.h.def
- GEN_HDR pthread.h
- DEPENDS
- .llvm_libc_common_h
- .llvm-libc-types.__atfork_callback_t
- .llvm-libc-types.__pthread_once_func_t
- .llvm-libc-types.__pthread_start_t
- .llvm-libc-types.__pthread_tss_dtor_t
- .llvm-libc-types.pthread_attr_t
- .llvm-libc-types.pthread_condattr_t
- .llvm-libc-types.pthread_key_t
- .llvm-libc-types.pthread_mutex_t
- .llvm-libc-types.pthread_mutexattr_t
- .llvm-libc-types.pthread_once_t
- .llvm-libc-types.pthread_rwlock_t
- .llvm-libc-types.pthread_rwlockattr_t
- .llvm-libc-types.pthread_t
-)
+ add_gen_header2(
+ unistd
+ YAML_FILE ../libc/newhdrgen/yaml/unistd.yaml
+ DEF_FILE unistd.h.def
+ GEN_HDR unistd.h
+ DEPENDS
+ .llvm_libc_common_h
+ .llvm-libc-macros.file_seek_macros
+ .llvm-libc-macros.unistd_macros
+ .llvm-libc-types.__exec_argv_t
+ .llvm-libc-types.__exec_envp_t
+ .llvm-libc-types.off_t
+ .llvm-libc-types.pid_t
+ .llvm-libc-types.size_t
+ .llvm-libc-types.ssize_t
+ .llvm-libc-types.uid_t
+ .llvm-libc-types.__getoptargv_t
+ )
-add_gen_header2(
- sched
- YAML_FILE ../libc/newhdrgen/yaml/sched.yaml
- DEF_FILE sched.h.def
- GEN_HDR sched.h
- DEPENDS
- .llvm_libc_common_h
- .llvm-libc-macros.sched_macros
- .llvm-libc-types.cpu_set_t
- .llvm-libc-types.pid_t
- .llvm-libc-types.size_t
- .llvm-libc-types.struct_sched_param
- # Needed according to posix standard
- .llvm-libc-types.time_t
- .llvm-libc-types.struct_timespec
-)
+ add_gen_header2(
+ pthread
+ YAML_FILE ../libc/newhdrgen/yaml/pthread.yaml
+ DEF_FILE pthread.h.def
+ GEN_HDR pthread.h
+ DEPENDS
+ .llvm_libc_common_h
+ .llvm-libc-types.__atfork_callback_t
+ .llvm-libc-types.__pthread_once_func_t
+ .llvm-libc-types.__pthread_start_t
+ .llvm-libc-types.__pthread_tss_dtor_t
+ .llvm-libc-types.pthread_attr_t
+ .llvm-libc-types.pthread_condattr_t
+ .llvm-libc-types.pthread_key_t
+ .llvm-libc-types.pthread_mutex_t
+ .llvm-libc-types.pthread_mutexattr_t
+ .llvm-libc-types.pthread_once_t
+ .llvm-libc-types.pthread_rwlock_t
+ .llvm-libc-types.pthread_rwlockattr_t
+ .llvm-libc-types.pthread_t
+ )
-add_gen_header2(
- spawn
- YAML_FILE ../libc/newhdrgen/yaml/spawn.yaml
- DEF_FILE spawn.h.def
- GEN_HDR spawn.h
- DEPENDS
- .llvm_libc_common_h
- .llvm-libc-types.mode_t
- .llvm-libc-types.pid_t
- .llvm-libc-types.posix_spawnattr_t
- .llvm-libc-types.posix_spawn_file_actions_t
-)
+ add_gen_header2(
+ sched
+ YAML_FILE ../libc/newhdrgen/yaml/sched.yaml
+ DEF_FILE sched.h.def
+ GEN_HDR sched.h
+ DEPENDS
+ .llvm_libc_common_h
+ .llvm-libc-macros.sched_macros
+ .llvm-libc-types.cpu_set_t
+ .llvm-libc-types.pid_t
+ .llvm-libc-types.size_t
+ .llvm-libc-types.struct_sched_param
+ # Needed according to posix standard
+ .llvm-libc-types.time_t
+ .llvm-libc-types.struct_timespec
+ )
-# TODO: Not all platforms will have a include/sys directory. Add the sys
-# directory and the targets for sys/*.h files conditional to the OS requiring
-# them.
-file(MAKE_DIRECTORY ${LIBC_INCLUDE_DIR}/sys)
-
-add_gen_header2(
- sys_auxv
- YAML_FILE ../libc/newhdrgen/yaml/sys/sys_auxv.yaml
- DEF_FILE sys/auxv.h.def
- GEN_HDR sys/auxv.h
- DEPENDS
- .llvm_libc_common_h
- .llvm-libc-macros.sys_auxv_macros
-)
+ add_gen_header2(
+ spawn
+ YAML_FILE ../libc/newhdrgen/yaml/spawn.yaml
+ DEF_FILE spawn.h.def
+ GEN_HDR spawn.h
+ DEPENDS
+ .llvm_libc_common_h
+ .llvm-libc-types.mode_t
+ .llvm-libc-types.pid_t
+ .llvm-libc-types.posix_spawnattr_t
+ .llvm-libc-types.posix_spawn_file_actions_t
+ )
-add_gen_header2(
- sys_epoll
- YAML_FILE ../libc/newhdrgen/yaml/sys/sys_epoll.yaml
- DEF_FILE sys/epoll.h.def
- GEN_HDR sys/epoll.h
- DEPENDS
- .llvm_libc_common_h
- .llvm-libc-types.struct_epoll_event
- .llvm-libc-types.struct_epoll_data
- .llvm-libc-types.sigset_t
- .llvm-libc-macros.sys_epoll_macros
-)
+ # TODO: Not all platforms will have a include/sys directory. Add the sys
+ # directory and the targets for sys/*.h files conditional to the OS requiring
+ # them.
+ file(MAKE_DIRECTORY ${LIBC_INCLUDE_DIR}/sys)
-add_gen_header2(
- sys_ioctl
- YAML_FILE ../libc/newhdrgen/yaml/sys/sys_ioctl.yaml
- DEF_FILE sys/ioctl.h.def
- GEN_HDR sys/ioctl.h
- DEPENDS
- .llvm_libc_common_h
- .llvm-libc-macros.sys_ioctl_macros
-)
+ add_gen_header2(
+ sys_auxv
+ YAML_FILE ../libc/newhdrgen/yaml/sys/sys_auxv.yaml
+ DEF_FILE sys/auxv.h.def
+ GEN_HDR sys/auxv.h
+ DEPENDS
+ .llvm_libc_common_h
+ .llvm-libc-macros.sys_auxv_macros
+ )
-add_gen_header2(
- sys_mman
- YAML_FILE ../libc/newhdrgen/yaml/sys/sys_mman.yaml
- DEF_FILE sys/mman.h.def
- GEN_HDR sys/mman.h
- DEPENDS
- .llvm_libc_common_h
- .llvm-libc-macros.sys_mman_macros
- .llvm-libc-types.off_t
- .llvm-libc-types.size_t
- .llvm-libc-types.ssize_t
-)
+ add_gen_header2(
+ sys_epoll
+ YAML_FILE ../libc/newhdrgen/yaml/sys/sys_epoll.yaml
+ DEF_FILE sys/epoll.h.def
+ GEN_HDR sys/epoll.h
+ DEPENDS
+ .llvm_libc_common_h
+ .llvm-libc-types.struct_epoll_event
+ .llvm-libc-types.struct_epoll_data
+ .llvm-libc-types.sigset_t
+ .llvm-libc-macros.sys_epoll_macros
+ )
-add_gen_header2(
- sys_prctl
- YAML_FILE ../libc/newhdrgen/yaml/sys/sys_prctl.yaml
- DEF_FILE sys/prctl.h.def
- GEN_HDR sys/prctl.h
- DEPENDS
- .llvm_libc_common_h
-)
+ add_gen_header2(
+ sys_ioctl
+ YAML_FILE ../libc/newhdrgen/yaml/sys/sys_ioctl.yaml
+ DEF_FILE sys/ioctl.h.def
+ GEN_HDR sys/ioctl.h
+ DEPENDS
+ .llvm_libc_common_h
+ .llvm-libc-macros.sys_ioctl_macros
+ )
-add_header(
- sys_queue
- HDR
- sys/queue.h
- DEPENDS
- .llvm-libc-macros.sys_queue_macros
-)
+ add_gen_header2(
+ sys_mman
+ YAML_FILE ../libc/newhdrgen/yaml/sys/sys_mman.yaml
+ DEF_FILE sys/mman.h.def
+ GEN_HDR sys/mman.h
+ DEPENDS
+ .llvm_libc_common_h
+ .llvm-libc-macros.sys_mman_macros
+ .llvm-libc-types.off_t
+ .llvm-libc-types.size_t
+ .llvm-libc-types.ssize_t
+ )
-add_gen_header2(
- sys_random
- YAML_FILE ../libc/newhdrgen/yaml/sys/sys_random.yaml
- DEF_FILE sys/random.h.def
- GEN_HDR sys/random.h
- DEPENDS
- .llvm_libc_common_h
- .llvm-libc-macros.sys_random_macros
- .llvm-libc-types.size_t
- .llvm-libc-types.ssize_t
-)
+ add_gen_header2(
+ sys_prctl
+ YAML_FILE ../libc/newhdrgen/yaml/sys/sys_prctl.yaml
+ DEF_FILE sys/prctl.h.def
+ GEN_HDR sys/prctl.h
+ DEPENDS
+ .llvm_libc_common_h
+ )
-add_gen_header2(
- sys_resource
- YAML_FILE ../libc/newhdrgen/yaml/sys/sys_resource.yaml
- DEF_FILE sys/resource.h.def
- GEN_HDR sys/resource.h
- DEPENDS
- .llvm_libc_common_h
- .llvm-libc-macros.sys_resource_macros
- .llvm-libc-types.rlim_t
- .llvm-libc-types.struct_rlimit
-)
+ add_header(
+ sys_queue
+ HDR
+ sys/queue.h
+ DEPENDS
+ .llvm-libc-macros.sys_queue_macros
+ )
-add_gen_header2(
- sys_stat
- YAML_FILE ../libc/newhdrgen/yaml/sys/sys_stat.yaml
- DEF_FILE sys/stat.h.def
- GEN_HDR sys/stat.h
- DEPENDS
- .llvm_libc_common_h
- .llvm-libc-macros.sys_stat_macros
- .llvm-libc-types.mode_t
- .llvm-libc-types.dev_t
- .llvm-libc-types.ino_t
- .llvm-libc-types.nlink_t
- .llvm-libc-types.uid_t
- .llvm-libc-types.gid_t
- .llvm-libc-types.off_t
- .llvm-libc-types.struct_timespec
- .llvm-libc-types.struct_timeval
- .llvm-libc-types.blksize_t
- .llvm-libc-types.blkcnt_t
- .llvm-libc-types.struct_stat
-)
+ add_gen_header2(
+ sys_random
+ YAML_FILE ../libc/newhdrgen/yaml/sys/sys_random.yaml
+ DEF_FILE sys/random.h.def
+ GEN_HDR sys/random.h
+ DEPENDS
+ .llvm_libc_common_h
+ .llvm-libc-macros.sys_random_macros
+ .llvm-libc-types.size_t
+ .llvm-libc-types.ssize_t
+ )
-add_gen_header2(
- sys_select
- YAML_FILE ../libc/newhdrgen/yaml/sys/sys_select.yaml
- DEF_FILE sys/select.h.def
- GEN_HDR sys/select.h
- DEPENDS
- .llvm_libc_common_h
- .llvm-libc-macros.sys_select_macros
- .llvm-libc-types.fd_set
- .llvm-libc-types.sigset_t
- .llvm-libc-types.suseconds_t
- .llvm-libc-types.time_t
- .llvm-libc-types.struct_timespec
- .llvm-libc-types.struct_timeval
-)
+ add_gen_header2(
+ sys_resource
+ YAML_FILE ../libc/newhdrgen/yaml/sys/sys_resource.yaml
+ DEF_FILE sys/resource.h.def
+ GEN_HDR sys/resource.h
+ DEPENDS
+ .llvm_libc_common_h
+ .llvm-libc-macros.sys_resource_macros
+ .llvm-libc-types.rlim_t
+ .llvm-libc-types.struct_rlimit
+ )
-add_gen_header2(
- sys_sendfile
- YAML_FILE ../libc/newhdrgen/yaml/sys/sys_sendfile.yaml
- DEF_FILE sys/sendfile.h.def
- GEN_HDR sys/sendfile.h
- DEPENDS
- .llvm_libc_common_h
- .llvm-libc-types.off_t
- .llvm-libc-types.size_t
- .llvm-libc-types.ssize_t
-)
+ add_gen_header2(
+ sys_stat
+ YAML_FILE ../libc/newhdrgen/yaml/sys/sys_stat.yaml
+ DEF_FILE sys/stat.h.def
+ GEN_HDR sys/stat.h
+ DEPENDS
+ .llvm_libc_common_h
+ .llvm-libc-macros.sys_stat_macros
+ .llvm-libc-types.mode_t
+ .llvm-libc-types.dev_t
+ .llvm-libc-types.ino_t
+ .llvm-libc-types.nlink_t
+ .llvm-libc-types.uid_t
+ .llvm-libc-types.gid_t
+ .llvm-libc-types.off_t
+ .llvm-libc-types.struct_timespec
+ .llvm-libc-types.struct_timeval
+ .llvm-libc-types.blksize_t
+ .llvm-libc-types.blkcnt_t
+ .llvm-libc-types.struct_stat
+ )
-add_gen_header2(
- sys_socket
- YAML_FILE ../libc/newhdrgen/yaml/sys/sys_socket.yaml
- DEF_FILE sys/socket.h.def
- GEN_HDR sys/socket.h
- DEPENDS
- .llvm_libc_common_h
- .llvm-libc-macros.sys_socket_macros
- .llvm-libc-types.sa_family_t
- .llvm-libc-types.socklen_t
- .llvm-libc-types.struct_sockaddr
- .llvm-libc-types.struct_sockaddr_un
-)
+ add_gen_header2(
+ sys_select
+ YAML_FILE ../libc/newhdrgen/yaml/sys/sys_select.yaml
+ DEF_FILE sys/select.h.def
+ GEN_HDR sys/select.h
+ DEPENDS
+ .llvm_libc_common_h
+ .llvm-libc-macros.sys_select_macros
+ .llvm-libc-types.fd_set
+ .llvm-libc-types.sigset_t
+ .llvm-libc-types.suseconds_t
+ .llvm-libc-types.time_t
+ .llvm-libc-types.struct_timespec
+ .llvm-libc-types.struct_timeval
+ )
-add_gen_header2(
- sys_statvfs
- YAML_FILE ../libc/newhdrgen/yaml/sys/sys_statvfs.yaml
- DEF_FILE sys/statvfs.h.def
- GEN_HDR sys/statvfs.h
- DEPENDS
- .llvm_libc_common_h
- .llvm-libc-types.struct_statvfs
-)
+ add_gen_header2(
+ sys_sendfile
+ YAML_FILE ../libc/newhdrgen/yaml/sys/sys_sendfile.yaml
+ DEF_FILE sys/sendfile.h.def
+ GEN_HDR sys/sendfile.h
+ DEPENDS
+ .llvm_libc_common_h
+ .llvm-libc-types.off_t
+ .llvm-libc-types.size_t
+ .llvm-libc-types.ssize_t
+ )
-add_gen_header2(
- sys_syscall
- YAML_FILE ../libc/newhdrgen/yaml/sys/sys_syscall.yaml
- DEF_FILE sys/syscall.h.def
- GEN_HDR sys/syscall.h
-)
+ add_gen_header2(
+ sys_socket
+ YAML_FILE ../libc/newhdrgen/yaml/sys/sys_socket.yaml
+ DEF_FILE sys/socket.h.def
+ GEN_HDR sys/socket.h
+ DEPENDS
+ .llvm_libc_common_h
+ .llvm-libc-macros.sys_socket_macros
+ .llvm-libc-types.sa_family_t
+ .llvm-libc-types.socklen_t
+ .llvm-libc-types.struct_sockaddr
+ .llvm-libc-types.struct_sockaddr_un
+ )
-add_gen_header2(
- sys_time
- YAML_FILE ../libc/newhdrgen/yaml/sys/sys_time.yaml
- DEF_FILE sys/time.h.def
- GEN_HDR sys/time.h
- DEPENDS
- .llvm_libc_common_h
- .llvm-libc-types.struct_timeval
- .llvm-libc-macros.sys_time_macros
-)
+ add_gen_header2(
+ sys_statvfs
+ YAML_FILE ../libc/newhdrgen/yaml/sys/sys_statvfs.yaml
+ DEF_FILE sys/statvfs.h.def
+ GEN_HDR sys/statvfs.h
+ DEPENDS
+ .llvm_libc_common_h
+ .llvm-libc-types.struct_statvfs
+ )
-add_gen_header2(
- sys_types
- YAML_FILE ../libc/newhdrgen/yaml/sys/sys_types.yaml
- DEF_FILE sys/types.h.def
- GEN_HDR sys/types.h
- DEPENDS
- .llvm_libc_common_h
- .llvm-libc-types.blkcnt_t
- .llvm-libc-types.blksize_t
- .llvm-libc-types.clockid_t
- .llvm-libc-types.dev_t
- .llvm-libc-types.gid_t
- .llvm-libc-types.ino_t
- .llvm-libc-types.mode_t
- .llvm-libc-types.nlink_t
- .llvm-libc-types.off_t
- .llvm-libc-types.pid_t
- .llvm-libc-types.pthread_attr_t
- .llvm-libc-types.pthread_key_t
- .llvm-libc-types.pthread_mutex_t
- .llvm-libc-types.pthread_mutexattr_t
- .llvm-libc-types.pthread_once_t
- .llvm-libc-types.pthread_t
- .llvm-libc-types.size_t
- .llvm-libc-types.ssize_t
- .llvm-libc-types.suseconds_t
- .llvm-libc-types.time_t
- .llvm-libc-types.uid_t
-)
+ add_gen_header2(
+ sys_syscall
+ YAML_FILE ../libc/newhdrgen/yaml/sys/sys_syscall.yaml
+ DEF_FILE sys/syscall.h.def
+ GEN_HDR sys/syscall.h
+ )
-add_gen_header2(
- sys_utsname
- YAML_FILE ../libc/newhdrgen/yaml/sys/sys_utsname.yaml
- DEF_FILE sys/utsname.h.def
- GEN_HDR sys/utsname.h
- DEPENDS
- .llvm_libc_common_h
- .llvm-libc-types.struct_utsname
-)
+ add_gen_header2(
+ sys_time
+ YAML_FILE ../libc/newhdrgen/yaml/sys/sys_time.yaml
+ DEF_FILE sys/time.h.def
+ GEN_HDR sys/time.h
+ DEPENDS
+ .llvm_libc_common_h
+ .llvm-libc-types.struct_timeval
+ .llvm-libc-macros.sys_time_macros
+ )
-add_gen_header2(
- sys_wait
- YAML_FILE ../libc/newhdrgen/yaml/sys/sys_wait.yaml
- DEF_FILE sys/wait.h.def
- GEN_HDR sys/wait.h
- DEPENDS
- .llvm_libc_common_h
- .llvm-libc-macros.sys_wait_macros
- .llvm-libc-types.pid_t
- .llvm-libc-types.struct_rusage
- .llvm-libc-types.siginfo_t
-)
+ add_gen_header2(
+ sys_types
+ YAML_FILE ../libc/newhdrgen/yaml/sys/sys_types.yaml
+ DEF_FILE sys/types.h.def
+ GEN_HDR sys/types.h
+ DEPENDS
+ .llvm_libc_common_h
+ .llvm-libc-types.blkcnt_t
+ .llvm-libc-types.blksize_t
+ .llvm-libc-types.clockid_t
+ .llvm-libc-types.dev_t
+ .llvm-libc-types.gid_t
+ .llvm-libc-types.ino_t
+ .llvm-libc-types.mode_t
+ .llvm-libc-types.nlink_t
+ .llvm-libc-types.off_t
+ .llvm-libc-types.pid_t
+ .llvm-libc-types.pthread_attr_t
+ .llvm-libc-types.pthread_key_t
+ .llvm-libc-types.pthread_mutex_t
+ .llvm-libc-types.pthread_mutexattr_t
+ .llvm-libc-types.pthread_once_t
+ .llvm-libc-types.pthread_t
+ .llvm-libc-types.size_t
+ .llvm-libc-types.ssize_t
+ .llvm-libc-types.suseconds_t
+ .llvm-libc-types.time_t
+ .llvm-libc-types.uid_t
+ )
-add_gen_header2(
- termios
- YAML_FILE ../libc/newhdrgen/yaml/termios.yaml
- DEF_FILE termios.h.def
- GEN_HDR termios.h
- DEPENDS
- .llvm_libc_common_h
- .llvm-libc-macros.termios_macros
- .llvm-libc-types.cc_t
- .llvm-libc-types.pid_t
- .llvm-libc-types.speed_t
- .llvm-libc-types.struct_termios
- .llvm-libc-types.tcflag_t
-)
+ add_gen_header2(
+ sys_utsname
+ YAML_FILE ../libc/newhdrgen/yaml/sys/sys_utsname.yaml
+ DEF_FILE sys/utsname.h.def
+ GEN_HDR sys/utsname.h
+ DEPENDS
+ .llvm_libc_common_h
+ .llvm-libc-types.struct_utsname
+ )
-add_gen_header2(
- uchar
- YAML_FILE ../libc/newhdrgen/yaml/uchar.yaml
- DEF_FILE uchar.h.def
- GEN_HDR uchar.h
- DEPENDS
- .llvm_libc_common_h
- .llvm-libc-types.mbstate_t
- .llvm-libc-types.char8_t
- .llvm-libc-types.char16_t
- .llvm-libc-types.char32_t
-)
+ add_gen_header2(
+ sys_wait
+ YAML_FILE ../libc/newhdrgen/yaml/sys/sys_wait.yaml
+ DEF_FILE sys/wait.h.def
+ GEN_HDR sys/wait.h
+ DEPENDS
+ .llvm_libc_common_h
+ .llvm-libc-macros.sys_wait_macros
+ .llvm-libc-types.pid_t
+ .llvm-libc-types.struct_rusage
+ .llvm-libc-types.siginfo_t
+ )
-add_gen_header2(
- wchar
- YAML_FILE ../libc/newhdrgen/yaml/wchar.yaml
- DEF_FILE wchar.h.def
- GEN_HDR wchar.h
- DEPENDS
- .llvm_libc_common_h
- .llvm-libc-macros.wchar_macros
- .llvm-libc-types.mbstate_t
- .llvm-libc-types.size_t
- .llvm-libc-types.wint_t
- .llvm-libc-types.wchar_t
-)
+ add_gen_header2(
+ termios
+ YAML_FILE ../libc/newhdrgen/yaml/termios.yaml
+ DEF_FILE termios.h.def
+ GEN_HDR termios.h
+ DEPENDS
+ .llvm_libc_common_h
+ .llvm-libc-macros.termios_macros
+ .llvm-libc-types.cc_t
+ .llvm-libc-types.pid_t
+ .llvm-libc-types.speed_t
+ .llvm-libc-types.struct_termios
+ .llvm-libc-types.tcflag_t
+ )
-if(LIBC_TARGET_OS_IS_GPU)
- file(MAKE_DIRECTORY ${LIBC_INCLUDE_DIR}/gpu)
+ add_gen_header2(
+ uchar
+ YAML_FILE ../libc/newhdrgen/yaml/uchar.yaml
+ DEF_FILE uchar.h.def
+ GEN_HDR uchar.h
+ DEPENDS
+ .llvm_libc_common_h
+ .llvm-libc-types.mbstate_t
+ .llvm-libc-types.char8_t
+ .llvm-libc-types.char16_t
+ .llvm-libc-types.char32_t
+ )
add_gen_header2(
- gpu_rpc
- YAML_FILE ../libc/newhdrgen/yaml/rpc.yaml
- DEF_FILE gpu/rpc.h.def
- GEN_HDR gpu/rpc.h
+ wchar
+ YAML_FILE ../libc/newhdrgen/yaml/wchar.yaml
+ DEF_FILE wchar.h.def
+ GEN_HDR wchar.h
+ DEPENDS
+ .llvm_libc_common_h
+ .llvm-libc-macros.wchar_macros
+ .llvm-libc-types.mbstate_t
+ .llvm-libc-types.size_t
+ .llvm-libc-types.wint_t
+ .llvm-libc-types.wchar_t
+ )
+
+ if(LIBC_TARGET_OS_IS_GPU)
+ file(MAKE_DIRECTORY ${LIBC_INCLUDE_DIR}/gpu)
+
+ add_gen_header2(
+ gpu_rpc
+ YAML_FILE ../libc/newhdrgen/yaml/rpc.yaml
+ DEF_FILE gpu/rpc.h.def
+ GEN_HDR gpu/rpc.h
+ DEPENDS
+ .llvm_libc_common_h
+ .llvm-libc-types.rpc_opcodes_t
+ )
+ endif()
+else()
+ add_gen_header(
+ ctype
+ DEF_FILE ctype.h.def
+ GEN_HDR ctype.h
+ DEPENDS
+ .llvm_libc_common_h
+ )
+
+ add_gen_header(
+ dirent
+ DEF_FILE dirent.h.def
+ GEN_HDR dirent.h
+ DEPENDS
+ .llvm_libc_common_h
+ .llvm-libc-types.ino_t
+ .llvm-libc-types.DIR
+ .llvm-libc-types.struct_dirent
+ )
+
+ add_gen_header(
+ fcntl
+ DEF_FILE fcntl.h.def
+ GEN_HDR fcntl.h
+ DEPENDS
+ .llvm-libc-macros.fcntl_macros
+ .llvm-libc-types.mode_t
+ .llvm-libc-types.struct_flock
+ .llvm-libc-types.struct_flock64
+ .llvm-libc-types.off64_t
+ .llvm-libc-types.pid_t
+ .llvm-libc-types.off_t
+ .llvm_libc_common_h
+ )
+
+ add_gen_header(
+ dlfcn
+ DEF_FILE dlfcn.h.def
+ GEN_HDR dlfcn.h
+ DEPENDS
+ .llvm-libc-macros.dlfcn_macros
+ .llvm_libc_common_h
+ )
+
+ add_gen_header(
+ features
+ DEF_FILE features.h.def
+ GEN_HDR features.h
+ DEPENDS
+ .llvm_libc_common_h
+ .llvm-libc-macros.features_macros
+ )
+
+ add_gen_header(
+ fenv
+ DEF_FILE fenv.h.def
+ GEN_HDR fenv.h
+ DEPENDS
+ .llvm_libc_common_h
+ .llvm-libc-macros.fenv_macros
+ .llvm-libc-types.fenv_t
+ .llvm-libc-types.fexcept_t
+ )
+
+ add_gen_header(
+ inttypes
+ DEF_FILE inttypes.h.def
+ GEN_HDR inttypes.h
+ DEPENDS
+ .llvm_libc_common_h
+ .llvm-libc-types.imaxdiv_t
+ .llvm-libc-macros.inttypes_macros
+ )
+
+ add_gen_header(
+ float
+ DEF_FILE float.h.def
+ GEN_HDR float.h
+ DEPENDS
+ .llvm-libc-macros.float_macros
+ )
+
+ add_gen_header(
+ stdint
+ DEF_FILE stdint.h.def
+ GEN_HDR stdint.h
+ DEPENDS
+ .llvm-libc-macros.stdint_macros
+ )
+
+ add_gen_header(
+ limits
+ DEF_FILE limits.h.def
+ GEN_HDR limits.h
+ DEPENDS
+ .llvm-libc-macros.limits_macros
+ )
+
+ add_gen_header(
+ math
+ DEF_FILE math.h.def
+ GEN_HDR math.h
+ DEPENDS
+ .llvm_libc_common_h
+ .llvm-libc-macros.float16_macros
+ .llvm-libc-macros.math_macros
+ .llvm-libc-macros.math_function_macros
+ .llvm-libc-types.double_t
+ .llvm-libc-types.float_t
+ .llvm-libc-types.float128
+ )
+
+ add_gen_header(
+ stdfix
+ DEF_FILE stdfix.h.def
+ GEN_HDR stdfix.h
+ DEPENDS
+ .llvm-libc-macros.stdfix_macros
+ )
+
+ # TODO: This should be conditional on POSIX networking being included.
+ file(MAKE_DIRECTORY ${LIBC_INCLUDE_DIR}/arpa)
+
+ add_gen_header(
+ arpa_inet
+ DEF_FILE arpa/inet.h.def
+ GEN_HDR arpa/inet.h
+ DEPENDS
+ .llvm_libc_common_h
+ )
+
+ add_gen_header(
+ assert
+ DEF_FILE assert.h.def
+ GEN_HDR assert.h
+ DEPENDS
+ .llvm_libc_common_h
+ .llvm-libc-macros.assert_macros
+ )
+
+ add_gen_header(
+ setjmp
+ DEF_FILE setjmp.h.def
+ GEN_HDR setjmp.h
+ DEPENDS
+ .llvm_libc_common_h
+ .llvm-libc-types.jmp_buf
+ )
+
+ add_gen_header(
+ string
+ DEF_FILE string.h.def
+ GEN_HDR string.h
+ DEPENDS
+ .llvm_libc_common_h
+ .llvm-libc-macros.null_macro
+ .llvm-libc-types.size_t
+ )
+
+ add_gen_header(
+ strings
+ DEF_FILE strings.h.def
+ GEN_HDR strings.h
+ DEPENDS
+ .llvm_libc_common_h
+ .llvm-libc-types.size_t
+ )
+
+ add_gen_header(
+ search
+ DEF_FILE search.h.def
+ GEN_HDR search.h
+ DEPENDS
+ .llvm_libc_common_h
+ .llvm-libc-types.ACTION
+ .llvm-libc-types.ENTRY
+ .llvm-libc-types.struct_hsearch_data
+ .llvm-libc-types.size_t
+ )
+
+ add_gen_header(
+ time
+ DEF_FILE time.h.def
+ GEN_HDR time.h
+ DEPENDS
+ .llvm_libc_common_h
+ .llvm-libc-macros.time_macros
+ .llvm-libc-types.clock_t
+ .llvm-libc-types.time_t
+ .llvm-libc-types.struct_tm
+ .llvm-libc-types.struct_timespec
+ .llvm-libc-types.struct_timeval
+ .llvm-libc-types.clockid_t
+ )
+
+ add_gen_header(
+ threads
+ DEF_FILE threads.h.def
+ GEN_HDR threads.h
+ DEPENDS
+ .llvm_libc_common_h
+ .llvm-libc-types.__call_once_func_t
+ .llvm-libc-types.once_flag
+ .llvm-libc-types.cnd_t
+ .llvm-libc-types.mtx_t
+ .llvm-libc-types.thrd_t
+ .llvm-libc-types.thrd_start_t
+ .llvm-libc-types.tss_t
+ .llvm-libc-types.tss_dtor_t
+ )
+
+ add_gen_header(
+ errno
+ DEF_FILE errno.h.def
+ GEN_HDR errno.h
+ DEPENDS
+ .llvm-libc-macros.generic_error_number_macros
+ .llvm-libc-macros.error_number_macros
+ )
+
+ add_gen_header(
+ signal
+ DEF_FILE signal.h.def
+ GEN_HDR signal.h
+ DEPENDS
+ .llvm-libc-macros.signal_macros
+ .llvm-libc-types.sig_atomic_t
+ .llvm-libc-types.sigset_t
+ .llvm-libc-types.struct_sigaction
+ .llvm-libc-types.union_sigval
+ .llvm-libc-types.siginfo_t
+ .llvm-libc-types.stack_t
+ .llvm-libc-types.pid_t
+ )
+
+ add_gen_header(
+ stdbit
+ DEF_FILE stdbit.h.def
+ GEN_HDR stdbit.h
+ DEPENDS
+ .llvm_libc_common_h
+ .llvm-libc-macros.stdbit_macros
+ )
+
+ add_gen_header(
+ stdckdint
+ DEF_FILE stdckdint.h.def
+ GEN_HDR stdckdint.h
+ DEPENDS
+ .llvm_libc_common_h
+ .llvm-libc-macros.stdckdint_macros
+ )
+
+ add_gen_header(
+ stdio
+ DEF_FILE stdio.h.def
+ GEN_HDR stdio.h
+ DEPENDS
+ .llvm-libc-macros.file_seek_macros
+ .llvm-libc-macros.stdio_macros
+ .llvm-libc-types.FILE
+ .llvm-libc-types.cookie_io_functions_t
+ .llvm-libc-types.off_t
+ .llvm-libc-types.size_t
+ .llvm-libc-types.ssize_t
+ .llvm_libc_common_h
+ )
+
+ add_gen_header(
+ stdlib
+ DEF_FILE stdlib.h.def
+ GEN_HDR stdlib.h
+ DEPENDS
+ .llvm_libc_common_h
+ .llvm-libc-macros.stdlib_macros
+ .llvm-libc-types.div_t
+ .llvm-libc-types.ldiv_t
+ .llvm-libc-types.lldiv_t
+ .llvm-libc-types.size_t
+ .llvm-libc-types.__bsearchcompare_t
+ .llvm-libc-types.__qsortcompare_t
+ .llvm-libc-types.__qsortrcompare_t
+ .llvm-libc-types.__atexithandler_t
+ )
+
+ add_gen_header(
+ unistd
+ DEF_FILE unistd.h.def
+ GEN_HDR unistd.h
+ DEPENDS
+ .llvm_libc_common_h
+ .llvm-libc-macros.file_seek_macros
+ .llvm-libc-macros.unistd_macros
+ .llvm-libc-types.__exec_argv_t
+ .llvm-libc-types.__exec_envp_t
+ .llvm-libc-types.off_t
+ .llvm-libc-types.pid_t
+ .llvm-libc-types.size_t
+ .llvm-libc-types.ssize_t
+ .llvm-libc-types.uid_t
+ .llvm-libc-types.__getoptargv_t
+ )
+
+ add_gen_header(
+ pthread
+ DEF_FILE pthread.h.def
+ GEN_HDR pthread.h
+ DEPENDS
+ .llvm_libc_common_h
+ .llvm-libc-types.__atfork_callback_t
+ .llvm-libc-types.__pthread_once_func_t
+ .llvm-libc-types.__pthread_start_t
+ .llvm-libc-types.__pthread_tss_dtor_t
+ .llvm-libc-types.pthread_attr_t
+ .llvm-libc-types.pthread_condattr_t
+ .llvm-libc-types.pthread_key_t
+ .llvm-libc-types.pthread_mutex_t
+ .llvm-libc-types.pthread_mutexattr_t
+ .llvm-libc-types.pthread_once_t
+ .llvm-libc-types.pthread_rwlock_t
+ .llvm-libc-types.pthread_rwlockattr_t
+ .llvm-libc-types.pthread_t
+ )
+
+ add_gen_header(
+ sched
+ DEF_FILE sched.h.def
+ GEN_HDR sched.h
+ DEPENDS
+ .llvm_libc_common_h
+ .llvm-libc-macros.sched_macros
+ .llvm-libc-types.cpu_set_t
+ .llvm-libc-types.pid_t
+ .llvm-libc-types.size_t
+ .llvm-libc-types.struct_sched_param
+ # Needed according to posix standard
+ .llvm-libc-types.time_t
+ .llvm-libc-types.struct_timespec
+ )
+
+ add_gen_header(
+ spawn
+ DEF_FILE spawn.h.def
+ GEN_HDR spawn.h
+ DEPENDS
+ .llvm_libc_common_h
+ .llvm-libc-types.mode_t
+ .llvm-libc-types.pid_t
+ .llvm-libc-types.posix_spawnattr_t
+ .llvm-libc-types.posix_spawn_file_actions_t
+ )
+
+ # TODO: Not all platforms will have a include/sys directory. Add the sys
+ # directory and the targets for sys/*.h files conditional to the OS requiring
+ # them.
+ file(MAKE_DIRECTORY ${LIBC_INCLUDE_DIR}/sys)
+
+ add_gen_header(
+ sys_auxv
+ DEF_FILE sys/auxv.h.def
+ GEN_HDR sys/auxv.h
+ DEPENDS
+ .llvm_libc_common_h
+ .llvm-libc-macros.sys_auxv_macros
+ )
+
+ add_gen_header(
+ sys_epoll
+ DEF_FILE sys/epoll.h.def
+ GEN_HDR sys/epoll.h
+ DEPENDS
+ .llvm_libc_common_h
+ .llvm-libc-types.struct_epoll_event
+ .llvm-libc-types.struct_epoll_data
+ .llvm-libc-types.sigset_t
+ .llvm-libc-macros.sys_epoll_macros
+ )
+
+ add_gen_header(
+ sys_ioctl
+ DEF_FILE sys/ioctl.h.def
+ GEN_HDR sys/ioctl.h
+ DEPENDS
+ .llvm_libc_common_h
+ .llvm-libc-macros.sys_ioctl_macros
+ )
+
+ add_gen_header(
+ sys_mman
+ DEF_FILE sys/mman.h.def
+ GEN_HDR sys/mman.h
+ DEPENDS
+ .llvm_libc_common_h
+ .llvm-libc-macros.sys_mman_macros
+ .llvm-libc-types.off_t
+ .llvm-libc-types.size_t
+ .llvm-libc-types.ssize_t
+ )
+
+ add_gen_header(
+ sys_prctl
+ DEF_FILE sys/prctl.h.def
+ GEN_HDR sys/prctl.h
+ DEPENDS
+ .llvm_libc_common_h
+ )
+
+ add_header(
+ sys_queue
+ HDR
+ sys/queue.h
+ DEPENDS
+ .llvm-libc-macros.sys_queue_macros
+ )
+
+ add_gen_header(
+ sys_random
+ DEF_FILE sys/random.h.def
+ GEN_HDR sys/random.h
DEPENDS
.llvm_libc_common_h
- .llvm-libc-types.rpc_opcodes_t
+ .llvm-libc-macros.sys_random_macros
+ .llvm-libc-types.size_t
+ .llvm-libc-types.ssize_t
)
+
+ add_gen_header(
+ sys_resource
+ DEF_FILE sys/resource.h.def
+ GEN_HDR sys/resource.h
+ DEPENDS
+ .llvm_libc_common_h
+ .llvm-libc-macros.sys_resource_macros
+ .llvm-libc-types.rlim_t
+ .llvm-libc-types.struct_rlimit
+ )
+
+ add_gen_header(
+ sys_stat
+ DEF_FILE sys/stat.h.def
+ GEN_HDR sys/stat.h
+ DEPENDS
+ .llvm_libc_common_h
+ .llvm-libc-macros.sys_stat_macros
+ .llvm-libc-types.mode_t
+ .llvm-libc-types.dev_t
+ .llvm-libc-types.ino_t
+ .llvm-libc-types.nlink_t
+ .llvm-libc-types.uid_t
+ .llvm-libc-types.gid_t
+ .llvm-libc-types.off_t
+ .llvm-libc-types.struct_timespec
+ .llvm-libc-types.struct_timeval
+ .llvm-libc-types.blksize_t
+ .llvm-libc-types.blkcnt_t
+ .llvm-libc-types.struct_stat
+ )
+
+ add_gen_header(
+ sys_select
+ DEF_FILE sys/select.h.def
+ GEN_HDR sys/select.h
+ DEPENDS
+ .llvm_libc_common_h
+ .llvm-libc-macros.sys_select_macros
+ .llvm-libc-types.fd_set
+ .llvm-libc-types.sigset_t
+ .llvm-libc-types.suseconds_t
+ .llvm-libc-types.time_t
+ .llvm-libc-types.struct_timespec
+ .llvm-libc-types.struct_timeval
+ )
+
+ add_gen_header(
+ sys_sendfile
+ DEF_FILE sys/sendfile.h.def
+ GEN_HDR sys/sendfile.h
+ DEPENDS
+ .llvm_libc_common_h
+ .llvm-libc-types.off_t
+ .llvm-libc-types.size_t
+ .llvm-libc-types.ssize_t
+ )
+
+ add_gen_header(
+ sys_socket
+ DEF_FILE sys/socket.h.def
+ GEN_HDR sys/socket.h
+ DEPENDS
+ .llvm_libc_common_h
+ .llvm-libc-macros.sys_socket_macros
+ .llvm-libc-types.sa_family_t
+ .llvm-libc-types.socklen_t
+ .llvm-libc-types.struct_sockaddr
+ .llvm-libc-types.struct_sockaddr_un
+ )
+
+ add_gen_header(
+ sys_statvfs
+ DEF_FILE sys/statvfs.h.def
+ GEN_HDR sys/statvfs.h
+ DEPENDS
+ .llvm_libc_common_h
+ .llvm-libc-types.struct_statvfs
+ )
+
+ add_gen_header(
+ sys_syscall
+ DEF_FILE sys/syscall.h.def
+ GEN_HDR sys/syscall.h
+ )
+
+ add_gen_header(
+ sys_time
+ DEF_FILE sys/time.h.def
+ GEN_HDR sys/time.h
+ DEPENDS
+ .llvm_libc_common_h
+ .llvm-libc-types.struct_timeval
+ .llvm-libc-macros.sys_time_macros
+ )
+
+ add_gen_header(
+ sys_types
+ DEF_FILE sys/types.h.def
+ GEN_HDR sys/types.h
+ DEPENDS
+ .llvm_libc_common_h
+ .llvm-libc-types.blkcnt_t
+ .llvm-libc-types.blksize_t
+ .llvm-libc-types.clockid_t
+ .llvm-libc-types.dev_t
+ .llvm-libc-types.gid_t
+ .llvm-libc-types.ino_t
+ .llvm-libc-types.mode_t
+ .llvm-libc-types.nlink_t
+ .llvm-libc-types.off_t
+ .llvm-libc-types.pid_t
+ .llvm-libc-types.pthread_attr_t
+ .llvm-libc-types.pthread_key_t
+ .llvm-libc-types.pthread_mutex_t
+ .llvm-libc-types.pthread_mutexattr_t
+ .llvm-libc-types.pthread_once_t
+ .llvm-libc-types.pthread_t
+ .llvm-libc-types.size_t
+ .llvm-libc-types.ssize_t
+ .llvm-libc-types.suseconds_t
+ .llvm-libc-types.time_t
+ .llvm-libc-types.uid_t
+ )
+
+ add_gen_header(
+ sys_utsname
+ DEF_FILE sys/utsname.h.def
+ GEN_HDR sys/utsname.h
+ DEPENDS
+ .llvm_libc_common_h
+ .llvm-libc-types.struct_utsname
+ )
+
+ add_gen_header(
+ sys_wait
+ DEF_FILE sys/wait.h.def
+ GEN_HDR sys/wait.h
+ DEPENDS
+ .llvm_libc_common_h
+ .llvm-libc-macros.sys_wait_macros
+ .llvm-libc-types.pid_t
+ .llvm-libc-types.struct_rusage
+ .llvm-libc-types.siginfo_t
+ )
+
+ add_gen_header(
+ termios
+ DEF_FILE termios.h.def
+ GEN_HDR termios.h
+ DEPENDS
+ .llvm_libc_common_h
+ .llvm-libc-macros.termios_macros
+ .llvm-libc-types.cc_t
+ .llvm-libc-types.pid_t
+ .llvm-libc-types.speed_t
+ .llvm-libc-types.struct_termios
+ .llvm-libc-types.tcflag_t
+ )
+
+ add_gen_header(
+ uchar
+ DEF_FILE uchar.h.def
+ GEN_HDR uchar.h
+ DEPENDS
+ .llvm_libc_common_h
+ .llvm-libc-types.mbstate_t
+ .llvm-libc-types.char8_t
+ .llvm-libc-types.char16_t
+ .llvm-libc-types.char32_t
+ )
+
+ add_gen_header(
+ wchar
+ DEF_FILE wchar.h.def
+ GEN_HDR wchar.h
+ DEPENDS
+ .llvm_libc_common_h
+ .llvm-libc-macros.wchar_macros
+ .llvm-libc-types.mbstate_t
+ .llvm-libc-types.size_t
+ .llvm-libc-types.wint_t
+ .llvm-libc-types.wchar_t
+ )
+
+ if(LIBC_TARGET_OS_IS_GPU)
+ file(MAKE_DIRECTORY ${LIBC_INCLUDE_DIR}/gpu)
+
+ add_gen_header(
+ gpu_rpc
+ DEF_FILE gpu/rpc.h.def
+ GEN_HDR gpu/rpc.h
+ DEPENDS
+ .llvm_libc_common_h
+ .llvm-libc-types.rpc_opcodes_t
+ )
+ endif()
endif()
if(NOT LLVM_LIBC_FULL_BUILD)
>From bccec45da90e80dff075693e3362fd68d4a7cf92 Mon Sep 17 00:00:00 2001
From: Rose Zhang <rosezhang at google.com>
Date: Mon, 15 Jul 2024 23:05:58 +0000
Subject: [PATCH 06/18] added option and changed name to start with LIBC_
---
libc/CMakeLists.txt | 1 +
libc/include/CMakeLists.txt | 2 +-
2 files changed, 2 insertions(+), 1 deletion(-)
diff --git a/libc/CMakeLists.txt b/libc/CMakeLists.txt
index 6ba54475d0fd1..c89897f2900fe 100644
--- a/libc/CMakeLists.txt
+++ b/libc/CMakeLists.txt
@@ -72,6 +72,7 @@ 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)
diff --git a/libc/include/CMakeLists.txt b/libc/include/CMakeLists.txt
index 3a9f511d47d77..91fd8ce1a1f79 100644
--- a/libc/include/CMakeLists.txt
+++ b/libc/include/CMakeLists.txt
@@ -17,7 +17,7 @@ add_header(
__llvm-libc-common.h
)
-if (USE_NEW_HEADER_GEN)
+if (LIBC_USE_NEW_HEADER_GEN)
add_gen_header2(
ctype
YAML_FILE ../libc/newhdrgen/yaml/ctype.yaml
>From 0fbecb7314ca776a595efa6609bbc6b48fedecb1 Mon Sep 17 00:00:00 2001
From: Aaryan Shukla <aaryanshukla at google.com>
Date: Mon, 15 Jul 2024 23:50:38 +0000
Subject: [PATCH 07/18] spacing for gpu target and assert.yaml
---
libc/cmake/modules/LLVMLibCHeaderRules.cmake | 22 ++++++++++----------
libc/include/CMakeLists.txt | 1 +
2 files changed, 12 insertions(+), 11 deletions(-)
diff --git a/libc/cmake/modules/LLVMLibCHeaderRules.cmake b/libc/cmake/modules/LLVMLibCHeaderRules.cmake
index b87137c5f1a0d..121dab0e40c1b 100644
--- a/libc/cmake/modules/LLVMLibCHeaderRules.cmake
+++ b/libc/cmake/modules/LLVMLibCHeaderRules.cmake
@@ -243,18 +243,18 @@ function(add_gen_header target_name)
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
+ 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()
+ 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)
get_fq_deps_list(fq_deps_list ${ADD_GEN_HDR_DEPENDS})
diff --git a/libc/include/CMakeLists.txt b/libc/include/CMakeLists.txt
index 91fd8ce1a1f79..bd07a3dc9b3d0 100644
--- a/libc/include/CMakeLists.txt
+++ b/libc/include/CMakeLists.txt
@@ -162,6 +162,7 @@ if (LIBC_USE_NEW_HEADER_GEN)
add_gen_header2(
assert
+ YAML_FILE ../libc/newhdrgen/yaml/assert.yaml
DEF_FILE assert.h.def
GEN_HDR assert.h
DEPENDS
>From 797b6af6931ba17914ead3ddcab921ea8b9c3c29 Mon Sep 17 00:00:00 2001
From: Rose Zhang <rosezhang at google.com>
Date: Tue, 16 Jul 2024 00:28:33 +0000
Subject: [PATCH 08/18] added macro
---
libc/include/CMakeLists.txt | 1871 ++++++++++++-----------------------
1 file changed, 632 insertions(+), 1239 deletions(-)
diff --git a/libc/include/CMakeLists.txt b/libc/include/CMakeLists.txt
index bd07a3dc9b3d0..5ad09e4ae8aad 100644
--- a/libc/include/CMakeLists.txt
+++ b/libc/include/CMakeLists.txt
@@ -17,1304 +17,697 @@ add_header(
__llvm-libc-common.h
)
-if (LIBC_USE_NEW_HEADER_GEN)
- add_gen_header2(
- ctype
- YAML_FILE ../libc/newhdrgen/yaml/ctype.yaml
- DEF_FILE ctype.h.def
- GEN_HDR ctype.h
- DEPENDS
- .llvm_libc_common_h
- )
-
- add_gen_header2(
- dirent
- YAML_FILE ../libc/newhdrgen/yaml/dirent.yaml
- DEF_FILE dirent.h.def
- GEN_HDR dirent.h
- DEPENDS
- .llvm_libc_common_h
- .llvm-libc-types.ino_t
- .llvm-libc-types.DIR
- .llvm-libc-types.struct_dirent
- )
-
- add_gen_header2(
- fcntl
- YAML_FILE ../libc/newhdrgen/yaml/fcntl.yaml
- DEF_FILE fcntl.h.def
- GEN_HDR fcntl.h
- DEPENDS
- .llvm-libc-macros.fcntl_macros
- .llvm-libc-types.mode_t
- .llvm-libc-types.struct_flock
- .llvm-libc-types.struct_flock64
- .llvm-libc-types.off64_t
- .llvm-libc-types.pid_t
- .llvm-libc-types.off_t
- .llvm_libc_common_h
- )
-
- add_gen_header2(
- dlfcn
- YAML_FILE ../libc/newhdrgen/yaml/dlfcn.yaml
- DEF_FILE dlfcn.h.def
- GEN_HDR dlfcn.h
- DEPENDS
- .llvm-libc-macros.dlfcn_macros
- .llvm_libc_common_h
- )
-
- add_gen_header2(
- features
- YAML_FILE ../libc/newhdrgen/yaml/features.yaml
- DEF_FILE features.h.def
- GEN_HDR features.h
- DEPENDS
- .llvm_libc_common_h
- .llvm-libc-macros.features_macros
- )
-
- add_gen_header2(
- fenv
- YAML_FILE ../libc/newhdrgen/yaml/fenv.yaml
- DEF_FILE fenv.h.def
- GEN_HDR fenv.h
- DEPENDS
- .llvm_libc_common_h
- .llvm-libc-macros.fenv_macros
- .llvm-libc-types.fenv_t
- .llvm-libc-types.fexcept_t
- )
-
- add_gen_header2(
- inttypes
- YAML_FILE ../libc/newhdrgen/yaml/inttypes.yaml
- DEF_FILE inttypes.h.def
- GEN_HDR inttypes.h
- DEPENDS
- .llvm_libc_common_h
- .llvm-libc-types.imaxdiv_t
- .llvm-libc-macros.inttypes_macros
- )
-
- add_gen_header2(
- float
- YAML_FILE ../libc/newhdrgen/yaml/float.yaml
- DEF_FILE float.h.def
- GEN_HDR float.h
- DEPENDS
- .llvm-libc-macros.float_macros
- )
-
- add_gen_header2(
- stdint
- YAML_FILE ../libc/newhdrgen/yaml/stdint.yaml
- DEF_FILE stdint.h.def
- GEN_HDR stdint.h
- DEPENDS
- .llvm-libc-macros.stdint_macros
- )
-
- add_gen_header2(
- limits
- YAML_FILE ../libc/newhdrgen/yaml/limits.yaml
- DEF_FILE limits.h.def
- GEN_HDR limits.h
- DEPENDS
- .llvm-libc-macros.limits_macros
- )
-
- add_gen_header2(
- math
- YAML_FILE ../libc/newhdrgen/yaml/math.yaml
- DEF_FILE math.h.def
- GEN_HDR math.h
- DEPENDS
- .llvm_libc_common_h
- .llvm-libc-macros.float16_macros
- .llvm-libc-macros.math_macros
- .llvm-libc-types.double_t
- .llvm-libc-types.float_t
- .llvm-libc-types.float128
- )
-
- add_gen_header2(
- stdfix
- YAML_FILE ../libc/newhdrgen/yaml/stdfix.yaml
- DEF_FILE stdfix.h.def
- GEN_HDR stdfix.h
- DEPENDS
- .llvm-libc-macros.stdfix_macros
- )
-
- # TODO: This should be conditional on POSIX networking being included.
- file(MAKE_DIRECTORY ${LIBC_INCLUDE_DIR}/arpa)
-
- add_gen_header2(
- arpa_inet
- YAML_FILE ../libc/newhdrgen/yaml/arpa_inet.yaml
- DEF_FILE arpa/inet.h.def
- GEN_HDR arpa/inet.h
- DEPENDS
- .llvm_libc_common_h
- )
-
- add_gen_header2(
- assert
- YAML_FILE ../libc/newhdrgen/yaml/assert.yaml
- DEF_FILE assert.h.def
- GEN_HDR assert.h
- DEPENDS
- .llvm_libc_common_h
- .llvm-libc-macros.assert_macros
- )
-
- add_gen_header2(
- setjmp
- YAML_FILE ../libc/newhdrgen/yaml/setjmp.yaml
- DEF_FILE setjmp.h.def
- GEN_HDR setjmp.h
- DEPENDS
- .llvm_libc_common_h
- .llvm-libc-types.jmp_buf
- )
-
- add_gen_header2(
- string
- YAML_FILE ../libc/newhdrgen/yaml/string.yaml
- DEF_FILE string.h.def
- GEN_HDR string.h
- DEPENDS
- .llvm_libc_common_h
- .llvm-libc-macros.null_macro
- .llvm-libc-types.size_t
- )
-
- add_gen_header2(
- strings
- YAML_FILE ../libc/newhdrgen/yaml/strings.yaml
- DEF_FILE strings.h.def
- GEN_HDR strings.h
- DEPENDS
- .llvm_libc_common_h
- .llvm-libc-types.size_t
- )
-
- add_gen_header2(
- search
- YAML_FILE ../libc/newhdrgen/yaml/search.yaml
- DEF_FILE search.h.def
- GEN_HDR search.h
- DEPENDS
- .llvm_libc_common_h
- .llvm-libc-types.ACTION
- .llvm-libc-types.ENTRY
- .llvm-libc-types.struct_hsearch_data
- .llvm-libc-types.size_t
- )
-
- add_gen_header2(
- time
- YAML_FILE ../libc/newhdrgen/yaml/time.yaml
- DEF_FILE time.h.def
- GEN_HDR time.h
- DEPENDS
- .llvm_libc_common_h
- .llvm-libc-macros.time_macros
- .llvm-libc-types.clock_t
- .llvm-libc-types.time_t
- .llvm-libc-types.struct_tm
- .llvm-libc-types.struct_timespec
- .llvm-libc-types.struct_timeval
- .llvm-libc-types.clockid_t
- )
-
- add_gen_header2(
- threads
- YAML_FILE ../libc/newhdrgen/yaml/threads.yaml
- DEF_FILE threads.h.def
- GEN_HDR threads.h
- DEPENDS
- .llvm_libc_common_h
- .llvm-libc-types.__call_once_func_t
- .llvm-libc-types.once_flag
- .llvm-libc-types.cnd_t
- .llvm-libc-types.mtx_t
- .llvm-libc-types.thrd_t
- .llvm-libc-types.thrd_start_t
- .llvm-libc-types.tss_t
- .llvm-libc-types.tss_dtor_t
- )
-
- add_gen_header2(
- errno
- YAML_FILE ../libc/newhdrgen/yaml/errno.yaml
- DEF_FILE errno.h.def
- GEN_HDR errno.h
- DEPENDS
- .llvm-libc-macros.generic_error_number_macros
- .llvm-libc-macros.error_number_macros
- )
-
- add_gen_header2(
- signal
- YAML_FILE ../libc/newhdrgen/yaml/signal.yaml
- DEF_FILE signal.h.def
- GEN_HDR signal.h
- DEPENDS
- .llvm-libc-macros.signal_macros
- .llvm-libc-types.sig_atomic_t
- .llvm-libc-types.sigset_t
- .llvm-libc-types.struct_sigaction
- .llvm-libc-types.union_sigval
- .llvm-libc-types.siginfo_t
- .llvm-libc-types.stack_t
- .llvm-libc-types.pid_t
- )
-
- add_gen_header2(
- stdbit
- YAML_FILE ../libc/newhdrgen/yaml/stdbit.yaml
- DEF_FILE stdbit.h.def
- GEN_HDR stdbit.h
- DEPENDS
- .llvm_libc_common_h
- .llvm-libc-macros.stdbit_macros
- )
-
- add_gen_header2(
- stdckdint
- YAML_FILE ../libc/newhdrgen/yaml/stdckdint.yaml
- DEF_FILE stdckdint.h.def
- GEN_HDR stdckdint.h
- DEPENDS
- .llvm_libc_common_h
- .llvm-libc-macros.stdckdint_macros
- )
-
- add_gen_header2(
- stdio
- YAML_FILE ../libc/newhdrgen/yaml/stdio.yaml
- DEF_FILE stdio.h.def
- GEN_HDR stdio.h
- DEPENDS
- .llvm-libc-macros.file_seek_macros
- .llvm-libc-macros.stdio_macros
- .llvm-libc-types.FILE
- .llvm-libc-types.cookie_io_functions_t
- .llvm-libc-types.off_t
- .llvm-libc-types.size_t
- .llvm-libc-types.ssize_t
- .llvm_libc_common_h
- )
-
- add_gen_header2(
- stdlib
- YAML_FILE ../libc/newhdrgen/yaml/stdlib.yaml
- DEF_FILE stdlib.h.def
- GEN_HDR stdlib.h
- DEPENDS
- .llvm_libc_common_h
- .llvm-libc-macros.stdlib_macros
- .llvm-libc-types.div_t
- .llvm-libc-types.ldiv_t
- .llvm-libc-types.lldiv_t
- .llvm-libc-types.size_t
- .llvm-libc-types.__bsearchcompare_t
- .llvm-libc-types.__qsortcompare_t
- .llvm-libc-types.__qsortrcompare_t
- .llvm-libc-types.__atexithandler_t
- )
-
- add_gen_header2(
- unistd
- YAML_FILE ../libc/newhdrgen/yaml/unistd.yaml
- DEF_FILE unistd.h.def
- GEN_HDR unistd.h
- DEPENDS
- .llvm_libc_common_h
- .llvm-libc-macros.file_seek_macros
- .llvm-libc-macros.unistd_macros
- .llvm-libc-types.__exec_argv_t
- .llvm-libc-types.__exec_envp_t
- .llvm-libc-types.off_t
- .llvm-libc-types.pid_t
- .llvm-libc-types.size_t
- .llvm-libc-types.ssize_t
- .llvm-libc-types.uid_t
- .llvm-libc-types.__getoptargv_t
- )
-
- add_gen_header2(
- pthread
- YAML_FILE ../libc/newhdrgen/yaml/pthread.yaml
- DEF_FILE pthread.h.def
- GEN_HDR pthread.h
- DEPENDS
- .llvm_libc_common_h
- .llvm-libc-types.__atfork_callback_t
- .llvm-libc-types.__pthread_once_func_t
- .llvm-libc-types.__pthread_start_t
- .llvm-libc-types.__pthread_tss_dtor_t
- .llvm-libc-types.pthread_attr_t
- .llvm-libc-types.pthread_condattr_t
- .llvm-libc-types.pthread_key_t
- .llvm-libc-types.pthread_mutex_t
- .llvm-libc-types.pthread_mutexattr_t
- .llvm-libc-types.pthread_once_t
- .llvm-libc-types.pthread_rwlock_t
- .llvm-libc-types.pthread_rwlockattr_t
- .llvm-libc-types.pthread_t
- )
-
- add_gen_header2(
- sched
- YAML_FILE ../libc/newhdrgen/yaml/sched.yaml
- DEF_FILE sched.h.def
- GEN_HDR sched.h
- DEPENDS
- .llvm_libc_common_h
- .llvm-libc-macros.sched_macros
- .llvm-libc-types.cpu_set_t
- .llvm-libc-types.pid_t
- .llvm-libc-types.size_t
- .llvm-libc-types.struct_sched_param
- # Needed according to posix standard
- .llvm-libc-types.time_t
- .llvm-libc-types.struct_timespec
- )
-
- add_gen_header2(
- spawn
- YAML_FILE ../libc/newhdrgen/yaml/spawn.yaml
- DEF_FILE spawn.h.def
- GEN_HDR spawn.h
- DEPENDS
- .llvm_libc_common_h
- .llvm-libc-types.mode_t
- .llvm-libc-types.pid_t
- .llvm-libc-types.posix_spawnattr_t
- .llvm-libc-types.posix_spawn_file_actions_t
- )
-
- # TODO: Not all platforms will have a include/sys directory. Add the sys
- # directory and the targets for sys/*.h files conditional to the OS requiring
- # them.
- file(MAKE_DIRECTORY ${LIBC_INCLUDE_DIR}/sys)
-
- add_gen_header2(
- sys_auxv
- YAML_FILE ../libc/newhdrgen/yaml/sys/sys_auxv.yaml
- DEF_FILE sys/auxv.h.def
- GEN_HDR sys/auxv.h
- DEPENDS
- .llvm_libc_common_h
- .llvm-libc-macros.sys_auxv_macros
- )
-
- add_gen_header2(
- sys_epoll
- YAML_FILE ../libc/newhdrgen/yaml/sys/sys_epoll.yaml
- DEF_FILE sys/epoll.h.def
- GEN_HDR sys/epoll.h
- DEPENDS
- .llvm_libc_common_h
- .llvm-libc-types.struct_epoll_event
- .llvm-libc-types.struct_epoll_data
- .llvm-libc-types.sigset_t
- .llvm-libc-macros.sys_epoll_macros
- )
-
- add_gen_header2(
- sys_ioctl
- YAML_FILE ../libc/newhdrgen/yaml/sys/sys_ioctl.yaml
- DEF_FILE sys/ioctl.h.def
- GEN_HDR sys/ioctl.h
- DEPENDS
- .llvm_libc_common_h
- .llvm-libc-macros.sys_ioctl_macros
- )
-
- add_gen_header2(
- sys_mman
- YAML_FILE ../libc/newhdrgen/yaml/sys/sys_mman.yaml
- DEF_FILE sys/mman.h.def
- GEN_HDR sys/mman.h
- DEPENDS
- .llvm_libc_common_h
- .llvm-libc-macros.sys_mman_macros
- .llvm-libc-types.off_t
- .llvm-libc-types.size_t
- .llvm-libc-types.ssize_t
- )
-
- add_gen_header2(
- sys_prctl
- YAML_FILE ../libc/newhdrgen/yaml/sys/sys_prctl.yaml
- DEF_FILE sys/prctl.h.def
- GEN_HDR sys/prctl.h
- DEPENDS
- .llvm_libc_common_h
- )
-
- add_header(
- sys_queue
- HDR
- sys/queue.h
- DEPENDS
- .llvm-libc-macros.sys_queue_macros
- )
-
- add_gen_header2(
- sys_random
- YAML_FILE ../libc/newhdrgen/yaml/sys/sys_random.yaml
- DEF_FILE sys/random.h.def
- GEN_HDR sys/random.h
- DEPENDS
- .llvm_libc_common_h
- .llvm-libc-macros.sys_random_macros
- .llvm-libc-types.size_t
- .llvm-libc-types.ssize_t
- )
-
- add_gen_header2(
- sys_resource
- YAML_FILE ../libc/newhdrgen/yaml/sys/sys_resource.yaml
- DEF_FILE sys/resource.h.def
- GEN_HDR sys/resource.h
- DEPENDS
- .llvm_libc_common_h
- .llvm-libc-macros.sys_resource_macros
- .llvm-libc-types.rlim_t
- .llvm-libc-types.struct_rlimit
- )
-
- add_gen_header2(
- sys_stat
- YAML_FILE ../libc/newhdrgen/yaml/sys/sys_stat.yaml
- DEF_FILE sys/stat.h.def
- GEN_HDR sys/stat.h
- DEPENDS
- .llvm_libc_common_h
- .llvm-libc-macros.sys_stat_macros
- .llvm-libc-types.mode_t
- .llvm-libc-types.dev_t
- .llvm-libc-types.ino_t
- .llvm-libc-types.nlink_t
- .llvm-libc-types.uid_t
- .llvm-libc-types.gid_t
- .llvm-libc-types.off_t
- .llvm-libc-types.struct_timespec
- .llvm-libc-types.struct_timeval
- .llvm-libc-types.blksize_t
- .llvm-libc-types.blkcnt_t
- .llvm-libc-types.struct_stat
- )
-
- add_gen_header2(
- sys_select
- YAML_FILE ../libc/newhdrgen/yaml/sys/sys_select.yaml
- DEF_FILE sys/select.h.def
- GEN_HDR sys/select.h
- DEPENDS
- .llvm_libc_common_h
- .llvm-libc-macros.sys_select_macros
- .llvm-libc-types.fd_set
- .llvm-libc-types.sigset_t
- .llvm-libc-types.suseconds_t
- .llvm-libc-types.time_t
- .llvm-libc-types.struct_timespec
- .llvm-libc-types.struct_timeval
- )
-
- add_gen_header2(
- sys_sendfile
- YAML_FILE ../libc/newhdrgen/yaml/sys/sys_sendfile.yaml
- DEF_FILE sys/sendfile.h.def
- GEN_HDR sys/sendfile.h
- DEPENDS
- .llvm_libc_common_h
- .llvm-libc-types.off_t
- .llvm-libc-types.size_t
- .llvm-libc-types.ssize_t
- )
-
- add_gen_header2(
- sys_socket
- YAML_FILE ../libc/newhdrgen/yaml/sys/sys_socket.yaml
- DEF_FILE sys/socket.h.def
- GEN_HDR sys/socket.h
- DEPENDS
- .llvm_libc_common_h
- .llvm-libc-macros.sys_socket_macros
- .llvm-libc-types.sa_family_t
- .llvm-libc-types.socklen_t
- .llvm-libc-types.struct_sockaddr
- .llvm-libc-types.struct_sockaddr_un
- )
-
- add_gen_header2(
- sys_statvfs
- YAML_FILE ../libc/newhdrgen/yaml/sys/sys_statvfs.yaml
- DEF_FILE sys/statvfs.h.def
- GEN_HDR sys/statvfs.h
- DEPENDS
- .llvm_libc_common_h
- .llvm-libc-types.struct_statvfs
- )
-
- add_gen_header2(
- sys_syscall
- YAML_FILE ../libc/newhdrgen/yaml/sys/sys_syscall.yaml
- DEF_FILE sys/syscall.h.def
- GEN_HDR sys/syscall.h
- )
-
- add_gen_header2(
- sys_time
- YAML_FILE ../libc/newhdrgen/yaml/sys/sys_time.yaml
- DEF_FILE sys/time.h.def
- GEN_HDR sys/time.h
- DEPENDS
- .llvm_libc_common_h
- .llvm-libc-types.struct_timeval
- .llvm-libc-macros.sys_time_macros
- )
-
- add_gen_header2(
- sys_types
- YAML_FILE ../libc/newhdrgen/yaml/sys/sys_types.yaml
- DEF_FILE sys/types.h.def
- GEN_HDR sys/types.h
- DEPENDS
- .llvm_libc_common_h
- .llvm-libc-types.blkcnt_t
- .llvm-libc-types.blksize_t
- .llvm-libc-types.clockid_t
- .llvm-libc-types.dev_t
- .llvm-libc-types.gid_t
- .llvm-libc-types.ino_t
- .llvm-libc-types.mode_t
- .llvm-libc-types.nlink_t
- .llvm-libc-types.off_t
- .llvm-libc-types.pid_t
- .llvm-libc-types.pthread_attr_t
- .llvm-libc-types.pthread_key_t
- .llvm-libc-types.pthread_mutex_t
- .llvm-libc-types.pthread_mutexattr_t
- .llvm-libc-types.pthread_once_t
- .llvm-libc-types.pthread_t
- .llvm-libc-types.size_t
- .llvm-libc-types.ssize_t
- .llvm-libc-types.suseconds_t
- .llvm-libc-types.time_t
- .llvm-libc-types.uid_t
- )
-
- add_gen_header2(
- sys_utsname
- YAML_FILE ../libc/newhdrgen/yaml/sys/sys_utsname.yaml
- DEF_FILE sys/utsname.h.def
- GEN_HDR sys/utsname.h
- DEPENDS
- .llvm_libc_common_h
- .llvm-libc-types.struct_utsname
- )
-
- add_gen_header2(
- sys_wait
- YAML_FILE ../libc/newhdrgen/yaml/sys/sys_wait.yaml
- DEF_FILE sys/wait.h.def
- GEN_HDR sys/wait.h
- DEPENDS
- .llvm_libc_common_h
- .llvm-libc-macros.sys_wait_macros
- .llvm-libc-types.pid_t
- .llvm-libc-types.struct_rusage
- .llvm-libc-types.siginfo_t
- )
-
- add_gen_header2(
- termios
- YAML_FILE ../libc/newhdrgen/yaml/termios.yaml
- DEF_FILE termios.h.def
- GEN_HDR termios.h
- DEPENDS
- .llvm_libc_common_h
- .llvm-libc-macros.termios_macros
- .llvm-libc-types.cc_t
- .llvm-libc-types.pid_t
- .llvm-libc-types.speed_t
- .llvm-libc-types.struct_termios
- .llvm-libc-types.tcflag_t
- )
-
- add_gen_header2(
- uchar
- YAML_FILE ../libc/newhdrgen/yaml/uchar.yaml
- DEF_FILE uchar.h.def
- GEN_HDR uchar.h
- DEPENDS
- .llvm_libc_common_h
- .llvm-libc-types.mbstate_t
- .llvm-libc-types.char8_t
- .llvm-libc-types.char16_t
- .llvm-libc-types.char32_t
- )
-
- add_gen_header2(
- wchar
- YAML_FILE ../libc/newhdrgen/yaml/wchar.yaml
- DEF_FILE wchar.h.def
- GEN_HDR wchar.h
- DEPENDS
- .llvm_libc_common_h
- .llvm-libc-macros.wchar_macros
- .llvm-libc-types.mbstate_t
- .llvm-libc-types.size_t
- .llvm-libc-types.wint_t
- .llvm-libc-types.wchar_t
- )
-
- if(LIBC_TARGET_OS_IS_GPU)
- file(MAKE_DIRECTORY ${LIBC_INCLUDE_DIR}/gpu)
-
+macro(add_header_macro TYPE YAML_FILE DEF_FILE GEN_HDR DEPENDS)
+ if (LIBC_USE_NEW_HEADER_GEN)
add_gen_header2(
- gpu_rpc
- YAML_FILE ../libc/newhdrgen/yaml/rpc.yaml
- DEF_FILE gpu/rpc.h.def
- GEN_HDR gpu/rpc.h
- DEPENDS
- .llvm_libc_common_h
- .llvm-libc-types.rpc_opcodes_t
+ ${TYPE}
+ ${YAML_FILE}
+ ${DEF_FILE}
+ ${GEN_HDR}
+ ${DEPENDS}
+ )
+ else()
+ add_gen_header(
+ ${TYPE}
+ ${DEF_FILE}
+ ${GEN_HDR}
+ ${DEPENDS}
)
endif()
-else()
- add_gen_header(
- ctype
- DEF_FILE ctype.h.def
- GEN_HDR ctype.h
- DEPENDS
- .llvm_libc_common_h
- )
+endmacro()
+
+add_header_macro(
+ ctype
+ YAML_FILE ../libc/newhdrgen/yaml/ctype.yaml
+ DEF_FILE ctype.h.def
+ GEN_HDR ctype.h
+ DEPENDS
+ .llvm_libc_common_h
+)
- add_gen_header(
- dirent
- DEF_FILE dirent.h.def
- GEN_HDR dirent.h
- DEPENDS
- .llvm_libc_common_h
- .llvm-libc-types.ino_t
- .llvm-libc-types.DIR
- .llvm-libc-types.struct_dirent
- )
+add_header_macro(
+ dirent
+ YAML_FILE ../libc/newhdrgen/yaml/dirent.yaml
+ DEF_FILE dirent.h.def
+ GEN_HDR dirent.h
+ DEPENDS
+ .llvm_libc_common_h
+ .llvm-libc-types.ino_t
+ .llvm-libc-types.DIR
+ .llvm-libc-types.struct_dirent
+)
- add_gen_header(
- fcntl
- DEF_FILE fcntl.h.def
- GEN_HDR fcntl.h
- DEPENDS
- .llvm-libc-macros.fcntl_macros
- .llvm-libc-types.mode_t
- .llvm-libc-types.struct_flock
- .llvm-libc-types.struct_flock64
- .llvm-libc-types.off64_t
- .llvm-libc-types.pid_t
- .llvm-libc-types.off_t
- .llvm_libc_common_h
- )
+add_header_macro(
+ fcntl
+ YAML_FILE ../libc/newhdrgen/yaml/fcntl.yaml
+ DEF_FILE fcntl.h.def
+ GEN_HDR fcntl.h
+ DEPENDS
+ .llvm-libc-macros.fcntl_macros
+ .llvm-libc-types.mode_t
+ .llvm-libc-types.struct_flock
+ .llvm-libc-types.struct_flock64
+ .llvm-libc-types.off64_t
+ .llvm-libc-types.pid_t
+ .llvm-libc-types.off_t
+ .llvm_libc_common_h
+)
- add_gen_header(
- dlfcn
- DEF_FILE dlfcn.h.def
- GEN_HDR dlfcn.h
- DEPENDS
- .llvm-libc-macros.dlfcn_macros
- .llvm_libc_common_h
- )
+add_header_macro(
+ dlfcn
+ YAML_FILE ../libc/newhdrgen/yaml/dlfcn.yaml
+ DEF_FILE dlfcn.h.def
+ GEN_HDR dlfcn.h
+ DEPENDS
+ .llvm-libc-macros.dlfcn_macros
+ .llvm_libc_common_h
+)
- add_gen_header(
- features
- DEF_FILE features.h.def
- GEN_HDR features.h
- DEPENDS
- .llvm_libc_common_h
- .llvm-libc-macros.features_macros
- )
+add_header_macro(
+ features
+ YAML_FILE ../libc/newhdrgen/yaml/features.yaml
+ DEF_FILE features.h.def
+ GEN_HDR features.h
+ DEPENDS
+ .llvm_libc_common_h
+ .llvm-libc-macros.features_macros
+)
- add_gen_header(
- fenv
- DEF_FILE fenv.h.def
- GEN_HDR fenv.h
- DEPENDS
- .llvm_libc_common_h
- .llvm-libc-macros.fenv_macros
- .llvm-libc-types.fenv_t
- .llvm-libc-types.fexcept_t
- )
+add_header_macro(
+ fenv
+ YAML_FILE ../libc/newhdrgen/yaml/fenv.yaml
+ DEF_FILE fenv.h.def
+ GEN_HDR fenv.h
+ DEPENDS
+ .llvm_libc_common_h
+ .llvm-libc-macros.fenv_macros
+ .llvm-libc-types.fenv_t
+ .llvm-libc-types.fexcept_t
+)
- add_gen_header(
- inttypes
- DEF_FILE inttypes.h.def
- GEN_HDR inttypes.h
- DEPENDS
- .llvm_libc_common_h
- .llvm-libc-types.imaxdiv_t
- .llvm-libc-macros.inttypes_macros
- )
+add_header_macro(
+ inttypes
+ YAML_FILE ../libc/newhdrgen/yaml/inttypes.yaml
+ DEF_FILE inttypes.h.def
+ GEN_HDR inttypes.h
+ DEPENDS
+ .llvm_libc_common_h
+ .llvm-libc-types.imaxdiv_t
+ .llvm-libc-macros.inttypes_macros
+)
- add_gen_header(
- float
- DEF_FILE float.h.def
- GEN_HDR float.h
- DEPENDS
- .llvm-libc-macros.float_macros
- )
+add_header_macro(
+ float
+ YAML_FILE ../libc/newhdrgen/yaml/float.yaml
+ DEF_FILE float.h.def
+ GEN_HDR float.h
+ DEPENDS
+ .llvm-libc-macros.float_macros
+)
- add_gen_header(
- stdint
- DEF_FILE stdint.h.def
- GEN_HDR stdint.h
- DEPENDS
- .llvm-libc-macros.stdint_macros
- )
+add_header_macro(
+ stdint
+ YAML_FILE ../libc/newhdrgen/yaml/stdint.yaml
+ DEF_FILE stdint.h.def
+ GEN_HDR stdint.h
+ DEPENDS
+ .llvm-libc-macros.stdint_macros
+)
- add_gen_header(
- limits
- DEF_FILE limits.h.def
- GEN_HDR limits.h
- DEPENDS
- .llvm-libc-macros.limits_macros
- )
+add_header_macro(
+ limits
+ YAML_FILE ../libc/newhdrgen/yaml/limits.yaml
+ DEF_FILE limits.h.def
+ GEN_HDR limits.h
+ DEPENDS
+ .llvm-libc-macros.limits_macros
+)
- add_gen_header(
- math
- DEF_FILE math.h.def
- GEN_HDR math.h
- DEPENDS
- .llvm_libc_common_h
- .llvm-libc-macros.float16_macros
- .llvm-libc-macros.math_macros
- .llvm-libc-macros.math_function_macros
- .llvm-libc-types.double_t
- .llvm-libc-types.float_t
- .llvm-libc-types.float128
- )
+add_header_macro(
+ math
+ YAML_FILE ../libc/newhdrgen/yaml/math.yaml
+ DEF_FILE math.h.def
+ GEN_HDR math.h
+ DEPENDS
+ .llvm_libc_common_h
+ .llvm-libc-macros.float16_macros
+ .llvm-libc-macros.math_macros
+ .llvm-libc-types.double_t
+ .llvm-libc-types.float_t
+ .llvm-libc-types.float128
+)
- add_gen_header(
- stdfix
- DEF_FILE stdfix.h.def
- GEN_HDR stdfix.h
- DEPENDS
- .llvm-libc-macros.stdfix_macros
- )
+add_header_macro(
+ stdfix
+ YAML_FILE ../libc/newhdrgen/yaml/stdfix.yaml
+ DEF_FILE stdfix.h.def
+ GEN_HDR stdfix.h
+ DEPENDS
+ .llvm-libc-macros.stdfix_macros
+)
- # TODO: This should be conditional on POSIX networking being included.
- file(MAKE_DIRECTORY ${LIBC_INCLUDE_DIR}/arpa)
+# TODO: This should be conditional on POSIX networking being included.
+file(MAKE_DIRECTORY ${LIBC_INCLUDE_DIR}/arpa)
- add_gen_header(
- arpa_inet
- DEF_FILE arpa/inet.h.def
- GEN_HDR arpa/inet.h
- DEPENDS
- .llvm_libc_common_h
- )
+add_header_macro(
+ arpa_inet
+ YAML_FILE ../libc/newhdrgen/yaml/arpa_inet.yaml
+ DEF_FILE arpa/inet.h.def
+ GEN_HDR arpa/inet.h
+ DEPENDS
+ .llvm_libc_common_h
+)
- add_gen_header(
- assert
- DEF_FILE assert.h.def
- GEN_HDR assert.h
- DEPENDS
- .llvm_libc_common_h
- .llvm-libc-macros.assert_macros
- )
+add_header_macro(
+ assert
+ YAML_FILE ../libc/newhdrgen/yaml/assert.yaml
+ DEF_FILE assert.h.def
+ GEN_HDR assert.h
+ DEPENDS
+ .llvm_libc_common_h
+ .llvm-libc-macros.assert_macros
+)
- add_gen_header(
- setjmp
- DEF_FILE setjmp.h.def
- GEN_HDR setjmp.h
- DEPENDS
- .llvm_libc_common_h
- .llvm-libc-types.jmp_buf
- )
+add_header_macro(
+ setjmp
+ YAML_FILE ../libc/newhdrgen/yaml/setjmp.yaml
+ DEF_FILE setjmp.h.def
+ GEN_HDR setjmp.h
+ DEPENDS
+ .llvm_libc_common_h
+ .llvm-libc-types.jmp_buf
+)
- add_gen_header(
- string
- DEF_FILE string.h.def
- GEN_HDR string.h
- DEPENDS
- .llvm_libc_common_h
- .llvm-libc-macros.null_macro
- .llvm-libc-types.size_t
- )
+add_header_macro(
+ string
+ YAML_FILE ../libc/newhdrgen/yaml/string.yaml
+ DEF_FILE string.h.def
+ GEN_HDR string.h
+ DEPENDS
+ .llvm_libc_common_h
+ .llvm-libc-macros.null_macro
+ .llvm-libc-types.size_t
+)
- add_gen_header(
- strings
- DEF_FILE strings.h.def
- GEN_HDR strings.h
- DEPENDS
- .llvm_libc_common_h
- .llvm-libc-types.size_t
- )
+add_header_macro(
+ strings
+ YAML_FILE ../libc/newhdrgen/yaml/strings.yaml
+ DEF_FILE strings.h.def
+ GEN_HDR strings.h
+ DEPENDS
+ .llvm_libc_common_h
+ .llvm-libc-types.size_t
+)
- add_gen_header(
- search
- DEF_FILE search.h.def
- GEN_HDR search.h
- DEPENDS
- .llvm_libc_common_h
- .llvm-libc-types.ACTION
- .llvm-libc-types.ENTRY
- .llvm-libc-types.struct_hsearch_data
- .llvm-libc-types.size_t
- )
+add_header_macro(
+ search
+ YAML_FILE ../libc/newhdrgen/yaml/search.yaml
+ DEF_FILE search.h.def
+ GEN_HDR search.h
+ DEPENDS
+ .llvm_libc_common_h
+ .llvm-libc-types.ACTION
+ .llvm-libc-types.ENTRY
+ .llvm-libc-types.struct_hsearch_data
+ .llvm-libc-types.size_t
+)
- add_gen_header(
- time
- DEF_FILE time.h.def
- GEN_HDR time.h
- DEPENDS
- .llvm_libc_common_h
- .llvm-libc-macros.time_macros
- .llvm-libc-types.clock_t
- .llvm-libc-types.time_t
- .llvm-libc-types.struct_tm
- .llvm-libc-types.struct_timespec
- .llvm-libc-types.struct_timeval
- .llvm-libc-types.clockid_t
- )
+add_header_macro(
+ time
+ YAML_FILE ../libc/newhdrgen/yaml/time.yaml
+ DEF_FILE time.h.def
+ GEN_HDR time.h
+ DEPENDS
+ .llvm_libc_common_h
+ .llvm-libc-macros.time_macros
+ .llvm-libc-types.clock_t
+ .llvm-libc-types.time_t
+ .llvm-libc-types.struct_tm
+ .llvm-libc-types.struct_timespec
+ .llvm-libc-types.struct_timeval
+ .llvm-libc-types.clockid_t
+)
- add_gen_header(
- threads
- DEF_FILE threads.h.def
- GEN_HDR threads.h
- DEPENDS
- .llvm_libc_common_h
- .llvm-libc-types.__call_once_func_t
- .llvm-libc-types.once_flag
- .llvm-libc-types.cnd_t
- .llvm-libc-types.mtx_t
- .llvm-libc-types.thrd_t
- .llvm-libc-types.thrd_start_t
- .llvm-libc-types.tss_t
- .llvm-libc-types.tss_dtor_t
- )
+add_header_macro(
+ threads
+ YAML_FILE ../libc/newhdrgen/yaml/threads.yaml
+ DEF_FILE threads.h.def
+ GEN_HDR threads.h
+ DEPENDS
+ .llvm_libc_common_h
+ .llvm-libc-types.__call_once_func_t
+ .llvm-libc-types.once_flag
+ .llvm-libc-types.cnd_t
+ .llvm-libc-types.mtx_t
+ .llvm-libc-types.thrd_t
+ .llvm-libc-types.thrd_start_t
+ .llvm-libc-types.tss_t
+ .llvm-libc-types.tss_dtor_t
+)
- add_gen_header(
- errno
- DEF_FILE errno.h.def
- GEN_HDR errno.h
- DEPENDS
- .llvm-libc-macros.generic_error_number_macros
- .llvm-libc-macros.error_number_macros
- )
+add_header_macro(
+ errno
+ YAML_FILE ../libc/newhdrgen/yaml/errno.yaml
+ DEF_FILE errno.h.def
+ GEN_HDR errno.h
+ DEPENDS
+ .llvm-libc-macros.generic_error_number_macros
+ .llvm-libc-macros.error_number_macros
+)
- add_gen_header(
- signal
- DEF_FILE signal.h.def
- GEN_HDR signal.h
- DEPENDS
- .llvm-libc-macros.signal_macros
- .llvm-libc-types.sig_atomic_t
- .llvm-libc-types.sigset_t
- .llvm-libc-types.struct_sigaction
- .llvm-libc-types.union_sigval
- .llvm-libc-types.siginfo_t
- .llvm-libc-types.stack_t
- .llvm-libc-types.pid_t
- )
+add_header_macro(
+ signal
+ YAML_FILE ../libc/newhdrgen/yaml/signal.yaml
+ DEF_FILE signal.h.def
+ GEN_HDR signal.h
+ DEPENDS
+ .llvm-libc-macros.signal_macros
+ .llvm-libc-types.sig_atomic_t
+ .llvm-libc-types.sigset_t
+ .llvm-libc-types.struct_sigaction
+ .llvm-libc-types.union_sigval
+ .llvm-libc-types.siginfo_t
+ .llvm-libc-types.stack_t
+ .llvm-libc-types.pid_t
+)
- add_gen_header(
- stdbit
- DEF_FILE stdbit.h.def
- GEN_HDR stdbit.h
- DEPENDS
- .llvm_libc_common_h
- .llvm-libc-macros.stdbit_macros
- )
+add_header_macro(
+ stdbit
+ YAML_FILE ../libc/newhdrgen/yaml/stdbit.yaml
+ DEF_FILE stdbit.h.def
+ GEN_HDR stdbit.h
+ DEPENDS
+ .llvm_libc_common_h
+ .llvm-libc-macros.stdbit_macros
+)
- add_gen_header(
- stdckdint
- DEF_FILE stdckdint.h.def
- GEN_HDR stdckdint.h
- DEPENDS
- .llvm_libc_common_h
- .llvm-libc-macros.stdckdint_macros
- )
+add_header_macro(
+ stdckdint
+ YAML_FILE ../libc/newhdrgen/yaml/stdckdint.yaml
+ DEF_FILE stdckdint.h.def
+ GEN_HDR stdckdint.h
+ DEPENDS
+ .llvm_libc_common_h
+ .llvm-libc-macros.stdckdint_macros
+)
- add_gen_header(
- stdio
- DEF_FILE stdio.h.def
- GEN_HDR stdio.h
- DEPENDS
- .llvm-libc-macros.file_seek_macros
- .llvm-libc-macros.stdio_macros
- .llvm-libc-types.FILE
- .llvm-libc-types.cookie_io_functions_t
- .llvm-libc-types.off_t
- .llvm-libc-types.size_t
- .llvm-libc-types.ssize_t
- .llvm_libc_common_h
- )
+add_header_macro(
+ stdio
+ YAML_FILE ../libc/newhdrgen/yaml/stdio.yaml
+ DEF_FILE stdio.h.def
+ GEN_HDR stdio.h
+ DEPENDS
+ .llvm-libc-macros.file_seek_macros
+ .llvm-libc-macros.stdio_macros
+ .llvm-libc-types.FILE
+ .llvm-libc-types.cookie_io_functions_t
+ .llvm-libc-types.off_t
+ .llvm-libc-types.size_t
+ .llvm-libc-types.ssize_t
+ .llvm_libc_common_h
+)
- add_gen_header(
- stdlib
- DEF_FILE stdlib.h.def
- GEN_HDR stdlib.h
- DEPENDS
- .llvm_libc_common_h
- .llvm-libc-macros.stdlib_macros
- .llvm-libc-types.div_t
- .llvm-libc-types.ldiv_t
- .llvm-libc-types.lldiv_t
- .llvm-libc-types.size_t
- .llvm-libc-types.__bsearchcompare_t
- .llvm-libc-types.__qsortcompare_t
- .llvm-libc-types.__qsortrcompare_t
- .llvm-libc-types.__atexithandler_t
- )
+add_header_macro(
+ stdlib
+ YAML_FILE ../libc/newhdrgen/yaml/stdlib.yaml
+ DEF_FILE stdlib.h.def
+ GEN_HDR stdlib.h
+ DEPENDS
+ .llvm_libc_common_h
+ .llvm-libc-macros.stdlib_macros
+ .llvm-libc-types.div_t
+ .llvm-libc-types.ldiv_t
+ .llvm-libc-types.lldiv_t
+ .llvm-libc-types.size_t
+ .llvm-libc-types.__bsearchcompare_t
+ .llvm-libc-types.__qsortcompare_t
+ .llvm-libc-types.__qsortrcompare_t
+ .llvm-libc-types.__atexithandler_t
+)
- add_gen_header(
- unistd
- DEF_FILE unistd.h.def
- GEN_HDR unistd.h
- DEPENDS
- .llvm_libc_common_h
- .llvm-libc-macros.file_seek_macros
- .llvm-libc-macros.unistd_macros
- .llvm-libc-types.__exec_argv_t
- .llvm-libc-types.__exec_envp_t
- .llvm-libc-types.off_t
- .llvm-libc-types.pid_t
- .llvm-libc-types.size_t
- .llvm-libc-types.ssize_t
- .llvm-libc-types.uid_t
- .llvm-libc-types.__getoptargv_t
- )
+add_header_macro(
+ unistd
+ YAML_FILE ../libc/newhdrgen/yaml/unistd.yaml
+ DEF_FILE unistd.h.def
+ GEN_HDR unistd.h
+ DEPENDS
+ .llvm_libc_common_h
+ .llvm-libc-macros.file_seek_macros
+ .llvm-libc-macros.unistd_macros
+ .llvm-libc-types.__exec_argv_t
+ .llvm-libc-types.__exec_envp_t
+ .llvm-libc-types.off_t
+ .llvm-libc-types.pid_t
+ .llvm-libc-types.size_t
+ .llvm-libc-types.ssize_t
+ .llvm-libc-types.uid_t
+ .llvm-libc-types.__getoptargv_t
+)
- add_gen_header(
- pthread
- DEF_FILE pthread.h.def
- GEN_HDR pthread.h
- DEPENDS
- .llvm_libc_common_h
- .llvm-libc-types.__atfork_callback_t
- .llvm-libc-types.__pthread_once_func_t
- .llvm-libc-types.__pthread_start_t
- .llvm-libc-types.__pthread_tss_dtor_t
- .llvm-libc-types.pthread_attr_t
- .llvm-libc-types.pthread_condattr_t
- .llvm-libc-types.pthread_key_t
- .llvm-libc-types.pthread_mutex_t
- .llvm-libc-types.pthread_mutexattr_t
- .llvm-libc-types.pthread_once_t
- .llvm-libc-types.pthread_rwlock_t
- .llvm-libc-types.pthread_rwlockattr_t
- .llvm-libc-types.pthread_t
- )
+add_header_macro(
+ pthread
+ YAML_FILE ../libc/newhdrgen/yaml/pthread.yaml
+ DEF_FILE pthread.h.def
+ GEN_HDR pthread.h
+ DEPENDS
+ .llvm_libc_common_h
+ .llvm-libc-types.__atfork_callback_t
+ .llvm-libc-types.__pthread_once_func_t
+ .llvm-libc-types.__pthread_start_t
+ .llvm-libc-types.__pthread_tss_dtor_t
+ .llvm-libc-types.pthread_attr_t
+ .llvm-libc-types.pthread_condattr_t
+ .llvm-libc-types.pthread_key_t
+ .llvm-libc-types.pthread_mutex_t
+ .llvm-libc-types.pthread_mutexattr_t
+ .llvm-libc-types.pthread_once_t
+ .llvm-libc-types.pthread_rwlock_t
+ .llvm-libc-types.pthread_rwlockattr_t
+ .llvm-libc-types.pthread_t
+)
- add_gen_header(
- sched
- DEF_FILE sched.h.def
- GEN_HDR sched.h
- DEPENDS
- .llvm_libc_common_h
- .llvm-libc-macros.sched_macros
- .llvm-libc-types.cpu_set_t
- .llvm-libc-types.pid_t
- .llvm-libc-types.size_t
- .llvm-libc-types.struct_sched_param
- # Needed according to posix standard
- .llvm-libc-types.time_t
- .llvm-libc-types.struct_timespec
- )
+add_header_macro(
+ sched
+ YAML_FILE ../libc/newhdrgen/yaml/sched.yaml
+ DEF_FILE sched.h.def
+ GEN_HDR sched.h
+ DEPENDS
+ .llvm_libc_common_h
+ .llvm-libc-macros.sched_macros
+ .llvm-libc-types.cpu_set_t
+ .llvm-libc-types.pid_t
+ .llvm-libc-types.size_t
+ .llvm-libc-types.struct_sched_param
+ # Needed according to posix standard
+ .llvm-libc-types.time_t
+ .llvm-libc-types.struct_timespec
+)
- add_gen_header(
- spawn
- DEF_FILE spawn.h.def
- GEN_HDR spawn.h
- DEPENDS
- .llvm_libc_common_h
- .llvm-libc-types.mode_t
- .llvm-libc-types.pid_t
- .llvm-libc-types.posix_spawnattr_t
- .llvm-libc-types.posix_spawn_file_actions_t
- )
+add_header_macro(
+ spawn
+ YAML_FILE ../libc/newhdrgen/yaml/spawn.yaml
+ DEF_FILE spawn.h.def
+ GEN_HDR spawn.h
+ DEPENDS
+ .llvm_libc_common_h
+ .llvm-libc-types.mode_t
+ .llvm-libc-types.pid_t
+ .llvm-libc-types.posix_spawnattr_t
+ .llvm-libc-types.posix_spawn_file_actions_t
+)
- # TODO: Not all platforms will have a include/sys directory. Add the sys
- # directory and the targets for sys/*.h files conditional to the OS requiring
- # them.
- file(MAKE_DIRECTORY ${LIBC_INCLUDE_DIR}/sys)
+# TODO: Not all platforms will have a include/sys directory. Add the sys
+# directory and the targets for sys/*.h files conditional to the OS requiring
+# them.
+file(MAKE_DIRECTORY ${LIBC_INCLUDE_DIR}/sys)
+
+add_header_macro(
+ sys_auxv
+ YAML_FILE ../libc/newhdrgen/yaml/sys/sys_auxv.yaml
+ DEF_FILE sys/auxv.h.def
+ GEN_HDR sys/auxv.h
+ DEPENDS
+ .llvm_libc_common_h
+ .llvm-libc-macros.sys_auxv_macros
+)
- add_gen_header(
- sys_auxv
- DEF_FILE sys/auxv.h.def
- GEN_HDR sys/auxv.h
- DEPENDS
- .llvm_libc_common_h
- .llvm-libc-macros.sys_auxv_macros
- )
+add_header_macro(
+ sys_epoll
+ YAML_FILE ../libc/newhdrgen/yaml/sys/sys_epoll.yaml
+ DEF_FILE sys/epoll.h.def
+ GEN_HDR sys/epoll.h
+ DEPENDS
+ .llvm_libc_common_h
+ .llvm-libc-types.struct_epoll_event
+ .llvm-libc-types.struct_epoll_data
+ .llvm-libc-types.sigset_t
+ .llvm-libc-macros.sys_epoll_macros
+)
- add_gen_header(
- sys_epoll
- DEF_FILE sys/epoll.h.def
- GEN_HDR sys/epoll.h
- DEPENDS
- .llvm_libc_common_h
- .llvm-libc-types.struct_epoll_event
- .llvm-libc-types.struct_epoll_data
- .llvm-libc-types.sigset_t
- .llvm-libc-macros.sys_epoll_macros
- )
+add_header_macro(
+ sys_ioctl
+ YAML_FILE ../libc/newhdrgen/yaml/sys/sys_ioctl.yaml
+ DEF_FILE sys/ioctl.h.def
+ GEN_HDR sys/ioctl.h
+ DEPENDS
+ .llvm_libc_common_h
+ .llvm-libc-macros.sys_ioctl_macros
+)
- add_gen_header(
- sys_ioctl
- DEF_FILE sys/ioctl.h.def
- GEN_HDR sys/ioctl.h
- DEPENDS
- .llvm_libc_common_h
- .llvm-libc-macros.sys_ioctl_macros
- )
+add_header_macro(
+ sys_mman
+ YAML_FILE ../libc/newhdrgen/yaml/sys/sys_mman.yaml
+ DEF_FILE sys/mman.h.def
+ GEN_HDR sys/mman.h
+ DEPENDS
+ .llvm_libc_common_h
+ .llvm-libc-macros.sys_mman_macros
+ .llvm-libc-types.off_t
+ .llvm-libc-types.size_t
+ .llvm-libc-types.ssize_t
+)
- add_gen_header(
- sys_mman
- DEF_FILE sys/mman.h.def
- GEN_HDR sys/mman.h
- DEPENDS
- .llvm_libc_common_h
- .llvm-libc-macros.sys_mman_macros
- .llvm-libc-types.off_t
- .llvm-libc-types.size_t
- .llvm-libc-types.ssize_t
- )
+add_header_macro(
+ sys_prctl
+ YAML_FILE ../libc/newhdrgen/yaml/sys/sys_prctl.yaml
+ DEF_FILE sys/prctl.h.def
+ GEN_HDR sys/prctl.h
+ DEPENDS
+ .llvm_libc_common_h
+)
- add_gen_header(
- sys_prctl
- DEF_FILE sys/prctl.h.def
- GEN_HDR sys/prctl.h
- DEPENDS
- .llvm_libc_common_h
- )
+add_header(
+ sys_queue
+ HDR
+ sys/queue.h
+ DEPENDS
+ .llvm-libc-macros.sys_queue_macros
+)
- add_header(
- sys_queue
- HDR
- sys/queue.h
- DEPENDS
- .llvm-libc-macros.sys_queue_macros
- )
+add_header_macro(
+ sys_random
+ YAML_FILE ../libc/newhdrgen/yaml/sys/sys_random.yaml
+ DEF_FILE sys/random.h.def
+ GEN_HDR sys/random.h
+ DEPENDS
+ .llvm_libc_common_h
+ .llvm-libc-macros.sys_random_macros
+ .llvm-libc-types.size_t
+ .llvm-libc-types.ssize_t
+)
- add_gen_header(
- sys_random
- DEF_FILE sys/random.h.def
- GEN_HDR sys/random.h
- DEPENDS
- .llvm_libc_common_h
- .llvm-libc-macros.sys_random_macros
- .llvm-libc-types.size_t
- .llvm-libc-types.ssize_t
- )
+add_header_macro(
+ sys_resource
+ YAML_FILE ../libc/newhdrgen/yaml/sys/sys_resource.yaml
+ DEF_FILE sys/resource.h.def
+ GEN_HDR sys/resource.h
+ DEPENDS
+ .llvm_libc_common_h
+ .llvm-libc-macros.sys_resource_macros
+ .llvm-libc-types.rlim_t
+ .llvm-libc-types.struct_rlimit
+)
- add_gen_header(
- sys_resource
- DEF_FILE sys/resource.h.def
- GEN_HDR sys/resource.h
- DEPENDS
- .llvm_libc_common_h
- .llvm-libc-macros.sys_resource_macros
- .llvm-libc-types.rlim_t
- .llvm-libc-types.struct_rlimit
- )
+add_header_macro(
+ sys_stat
+ YAML_FILE ../libc/newhdrgen/yaml/sys/sys_stat.yaml
+ DEF_FILE sys/stat.h.def
+ GEN_HDR sys/stat.h
+ DEPENDS
+ .llvm_libc_common_h
+ .llvm-libc-macros.sys_stat_macros
+ .llvm-libc-types.mode_t
+ .llvm-libc-types.dev_t
+ .llvm-libc-types.ino_t
+ .llvm-libc-types.nlink_t
+ .llvm-libc-types.uid_t
+ .llvm-libc-types.gid_t
+ .llvm-libc-types.off_t
+ .llvm-libc-types.struct_timespec
+ .llvm-libc-types.struct_timeval
+ .llvm-libc-types.blksize_t
+ .llvm-libc-types.blkcnt_t
+ .llvm-libc-types.struct_stat
+)
- add_gen_header(
- sys_stat
- DEF_FILE sys/stat.h.def
- GEN_HDR sys/stat.h
- DEPENDS
- .llvm_libc_common_h
- .llvm-libc-macros.sys_stat_macros
- .llvm-libc-types.mode_t
- .llvm-libc-types.dev_t
- .llvm-libc-types.ino_t
- .llvm-libc-types.nlink_t
- .llvm-libc-types.uid_t
- .llvm-libc-types.gid_t
- .llvm-libc-types.off_t
- .llvm-libc-types.struct_timespec
- .llvm-libc-types.struct_timeval
- .llvm-libc-types.blksize_t
- .llvm-libc-types.blkcnt_t
- .llvm-libc-types.struct_stat
- )
+add_header_macro(
+ sys_select
+ YAML_FILE ../libc/newhdrgen/yaml/sys/sys_select.yaml
+ DEF_FILE sys/select.h.def
+ GEN_HDR sys/select.h
+ DEPENDS
+ .llvm_libc_common_h
+ .llvm-libc-macros.sys_select_macros
+ .llvm-libc-types.fd_set
+ .llvm-libc-types.sigset_t
+ .llvm-libc-types.suseconds_t
+ .llvm-libc-types.time_t
+ .llvm-libc-types.struct_timespec
+ .llvm-libc-types.struct_timeval
+)
- add_gen_header(
- sys_select
- DEF_FILE sys/select.h.def
- GEN_HDR sys/select.h
- DEPENDS
- .llvm_libc_common_h
- .llvm-libc-macros.sys_select_macros
- .llvm-libc-types.fd_set
- .llvm-libc-types.sigset_t
- .llvm-libc-types.suseconds_t
- .llvm-libc-types.time_t
- .llvm-libc-types.struct_timespec
- .llvm-libc-types.struct_timeval
- )
+add_header_macro(
+ sys_sendfile
+ YAML_FILE ../libc/newhdrgen/yaml/sys/sys_sendfile.yaml
+ DEF_FILE sys/sendfile.h.def
+ GEN_HDR sys/sendfile.h
+ DEPENDS
+ .llvm_libc_common_h
+ .llvm-libc-types.off_t
+ .llvm-libc-types.size_t
+ .llvm-libc-types.ssize_t
+)
- add_gen_header(
- sys_sendfile
- DEF_FILE sys/sendfile.h.def
- GEN_HDR sys/sendfile.h
- DEPENDS
- .llvm_libc_common_h
- .llvm-libc-types.off_t
- .llvm-libc-types.size_t
- .llvm-libc-types.ssize_t
- )
+add_header_macro(
+ sys_socket
+ YAML_FILE ../libc/newhdrgen/yaml/sys/sys_socket.yaml
+ DEF_FILE sys/socket.h.def
+ GEN_HDR sys/socket.h
+ DEPENDS
+ .llvm_libc_common_h
+ .llvm-libc-macros.sys_socket_macros
+ .llvm-libc-types.sa_family_t
+ .llvm-libc-types.socklen_t
+ .llvm-libc-types.struct_sockaddr
+ .llvm-libc-types.struct_sockaddr_un
+)
- add_gen_header(
- sys_socket
- DEF_FILE sys/socket.h.def
- GEN_HDR sys/socket.h
- DEPENDS
- .llvm_libc_common_h
- .llvm-libc-macros.sys_socket_macros
- .llvm-libc-types.sa_family_t
- .llvm-libc-types.socklen_t
- .llvm-libc-types.struct_sockaddr
- .llvm-libc-types.struct_sockaddr_un
- )
+add_header_macro(
+ sys_statvfs
+ YAML_FILE ../libc/newhdrgen/yaml/sys/sys_statvfs.yaml
+ DEF_FILE sys/statvfs.h.def
+ GEN_HDR sys/statvfs.h
+ DEPENDS
+ .llvm_libc_common_h
+ .llvm-libc-types.struct_statvfs
+)
- add_gen_header(
- sys_statvfs
- DEF_FILE sys/statvfs.h.def
- GEN_HDR sys/statvfs.h
- DEPENDS
- .llvm_libc_common_h
- .llvm-libc-types.struct_statvfs
- )
+add_header_macro(
+ sys_syscall
+ YAML_FILE ../libc/newhdrgen/yaml/sys/sys_syscall.yaml
+ DEF_FILE sys/syscall.h.def
+ GEN_HDR sys/syscall.h
+)
- add_gen_header(
- sys_syscall
- DEF_FILE sys/syscall.h.def
- GEN_HDR sys/syscall.h
- )
+add_header_macro(
+ sys_time
+ YAML_FILE ../libc/newhdrgen/yaml/sys/sys_time.yaml
+ DEF_FILE sys/time.h.def
+ GEN_HDR sys/time.h
+ DEPENDS
+ .llvm_libc_common_h
+ .llvm-libc-types.struct_timeval
+ .llvm-libc-macros.sys_time_macros
+)
- add_gen_header(
- sys_time
- DEF_FILE sys/time.h.def
- GEN_HDR sys/time.h
- DEPENDS
- .llvm_libc_common_h
- .llvm-libc-types.struct_timeval
- .llvm-libc-macros.sys_time_macros
- )
+add_header_macro(
+ sys_types
+ YAML_FILE ../libc/newhdrgen/yaml/sys/sys_types.yaml
+ DEF_FILE sys/types.h.def
+ GEN_HDR sys/types.h
+ DEPENDS
+ .llvm_libc_common_h
+ .llvm-libc-types.blkcnt_t
+ .llvm-libc-types.blksize_t
+ .llvm-libc-types.clockid_t
+ .llvm-libc-types.dev_t
+ .llvm-libc-types.gid_t
+ .llvm-libc-types.ino_t
+ .llvm-libc-types.mode_t
+ .llvm-libc-types.nlink_t
+ .llvm-libc-types.off_t
+ .llvm-libc-types.pid_t
+ .llvm-libc-types.pthread_attr_t
+ .llvm-libc-types.pthread_key_t
+ .llvm-libc-types.pthread_mutex_t
+ .llvm-libc-types.pthread_mutexattr_t
+ .llvm-libc-types.pthread_once_t
+ .llvm-libc-types.pthread_t
+ .llvm-libc-types.size_t
+ .llvm-libc-types.ssize_t
+ .llvm-libc-types.suseconds_t
+ .llvm-libc-types.time_t
+ .llvm-libc-types.uid_t
+)
- add_gen_header(
- sys_types
- DEF_FILE sys/types.h.def
- GEN_HDR sys/types.h
- DEPENDS
- .llvm_libc_common_h
- .llvm-libc-types.blkcnt_t
- .llvm-libc-types.blksize_t
- .llvm-libc-types.clockid_t
- .llvm-libc-types.dev_t
- .llvm-libc-types.gid_t
- .llvm-libc-types.ino_t
- .llvm-libc-types.mode_t
- .llvm-libc-types.nlink_t
- .llvm-libc-types.off_t
- .llvm-libc-types.pid_t
- .llvm-libc-types.pthread_attr_t
- .llvm-libc-types.pthread_key_t
- .llvm-libc-types.pthread_mutex_t
- .llvm-libc-types.pthread_mutexattr_t
- .llvm-libc-types.pthread_once_t
- .llvm-libc-types.pthread_t
- .llvm-libc-types.size_t
- .llvm-libc-types.ssize_t
- .llvm-libc-types.suseconds_t
- .llvm-libc-types.time_t
- .llvm-libc-types.uid_t
- )
+add_header_macro(
+ sys_utsname
+ YAML_FILE ../libc/newhdrgen/yaml/sys/sys_utsname.yaml
+ DEF_FILE sys/utsname.h.def
+ GEN_HDR sys/utsname.h
+ DEPENDS
+ .llvm_libc_common_h
+ .llvm-libc-types.struct_utsname
+)
- add_gen_header(
- sys_utsname
- DEF_FILE sys/utsname.h.def
- GEN_HDR sys/utsname.h
- DEPENDS
- .llvm_libc_common_h
- .llvm-libc-types.struct_utsname
- )
+add_header_macro(
+ sys_wait
+ YAML_FILE ../libc/newhdrgen/yaml/sys/sys_wait.yaml
+ DEF_FILE sys/wait.h.def
+ GEN_HDR sys/wait.h
+ DEPENDS
+ .llvm_libc_common_h
+ .llvm-libc-macros.sys_wait_macros
+ .llvm-libc-types.pid_t
+ .llvm-libc-types.struct_rusage
+ .llvm-libc-types.siginfo_t
+)
- add_gen_header(
- sys_wait
- DEF_FILE sys/wait.h.def
- GEN_HDR sys/wait.h
- DEPENDS
- .llvm_libc_common_h
- .llvm-libc-macros.sys_wait_macros
- .llvm-libc-types.pid_t
- .llvm-libc-types.struct_rusage
- .llvm-libc-types.siginfo_t
- )
+add_header_macro(
+ termios
+ YAML_FILE ../libc/newhdrgen/yaml/termios.yaml
+ DEF_FILE termios.h.def
+ GEN_HDR termios.h
+ DEPENDS
+ .llvm_libc_common_h
+ .llvm-libc-macros.termios_macros
+ .llvm-libc-types.cc_t
+ .llvm-libc-types.pid_t
+ .llvm-libc-types.speed_t
+ .llvm-libc-types.struct_termios
+ .llvm-libc-types.tcflag_t
+)
- add_gen_header(
- termios
- DEF_FILE termios.h.def
- GEN_HDR termios.h
- DEPENDS
- .llvm_libc_common_h
- .llvm-libc-macros.termios_macros
- .llvm-libc-types.cc_t
- .llvm-libc-types.pid_t
- .llvm-libc-types.speed_t
- .llvm-libc-types.struct_termios
- .llvm-libc-types.tcflag_t
- )
+add_header_macro(
+ uchar
+ YAML_FILE ../libc/newhdrgen/yaml/uchar.yaml
+ DEF_FILE uchar.h.def
+ GEN_HDR uchar.h
+ DEPENDS
+ .llvm_libc_common_h
+ .llvm-libc-types.mbstate_t
+ .llvm-libc-types.char8_t
+ .llvm-libc-types.char16_t
+ .llvm-libc-types.char32_t
+)
- add_gen_header(
- uchar
- DEF_FILE uchar.h.def
- GEN_HDR uchar.h
- DEPENDS
- .llvm_libc_common_h
- .llvm-libc-types.mbstate_t
- .llvm-libc-types.char8_t
- .llvm-libc-types.char16_t
- .llvm-libc-types.char32_t
- )
+add_header_macro(
+ wchar
+ YAML_FILE ../libc/newhdrgen/yaml/wchar.yaml
+ DEF_FILE wchar.h.def
+ GEN_HDR wchar.h
+ DEPENDS
+ .llvm_libc_common_h
+ .llvm-libc-macros.wchar_macros
+ .llvm-libc-types.mbstate_t
+ .llvm-libc-types.size_t
+ .llvm-libc-types.wint_t
+ .llvm-libc-types.wchar_t
+)
+
+if(LIBC_TARGET_OS_IS_GPU)
+ file(MAKE_DIRECTORY ${LIBC_INCLUDE_DIR}/gpu)
- add_gen_header(
- wchar
- DEF_FILE wchar.h.def
- GEN_HDR wchar.h
+ add_header_macro(
+ gpu_rpc
+ YAML_FILE ../libc/newhdrgen/yaml/rpc.yaml
+ DEF_FILE gpu/rpc.h.def
+ GEN_HDR gpu/rpc.h
DEPENDS
.llvm_libc_common_h
- .llvm-libc-macros.wchar_macros
- .llvm-libc-types.mbstate_t
- .llvm-libc-types.size_t
- .llvm-libc-types.wint_t
- .llvm-libc-types.wchar_t
+ .llvm-libc-types.rpc_opcodes_t
)
- if(LIBC_TARGET_OS_IS_GPU)
- file(MAKE_DIRECTORY ${LIBC_INCLUDE_DIR}/gpu)
-
- add_gen_header(
- gpu_rpc
- DEF_FILE gpu/rpc.h.def
- GEN_HDR gpu/rpc.h
- DEPENDS
- .llvm_libc_common_h
- .llvm-libc-types.rpc_opcodes_t
- )
- endif()
-endif()
-
if(NOT LLVM_LIBC_FULL_BUILD)
# We don't install headers in non-fullbuild mode.
return()
>From f0501fbc6d4e34956c99d155662935f2a8aad9ba Mon Sep 17 00:00:00 2001
From: Rose Zhang <rosezhang at google.com>
Date: Tue, 16 Jul 2024 00:38:07 +0000
Subject: [PATCH 09/18] added deleted endif()
---
libc/include/CMakeLists.txt | 1 +
1 file changed, 1 insertion(+)
diff --git a/libc/include/CMakeLists.txt b/libc/include/CMakeLists.txt
index 5ad09e4ae8aad..68fd7d3bec415 100644
--- a/libc/include/CMakeLists.txt
+++ b/libc/include/CMakeLists.txt
@@ -707,6 +707,7 @@ if(LIBC_TARGET_OS_IS_GPU)
.llvm_libc_common_h
.llvm-libc-types.rpc_opcodes_t
)
+endif()
if(NOT LLVM_LIBC_FULL_BUILD)
# We don't install headers in non-fullbuild mode.
>From b7a5ee425c78b28afb1adf258755ba60eac38098 Mon Sep 17 00:00:00 2001
From: Rose Zhang <rosezhang at google.com>
Date: Tue, 16 Jul 2024 00:46:11 +0000
Subject: [PATCH 10/18] changed argument name TYPE to NAME
---
libc/include/CMakeLists.txt | 6 +++---
1 file changed, 3 insertions(+), 3 deletions(-)
diff --git a/libc/include/CMakeLists.txt b/libc/include/CMakeLists.txt
index 68fd7d3bec415..4645f7b59990c 100644
--- a/libc/include/CMakeLists.txt
+++ b/libc/include/CMakeLists.txt
@@ -17,10 +17,10 @@ add_header(
__llvm-libc-common.h
)
-macro(add_header_macro TYPE YAML_FILE DEF_FILE GEN_HDR DEPENDS)
+macro(add_header_macro NAME YAML_FILE DEF_FILE GEN_HDR DEPENDS)
if (LIBC_USE_NEW_HEADER_GEN)
add_gen_header2(
- ${TYPE}
+ ${NAME}
${YAML_FILE}
${DEF_FILE}
${GEN_HDR}
@@ -28,7 +28,7 @@ macro(add_header_macro TYPE YAML_FILE DEF_FILE GEN_HDR DEPENDS)
)
else()
add_gen_header(
- ${TYPE}
+ ${NAME}
${DEF_FILE}
${GEN_HDR}
${DEPENDS}
>From 89d19702c67800702e6b0c00dbdebae54d829b80 Mon Sep 17 00:00:00 2001
From: Rose Zhang <rosezhang at google.com>
Date: Tue, 16 Jul 2024 00:50:37 +0000
Subject: [PATCH 11/18] updated argument NAME to TARGET_NAME
---
libc/include/CMakeLists.txt | 6 +++---
1 file changed, 3 insertions(+), 3 deletions(-)
diff --git a/libc/include/CMakeLists.txt b/libc/include/CMakeLists.txt
index 4645f7b59990c..ce2bbe75a53c3 100644
--- a/libc/include/CMakeLists.txt
+++ b/libc/include/CMakeLists.txt
@@ -17,10 +17,10 @@ add_header(
__llvm-libc-common.h
)
-macro(add_header_macro NAME YAML_FILE DEF_FILE GEN_HDR DEPENDS)
+macro(add_header_macro TARGET_NAME YAML_FILE DEF_FILE GEN_HDR DEPENDS)
if (LIBC_USE_NEW_HEADER_GEN)
add_gen_header2(
- ${NAME}
+ ${TARGET_NAME}
${YAML_FILE}
${DEF_FILE}
${GEN_HDR}
@@ -28,7 +28,7 @@ macro(add_header_macro NAME YAML_FILE DEF_FILE GEN_HDR DEPENDS)
)
else()
add_gen_header(
- ${NAME}
+ ${TARGET_NAME}
${DEF_FILE}
${GEN_HDR}
${DEPENDS}
>From f78628eedb2034cf1ba081ecf79f5cd32d96ae53 Mon Sep 17 00:00:00 2001
From: Rose Zhang <rosezhang at google.com>
Date: Tue, 16 Jul 2024 17:33:56 +0000
Subject: [PATCH 12/18] changed option LIBC_USE_NEW_HEADER_GEN to default OFF
---
libc/CMakeLists.txt | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/libc/CMakeLists.txt b/libc/CMakeLists.txt
index c89897f2900fe..3b8e4e6c517e9 100644
--- a/libc/CMakeLists.txt
+++ b/libc/CMakeLists.txt
@@ -72,7 +72,7 @@ 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)
+option(LIBC_USE_NEW_HEADER_GEN "Generate header files using new headergen instead of the old one" OFF)
set(NEED_LIBC_HDRGEN FALSE)
if(NOT LLVM_RUNTIMES_BUILD)
>From 5f43f10567a63faf9c065746aa4081ad8cc6634c Mon Sep 17 00:00:00 2001
From: Rose Zhang <rosezhang at google.com>
Date: Tue, 16 Jul 2024 19:58:33 +0000
Subject: [PATCH 13/18] fixed macro implementation, fixed message typo in
LLVMLibCHeaderRules.cmake
---
libc/cmake/modules/LLVMLibCHeaderRules.cmake | 2 +-
libc/include/CMakeLists.txt | 316 +++++++++----------
2 files changed, 159 insertions(+), 159 deletions(-)
diff --git a/libc/cmake/modules/LLVMLibCHeaderRules.cmake b/libc/cmake/modules/LLVMLibCHeaderRules.cmake
index 121dab0e40c1b..fa743279641c5 100644
--- a/libc/cmake/modules/LLVMLibCHeaderRules.cmake
+++ b/libc/cmake/modules/LLVMLibCHeaderRules.cmake
@@ -80,7 +80,7 @@ function(add_gen_header2 target_name)
return()
endif()
if(NOT ADD_GEN_HDR2_DEF_FILE)
- mesage(FATAL_ERROR "`add_gen_hdr2` rule requires DEF_FILE to be specified.")
+ message(FATAL_ERROR "`add_gen_hdr2` 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.")
diff --git a/libc/include/CMakeLists.txt b/libc/include/CMakeLists.txt
index ce2bbe75a53c3..cb89c2565d5fe 100644
--- a/libc/include/CMakeLists.txt
+++ b/libc/include/CMakeLists.txt
@@ -21,16 +21,16 @@ 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}
- ${DEF_FILE}
- ${GEN_HDR}
+ YAML_FILE ${YAML_FILE}
+ DEF_FILE ${DEF_FILE}
+ GEN_HDR ${GEN_HDR}
${DEPENDS}
)
else()
add_gen_header(
${TARGET_NAME}
- ${DEF_FILE}
- ${GEN_HDR}
+ DEF_FILE ${DEF_FILE}
+ GEN_HDR ${GEN_HDR}
${DEPENDS}
)
endif()
@@ -38,18 +38,18 @@ endmacro()
add_header_macro(
ctype
- YAML_FILE ../libc/newhdrgen/yaml/ctype.yaml
- DEF_FILE ctype.h.def
- GEN_HDR ctype.h
+ ../libc/newhdrgen/yaml/ctype.yaml
+ ctype.h.def
+ ctype.h
DEPENDS
.llvm_libc_common_h
)
add_header_macro(
dirent
- YAML_FILE ../libc/newhdrgen/yaml/dirent.yaml
- DEF_FILE dirent.h.def
- GEN_HDR dirent.h
+ ../libc/newhdrgen/yaml/dirent.yaml
+ dirent.h.def
+ dirent.h
DEPENDS
.llvm_libc_common_h
.llvm-libc-types.ino_t
@@ -59,9 +59,9 @@ add_header_macro(
add_header_macro(
fcntl
- YAML_FILE ../libc/newhdrgen/yaml/fcntl.yaml
- DEF_FILE fcntl.h.def
- GEN_HDR fcntl.h
+ ../libc/newhdrgen/yaml/fcntl.yaml
+ fcntl.h.def
+ fcntl.h
DEPENDS
.llvm-libc-macros.fcntl_macros
.llvm-libc-types.mode_t
@@ -75,9 +75,9 @@ add_header_macro(
add_header_macro(
dlfcn
- YAML_FILE ../libc/newhdrgen/yaml/dlfcn.yaml
- DEF_FILE dlfcn.h.def
- GEN_HDR dlfcn.h
+ ../libc/newhdrgen/yaml/dlfcn.yaml
+ dlfcn.h.def
+ dlfcn.h
DEPENDS
.llvm-libc-macros.dlfcn_macros
.llvm_libc_common_h
@@ -85,9 +85,9 @@ add_header_macro(
add_header_macro(
features
- YAML_FILE ../libc/newhdrgen/yaml/features.yaml
- DEF_FILE features.h.def
- GEN_HDR features.h
+ ../libc/newhdrgen/yaml/features.yaml
+ features.h.def
+ features.h
DEPENDS
.llvm_libc_common_h
.llvm-libc-macros.features_macros
@@ -95,9 +95,9 @@ add_header_macro(
add_header_macro(
fenv
- YAML_FILE ../libc/newhdrgen/yaml/fenv.yaml
- DEF_FILE fenv.h.def
- GEN_HDR fenv.h
+ ../libc/newhdrgen/yaml/fenv.yaml
+ fenv.h.def
+ fenv.h
DEPENDS
.llvm_libc_common_h
.llvm-libc-macros.fenv_macros
@@ -107,9 +107,9 @@ add_header_macro(
add_header_macro(
inttypes
- YAML_FILE ../libc/newhdrgen/yaml/inttypes.yaml
- DEF_FILE inttypes.h.def
- GEN_HDR inttypes.h
+ ../libc/newhdrgen/yaml/inttypes.yaml
+ inttypes.h.def
+ inttypes.h
DEPENDS
.llvm_libc_common_h
.llvm-libc-types.imaxdiv_t
@@ -118,36 +118,36 @@ add_header_macro(
add_header_macro(
float
- YAML_FILE ../libc/newhdrgen/yaml/float.yaml
- DEF_FILE float.h.def
- GEN_HDR float.h
+ ../libc/newhdrgen/yaml/float.yaml
+ float.h.def
+ float.h
DEPENDS
.llvm-libc-macros.float_macros
)
add_header_macro(
stdint
- YAML_FILE ../libc/newhdrgen/yaml/stdint.yaml
- DEF_FILE stdint.h.def
- GEN_HDR stdint.h
+ ../libc/newhdrgen/yaml/stdint.yaml
+ stdint.h.def
+ stdint.h
DEPENDS
.llvm-libc-macros.stdint_macros
)
add_header_macro(
limits
- YAML_FILE ../libc/newhdrgen/yaml/limits.yaml
- DEF_FILE limits.h.def
- GEN_HDR limits.h
+ ../libc/newhdrgen/yaml/limits.yaml
+ limits.h.def
+ limits.h
DEPENDS
.llvm-libc-macros.limits_macros
)
add_header_macro(
math
- YAML_FILE ../libc/newhdrgen/yaml/math.yaml
- DEF_FILE math.h.def
- GEN_HDR math.h
+ ../libc/newhdrgen/yaml/math.yaml
+ math.h.def
+ math.h
DEPENDS
.llvm_libc_common_h
.llvm-libc-macros.float16_macros
@@ -159,9 +159,9 @@ add_header_macro(
add_header_macro(
stdfix
- YAML_FILE ../libc/newhdrgen/yaml/stdfix.yaml
- DEF_FILE stdfix.h.def
- GEN_HDR stdfix.h
+ ../libc/newhdrgen/yaml/stdfix.yaml
+ stdfix.h.def
+ stdfix.h
DEPENDS
.llvm-libc-macros.stdfix_macros
)
@@ -171,18 +171,18 @@ file(MAKE_DIRECTORY ${LIBC_INCLUDE_DIR}/arpa)
add_header_macro(
arpa_inet
- YAML_FILE ../libc/newhdrgen/yaml/arpa_inet.yaml
- DEF_FILE arpa/inet.h.def
- GEN_HDR arpa/inet.h
+ ../libc/newhdrgen/yaml/arpa_inet.yaml
+ arpa/inet.h.def
+ arpa/inet.h
DEPENDS
.llvm_libc_common_h
)
add_header_macro(
assert
- YAML_FILE ../libc/newhdrgen/yaml/assert.yaml
- DEF_FILE assert.h.def
- GEN_HDR assert.h
+ ../libc/newhdrgen/yaml/assert.yaml
+ assert.h.def
+ assert.h
DEPENDS
.llvm_libc_common_h
.llvm-libc-macros.assert_macros
@@ -190,9 +190,9 @@ add_header_macro(
add_header_macro(
setjmp
- YAML_FILE ../libc/newhdrgen/yaml/setjmp.yaml
- DEF_FILE setjmp.h.def
- GEN_HDR setjmp.h
+ ../libc/newhdrgen/yaml/setjmp.yaml
+ setjmp.h.def
+ setjmp.h
DEPENDS
.llvm_libc_common_h
.llvm-libc-types.jmp_buf
@@ -200,9 +200,9 @@ add_header_macro(
add_header_macro(
string
- YAML_FILE ../libc/newhdrgen/yaml/string.yaml
- DEF_FILE string.h.def
- GEN_HDR string.h
+ ../libc/newhdrgen/yaml/string.yaml
+ string.h.def
+ string.h
DEPENDS
.llvm_libc_common_h
.llvm-libc-macros.null_macro
@@ -211,9 +211,9 @@ add_header_macro(
add_header_macro(
strings
- YAML_FILE ../libc/newhdrgen/yaml/strings.yaml
- DEF_FILE strings.h.def
- GEN_HDR strings.h
+ ../libc/newhdrgen/yaml/strings.yaml
+ strings.h.def
+ strings.h
DEPENDS
.llvm_libc_common_h
.llvm-libc-types.size_t
@@ -221,9 +221,9 @@ add_header_macro(
add_header_macro(
search
- YAML_FILE ../libc/newhdrgen/yaml/search.yaml
- DEF_FILE search.h.def
- GEN_HDR search.h
+ ../libc/newhdrgen/yaml/search.yaml
+ search.h.def
+ search.h
DEPENDS
.llvm_libc_common_h
.llvm-libc-types.ACTION
@@ -234,9 +234,9 @@ add_header_macro(
add_header_macro(
time
- YAML_FILE ../libc/newhdrgen/yaml/time.yaml
- DEF_FILE time.h.def
- GEN_HDR time.h
+ ../libc/newhdrgen/yaml/time.yaml
+ time.h.def
+ time.h
DEPENDS
.llvm_libc_common_h
.llvm-libc-macros.time_macros
@@ -250,9 +250,9 @@ add_header_macro(
add_header_macro(
threads
- YAML_FILE ../libc/newhdrgen/yaml/threads.yaml
- DEF_FILE threads.h.def
- GEN_HDR threads.h
+ ../libc/newhdrgen/yaml/threads.yaml
+ threads.h.def
+ threads.h
DEPENDS
.llvm_libc_common_h
.llvm-libc-types.__call_once_func_t
@@ -267,9 +267,9 @@ add_header_macro(
add_header_macro(
errno
- YAML_FILE ../libc/newhdrgen/yaml/errno.yaml
- DEF_FILE errno.h.def
- GEN_HDR errno.h
+ ../libc/newhdrgen/yaml/errno.yaml
+ errno.h.def
+ errno.h
DEPENDS
.llvm-libc-macros.generic_error_number_macros
.llvm-libc-macros.error_number_macros
@@ -277,9 +277,9 @@ add_header_macro(
add_header_macro(
signal
- YAML_FILE ../libc/newhdrgen/yaml/signal.yaml
- DEF_FILE signal.h.def
- GEN_HDR signal.h
+ ../libc/newhdrgen/yaml/signal.yaml
+ signal.h.def
+ signal.h
DEPENDS
.llvm-libc-macros.signal_macros
.llvm-libc-types.sig_atomic_t
@@ -293,9 +293,9 @@ add_header_macro(
add_header_macro(
stdbit
- YAML_FILE ../libc/newhdrgen/yaml/stdbit.yaml
- DEF_FILE stdbit.h.def
- GEN_HDR stdbit.h
+ ../libc/newhdrgen/yaml/stdbit.yaml
+ stdbit.h.def
+ stdbit.h
DEPENDS
.llvm_libc_common_h
.llvm-libc-macros.stdbit_macros
@@ -303,9 +303,9 @@ add_header_macro(
add_header_macro(
stdckdint
- YAML_FILE ../libc/newhdrgen/yaml/stdckdint.yaml
- DEF_FILE stdckdint.h.def
- GEN_HDR stdckdint.h
+ ../libc/newhdrgen/yaml/stdckdint.yaml
+ stdckdint.h.def
+ stdckdint.h
DEPENDS
.llvm_libc_common_h
.llvm-libc-macros.stdckdint_macros
@@ -313,9 +313,9 @@ add_header_macro(
add_header_macro(
stdio
- YAML_FILE ../libc/newhdrgen/yaml/stdio.yaml
- DEF_FILE stdio.h.def
- GEN_HDR stdio.h
+ ../libc/newhdrgen/yaml/stdio.yaml
+ stdio.h.def
+ stdio.h
DEPENDS
.llvm-libc-macros.file_seek_macros
.llvm-libc-macros.stdio_macros
@@ -329,9 +329,9 @@ add_header_macro(
add_header_macro(
stdlib
- YAML_FILE ../libc/newhdrgen/yaml/stdlib.yaml
- DEF_FILE stdlib.h.def
- GEN_HDR stdlib.h
+ ../libc/newhdrgen/yaml/stdlib.yaml
+ stdlib.h.def
+ stdlib.h
DEPENDS
.llvm_libc_common_h
.llvm-libc-macros.stdlib_macros
@@ -347,9 +347,9 @@ add_header_macro(
add_header_macro(
unistd
- YAML_FILE ../libc/newhdrgen/yaml/unistd.yaml
- DEF_FILE unistd.h.def
- GEN_HDR unistd.h
+ ../libc/newhdrgen/yaml/unistd.yaml
+ unistd.h.def
+ unistd.h
DEPENDS
.llvm_libc_common_h
.llvm-libc-macros.file_seek_macros
@@ -366,9 +366,9 @@ add_header_macro(
add_header_macro(
pthread
- YAML_FILE ../libc/newhdrgen/yaml/pthread.yaml
- DEF_FILE pthread.h.def
- GEN_HDR pthread.h
+ ../libc/newhdrgen/yaml/pthread.yaml
+ pthread.h.def
+ pthread.h
DEPENDS
.llvm_libc_common_h
.llvm-libc-types.__atfork_callback_t
@@ -388,9 +388,9 @@ add_header_macro(
add_header_macro(
sched
- YAML_FILE ../libc/newhdrgen/yaml/sched.yaml
- DEF_FILE sched.h.def
- GEN_HDR sched.h
+ ../libc/newhdrgen/yaml/sched.yaml
+ sched.h.def
+ sched.h
DEPENDS
.llvm_libc_common_h
.llvm-libc-macros.sched_macros
@@ -405,9 +405,9 @@ add_header_macro(
add_header_macro(
spawn
- YAML_FILE ../libc/newhdrgen/yaml/spawn.yaml
- DEF_FILE spawn.h.def
- GEN_HDR spawn.h
+ ../libc/newhdrgen/yaml/spawn.yaml
+ spawn.h.def
+ spawn.h
DEPENDS
.llvm_libc_common_h
.llvm-libc-types.mode_t
@@ -423,9 +423,9 @@ file(MAKE_DIRECTORY ${LIBC_INCLUDE_DIR}/sys)
add_header_macro(
sys_auxv
- YAML_FILE ../libc/newhdrgen/yaml/sys/sys_auxv.yaml
- DEF_FILE sys/auxv.h.def
- GEN_HDR sys/auxv.h
+ ../libc/newhdrgen/yaml/sys/sys_auxv.yaml
+ sys/auxv.h.def
+ sys/auxv.h
DEPENDS
.llvm_libc_common_h
.llvm-libc-macros.sys_auxv_macros
@@ -433,9 +433,9 @@ add_header_macro(
add_header_macro(
sys_epoll
- YAML_FILE ../libc/newhdrgen/yaml/sys/sys_epoll.yaml
- DEF_FILE sys/epoll.h.def
- GEN_HDR sys/epoll.h
+ ../libc/newhdrgen/yaml/sys/sys_epoll.yaml
+ sys/epoll.h.def
+ sys/epoll.h
DEPENDS
.llvm_libc_common_h
.llvm-libc-types.struct_epoll_event
@@ -446,9 +446,9 @@ add_header_macro(
add_header_macro(
sys_ioctl
- YAML_FILE ../libc/newhdrgen/yaml/sys/sys_ioctl.yaml
- DEF_FILE sys/ioctl.h.def
- GEN_HDR sys/ioctl.h
+ ../libc/newhdrgen/yaml/sys/sys_ioctl.yaml
+ sys/ioctl.h.def
+ sys/ioctl.h
DEPENDS
.llvm_libc_common_h
.llvm-libc-macros.sys_ioctl_macros
@@ -456,9 +456,9 @@ add_header_macro(
add_header_macro(
sys_mman
- YAML_FILE ../libc/newhdrgen/yaml/sys/sys_mman.yaml
- DEF_FILE sys/mman.h.def
- GEN_HDR sys/mman.h
+ ../libc/newhdrgen/yaml/sys/sys_mman.yaml
+ sys/mman.h.def
+ sys/mman.h
DEPENDS
.llvm_libc_common_h
.llvm-libc-macros.sys_mman_macros
@@ -469,9 +469,9 @@ add_header_macro(
add_header_macro(
sys_prctl
- YAML_FILE ../libc/newhdrgen/yaml/sys/sys_prctl.yaml
- DEF_FILE sys/prctl.h.def
- GEN_HDR sys/prctl.h
+ ../libc/newhdrgen/yaml/sys/sys_prctl.yaml
+ sys/prctl.h.def
+ sys/prctl.h
DEPENDS
.llvm_libc_common_h
)
@@ -486,9 +486,9 @@ add_header(
add_header_macro(
sys_random
- YAML_FILE ../libc/newhdrgen/yaml/sys/sys_random.yaml
- DEF_FILE sys/random.h.def
- GEN_HDR sys/random.h
+ ../libc/newhdrgen/yaml/sys/sys_random.yaml
+ sys/random.h.def
+ sys/random.h
DEPENDS
.llvm_libc_common_h
.llvm-libc-macros.sys_random_macros
@@ -498,9 +498,9 @@ add_header_macro(
add_header_macro(
sys_resource
- YAML_FILE ../libc/newhdrgen/yaml/sys/sys_resource.yaml
- DEF_FILE sys/resource.h.def
- GEN_HDR sys/resource.h
+ ../libc/newhdrgen/yaml/sys/sys_resource.yaml
+ sys/resource.h.def
+ sys/resource.h
DEPENDS
.llvm_libc_common_h
.llvm-libc-macros.sys_resource_macros
@@ -510,9 +510,9 @@ add_header_macro(
add_header_macro(
sys_stat
- YAML_FILE ../libc/newhdrgen/yaml/sys/sys_stat.yaml
- DEF_FILE sys/stat.h.def
- GEN_HDR sys/stat.h
+ ../libc/newhdrgen/yaml/sys/sys_stat.yaml
+ sys/stat.h.def
+ sys/stat.h
DEPENDS
.llvm_libc_common_h
.llvm-libc-macros.sys_stat_macros
@@ -532,9 +532,9 @@ add_header_macro(
add_header_macro(
sys_select
- YAML_FILE ../libc/newhdrgen/yaml/sys/sys_select.yaml
- DEF_FILE sys/select.h.def
- GEN_HDR sys/select.h
+ ../libc/newhdrgen/yaml/sys/sys_select.yaml
+ sys/select.h.def
+ sys/select.h
DEPENDS
.llvm_libc_common_h
.llvm-libc-macros.sys_select_macros
@@ -548,9 +548,9 @@ add_header_macro(
add_header_macro(
sys_sendfile
- YAML_FILE ../libc/newhdrgen/yaml/sys/sys_sendfile.yaml
- DEF_FILE sys/sendfile.h.def
- GEN_HDR sys/sendfile.h
+ ../libc/newhdrgen/yaml/sys/sys_sendfile.yaml
+ sys/sendfile.h.def
+ sys/sendfile.h
DEPENDS
.llvm_libc_common_h
.llvm-libc-types.off_t
@@ -560,9 +560,9 @@ add_header_macro(
add_header_macro(
sys_socket
- YAML_FILE ../libc/newhdrgen/yaml/sys/sys_socket.yaml
- DEF_FILE sys/socket.h.def
- GEN_HDR sys/socket.h
+ ../libc/newhdrgen/yaml/sys/sys_socket.yaml
+ sys/socket.h.def
+ sys/socket.h
DEPENDS
.llvm_libc_common_h
.llvm-libc-macros.sys_socket_macros
@@ -574,9 +574,9 @@ add_header_macro(
add_header_macro(
sys_statvfs
- YAML_FILE ../libc/newhdrgen/yaml/sys/sys_statvfs.yaml
- DEF_FILE sys/statvfs.h.def
- GEN_HDR sys/statvfs.h
+ ../libc/newhdrgen/yaml/sys/sys_statvfs.yaml
+ sys/statvfs.h.def
+ sys/statvfs.h
DEPENDS
.llvm_libc_common_h
.llvm-libc-types.struct_statvfs
@@ -584,16 +584,16 @@ add_header_macro(
add_header_macro(
sys_syscall
- YAML_FILE ../libc/newhdrgen/yaml/sys/sys_syscall.yaml
- DEF_FILE sys/syscall.h.def
- GEN_HDR sys/syscall.h
+ ../libc/newhdrgen/yaml/sys/sys_syscall.yaml
+ sys/syscall.h.def
+ sys/syscall.h
)
add_header_macro(
sys_time
- YAML_FILE ../libc/newhdrgen/yaml/sys/sys_time.yaml
- DEF_FILE sys/time.h.def
- GEN_HDR sys/time.h
+ ../libc/newhdrgen/yaml/sys/sys_time.yaml
+ sys/time.h.def
+ sys/time.h
DEPENDS
.llvm_libc_common_h
.llvm-libc-types.struct_timeval
@@ -602,9 +602,9 @@ add_header_macro(
add_header_macro(
sys_types
- YAML_FILE ../libc/newhdrgen/yaml/sys/sys_types.yaml
- DEF_FILE sys/types.h.def
- GEN_HDR sys/types.h
+ ../libc/newhdrgen/yaml/sys/sys_types.yaml
+ sys/types.h.def
+ sys/types.h
DEPENDS
.llvm_libc_common_h
.llvm-libc-types.blkcnt_t
@@ -632,9 +632,9 @@ add_header_macro(
add_header_macro(
sys_utsname
- YAML_FILE ../libc/newhdrgen/yaml/sys/sys_utsname.yaml
- DEF_FILE sys/utsname.h.def
- GEN_HDR sys/utsname.h
+ ../libc/newhdrgen/yaml/sys/sys_utsname.yaml
+ sys/utsname.h.def
+ sys/utsname.h
DEPENDS
.llvm_libc_common_h
.llvm-libc-types.struct_utsname
@@ -642,9 +642,9 @@ add_header_macro(
add_header_macro(
sys_wait
- YAML_FILE ../libc/newhdrgen/yaml/sys/sys_wait.yaml
- DEF_FILE sys/wait.h.def
- GEN_HDR sys/wait.h
+ ../libc/newhdrgen/yaml/sys/sys_wait.yaml
+ sys/wait.h.def
+ sys/wait.h
DEPENDS
.llvm_libc_common_h
.llvm-libc-macros.sys_wait_macros
@@ -655,9 +655,9 @@ add_header_macro(
add_header_macro(
termios
- YAML_FILE ../libc/newhdrgen/yaml/termios.yaml
- DEF_FILE termios.h.def
- GEN_HDR termios.h
+ ../libc/newhdrgen/yaml/termios.yaml
+ termios.h.def
+ termios.h
DEPENDS
.llvm_libc_common_h
.llvm-libc-macros.termios_macros
@@ -670,9 +670,9 @@ add_header_macro(
add_header_macro(
uchar
- YAML_FILE ../libc/newhdrgen/yaml/uchar.yaml
- DEF_FILE uchar.h.def
- GEN_HDR uchar.h
+ ../libc/newhdrgen/yaml/uchar.yaml
+ uchar.h.def
+ uchar.h
DEPENDS
.llvm_libc_common_h
.llvm-libc-types.mbstate_t
@@ -683,9 +683,9 @@ add_header_macro(
add_header_macro(
wchar
- YAML_FILE ../libc/newhdrgen/yaml/wchar.yaml
- DEF_FILE wchar.h.def
- GEN_HDR wchar.h
+ ../libc/newhdrgen/yaml/wchar.yaml
+ wchar.h.def
+ wchar.h
DEPENDS
.llvm_libc_common_h
.llvm-libc-macros.wchar_macros
@@ -700,9 +700,9 @@ if(LIBC_TARGET_OS_IS_GPU)
add_header_macro(
gpu_rpc
- YAML_FILE ../libc/newhdrgen/yaml/rpc.yaml
- DEF_FILE gpu/rpc.h.def
- GEN_HDR gpu/rpc.h
+ ../libc/newhdrgen/yaml/rpc.yaml
+ gpu/rpc.h.def
+ gpu/rpc.h
DEPENDS
.llvm_libc_common_h
.llvm-libc-types.rpc_opcodes_t
>From add676b179b3d58956584bb3b40ade61fa754280 Mon Sep 17 00:00:00 2001
From: Rose Zhang <rosezhang at google.com>
Date: Tue, 16 Jul 2024 20:22:15 +0000
Subject: [PATCH 14/18] added missing DEPENDS
---
libc/include/CMakeLists.txt | 1 +
1 file changed, 1 insertion(+)
diff --git a/libc/include/CMakeLists.txt b/libc/include/CMakeLists.txt
index cb89c2565d5fe..d15671a23fbaf 100644
--- a/libc/include/CMakeLists.txt
+++ b/libc/include/CMakeLists.txt
@@ -587,6 +587,7 @@ add_header_macro(
../libc/newhdrgen/yaml/sys/sys_syscall.yaml
sys/syscall.h.def
sys/syscall.h
+ DEPENDS
)
add_header_macro(
>From 3ffc0ee647574e4a7f191a3ec501b42fbf3f308e Mon Sep 17 00:00:00 2001
From: Rose Zhang <rosezhang at google.com>
Date: Tue, 16 Jul 2024 23:03:44 +0000
Subject: [PATCH 15/18] nit spacing
---
libc/newhdrgen/header.py | 8 ++++----
1 file changed, 4 insertions(+), 4 deletions(-)
diff --git a/libc/newhdrgen/header.py b/libc/newhdrgen/header.py
index 69de81eebb719..141e3c9b2736b 100644
--- a/libc/newhdrgen/header.py
+++ b/libc/newhdrgen/header.py
@@ -60,16 +60,16 @@ def __str__(self):
current_guard = None
for function in self.functions:
if function.guard == None:
- content.append(str(function) + "__NOEXCEPT")
+ content.append(str(function) + " __NOEXCEPT;")
content.append("")
else:
if current_guard == None:
current_guard = function.guard
content.append(f"#ifdef {current_guard}")
- content.append(str(function) + "__NOEXCEPT")
+ content.append(str(function) + " __NOEXCEPT;")
content.append("")
elif current_guard == function.guard:
- content.append(str(function) + "__NOEXCEPT")
+ content.append(str(function) + " __NOEXCEPT;")
content.append("")
else:
content.pop()
@@ -77,7 +77,7 @@ def __str__(self):
content.append("")
current_guard = function.guard
content.append(f"#ifdef {current_guard}")
- content.append(str(function) + "__NOEXCEPT")
+ content.append(str(function) + " __NOEXCEPT;")
content.append("")
if current_guard != None:
content.pop()
>From 50da8f0fa6a9b7e6b834b96e68ad2420ded16e7e Mon Sep 17 00:00:00 2001
From: Rose Zhang <rosezhang at google.com>
Date: Wed, 17 Jul 2024 22:29:03 +0000
Subject: [PATCH 16/18] added ARGN to CMakeLists function call and reformatted
__NOEXCEPT
---
libc/include/CMakeLists.txt | 2 ++
libc/newhdrgen/class_implementation/classes/function.py | 4 ++--
libc/newhdrgen/header.py | 8 ++++----
3 files changed, 8 insertions(+), 6 deletions(-)
diff --git a/libc/include/CMakeLists.txt b/libc/include/CMakeLists.txt
index d15671a23fbaf..bbc0f7abafd55 100644
--- a/libc/include/CMakeLists.txt
+++ b/libc/include/CMakeLists.txt
@@ -25,6 +25,7 @@ macro(add_header_macro TARGET_NAME YAML_FILE DEF_FILE GEN_HDR DEPENDS)
DEF_FILE ${DEF_FILE}
GEN_HDR ${GEN_HDR}
${DEPENDS}
+ ${ARGN}
)
else()
add_gen_header(
@@ -32,6 +33,7 @@ macro(add_header_macro TARGET_NAME YAML_FILE DEF_FILE GEN_HDR DEPENDS)
DEF_FILE ${DEF_FILE}
GEN_HDR ${GEN_HDR}
${DEPENDS}
+ ${ARGN}
)
endif()
endmacro()
diff --git a/libc/newhdrgen/class_implementation/classes/function.py b/libc/newhdrgen/class_implementation/classes/function.py
index ccfd93547c1d8..ea5e8223a538e 100644
--- a/libc/newhdrgen/class_implementation/classes/function.py
+++ b/libc/newhdrgen/class_implementation/classes/function.py
@@ -26,7 +26,7 @@ def __str__(self):
attributes_str = " ".join(self.attributes)
arguments_str = ", ".join(self.arguments)
if attributes_str == "":
- result = f"{self.return_type} {self.name}({arguments_str});"
+ result = f"{self.return_type} {self.name}({arguments_str}) __NOEXCEPT;"
else:
- result = f"{attributes_str} {self.return_type} {self.name}({arguments_str})"
+ result = f"{attributes_str} {self.return_type} {self.name}({arguments_str}) __NOEXCEPT;"
return result
diff --git a/libc/newhdrgen/header.py b/libc/newhdrgen/header.py
index 141e3c9b2736b..2671f00d7e47a 100644
--- a/libc/newhdrgen/header.py
+++ b/libc/newhdrgen/header.py
@@ -60,16 +60,16 @@ def __str__(self):
current_guard = None
for function in self.functions:
if function.guard == None:
- content.append(str(function) + " __NOEXCEPT;")
+ content.append(str(function))
content.append("")
else:
if current_guard == None:
current_guard = function.guard
content.append(f"#ifdef {current_guard}")
- content.append(str(function) + " __NOEXCEPT;")
+ content.append(str(function))
content.append("")
elif current_guard == function.guard:
- content.append(str(function) + " __NOEXCEPT;")
+ content.append(str(function))
content.append("")
else:
content.pop()
@@ -77,7 +77,7 @@ def __str__(self):
content.append("")
current_guard = function.guard
content.append(f"#ifdef {current_guard}")
- content.append(str(function) + " __NOEXCEPT;")
+ content.append(str(function))
content.append("")
if current_guard != None:
content.pop()
>From 5e450512cf2a1a4e0949c75c47a593aec3f1f53b Mon Sep 17 00:00:00 2001
From: Rose Zhang <rosezhang at google.com>
Date: Wed, 17 Jul 2024 22:32:05 +0000
Subject: [PATCH 17/18] removed two 2's
---
libc/cmake/modules/LLVMLibCHeaderRules.cmake | 4 ++--
1 file changed, 2 insertions(+), 2 deletions(-)
diff --git a/libc/cmake/modules/LLVMLibCHeaderRules.cmake b/libc/cmake/modules/LLVMLibCHeaderRules.cmake
index fa743279641c5..91054810f5ec5 100644
--- a/libc/cmake/modules/LLVMLibCHeaderRules.cmake
+++ b/libc/cmake/modules/LLVMLibCHeaderRules.cmake
@@ -97,7 +97,7 @@ function(add_gen_header2 target_name)
set(fq_data_files "")
if(ADD_GEN_HDR2_DATA_FILES)
- foreach(data_file IN 2LISTS ADD_GEN_HDR2_DATA_FILES)
+ foreach(data_file IN LISTS ADD_GEN_HDR2_DATA_FILES)
list(APPEND fq_data_files "${CMAKE_CURRENT_SOURCE_DIR}/${data_file}")
endforeach(data_file)
endif()
@@ -132,7 +132,7 @@ function(add_gen_header2 target_name)
endif()
if(ADD_GEN_HDR2_DEPENDS)
- get_fq_deps_list(f2q_deps_list ${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)
>From c16998ab67a649ff59c96db4d741a233eddc937a Mon Sep 17 00:00:00 2001
From: Rose Zhang <rosezhang at google.com>
Date: Wed, 17 Jul 2024 23:18:18 +0000
Subject: [PATCH 18/18] restored __NOEXCEPT formatting
---
libc/newhdrgen/class_implementation/classes/function.py | 4 ++--
libc/newhdrgen/header.py | 8 ++++----
2 files changed, 6 insertions(+), 6 deletions(-)
diff --git a/libc/newhdrgen/class_implementation/classes/function.py b/libc/newhdrgen/class_implementation/classes/function.py
index ea5e8223a538e..845ef1aebf54b 100644
--- a/libc/newhdrgen/class_implementation/classes/function.py
+++ b/libc/newhdrgen/class_implementation/classes/function.py
@@ -26,7 +26,7 @@ def __str__(self):
attributes_str = " ".join(self.attributes)
arguments_str = ", ".join(self.arguments)
if attributes_str == "":
- result = f"{self.return_type} {self.name}({arguments_str}) __NOEXCEPT;"
+ result = f"{self.return_type} {self.name}({arguments_str})"
else:
- result = f"{attributes_str} {self.return_type} {self.name}({arguments_str}) __NOEXCEPT;"
+ result = f"{attributes_str} {self.return_type} {self.name}({arguments_str})"
return result
diff --git a/libc/newhdrgen/header.py b/libc/newhdrgen/header.py
index 2671f00d7e47a..d1f0fe96dbc60 100644
--- a/libc/newhdrgen/header.py
+++ b/libc/newhdrgen/header.py
@@ -60,16 +60,16 @@ def __str__(self):
current_guard = None
for function in self.functions:
if function.guard == None:
- content.append(str(function))
+ content.append(str(function) + "__NOEXCEPT;")
content.append("")
else:
if current_guard == None:
current_guard = function.guard
content.append(f"#ifdef {current_guard}")
- content.append(str(function))
+ content.append(str(function) + "__NOEXCEPT;")
content.append("")
elif current_guard == function.guard:
- content.append(str(function))
+ content.append(str(function) + "__NOEXCEPT;")
content.append("")
else:
content.pop()
@@ -77,7 +77,7 @@ def __str__(self):
content.append("")
current_guard = function.guard
content.append(f"#ifdef {current_guard}")
- content.append(str(function))
+ content.append(str(function) + "__NOEXCEPT;")
content.append("")
if current_guard != None:
content.pop()
More information about the libc-commits
mailing list