[libc-commits] [libc] rosezhang13 (PR #98983)

via libc-commits libc-commits at lists.llvm.org
Mon Jul 15 19:36:34 PDT 2024


llvmbot wrote:


<!--LLVM PR SUMMARY COMMENT-->

@llvm/pr-subscribers-libc

Author: None (RoseZhang03)

<details>
<summary>Changes</summary>

- **[libc] newheadergen: configured cmake**
- **added sys path for prctl**
- **added newline for CMakeLists.txt**
- **spacing and nits**
- **added switch for using old versus new headergen in CMakeLists**
- **added option and changed name to start with LIBC_**
- **[libc] final edits to newheadergen yaml files**


---

Patch is 49.55 KiB, truncated to 20.00 KiB below, full version: https://github.com/llvm/llvm-project/pull/98983.diff


4 Files Affected:

- (modified) libc/CMakeLists.txt (+1) 
- (modified) libc/cmake/modules/LLVMLibCHeaderRules.cmake (+111-12) 
- (modified) libc/include/CMakeLists.txt (+1238-564) 
- (modified) libc/newhdrgen/yaml/sys/sys_time.yaml (+1-2) 


``````````diff
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/cmake/modules/LLVMLibCHeaderRules.cmake b/libc/cmake/modules/LLVMLibCHeaderRules.cmake
index 7fc6860f23eb2..b87137c5f1a0d 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()
+  
+  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>
@@ -144,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 2cf7206f3a625..91fd8ce1a1f79 100644
--- a/libc/include/CMakeLists.txt
+++ b/libc/include/CMakeLists.txt
@@ -17,627 +17,1301 @@ add_header(
     __llvm-libc-common.h
 )
 
-add_gen_header(
-  ctype
-  DEF_FILE ctype.h.def
-  GEN_HDR ctype.h
-  DEPENDS
-    .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_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_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_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_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_header(
-  dlfcn
-  DEF_FILE dlfcn.h.def
-  GEN_HDR dlfcn.h
-  DEPENDS
-    .llvm-libc-macros.dlfcn_macros
-    .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_header(
-  features
-  DEF_FILE features.h.def
-  GEN_HDR features.h
-  DEPENDS
-    .llvm_libc_common_h
-    .llvm-libc-macros.features_macros
-)
+  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_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_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_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_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_header(
-  float
-  DEF_FILE float.h.def
-  GEN_HDR float.h
-  DEPENDS
-    .llvm-libc-macros.float_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_header(
-  stdint
-  DEF_FILE stdint.h.def
-  GEN_HDR stdint.h
-  DEPENDS
-    .llvm-libc-macros.stdint_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_header(
-  limits
-  DEF_FILE limits.h.def
-  GEN_HDR limits.h
-  DEPENDS
-    .llvm-libc-macros.limits_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_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_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_header(
-  stdfix
-  DEF_FILE stdfix.h.def
-  GEN_HDR stdfix.h
-  DEPENDS
-    .llvm-libc-macros.stdfix_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
+  )
 
-# 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_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(
-  assert
-  DEF_FILE assert.h.def
-  GEN_HDR assert.h
-  DEPENDS
-    .llvm_libc_common_h
-    .llvm-libc-macros.assert_macros
-)
+  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_header(
-  setjmp
-  DEF_FILE setjmp.h.def
-  GEN_HDR setjmp.h
-  DEPENDS
-    .llvm_libc_common_h
-    .llvm-libc-types.jmp_buf
-)
+  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_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_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_header(
-  strings
-  DEF_FILE strings.h.def
-  GEN_HDR strings.h
-  DEPENDS
-    .llvm_libc_common_h
-    .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_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_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_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_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_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_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_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_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_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_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_header(
-  stdbit
-  DEF_FILE stdbit.h.def
-  GEN_HDR stdbit.h
-  DEPENDS
-    .llvm_libc_common_h
-    .llvm-libc-macros.stdbit_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_header(
-  stdckdint
-  DEF_FILE stdckdint.h.def
-  GEN_HDR stdckdint.h
-  DEPENDS
-    .llvm_libc_common_h
-    .llvm-libc-macros.stdckdint_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_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_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_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_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_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_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_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
- ...
[truncated]

``````````

</details>


https://github.com/llvm/llvm-project/pull/98983


More information about the libc-commits mailing list