Skip to content
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

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

Merged
merged 3 commits into from
Jul 12, 2024

Conversation

RoseZhang03
Copy link
Contributor

@RoseZhang03 RoseZhang03 commented Jul 12, 2024

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 in a separate patch.

…ate 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.
@llvmbot
Copy link
Collaborator

llvmbot commented Jul 12, 2024

@llvm/pr-subscribers-libc

Author: None (RoseZhang03)

Changes

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 --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)
 

@@ -232,6 +232,15 @@ 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:
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

did you mean to leave this in?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Just as a placeholder for now while I wait for the CMake to come out. I'm not sure if I can manually add sys to the file path here or if I will have to make an alternate path in the CMake file.

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

in that case I'd say it's probably best to leave this out of this patch. Commented out code is often confusing when reading a file

Copy link
Contributor

@michaelrj-google michaelrj-google left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM, feel free to land after addressing comments

@@ -232,6 +232,15 @@ 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:
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

in that case I'd say it's probably best to leave this out of this patch. Commented out code is often confusing when reading a file

@RoseZhang03 RoseZhang03 merged commit 0870afa into llvm:main Jul 12, 2024
4 of 5 checks passed
@RoseZhang03 RoseZhang03 deleted the rosezhang12 branch July 12, 2024 22:34
aaryanshukla pushed a commit to aaryanshukla/llvm-project that referenced this pull request Jul 14, 2024
…ate updates to CMake file for sys folder (llvm#98693)

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 in
a separate patch.
aaryanshukla pushed a commit to aaryanshukla/llvm-project that referenced this pull request Jul 16, 2024
…ate updates to CMake file for sys folder (llvm#98693)

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 in
a separate patch.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants