[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 15:26:28 PDT 2024
https://github.com/RoseZhang03 updated https://github.com/llvm/llvm-project/pull/98693
>From dc535652cfd6963679a13a3e0b646421f995ba34 Mon Sep 17 00:00:00 2001
From: Rose Zhang <rosezhang at google.com>
Date: Fri, 12 Jul 2024 20:42:44 +0000
Subject: [PATCH 1/3] [libc] newheadergen: created sys folder for yaml files,
make appropriate updates to CMake file for sys folder
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.
---
libc/newhdrgen/yaml/{ => sys}/sys_auxv.yaml | 2 --
libc/newhdrgen/yaml/{ => sys}/sys_epoll.yaml | 0
libc/newhdrgen/yaml/{ => sys}/sys_ioctl.yaml | 0
libc/newhdrgen/yaml/{ => sys}/sys_mman.yaml | 0
libc/newhdrgen/yaml/{ => sys}/sys_prctl.yaml | 0
libc/newhdrgen/yaml/{ => sys}/sys_random.yaml | 0
libc/newhdrgen/yaml/{ => sys}/sys_resource.yaml | 0
libc/newhdrgen/yaml/{ => sys}/sys_select.yaml | 0
libc/newhdrgen/yaml/{ => sys}/sys_sendfile.yaml | 0
libc/newhdrgen/yaml/{ => sys}/sys_socket.yaml | 0
libc/newhdrgen/yaml/{ => sys}/sys_stat.yaml | 0
libc/newhdrgen/yaml/{ => sys}/sys_statvfs.yaml | 0
libc/newhdrgen/yaml/{ => sys}/sys_syscall.yaml | 0
libc/newhdrgen/yaml/{ => sys}/sys_time.yaml | 0
libc/newhdrgen/yaml/{ => sys}/sys_types.yaml | 0
libc/newhdrgen/yaml/{ => sys}/sys_utsname.yaml | 0
libc/newhdrgen/yaml/{ => sys}/sys_wait.yaml | 0
libc/newhdrgen/yaml_to_classes.py | 7 +++++++
18 files changed, 7 insertions(+), 2 deletions(-)
rename libc/newhdrgen/yaml/{ => sys}/sys_auxv.yaml (87%)
rename libc/newhdrgen/yaml/{ => sys}/sys_epoll.yaml (100%)
rename libc/newhdrgen/yaml/{ => sys}/sys_ioctl.yaml (100%)
rename libc/newhdrgen/yaml/{ => sys}/sys_mman.yaml (100%)
rename libc/newhdrgen/yaml/{ => sys}/sys_prctl.yaml (100%)
rename libc/newhdrgen/yaml/{ => sys}/sys_random.yaml (100%)
rename libc/newhdrgen/yaml/{ => sys}/sys_resource.yaml (100%)
rename libc/newhdrgen/yaml/{ => sys}/sys_select.yaml (100%)
rename libc/newhdrgen/yaml/{ => sys}/sys_sendfile.yaml (100%)
rename libc/newhdrgen/yaml/{ => sys}/sys_socket.yaml (100%)
rename libc/newhdrgen/yaml/{ => sys}/sys_stat.yaml (100%)
rename libc/newhdrgen/yaml/{ => sys}/sys_statvfs.yaml (100%)
rename libc/newhdrgen/yaml/{ => sys}/sys_syscall.yaml (100%)
rename libc/newhdrgen/yaml/{ => sys}/sys_time.yaml (100%)
rename libc/newhdrgen/yaml/{ => sys}/sys_types.yaml (100%)
rename libc/newhdrgen/yaml/{ => sys}/sys_utsname.yaml (100%)
rename libc/newhdrgen/yaml/{ => sys}/sys_wait.yaml (100%)
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)
>From bf4d973896b0f881e025aedfb9d583714cf3b80e Mon Sep 17 00:00:00 2001
From: Rose Zhang <rosezhang at google.com>
Date: Fri, 12 Jul 2024 20:47:30 +0000
Subject: [PATCH 2/3] added comment
---
libc/newhdrgen/yaml_to_classes.py | 2 ++
1 file changed, 2 insertions(+)
diff --git a/libc/newhdrgen/yaml_to_classes.py b/libc/newhdrgen/yaml_to_classes.py
index 4a5c4a0cd82eb..e4ef44aa732a0 100644
--- a/libc/newhdrgen/yaml_to_classes.py
+++ b/libc/newhdrgen/yaml_to_classes.py
@@ -238,6 +238,8 @@ def main(yaml_file, h_def_file, output_dir, add_function=None):
# 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
+ # or maybe:
+ # output_file_path = Path(other_output_dir) / output_file_name
with open(output_file_path, "w") as f:
f.write(final_header_content)
>From 9026b83d61cd5794b2f021b689d1e028fa05a748 Mon Sep 17 00:00:00 2001
From: Rose Zhang <rosezhang at google.com>
Date: Fri, 12 Jul 2024 22:26:11 +0000
Subject: [PATCH 3/3] deleted comments, will fix header file generation
filepath in next patch
---
libc/newhdrgen/yaml_to_classes.py | 9 ---------
1 file changed, 9 deletions(-)
diff --git a/libc/newhdrgen/yaml_to_classes.py b/libc/newhdrgen/yaml_to_classes.py
index e4ef44aa732a0..6bccda8e03640 100644
--- a/libc/newhdrgen/yaml_to_classes.py
+++ b/libc/newhdrgen/yaml_to_classes.py
@@ -232,15 +232,6 @@ 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
- # or maybe:
- # output_file_path = Path(other_output_dir) / output_file_name
-
with open(output_file_path, "w") as f:
f.write(final_header_content)
More information about the libc-commits
mailing list