-
Notifications
You must be signed in to change notification settings - Fork 14.3k
[libc] Revamp hdrgen command line and build integration #121522
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Conversation
This adds a new main command-line entry point for hdrgen, in the new main.py. This new interface is used for generating a header. The old ways of invoking yaml_to_classes.py for other purposes are left there for now, but `--e` is renamed to `--entry-point` for consistency with the new CLI. The YAML schema is expanded with the `header_template` key where the corresponding `.h.def` file's path is given relative to where the YAML file is found. The build integration no longer gives the `.h.def` path on the command line. Instead, the script now emits a depfile that's used by the cmake rules to track that. The output file is always explicit in the script command line rather than sometimes being derived from a directory path.
✅ With the latest revision this PR passed the Python code formatter. |
@llvm/pr-subscribers-libc Author: Roland McGrath (frobtech) ChangesThis adds a new main command-line entry point for hdrgen, in the The YAML schema is expanded with the Patch is 37.04 KiB, truncated to 20.00 KiB below, full version: https://github.com/llvm/llvm-project/pull/121522.diff 62 Files Affected:
diff --git a/libc/cmake/modules/LLVMLibCHeaderRules.cmake b/libc/cmake/modules/LLVMLibCHeaderRules.cmake
index 0de5e14359cfbb..f079a3f3ca6662 100644
--- a/libc/cmake/modules/LLVMLibCHeaderRules.cmake
+++ b/libc/cmake/modules/LLVMLibCHeaderRules.cmake
@@ -75,7 +75,7 @@ function(add_gen_header target_name)
cmake_parse_arguments(
"ADD_GEN_HDR"
"PUBLIC" # No optional arguments
- "YAML_FILE;DEF_FILE;GEN_HDR" # Single value arguments
+ "YAML_FILE;GEN_HDR" # Single value arguments
"DEPENDS" # Multi value arguments
${ARGN}
)
@@ -84,9 +84,6 @@ function(add_gen_header target_name)
add_library(${fq_target_name} INTERFACE)
return()
endif()
- if(NOT ADD_GEN_HDR_DEF_FILE)
- message(FATAL_ERROR "`add_gen_hdr` rule requires DEF_FILE to be specified.")
- endif()
if(NOT ADD_GEN_HDR_GEN_HDR)
message(FATAL_ERROR "`add_gen_hdr` rule requires GEN_HDR to be specified.")
endif()
@@ -97,8 +94,11 @@ function(add_gen_header target_name)
set(absolute_path ${CMAKE_CURRENT_SOURCE_DIR}/${ADD_GEN_HDR_GEN_HDR})
file(RELATIVE_PATH relative_path ${LIBC_INCLUDE_SOURCE_DIR} ${absolute_path})
set(out_file ${LIBC_INCLUDE_DIR}/${relative_path})
+ set(dep_file "${out_file}.d")
+ file(RELATIVE_PATH rel_out_file ${CMAKE_BINARY_DIR} ${out_file})
+ file(RELATIVE_PATH rel_dep_file ${CMAKE_BINARY_DIR} ${dep_file})
set(yaml_file ${CMAKE_SOURCE_DIR}/${ADD_GEN_HDR_YAML_FILE})
- set(def_file ${CMAKE_CURRENT_SOURCE_DIR}/${ADD_GEN_HDR_DEF_FILE})
+ file(RELATIVE_PATH rel_yaml_file ${CMAKE_BINARY_DIR} ${yaml_file})
set(fq_data_files "")
if(ADD_GEN_HDR_DATA_FILES)
@@ -108,18 +108,19 @@ function(add_gen_header target_name)
endif()
set(entry_points "${TARGET_ENTRYPOINT_NAME_LIST}")
- list(TRANSFORM entry_points PREPEND "--e=")
+ list(TRANSFORM entry_points PREPEND "--entry-point=")
- set(LIBC_HDRGEN "${LIBC_SOURCE_DIR}/utils/hdrgen/yaml_to_classes.py")
add_custom_command(
OUTPUT ${out_file}
- COMMAND ${Python3_EXECUTABLE} ${LIBC_HDRGEN}
- ${yaml_file}
- --h_def_file ${def_file}
+ WORKING_DIRECTORY ${CMAKE_BINARY_DIR}
+ COMMAND ${Python3_EXECUTABLE} "${LIBC_SOURCE_DIR}/utils/hdrgen/main.py"
+ --output ${rel_out_file}
+ --depfile ${rel_dep_file}
${entry_points}
- --output_dir ${out_file}
- DEPENDS ${yaml_file} ${def_file} ${fq_data_files}
- COMMENT "Generating header ${ADD_GEN_HDR_GEN_HDR} from ${yaml_file} and ${def_file}"
+ ${rel_yaml_file}
+ DEPENDS ${yaml_file} ${fq_data_files}
+ DEPFILE ${dep_file}
+ COMMENT "Generating header ${ADD_GEN_HDR_GEN_HDR} from ${yaml_file}"
)
if(LIBC_TARGET_OS_IS_GPU)
file(MAKE_DIRECTORY ${LIBC_INCLUDE_DIR}/llvm-libc-decls)
@@ -127,7 +128,7 @@ function(add_gen_header target_name)
set(decl_out_file ${LIBC_INCLUDE_DIR}/llvm-libc-decls/${relative_path})
add_custom_command(
OUTPUT ${decl_out_file}
- COMMAND ${Python3_EXECUTABLE} ${LIBC_HDRGEN}
+ COMMAND ${Python3_EXECUTABLE} "${LIBC_SOURCE_DIR}/utils/hdrgen/yaml_to_classes.py"
${yaml_file}
--export-decls
${entry_points}
diff --git a/libc/include/CMakeLists.txt b/libc/include/CMakeLists.txt
index eb407183c99f5d..568bb05d923023 100644
--- a/libc/include/CMakeLists.txt
+++ b/libc/include/CMakeLists.txt
@@ -19,11 +19,10 @@ add_header(
# TODO: Can we simplify this macro expansion?
# https://github.com/llvm/llvm-project/issues/117254
-macro(add_header_macro TARGET_NAME YAML_FILE DEF_FILE GEN_HDR DEPENDS)
+macro(add_header_macro TARGET_NAME YAML_FILE GEN_HDR DEPENDS)
add_gen_header(
${TARGET_NAME}
YAML_FILE ${YAML_FILE}
- DEF_FILE ${DEF_FILE}
GEN_HDR ${GEN_HDR}
${DEPENDS}
${ARGN}
@@ -33,7 +32,6 @@ endmacro()
add_header_macro(
ctype
../libc/include/ctype.yaml
- ctype.h.def
ctype.h
DEPENDS
.llvm_libc_common_h
@@ -43,7 +41,6 @@ add_header_macro(
add_header_macro(
dirent
../libc/include/dirent.yaml
- dirent.h.def
dirent.h
DEPENDS
.llvm_libc_common_h
@@ -55,7 +52,6 @@ add_header_macro(
add_header_macro(
fcntl
../libc/include/fcntl.yaml
- fcntl.h.def
fcntl.h
DEPENDS
.llvm-libc-macros.fcntl_macros
@@ -71,7 +67,6 @@ add_header_macro(
add_header_macro(
dlfcn
../libc/include/dlfcn.yaml
- dlfcn.h.def
dlfcn.h
DEPENDS
.llvm-libc-macros.dlfcn_macros
@@ -81,7 +76,6 @@ add_header_macro(
add_header_macro(
features
../libc/include/features.yaml
- features.h.def
features.h
DEPENDS
.llvm_libc_common_h
@@ -91,7 +85,6 @@ add_header_macro(
add_header_macro(
fenv
../libc/include/fenv.yaml
- fenv.h.def
fenv.h
DEPENDS
.llvm_libc_common_h
@@ -103,7 +96,6 @@ add_header_macro(
add_header_macro(
inttypes
../libc/include/inttypes.yaml
- inttypes.h.def
inttypes.h
DEPENDS
.llvm_libc_common_h
@@ -114,7 +106,6 @@ add_header_macro(
add_header_macro(
float
../libc/include/float.yaml
- float.h.def
float.h
DEPENDS
.llvm-libc-macros.float_macros
@@ -123,7 +114,6 @@ add_header_macro(
add_header_macro(
stdint
../libc/include/stdint.yaml
- stdint.h.def
stdint.h
DEPENDS
.llvm-libc-macros.stdint_macros
@@ -132,7 +122,6 @@ add_header_macro(
add_header_macro(
limits
../libc/include/limits.yaml
- limits.h.def
limits.h
DEPENDS
.llvm-libc-macros.limits_macros
@@ -141,7 +130,6 @@ add_header_macro(
add_header_macro(
malloc
../libc/include/malloc.yaml
- malloc.h.def
malloc.h
DEPENDS
.llvm_libc_common_h
@@ -151,7 +139,6 @@ add_header_macro(
add_header_macro(
math
../libc/include/math.yaml
- math.h.def
math.h
DEPENDS
.llvm_libc_common_h
@@ -166,7 +153,6 @@ add_header_macro(
add_header_macro(
stdfix
../libc/include/stdfix.yaml
- stdfix.h.def
stdfix.h
DEPENDS
.llvm-libc-macros.stdfix_macros
@@ -179,7 +165,6 @@ file(MAKE_DIRECTORY ${LIBC_INCLUDE_DIR}/arpa)
add_header_macro(
arpa_inet
../libc/include/arpa/inet.yaml
- arpa/inet.h.def
arpa/inet.h
DEPENDS
.llvm_libc_common_h
@@ -188,7 +173,6 @@ add_header_macro(
add_header_macro(
assert
../libc/include/assert.yaml
- assert.h.def
assert.h
DEPENDS
.llvm_libc_common_h
@@ -198,7 +182,6 @@ add_header_macro(
add_header_macro(
complex
../libc/include/complex.yaml
- complex.h.def
complex.h
DEPENDS
.llvm_libc_common_h
@@ -208,7 +191,6 @@ add_header_macro(
add_header_macro(
setjmp
../libc/include/setjmp.yaml
- setjmp.h.def
setjmp.h
DEPENDS
.llvm_libc_common_h
@@ -218,7 +200,6 @@ add_header_macro(
add_header_macro(
string
../libc/include/string.yaml
- string.h.def
string.h
DEPENDS
.llvm_libc_common_h
@@ -229,7 +210,6 @@ add_header_macro(
add_header_macro(
strings
../libc/include/strings.yaml
- strings.h.def
strings.h
DEPENDS
.llvm_libc_common_h
@@ -239,7 +219,6 @@ add_header_macro(
add_header_macro(
search
../libc/include/search.yaml
- search.h.def
search.h
DEPENDS
.llvm_libc_common_h
@@ -253,7 +232,6 @@ add_header_macro(
add_header_macro(
time
../libc/include/time.yaml
- time.h.def
time.h
DEPENDS
.llvm_libc_common_h
@@ -269,7 +247,6 @@ add_header_macro(
add_header_macro(
threads
../libc/include/threads.yaml
- threads.h.def
threads.h
DEPENDS
.llvm_libc_common_h
@@ -286,7 +263,6 @@ add_header_macro(
add_header_macro(
errno
../libc/include/errno.yaml
- errno.h.def
errno.h
DEPENDS
.llvm-libc-macros.generic_error_number_macros
@@ -296,7 +272,6 @@ add_header_macro(
add_header_macro(
signal
../libc/include/signal.yaml
- signal.h.def
signal.h
DEPENDS
.llvm-libc-macros.signal_macros
@@ -312,7 +287,6 @@ add_header_macro(
add_header_macro(
stdbit
../libc/include/stdbit.yaml
- stdbit.h.def
stdbit.h
DEPENDS
.llvm_libc_common_h
@@ -322,7 +296,6 @@ add_header_macro(
add_header_macro(
stdckdint
../libc/include/stdckdint.yaml
- stdckdint.h.def
stdckdint.h
DEPENDS
.llvm_libc_common_h
@@ -332,7 +305,6 @@ add_header_macro(
add_header_macro(
stdio
../libc/include/stdio.yaml
- stdio.h.def
stdio.h
DEPENDS
.llvm-libc-macros.file_seek_macros
@@ -348,7 +320,6 @@ add_header_macro(
add_header_macro(
stdlib
../libc/include/stdlib.yaml
- stdlib.h.def
stdlib.h
DEPENDS
.llvm_libc_common_h
@@ -367,7 +338,6 @@ add_header_macro(
add_header_macro(
unistd
../libc/include/unistd.yaml
- unistd.h.def
unistd.h
DEPENDS
.llvm_libc_common_h
@@ -386,7 +356,6 @@ add_header_macro(
add_header_macro(
pthread
../libc/include/pthread.yaml
- pthread.h.def
pthread.h
DEPENDS
.llvm-libc-macros.pthread_macros
@@ -410,7 +379,6 @@ add_header_macro(
add_header_macro(
sched
../libc/include/sched.yaml
- sched.h.def
sched.h
DEPENDS
.llvm_libc_common_h
@@ -427,7 +395,6 @@ add_header_macro(
add_header_macro(
spawn
../libc/include/spawn.yaml
- spawn.h.def
spawn.h
DEPENDS
.llvm_libc_common_h
@@ -440,7 +407,6 @@ add_header_macro(
add_header_macro(
link
../libc/include/link.yaml
- link.h.def
link.h
DEPENDS
.llvm_libc_common_h
@@ -450,7 +416,6 @@ add_header_macro(
add_header_macro(
elf
../libc/include/elf.yaml
- elf.h.def
elf.h
DEPENDS
.llvm-libc-macros.elf_macros
@@ -464,7 +429,6 @@ file(MAKE_DIRECTORY ${LIBC_INCLUDE_DIR}/sys)
add_header_macro(
sys_auxv
../libc/include/sys/auxv.yaml
- sys/auxv.h.def
sys/auxv.h
DEPENDS
.llvm_libc_common_h
@@ -474,7 +438,6 @@ add_header_macro(
add_header_macro(
sys_epoll
../libc/include/sys/epoll.yaml
- sys/epoll.h.def
sys/epoll.h
DEPENDS
.llvm_libc_common_h
@@ -487,7 +450,6 @@ add_header_macro(
add_header_macro(
sys_ioctl
../libc/include/sys/ioctl.yaml
- sys/ioctl.h.def
sys/ioctl.h
DEPENDS
.llvm_libc_common_h
@@ -497,7 +459,6 @@ add_header_macro(
add_header_macro(
sys_mman
../libc/include/sys/mman.yaml
- sys/mman.h.def
sys/mman.h
DEPENDS
.llvm_libc_common_h
@@ -510,7 +471,6 @@ add_header_macro(
add_header_macro(
sys_prctl
../libc/include/sys/prctl.yaml
- sys/prctl.h.def
sys/prctl.h
DEPENDS
.llvm_libc_common_h
@@ -527,7 +487,6 @@ add_header(
add_header_macro(
sys_random
../libc/include/sys/random.yaml
- sys/random.h.def
sys/random.h
DEPENDS
.llvm_libc_common_h
@@ -539,7 +498,6 @@ add_header_macro(
add_header_macro(
sys_resource
../libc/include/sys/resource.yaml
- sys/resource.h.def
sys/resource.h
DEPENDS
.llvm_libc_common_h
@@ -551,7 +509,6 @@ add_header_macro(
add_header_macro(
sys_stat
../libc/include/sys/stat.yaml
- sys/stat.h.def
sys/stat.h
DEPENDS
.llvm_libc_common_h
@@ -573,7 +530,6 @@ add_header_macro(
add_header_macro(
sys_select
../libc/include/sys/select.yaml
- sys/select.h.def
sys/select.h
DEPENDS
.llvm_libc_common_h
@@ -589,7 +545,6 @@ add_header_macro(
add_header_macro(
sys_sendfile
../libc/include/sys/sendfile.yaml
- sys/sendfile.h.def
sys/sendfile.h
DEPENDS
.llvm_libc_common_h
@@ -601,7 +556,6 @@ add_header_macro(
add_header_macro(
sys_socket
../libc/include/sys/socket.yaml
- sys/socket.h.def
sys/socket.h
DEPENDS
.llvm_libc_common_h
@@ -617,7 +571,6 @@ add_header_macro(
add_header_macro(
sys_statvfs
../libc/include/sys/statvfs.yaml
- sys/statvfs.h.def
sys/statvfs.h
DEPENDS
.llvm_libc_common_h
@@ -627,7 +580,6 @@ add_header_macro(
add_header_macro(
sys_syscall
../libc/include/sys/syscall.yaml
- sys/syscall.h.def
sys/syscall.h
DEPENDS
)
@@ -635,7 +587,6 @@ add_header_macro(
add_header_macro(
sys_time
../libc/include/sys/time.yaml
- sys/time.h.def
sys/time.h
DEPENDS
.llvm_libc_common_h
@@ -646,7 +597,6 @@ add_header_macro(
add_header_macro(
sys_types
../libc/include/sys/types.yaml
- sys/types.h.def
sys/types.h
DEPENDS
.llvm_libc_common_h
@@ -676,7 +626,6 @@ add_header_macro(
add_header_macro(
sys_utsname
../libc/include/sys/utsname.yaml
- sys/utsname.h.def
sys/utsname.h
DEPENDS
.llvm_libc_common_h
@@ -686,7 +635,6 @@ add_header_macro(
add_header_macro(
sys_wait
../libc/include/sys/wait.yaml
- sys/wait.h.def
sys/wait.h
DEPENDS
.llvm_libc_common_h
@@ -699,7 +647,6 @@ add_header_macro(
add_header_macro(
termios
../libc/include/termios.yaml
- termios.h.def
termios.h
DEPENDS
.llvm_libc_common_h
@@ -714,7 +661,6 @@ add_header_macro(
add_header_macro(
uchar
../libc/include/uchar.yaml
- uchar.h.def
uchar.h
DEPENDS
.llvm_libc_common_h
@@ -727,7 +673,6 @@ add_header_macro(
add_header_macro(
wchar
../libc/include/wchar.yaml
- wchar.h.def
wchar.h
DEPENDS
.llvm_libc_common_h
@@ -741,7 +686,6 @@ add_header_macro(
add_header_macro(
locale
../libc/include/locale.yaml
- locale.h.def
locale.h
DEPENDS
.llvm_libc_common_h
diff --git a/libc/include/arpa/inet.yaml b/libc/include/arpa/inet.yaml
index cb366e0f5d6941..10cd56d6ce786f 100644
--- a/libc/include/arpa/inet.yaml
+++ b/libc/include/arpa/inet.yaml
@@ -1,4 +1,5 @@
-header: arpa-inet.h
+header: arpa/inet.h
+header_template: inet.h.def
macros: []
types: []
enums: []
diff --git a/libc/include/assert.yaml b/libc/include/assert.yaml
index f740554488ed5e..1a3bdeda7e5420 100644
--- a/libc/include/assert.yaml
+++ b/libc/include/assert.yaml
@@ -1,4 +1,5 @@
header: assert.h
+header_template: assert.h.def
macros: []
types: []
enums: []
diff --git a/libc/include/complex.yaml b/libc/include/complex.yaml
index cd81de7dd9e204..05318480a02f14 100644
--- a/libc/include/complex.yaml
+++ b/libc/include/complex.yaml
@@ -1,4 +1,5 @@
header: complex.h
+header_template: complex.h.def
macros: []
types:
- type_name: cfloat16
diff --git a/libc/include/ctype.yaml b/libc/include/ctype.yaml
index b4823c3e53234a..6238f1b889986e 100644
--- a/libc/include/ctype.yaml
+++ b/libc/include/ctype.yaml
@@ -1,4 +1,5 @@
header: ctype.h
+header_template: ctype.h.def
macros: []
types:
- type_name: locale_t
diff --git a/libc/include/dirent.yaml b/libc/include/dirent.yaml
index cdccf6a0c7f293..3fc522fda80e4a 100644
--- a/libc/include/dirent.yaml
+++ b/libc/include/dirent.yaml
@@ -1,4 +1,5 @@
header: dirent.h
+header_template: dirent.h.def
macros: []
types:
- type_name: struct_dirent
diff --git a/libc/include/dlfcn.yaml b/libc/include/dlfcn.yaml
index 725ee705714a75..9e8803cb5fa785 100644
--- a/libc/include/dlfcn.yaml
+++ b/libc/include/dlfcn.yaml
@@ -1,4 +1,5 @@
header: dlfcn.h
+header_template: dlfcn.h.def
macros:
- macro_name: RTLD_LAZY
macro_value: null
diff --git a/libc/include/elf.yaml b/libc/include/elf.yaml
index 2e9db329e22979..f78ae82c778505 100644
--- a/libc/include/elf.yaml
+++ b/libc/include/elf.yaml
@@ -1,4 +1,5 @@
header: elf.h
+header_template: elf.h.def
standards:
- Linux
macros: []
diff --git a/libc/include/errno.yaml b/libc/include/errno.yaml
index a894063a1ee2c4..188a9fa1211a16 100644
--- a/libc/include/errno.yaml
+++ b/libc/include/errno.yaml
@@ -1,4 +1,5 @@
header: errno.h
+header_template: errno.h.def
standards:
- stdc
- Linux
diff --git a/libc/include/fcntl.yaml b/libc/include/fcntl.yaml
index 71c0df3b0fadaa..78f93533b84d3e 100644
--- a/libc/include/fcntl.yaml
+++ b/libc/include/fcntl.yaml
@@ -1,4 +1,5 @@
header: fcntl.h
+header_template: fcntl.h.def
macros: []
types:
- type_name: off_t
diff --git a/libc/include/features.yaml b/libc/include/features.yaml
index a18af22edb7436..726320a40881dc 100644
--- a/libc/include/features.yaml
+++ b/libc/include/features.yaml
@@ -1,4 +1,5 @@
header: features.h
+header_template: features.h.def
standards:
- stdc
macros: []
diff --git a/libc/include/fenv.yaml b/libc/include/fenv.yaml
index 1010efc6402c1b..1ecaf630855045 100644
--- a/libc/include/fenv.yaml
+++ b/libc/include/fenv.yaml
@@ -1,4 +1,5 @@
header: fenv.h
+header_template: fenv.h.def
macros: []
types:
- type_name: fenv_t
diff --git a/libc/include/float.yaml b/libc/include/float.yaml
index 63639a6e8ed131..21df6513e77e4e 100644
--- a/libc/include/float.yaml
+++ b/libc/include/float.yaml
@@ -1,4 +1,5 @@
header: float.h
+header_template: float.h.def
standards:
- stdc
macros: []
diff --git a/libc/include/inttypes.yaml b/libc/include/inttypes.yaml
index ad636cc5121a11..d5dec5b465ba45 100644
--- a/libc/include/inttypes.yaml
+++ b/libc/include/inttypes.yaml
@@ -1,4 +1,5 @@
header: inttypes.h
+header_template: inttypes.h.def
macros: []
types:
- type_name: imaxdiv_t
diff --git a/libc/include/limits.yaml b/libc/include/limits.yaml
index bf33ed24e7a8d7..b664041bb56c29 100644
--- a/libc/include/limits.yaml
+++ b/libc/include/limits.yaml
@@ -1,4 +1,5 @@
header: limits.h
+header_template: limits.h.def
standards:
- stdc
macros: []
diff --git a/libc/include/link.yaml b/libc/include/link.yaml
index d1963a86813af3..1cd609e292b534 100644
--- a/libc/include/link.yaml
+++ b/libc/include/link.yaml
@@ -1,4 +1,5 @@
header: link.h
+header_template: link.h.def
standards:
- Linux
macros: []
diff --git a/libc/include/locale.yaml b/libc/include/locale.yaml
index 7da7966ea730f6..9ff53c16398a59 100644
--- a/libc/include/locale.yaml
+++ b/libc/include/locale.yaml
@@ -1,4 +1,5 @@
header: locale.h
+header_template: locale.h.def
functions:
- name: localeconv
standards:
diff --git a/libc/include/malloc.yaml b/libc/include/malloc.yaml
index 8db4f3aebb9b31..ec73c9090f729a 100644
--- a/libc/include/malloc.yaml
+++ b/libc/include/malloc.yaml
@@ -1,4 +1,5 @@
header: malloc.h
+header_template: malloc.h.def
macros: []
types: []
enums: []
diff --git a/libc/include/math.yaml b/libc/include/math.yaml
index 3b8caec66bbfd2..831d0457456774 100644
--- a/libc/include/math.yaml
+++ b/libc/include/math.yaml
@@ -1,4 +1,5 @@
header: math.h
+header_template: math.h.def
macros: []
types:
- type_name: float_t
diff --git a/libc/include/pthread.yaml b/libc/include/pthread.yaml
index b9068c3f176575..4f386bdd11cfd7 100644
--- a/libc/include/pthread.yaml
+++ b/libc/include/pthread.yaml
@@ -1,4 +1,5 @@
header: pthread.h
+header_template: pthread.h.def
macros: []
types:
- type_name: pthread_t
diff --git a/libc/include/sched.yaml b/libc/include/sched.yaml
index 2d4876b722ab21..57871f524bf115 100644
--- a/libc/include/sched.yaml
+++ b/libc/include/sched.yaml
@@ -1,4 +1,5 @@
header: sched.h
+header_template: sched.h.def
macros: []
types:
- type_name: struct_timespec
diff --git a/libc/include/search.yaml b/libc/include/search.yaml
index a0c73bc679d819..b7ce06d48e7042 100644
--- a/libc/include/search.yaml
+++ b/libc/include/search.yaml
@@ -1,4 +1,5 @@
header: search.h
+header_template: search.h.def
macros: []
types:
- type_name: struct_hsearch_data
diff --git a/libc/include/setjmp.yaml b/libc/include/setjmp.yaml
index 68e3ff046e4b8f..2c4f7fb6dfcc70 100644
--- a/libc/include/setjmp.yaml
+++ b/libc/include/setjmp.yaml
@@ -1,4 +1,5 @@
header: setjmp.h
+header_template: setjmp.h.def
macros: []
types:
- type_name: jmp_buf
diff --git a/libc/include/signal.yaml b/libc/include/signal.yaml
index c66abb1a874418..576e77576ac740 100644
--- a/libc/include/signal.yaml
+++ b/libc/include/signal.yaml
@@ -1,4 +1,5 @@
header: signal.h
+header_template: signal.h.def
macros: []
types:
- type_name: pid_t
diff --git a/libc/include/spawn.yaml b/libc/include/spawn.yaml
index be3f4e99d27fcd..e725ab9719eda4 100644
--- a/libc/include/spawn.yaml
+++ b/libc/include/spawn.yaml
@@ -1,4 +1,5 @@
header: spawn.h
+header_template: spawn.h.def
macros: []
types:
- type_name: posix_spawn_file_actions_t
diff --git a/libc/include/stdbit.yaml b/libc/include/stdbit.yaml
index 25d2d326c30eb9..e9bd6b3918e782 100644
--- a/libc/include/stdbit.yaml
+++ b/libc/include/stdbit.yaml
@@ -1,4 +1,5 @@
header: stdbit.h
+header_template: stdbit.h.def
macros: []
types: []
enums: []
diff --git a/libc/include/stdckdint.yaml b/libc/include/stdckdint.yaml
index ea8fc47625b038..e8b2e80ee029fe 100644
--- a/libc/include/stdckdint.yaml
+++ b/libc/include/stdckdint.yaml
@@ -1,4 +1,5 @@
header: stdckdint.h
+header_template: stdckdint.h.def
standards:
- stdc
macros: []
diff --git a/libc/include/stdfix.yaml b/libc/include/stdfix.yaml
index 9787eaba45e4ed..7b3bdba082dd5c 100644
--- a/libc/include/stdfix.yaml
+++ b/libc/include/stdfix.yaml
@@ -1,4 +1...
[truncated]
|
I was rather confused about canonical practice for cmake custom actions and depfiles wrt working directory, absolute vs relative paths, etc. I got it coming out right in Ninja, but perhaps @petrhosek can advise on the best way to do the cmake bits here. |
This adds a new main command-line entry point for hdrgen, in the
new main.py. This new interface is used for generating a header.
The old ways of invoking yaml_to_classes.py for other purposes
are left there for now, but
--e
is renamed to--entry-point
for consistency with the new CLI.
The YAML schema is expanded with the
header_template
key wherethe corresponding
.h.def
file's path is given relative to wherethe YAML file is found. The build integration no longer gives
the
.h.def
path on the command line. Instead, the script nowemits a depfile that's used by the cmake rules to track that.
The output file is always explicit in the script command line
rather than sometimes being derived from a directory path.