Skip to content

[libc] newhdrgen: updated sorting of guarded functions in fuction generation #98241

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

Merged
merged 6 commits into from
Jul 10, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
7 changes: 5 additions & 2 deletions libc/newhdrgen/class_implementation/classes/function.py
Original file line number Diff line number Diff line change
Expand Up @@ -23,9 +23,12 @@ def __init__(
self.attributes = attributes or ""

def __str__(self):
attributes_str = self.attributes
attributes_str = " ".join(self.attributes)
arguments_str = ", ".join(self.arguments)
result = f"{self.return_type} {self.name}({arguments_str}){attributes_str};"
if attributes_str == "":
result = f"{self.return_type} {self.name}({arguments_str}) __NOEXCEPT;"
else:
result = f"{attributes_str} {self.return_type} {self.name}({arguments_str}) __NOEXCEPT;"
if self.guard:
result = f"#ifdef {self.guard}\n{result}\n#endif // {self.guard}"
return result
2 changes: 1 addition & 1 deletion libc/newhdrgen/header.py
Original file line number Diff line number Diff line change
Expand Up @@ -62,6 +62,6 @@ def __str__(self):
content.append("")
for object in self.objects:
content.append(str(object))
content.append("\n__END_C_DECLS")
content.append("__END_C_DECLS")

return "\n".join(content)
39 changes: 39 additions & 0 deletions libc/newhdrgen/yaml/dlfcn.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,39 @@
header: dlfcn.h
macros:
- macro_name: RTLD_LAZY
macro_value: null
- macro_name: RTLD_NOW
macro_value: null
- macro_name: RTLD_GLOBAL
macro_value: null
- macro_name: RTLD_LOCAL
macro_value: null
types: []
enums: []
objects: []
functions:
- name: dlclose
standards:
- POSIX
return_type: int
arguments:
- type: void *
- name: dlerror
standards:
- POSIX
return_type: char *
arguments: []
- name: dlopen
standards:
- POSIX
return_type: void *
arguments:
- type: const char *
- type: int
- name: dlsym
standards:
- POSIX
return_type: void *
arguments:
- type: void *__restrict
- type: const char *__restrict
Loading
Loading