[libc-commits] [libc] [libc] newheadergen: created sys folder for yaml files, make appropriate updates to CMake file for sys folder (PR #98693)

via libc-commits libc-commits at lists.llvm.org
Fri Jul 12 13:46:20 PDT 2024


llvmbot wrote:


<!--LLVM PR SUMMARY COMMENT-->

@llvm/pr-subscribers-libc

Author: None (RoseZhang03)

<details>
<summary>Changes</summary>

Moved sys yaml files into the sys folder.
After CMake patch lands, will make appropriate changes to account for
yaml, header, and .h.def files that are located within the sys folder.


---
Full diff: https://github.com/llvm/llvm-project/pull/98693.diff


18 Files Affected:

- (renamed) libc/newhdrgen/yaml/sys/sys_auxv.yaml (-2) 
- (renamed) libc/newhdrgen/yaml/sys/sys_epoll.yaml () 
- (renamed) libc/newhdrgen/yaml/sys/sys_ioctl.yaml () 
- (renamed) libc/newhdrgen/yaml/sys/sys_mman.yaml () 
- (renamed) libc/newhdrgen/yaml/sys/sys_prctl.yaml () 
- (renamed) libc/newhdrgen/yaml/sys/sys_random.yaml () 
- (renamed) libc/newhdrgen/yaml/sys/sys_resource.yaml () 
- (renamed) libc/newhdrgen/yaml/sys/sys_select.yaml () 
- (renamed) libc/newhdrgen/yaml/sys/sys_sendfile.yaml () 
- (renamed) libc/newhdrgen/yaml/sys/sys_socket.yaml () 
- (renamed) libc/newhdrgen/yaml/sys/sys_stat.yaml () 
- (renamed) libc/newhdrgen/yaml/sys/sys_statvfs.yaml () 
- (renamed) libc/newhdrgen/yaml/sys/sys_syscall.yaml () 
- (renamed) libc/newhdrgen/yaml/sys/sys_time.yaml () 
- (renamed) libc/newhdrgen/yaml/sys/sys_types.yaml () 
- (renamed) libc/newhdrgen/yaml/sys/sys_utsname.yaml () 
- (renamed) libc/newhdrgen/yaml/sys/sys_wait.yaml () 
- (modified) libc/newhdrgen/yaml_to_classes.py (+7) 


``````````diff
diff --git a/libc/newhdrgen/yaml/sys_auxv.yaml b/libc/newhdrgen/yaml/sys/sys_auxv.yaml
similarity index 87%
rename from libc/newhdrgen/yaml/sys_auxv.yaml
rename to libc/newhdrgen/yaml/sys/sys_auxv.yaml
index bbf756a1ffe6a..072f63b36865c 100644
--- a/libc/newhdrgen/yaml/sys_auxv.yaml
+++ b/libc/newhdrgen/yaml/sys/sys_auxv.yaml
@@ -1,6 +1,4 @@
 header: sys-auxv.h
-standards: 
-  - GNUExtensions
 macros: []
 types: []
 enums: []
diff --git a/libc/newhdrgen/yaml/sys_epoll.yaml b/libc/newhdrgen/yaml/sys/sys_epoll.yaml
similarity index 100%
rename from libc/newhdrgen/yaml/sys_epoll.yaml
rename to libc/newhdrgen/yaml/sys/sys_epoll.yaml
diff --git a/libc/newhdrgen/yaml/sys_ioctl.yaml b/libc/newhdrgen/yaml/sys/sys_ioctl.yaml
similarity index 100%
rename from libc/newhdrgen/yaml/sys_ioctl.yaml
rename to libc/newhdrgen/yaml/sys/sys_ioctl.yaml
diff --git a/libc/newhdrgen/yaml/sys_mman.yaml b/libc/newhdrgen/yaml/sys/sys_mman.yaml
similarity index 100%
rename from libc/newhdrgen/yaml/sys_mman.yaml
rename to libc/newhdrgen/yaml/sys/sys_mman.yaml
diff --git a/libc/newhdrgen/yaml/sys_prctl.yaml b/libc/newhdrgen/yaml/sys/sys_prctl.yaml
similarity index 100%
rename from libc/newhdrgen/yaml/sys_prctl.yaml
rename to libc/newhdrgen/yaml/sys/sys_prctl.yaml
diff --git a/libc/newhdrgen/yaml/sys_random.yaml b/libc/newhdrgen/yaml/sys/sys_random.yaml
similarity index 100%
rename from libc/newhdrgen/yaml/sys_random.yaml
rename to libc/newhdrgen/yaml/sys/sys_random.yaml
diff --git a/libc/newhdrgen/yaml/sys_resource.yaml b/libc/newhdrgen/yaml/sys/sys_resource.yaml
similarity index 100%
rename from libc/newhdrgen/yaml/sys_resource.yaml
rename to libc/newhdrgen/yaml/sys/sys_resource.yaml
diff --git a/libc/newhdrgen/yaml/sys_select.yaml b/libc/newhdrgen/yaml/sys/sys_select.yaml
similarity index 100%
rename from libc/newhdrgen/yaml/sys_select.yaml
rename to libc/newhdrgen/yaml/sys/sys_select.yaml
diff --git a/libc/newhdrgen/yaml/sys_sendfile.yaml b/libc/newhdrgen/yaml/sys/sys_sendfile.yaml
similarity index 100%
rename from libc/newhdrgen/yaml/sys_sendfile.yaml
rename to libc/newhdrgen/yaml/sys/sys_sendfile.yaml
diff --git a/libc/newhdrgen/yaml/sys_socket.yaml b/libc/newhdrgen/yaml/sys/sys_socket.yaml
similarity index 100%
rename from libc/newhdrgen/yaml/sys_socket.yaml
rename to libc/newhdrgen/yaml/sys/sys_socket.yaml
diff --git a/libc/newhdrgen/yaml/sys_stat.yaml b/libc/newhdrgen/yaml/sys/sys_stat.yaml
similarity index 100%
rename from libc/newhdrgen/yaml/sys_stat.yaml
rename to libc/newhdrgen/yaml/sys/sys_stat.yaml
diff --git a/libc/newhdrgen/yaml/sys_statvfs.yaml b/libc/newhdrgen/yaml/sys/sys_statvfs.yaml
similarity index 100%
rename from libc/newhdrgen/yaml/sys_statvfs.yaml
rename to libc/newhdrgen/yaml/sys/sys_statvfs.yaml
diff --git a/libc/newhdrgen/yaml/sys_syscall.yaml b/libc/newhdrgen/yaml/sys/sys_syscall.yaml
similarity index 100%
rename from libc/newhdrgen/yaml/sys_syscall.yaml
rename to libc/newhdrgen/yaml/sys/sys_syscall.yaml
diff --git a/libc/newhdrgen/yaml/sys_time.yaml b/libc/newhdrgen/yaml/sys/sys_time.yaml
similarity index 100%
rename from libc/newhdrgen/yaml/sys_time.yaml
rename to libc/newhdrgen/yaml/sys/sys_time.yaml
diff --git a/libc/newhdrgen/yaml/sys_types.yaml b/libc/newhdrgen/yaml/sys/sys_types.yaml
similarity index 100%
rename from libc/newhdrgen/yaml/sys_types.yaml
rename to libc/newhdrgen/yaml/sys/sys_types.yaml
diff --git a/libc/newhdrgen/yaml/sys_utsname.yaml b/libc/newhdrgen/yaml/sys/sys_utsname.yaml
similarity index 100%
rename from libc/newhdrgen/yaml/sys_utsname.yaml
rename to libc/newhdrgen/yaml/sys/sys_utsname.yaml
diff --git a/libc/newhdrgen/yaml/sys_wait.yaml b/libc/newhdrgen/yaml/sys/sys_wait.yaml
similarity index 100%
rename from libc/newhdrgen/yaml/sys_wait.yaml
rename to libc/newhdrgen/yaml/sys/sys_wait.yaml
diff --git a/libc/newhdrgen/yaml_to_classes.py b/libc/newhdrgen/yaml_to_classes.py
index 6bccda8e03640..4a5c4a0cd82eb 100644
--- a/libc/newhdrgen/yaml_to_classes.py
+++ b/libc/newhdrgen/yaml_to_classes.py
@@ -232,6 +232,13 @@ def main(yaml_file, h_def_file, output_dir, add_function=None):
     output_file_name = Path(h_def_file).stem
     output_file_path = Path(output_dir) / output_file_name
 
+    # with open(yaml_file, "r") as f:
+    #     yaml_data = yaml.safe_load(f)
+
+    # header_name = yaml_data[header]
+    # if len(header_name) >= 6 and header_name[0:4] == "sys-":
+    #     output_file_path = Path(output_dir) / sys / output_file_name
+
     with open(output_file_path, "w") as f:
         f.write(final_header_content)
 

``````````

</details>


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


More information about the libc-commits mailing list