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] reordered Function class parameters and moved yaml files #97329

Merged
merged 5 commits into from
Jul 3, 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
4 changes: 2 additions & 2 deletions libc/newhdrgen/class_implementation/classes/function.py
Original file line number Diff line number Diff line change
Expand Up @@ -11,14 +11,14 @@

class Function:
def __init__(
self, standards, return_type, name, arguments, guard=None, attributes=[]
self, return_type, name, arguments, standards, guard=None, attributes=[]
RoseZhang03 marked this conversation as resolved.
Show resolved Hide resolved
):
self.standards = standards
self.return_type = return_type
self.name = name
self.arguments = [
arg if isinstance(arg, str) else arg["type"] for arg in arguments
]
self.standards = standards
self.guard = guard
self.attributes = attributes or []

Expand Down
File renamed without changes.
File renamed without changes.
Original file line number Diff line number Diff line change
Expand Up @@ -563,6 +563,15 @@ functions:
- type: float
- type: float
- type: float
- name: f16fma
standards:
- stdc
return_type: _Float16
arguments:
- type: double
- type: double
- type: double
guard: LIBC_TYPES_HAS_FLOAT16
- name: f16fmaf
standards:
- stdc
Expand All @@ -572,6 +581,24 @@ functions:
- type: float
- type: float
guard: LIBC_TYPES_HAS_FLOAT16
- name: f16fmal
standards:
- stdc
return_type: _Float16
arguments:
- type: long double
- type: long double
- type: long double
guard: LIBC_TYPES_HAS_FLOAT16
- name: f16fmaf128
standards:
- stdc
return_type: _Float16
arguments:
- type: float128
- type: float128
- type: float128
guard: LIBC_TYPES_HAS_FLOAT16_AND_FLOAT128
- name: fmod
standards:
- stdc
Expand Down Expand Up @@ -913,6 +940,14 @@ functions:
arguments:
- type: long double
- type: int
- name: ldexpf16
standards:
- stdc
return_type: _Float16
arguments:
- type: _Float16
- type: int
guard: LIBC_TYPES_HAS_FLOAT16
- name: ldexpf128
standards:
- stdc
Expand Down Expand Up @@ -1761,6 +1796,14 @@ functions:
return_type: float
arguments:
- type: float
- name: scalblnf16
standards:
- stdc
return_type: _Float16
arguments:
- type: _Float16
- type: long
guard: LIBC_TYPES_HAS_FLOAT16
- name: scalbn
standards:
- stdc
Expand All @@ -1782,6 +1825,13 @@ functions:
arguments:
- type: long double
- type: int
- name: scalbnf16
standards:
- stdc
return_type: _Float16
arguments:
- type: _Float16
- type: int
- name: scalbnf128
standards:
- stdc
Expand Down Expand Up @@ -1875,10 +1925,150 @@ functions:
- type: _Float16 *
- type: _Float16 *
guard: LIBC_TYPES_HAS_FLOAT16
- name: f16sqrtf
- name: getpayloadf16
standards:
- stdc
return_type: _Float16
arguments:
- type: _Float16 *
guard: LIBC_TYPES_HAS_FLOAT16
- name: setpayloadf16
standards:
- stdc
return_type: int
arguments:
- type: _Float16 *
- type: _Float16
guard: LIBC_TYPES_HAS_FLOAT16
- name: setpayloadsigf16
standards:
- stdc
return_type: int
arguments:
- type: _Float16 *
- type: _Float16
guard: LIBC_TYPES_HAS_FLOAT16
- name: f16addf128
standards:
- stdc
return_type: _Float16
arguments:
- type: float128
- type: float128
guard: LIBC_TYPES_HAS_FLOAT16_AND_FLOAT128
- name: f16subf128
standards:
- stdc
return_type: _Float16
arguments:
- type: float128
- type: float128
guard: LIBC_TYPES_HAS_FLOAT16_AND_FLOAT128
- name: f16sqrtf
standards:
- llvm_libc_ext
return_type: _Float16
arguments:
- type: float
guard: LIBC_TYPES_HAS_FLOAT16
- name: f16sqrtf128
standards:
- llvm_libc_ext
return_type: _Float16
arguments:
- type: float128
guard: LIBC_TYPES_HAS_FLOAT16_AND_FLOAT128
- name: f16add
standards:
- llvm_libc_ext
return_type: _Float16
arguments:
- type: double
- type: double
guard: LIBC_TYPES_HAS_FLOAT16
- name: f16addf
standards:
- llvm_libc_ext
return_type: _Float16
arguments:
- type: float
- type: float
guard: LIBC_TYPES_HAS_FLOAT16
- name: f16addl
standards:
- llvm_libc_ext
return_type: _Float16
arguments:
- type: long double
- type: long double
guard: LIBC_TYPES_HAS_FLOAT16
- name: f16sub
standards:
- llvm_libc_ext
return_type: _Float16
arguments:
- type: double
- type: double
guard: LIBC_TYPES_HAS_FLOAT16
- name: f16subf
standards:
- llvm_libc_ext
return_type: _Float16
arguments:
- type: float
- type: float
guard: LIBC_TYPES_HAS_FLOAT16
- name: f16subl
standards:
- llvm_libc_ext
return_type: _Float16
arguments:
- type: long double
- type: long double
guard: LIBC_TYPES_HAS_FLOAT16
- name: f16div
standards:
- llvm_libc_ext
return_type: _Float16
arguments:
- type: double
- type: double
guard: LIBC_TYPES_HAS_FLOAT16
- name: f16divf
standards:
- llvm_libc_ext
return_type: _Float16
arguments:
- type: float
- type: float
guard: LIBC_TYPES_HAS_FLOAT16
- name: f16divf128
standards:
- stdc
return_type: _Float16
arguments:
- type: float128
- type: float128
guard: LIBC_TYPES_HAS_FLOAT16_AND_FLOAT128
- name: f16divl
standards:
- llvm_libc_ext
return_type: _Float16
arguments:
- type: long double
- type: long double
guard: LIBC_TYPES_HAS_FLOAT16
- name: f16sqrt
standards:
- llvm_libc_ext
return_type: _Float16
arguments:
- type: double
guard: LIBC_TYPES_HAS_FLOAT16
- name: f16sqrtl
standards:
- llvm_libc_ext
return_type: _Float16
arguments:
- type: long double
guard: LIBC_TYPES_HAS_FLOAT16
Original file line number Diff line number Diff line change
Expand Up @@ -366,3 +366,51 @@ functions:
arguments:
- type: pthread_key_t
- type: const void *
- name: pthread_rwlock_init
standards: POSIX
return_type: int
arguments:
- type: pthread_rwlock_t *
- type: const pthread_rwlockattr_t *__restrict
- name: pthread_rwlock_tryrdlock
standards: POSIX
return_type: int
arguments:
- type: pthread_rwlock_t *
- name: pthread_rwlock_trywrlock
standards: POSIX
return_type: int
arguments:
- type: pthread_rwlock_t *
- name: pthread_rwlock_timedrdlock
standards: POSIX
return_type: int
arguments:
- type: pthread_rwlock_t *__restrict
- type: const struct timespec *__restrict
- name: pthread_rwlock_timedwrlock
standards: POSIX
return_type: int
arguments:
- type: pthread_rwlock_t *__restrict
- type: const struct timespec *__restrict
- name: pthread_rwlock_rdlock
standards: POSIX
return_type: int
arguments:
- type: pthread_rwlock_t *
- name: pthread_rwlock_wrlock
standards: POSIX
return_type: int
arguments:
- type: pthread_rwlock_t *
- name: pthread_rwlock_unlock
standards: POSIX
return_type: int
arguments:
- type: pthread_rwlock_t *
- name: pthread_rwlock_destroy
standards: POSIX
return_type: int
arguments:
- type: pthread_rwlock_t *
File renamed without changes.
Original file line number Diff line number Diff line change
Expand Up @@ -130,6 +130,13 @@ functions:
return_type: int
arguments:
- type: FILE *
- name: fdopen
standards:
- POSIX
return_type: FILE *
arguments:
- type: int
- type: const char *
- name: clearerr
standards:
- stdc
Expand Down
8 changes: 7 additions & 1 deletion libc/newhdrgen/yaml/sys_auxv.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -5,4 +5,10 @@ macros: []
types: []
enums: []
objects: []
functions: []
functions:
- name: getauxval
standards:
- GNUExtensions
return_type: unsigned long
arguments:
- type: unsigned long
Original file line number Diff line number Diff line change
@@ -1,8 +1,6 @@
#known as sys/mman in POSIX
header: sys-mman.h
standards: POSIX
macros: []
macros: []
types:
- type_name: mode_t
- type_name: size_t
Expand Down
2 changes: 1 addition & 1 deletion libc/newhdrgen/yaml/sys_types.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -26,5 +26,5 @@ types:
- type_name: pthread_key_t
- type_name: pthread_condattr_t
enums: []
functions: []
objects: []
functions: []
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
header: sys-wait.h #sys/wait.h
header: sys-wait.h
macros: []
types:
- type_name: siginfo_t
Expand Down
File renamed without changes.
2 changes: 1 addition & 1 deletion libc/newhdrgen/yaml_to_classes.py
Original file line number Diff line number Diff line change
Expand Up @@ -54,10 +54,10 @@ def yaml_to_classes(yaml_data):
standards = (function_data.get("standards", None),)
header.add_function(
Function(
standards,
function_data["return_type"],
function_data["name"],
arguments,
standards,
guard,
attributes,
)
Expand Down
Loading