[libc-commits] [libc] a004e50 - [libc] corrected yaml files in newhdrgen (#98069)
via libc-commits
libc-commits at lists.llvm.org
Mon Jul 8 15:41:32 PDT 2024
Author: aaryanshukla
Date: 2024-07-08T15:41:25-07:00
New Revision: a004e50b9e6880850b54e672bba9f650ed716910
URL: https://github.com/llvm/llvm-project/commit/a004e50b9e6880850b54e672bba9f650ed716910
DIFF: https://github.com/llvm/llvm-project/commit/a004e50b9e6880850b54e672bba9f650ed716910.diff
LOG: [libc] corrected yaml files in newhdrgen (#98069)
- fixed little issues in yaml issues through testing
- corrected function class in the case there is no attribute
Added:
libc/newhdrgen/yaml/sys_syscall.yaml
Modified:
libc/newhdrgen/class_implementation/classes/function.py
libc/newhdrgen/tests/test_integration.py
libc/newhdrgen/yaml/inttypes.yaml
libc/newhdrgen/yaml/pthread.yaml
libc/newhdrgen/yaml/sched.yaml
libc/newhdrgen/yaml/signal.yaml
libc/newhdrgen/yaml/stdio.yaml
libc/newhdrgen/yaml/stdlib.yaml
libc/newhdrgen/yaml/string.yaml
libc/newhdrgen/yaml/sys_mman.yaml
libc/newhdrgen/yaml/sys_types.yaml
libc/newhdrgen/yaml/termios.yaml
libc/newhdrgen/yaml/threads.yaml
libc/newhdrgen/yaml/time.yaml
libc/newhdrgen/yaml/unistd.yaml
Removed:
################################################################################
diff --git a/libc/newhdrgen/class_implementation/classes/function.py b/libc/newhdrgen/class_implementation/classes/function.py
index f79b53de9ade4..c73fe8db6bb11 100644
--- a/libc/newhdrgen/class_implementation/classes/function.py
+++ b/libc/newhdrgen/class_implementation/classes/function.py
@@ -20,7 +20,7 @@ def __init__(
]
self.standards = standards
self.guard = guard
- self.attributes = attributes or []
+ self.attributes = attributes or ""
def __str__(self):
attributes_str = self.attributes
diff --git a/libc/newhdrgen/tests/test_integration.py b/libc/newhdrgen/tests/test_integration.py
index 228fecc7f41c0..59d8d4204a578 100644
--- a/libc/newhdrgen/tests/test_integration.py
+++ b/libc/newhdrgen/tests/test_integration.py
@@ -23,7 +23,7 @@ def setUp(self):
)
self.maxDiff = None
- # Adjust based on your directory structure such as being in build etc.
+
self.source_dir = Path(__file__).resolve().parent.parent.parent.parent
def run_script(self, yaml_file, h_def_file, output_dir):
diff --git a/libc/newhdrgen/yaml/inttypes.yaml b/libc/newhdrgen/yaml/inttypes.yaml
index 772a1a0e06b21..6e3d1346f6006 100644
--- a/libc/newhdrgen/yaml/inttypes.yaml
+++ b/libc/newhdrgen/yaml/inttypes.yaml
@@ -1,5 +1,5 @@
header: inttypes.h
-macros:
+macros: []
types:
- type_name: imaxdiv_t
enums: []
diff --git a/libc/newhdrgen/yaml/pthread.yaml b/libc/newhdrgen/yaml/pthread.yaml
index 9ffcf454035ff..14a562082d5de 100644
--- a/libc/newhdrgen/yaml/pthread.yaml
+++ b/libc/newhdrgen/yaml/pthread.yaml
@@ -73,23 +73,23 @@ functions:
- POSIX
return_type: int
arguments:
- - type: const pthread_attr_t * __restrict
- - type: size_t * __restrict
+ - type: const pthread_attr_t *__restrict
+ - type: size_t *__restrict
- name: pthread_attr_getstack
standards:
- POSIX
return_type: int
arguments:
- - type: const pthread_attr_t * __restrict
- - type: void * * __restrict
- - type: size_t * __restrict
+ - type: const pthread_attr_t *__restrict
+ - type: void **__restrict
+ - type: size_t *__restrict
- name: pthread_attr_getstacksize
standards:
- POSIX
return_type: int
arguments:
- - type: const pthread_attr_t * __restrict
- - type: size_t * __restrict
+ - type: const pthread_attr_t *__restrict
+ - type: size_t *__restrict
- name: pthread_attr_setdetachstate
standards:
- POSIX
@@ -130,15 +130,15 @@ functions:
- POSIX
return_type: int
arguments:
- - type: const pthread_condattr_t * __restrict
+ - type: const pthread_condattr_t *__restrict
- type: clockid_t * __restrict
- name: pthread_condattr_getpshared
standards:
- POSIX
return_type: int
arguments:
- - type: const pthread_condattr_t * __restrict
- - type: int * __restrict
+ - type: const pthread_condattr_t *__restrict
+ - type: int *__restrict
- name: pthread_condattr_init
standards:
- POSIX
@@ -164,8 +164,8 @@ functions:
- POSIX
return_type: int
arguments:
- - type: pthread_t * __restrict
- - type: const pthread_attr_t * __restrict
+ - type: pthread_t *__restrict
+ - type: const pthread_attr_t *__restrict
- type: __pthread_start_t
- type: void *
- name: pthread_detach
@@ -207,7 +207,7 @@ functions:
return_type: int
arguments:
- type: pthread_t
- - type: void * *
+ - type: void **
- name: pthread_key_create
standards:
- POSIX
@@ -244,8 +244,8 @@ functions:
- POSIX
return_type: int
arguments:
- - type: pthread_mutex_t * __restrict
- - type: const pthread_mutexattr_t * __restrict
+ - type: pthread_mutex_t *__restrict
+ - type: const pthread_mutexattr_t *__restrict
- name: pthread_mutex_lock
standards:
- POSIX
@@ -275,42 +275,42 @@ functions:
- POSIX
return_type: int
arguments:
- - type: const pthread_mutexattr_t * __restrict
- - type: int * __restrict
+ - type: const pthread_mutexattr_t *__restrict
+ - type: int *__restrict
- name: pthread_mutexattr_getrobust
standards:
- POSIX
return_type: int
arguments:
- - type: const pthread_mutexattr_t * __restrict
- - type: int * __restrict
+ - type: const pthread_mutexattr_t *__restrict
+ - type: int *__restrict
- name: pthread_mutexattr_gettype
standards:
- POSIX
return_type: int
arguments:
- - type: const pthread_mutexattr_t * __restrict
- - type: int * __restrict
+ - type: const pthread_mutexattr_t *__restrict
+ - type: int *__restrict
- name: pthread_mutexattr_setpshared
standards:
- POSIX
return_type: int
arguments:
- - type: pthread_mutexattr_t * __restrict
+ - type: pthread_mutexattr_t *__restrict
- type: int
- name: pthread_mutexattr_setrobust
standards:
- POSIX
return_type: int
arguments:
- - type: pthread_mutexattr_t * __restrict
+ - type: pthread_mutexattr_t *__restrict
- type: int
- name: pthread_mutexattr_settype
standards:
- POSIX
return_type: int
arguments:
- - type: pthread_mutexattr_t * __restrict
+ - type: pthread_mutexattr_t *__restrict
- type: int
- name: pthread_once
standards:
diff --git a/libc/newhdrgen/yaml/sched.yaml b/libc/newhdrgen/yaml/sched.yaml
index 11a55b7d993b9..7b164bfeee391 100644
--- a/libc/newhdrgen/yaml/sched.yaml
+++ b/libc/newhdrgen/yaml/sched.yaml
@@ -77,7 +77,8 @@ functions:
standards:
- POSIX
return_type: int
- arguments: []
+ arguments:
+ - type: void
- name: __sched_getcpucount
standards:
- llvm_libc_ext
diff --git a/libc/newhdrgen/yaml/signal.yaml b/libc/newhdrgen/yaml/signal.yaml
index a95273419dbde..980bd5d90c4b6 100644
--- a/libc/newhdrgen/yaml/signal.yaml
+++ b/libc/newhdrgen/yaml/signal.yaml
@@ -1,7 +1,5 @@
header: signal.h
-macros:
- - macro_name: __need_size_t
- macro_value: null
+macros: []
types:
- type_name: pid_t
- type_name: stack_t
@@ -32,15 +30,15 @@ functions:
return_type: int
arguments:
- type: int
- - type: const struct sigaction * __restrict
- - type: struct sigaction * __restrict
+ - type: const struct sigaction *__restrict
+ - type: struct sigaction *__restrict
- name: sigaltstack
standards:
- POSIX
return_type: int
arguments:
- - type: const stack_t * __restrict
- - type: stack_t * __restrict
+ - type: const stack_t *__restrict
+ - type: stack_t *__restrict
- name: sigdelset
standards:
- POSIX
@@ -67,8 +65,8 @@ functions:
return_type: int
arguments:
- type: int
- - type: const sigset_t * __restrict
- - type: sigset_t * __restrict
+ - type: const sigset_t *__restrict
+ - type: sigset_t *__restrict
- name: sigfillset
standards:
- POSIX
diff --git a/libc/newhdrgen/yaml/stdio.yaml b/libc/newhdrgen/yaml/stdio.yaml
index 2fdc772da122c..6d2a8557f9b94 100644
--- a/libc/newhdrgen/yaml/stdio.yaml
+++ b/libc/newhdrgen/yaml/stdio.yaml
@@ -10,6 +10,8 @@ macros:
macro_value: stdout
- macro_name: stdin
macro_value: stdin
+ - macro_name: stderr
+ macro_value: stderr
types:
- type_name: size_t
- type_name: off_t
@@ -42,87 +44,87 @@ functions:
- stdc
return_type: int
arguments:
- - type: char * __restrict
- - type: const char * __restrict
+ - type: char *__restrict
+ - type: const char *__restrict
- type: ...
- name: snprintf
standards:
- stdc
return_type: int
arguments:
- - type: char * __restrict
+ - type: char *__restrict
- type: size_t
- - type: const char * __restrict
+ - type: const char *__restrict
- type: ...
- name: fprintf
standards:
- stdc
return_type: int
arguments:
- - type: FILE * __restrict
- - type: const char * __restrict
+ - type: FILE *__restrict
+ - type: const char *__restrict
- type: ...
- name: printf
standards:
- stdc
return_type: int
arguments:
- - type: const char * __restrict
+ - type: const char *__restrict
- type: ...
- name: vsprintf
standards:
- stdc
return_type: int
arguments:
- - type: char * __restrict
- - type: const char * __restrict
+ - type: char *__restrict
+ - type: const char *__restrict
- type: va_list
- name: vsnprintf
standards:
- stdc
return_type: int
arguments:
- - type: char * __restrict
+ - type: char *__restrict
- type: size_t
- - type: const char * __restrict
+ - type: const char *__restrict
- type: va_list
- name: vfprintf
standards:
- stdc
return_type: int
arguments:
- - type: FILE * __restrict
- - type: const char * __restrict
+ - type: FILE *__restrict
+ - type: const char *__restrict
- type: va_list
- name: vprintf
standards:
- stdc
return_type: int
arguments:
- - type: const char * __restrict
+ - type: const char *__restrict
- type: va_list
- name: sscanf
standards:
- stdc
return_type: int
arguments:
- - type: const char * __restrict
- - type: const char * __restrict
+ - type: const char *__restrict
+ - type: const char *__restrict
- type: ...
- name: scanf
standards:
- stdc
return_type: int
arguments:
- - type: const char * __restrict
+ - type: const char *__restrict
- type: ...
- name: fscanf
standards:
- stdc
return_type: int
arguments:
- - type: FILE * __restrict
- - type: const char * __restrict
+ - type: FILE *__restrict
+ - type: const char *__restrict
- type: ...
- name: fileno
standards:
@@ -202,9 +204,9 @@ functions:
- stdc
return_type: char *
arguments:
- - type: char * __restrict
+ - type: char *__restrict
- type: int
- - type: FILE * __restrict
+ - type: FILE *__restrict
- name: fflush
standards:
- stdc
@@ -230,8 +232,8 @@ functions:
- stdc
return_type: int
arguments:
- - type: const char * __restrict
- - type: FILE * __restrict
+ - type: const char *__restrict
+ - type: FILE *__restrict
- name: fopencookie
standards:
- GNUExtensions
@@ -245,19 +247,19 @@ functions:
- stdc
return_type: size_t
arguments:
- - type: void * __restrict
+ - type: void *__restrict
- type: size_t
- type: size_t
- - type: FILE * __restrict
+ - type: FILE *__restrict
- name: fread_unlocked
standards:
- GNUExtensions
return_type: size_t
arguments:
- - type: void * __restrict
+ - type: void *__restrict
- type: size_t
- type: size_t
- - type: FILE * __restrict
+ - type: FILE *__restrict
- name: fseek
standards:
- stdc
@@ -283,19 +285,19 @@ functions:
- stdc
return_type: size_t
arguments:
- - type: const void * __restrict
+ - type: const void *__restrict
- type: size_t
- type: size_t
- - type: FILE * __restrict
+ - type: FILE *__restrict
- name: fwrite_unlocked
standards:
- GNUExtensions
return_type: size_t
arguments:
- - type: const void * __restrict
+ - type: const void *__restrict
- type: size_t
- type: size_t
- - type: FILE * __restrict
+ - type: FILE *__restrict
- name: getc
standards:
- stdc
@@ -342,15 +344,15 @@ functions:
- stdc
return_type: void
arguments:
- - type: FILE * __restrict
- - type: char * __restrict
+ - type: FILE *__restrict
+ - type: char *__restrict
- name: setvbuf
standards:
- stdc
return_type: int
arguments:
- - type: FILE * __restrict
- - type: char * __restrict
+ - type: FILE *__restrict
+ - type: char *__restrict
- type: int
- type: size_t
- name: ungetc
@@ -360,18 +362,3 @@ functions:
arguments:
- type: int
- type: FILE *
- - name: stderr
- standards:
- - stdc
- return_type: extern FILE *
- arguments: []
- - name: stdin
- standards:
- - stdc
- return_type: extern FILE *
- arguments: []
- - name: stdout
- standards:
- - stdc
- return_type: extern FILE *
- arguments: []
diff --git a/libc/newhdrgen/yaml/stdlib.yaml b/libc/newhdrgen/yaml/stdlib.yaml
index 032b47f8291e6..478c65bfce3d0 100644
--- a/libc/newhdrgen/yaml/stdlib.yaml
+++ b/libc/newhdrgen/yaml/stdlib.yaml
@@ -1,6 +1,6 @@
header: stdlib.h
standards:
- - stdc
+ - stdc
macros: []
types:
- type_name: __atexithandler_t
@@ -31,7 +31,7 @@ functions:
- stdc
return_type: double
arguments:
- - type: const char * __restrict
+ - type: const char *__restrict
- name: atol
standards:
- stdc
@@ -110,7 +110,8 @@ functions:
standards:
- stdc
return_type: int
- arguments: []
+ arguments:
+ - type: void
- name: srand
standards:
- stdc
@@ -122,80 +123,80 @@ functions:
- stdc
return_type: int
arguments:
- - type: char * __restrict
+ - type: char *__restrict
- type: size_t
- - type: const char * __restrict
+ - type: const char *__restrict
- type: double
- name: strfromf
standards:
- stdc
return_type: int
arguments:
- - type: char * __restrict
+ - type: char *__restrict
- type: size_t
- - type: const char * __restrict
+ - type: const char *__restrict
- type: float
- name: strfroml
standards:
- stdc
return_type: int
arguments:
- - type: char * __restrict
+ - type: char *__restrict
- type: size_t
- - type: const char * __restrict
+ - type: const char *__restrict
- type: long double
- name: strtod
standards:
- stdc
return_type: double
arguments:
- - type: const char * __restrict
- - type: char * * __restrict
+ - type: const char *__restrict
+ - type: char **__restrict
- name: strtof
standards:
- stdc
return_type: float
arguments:
- - type: const char * __restrict
- - type: char * * __restrict
+ - type: const char *__restrict
+ - type: char **__restrict
- name: strtol
standards:
- stdc
return_type: long
arguments:
- - type: const char * __restrict
- - type: char * * __restrict
+ - type: const char *__restrict
+ - type: char **__restrict
- type: int
- name: strtold
standards:
- stdc
return_type: long double
arguments:
- - type: const char * __restrict
- - type: char * * __restrict
+ - type: const char *__restrict
+ - type: char **__restrict
- name: strtoll
standards:
- stdc
return_type: long long
arguments:
- - type: const char * __restrict
- - type: char * * __restrict
+ - type: const char *__restrict
+ - type: char **__restrict
- type: int
- name: strtoul
standards:
- stdc
return_type: unsigned long
arguments:
- - type: const char * __restrict
- - type: char * * __restrict
+ - type: const char *__restrict
+ - type: char **__restrict
- type: int
- name: strtoull
standards:
- stdc
return_type: unsigned long long
arguments:
- - type: const char * __restrict
- - type: char * * __restrict
+ - type: const char *__restrict
+ - type: char **__restrict
- type: int
- name: malloc
standards:
@@ -240,7 +241,8 @@ functions:
standards:
- stdc
return_type: _Noreturn void
- arguments: []
+ arguments:
+ - type: void
- name: at_quick_exit
standards:
- stdc
diff --git a/libc/newhdrgen/yaml/string.yaml b/libc/newhdrgen/yaml/string.yaml
index 7080a9b7cb3a7..f0e8efb5b77d7 100644
--- a/libc/newhdrgen/yaml/string.yaml
+++ b/libc/newhdrgen/yaml/string.yaml
@@ -56,7 +56,7 @@ functions:
- name: strcpy
standards:
- stdc
- return_type: char
+ return_type: char *
arguments:
- type: char *__restrict
- type: const char *__restrict
@@ -282,16 +282,16 @@ functions:
- BSDExtensions
return_type: size_t
arguments:
- - type: char *__restrict
- - type: char *__restrict
+ - type: const char *__restrict
+ - type: const char *__restrict
- type: size_t
- name: strlcpy
standards:
- BSDExtensions
return_type: size_t
arguments:
- - type: char *__restrict
- - type: char *__restrict
+ - type: const char *__restrict
+ - type: const char *__restrict
- type: size_t
- name: strsep
standards:
@@ -299,4 +299,4 @@ functions:
return_type: char *
arguments:
- type: char **__restrict
- - type: char *__restrict
+ - type: const char *__restrict
diff --git a/libc/newhdrgen/yaml/sys_mman.yaml b/libc/newhdrgen/yaml/sys_mman.yaml
index 16a6463b0917d..c465f6b2c791e 100644
--- a/libc/newhdrgen/yaml/sys_mman.yaml
+++ b/libc/newhdrgen/yaml/sys_mman.yaml
@@ -1,5 +1,4 @@
header: sys-mman.h
-standards: POSIX
macros: []
types:
- type_name: mode_t
@@ -42,7 +41,7 @@ functions:
arguments:
- type: void *
- type: size_t
- - name: POSIX_madvise
+ - name: posix_madvise
standards:
- POSIX
return_type: int
@@ -50,7 +49,6 @@ functions:
- type: void *
- type: size_t
- type: int
- # this is a linux function
- name: mincore
standards:
- Linux
@@ -90,7 +88,8 @@ functions:
standards:
- POSIX
return_type: int
- arguments: []
+ arguments:
+ - type: void
- name: msync
standards:
- POSIX
diff --git a/libc/newhdrgen/yaml/sys_syscall.yaml b/libc/newhdrgen/yaml/sys_syscall.yaml
new file mode 100644
index 0000000000000..c0a64338b6f7e
--- /dev/null
+++ b/libc/newhdrgen/yaml/sys_syscall.yaml
@@ -0,0 +1,7 @@
+header: sys-syscall.h
+standards: Linux
+macros: []
+types: []
+enums: []
+functions: []
+objects: []
diff --git a/libc/newhdrgen/yaml/sys_types.yaml b/libc/newhdrgen/yaml/sys_types.yaml
index 20cf9bcd39da3..15eaf107f6915 100644
--- a/libc/newhdrgen/yaml/sys_types.yaml
+++ b/libc/newhdrgen/yaml/sys_types.yaml
@@ -5,6 +5,7 @@ types:
- type_name: uid_t
- type_name: time_t
- type_name: pthread_t
+ - type_name: pthread_rwlock_t
- type_name: pthread_rwlockattr_t
- type_name: pthread_mutex_t
- type_name: blkcnt_t
diff --git a/libc/newhdrgen/yaml/termios.yaml b/libc/newhdrgen/yaml/termios.yaml
index 17986f8c0fc63..045279f5e9ff5 100644
--- a/libc/newhdrgen/yaml/termios.yaml
+++ b/libc/newhdrgen/yaml/termios.yaml
@@ -24,14 +24,14 @@ functions:
- name: cfsetispeed
standards:
- POSIX
- return_type: int
+ return_type: speed_t
arguments:
- type: struct termios *
- type: speed_t
- name: cfsetospeed
standards:
- POSIX
- return_type: int
+ return_type: speed_t
arguments:
- type: struct termios *
- type: speed_t
diff --git a/libc/newhdrgen/yaml/threads.yaml b/libc/newhdrgen/yaml/threads.yaml
index ef472af8bfd32..73da229b52713 100644
--- a/libc/newhdrgen/yaml/threads.yaml
+++ b/libc/newhdrgen/yaml/threads.yaml
@@ -146,3 +146,16 @@ functions:
return_type: int
arguments:
- type: tss_t
+ - name: tss_get
+ standards:
+ - stdc
+ return_type: void *
+ arguments:
+ - type: tss_t
+ - name: tss_set
+ standards:
+ - stdc
+ return_type: int
+ arguments:
+ - type: tss_t
+ - type: void *
diff --git a/libc/newhdrgen/yaml/time.yaml b/libc/newhdrgen/yaml/time.yaml
index fbdf187792484..e7f8de65eeb75 100644
--- a/libc/newhdrgen/yaml/time.yaml
+++ b/libc/newhdrgen/yaml/time.yaml
@@ -34,7 +34,8 @@ functions:
standard:
- stdc
return_type: clock_t
- arguments: []
+ arguments:
+ - type: void
- name:
diff time
standard:
- stdc
diff --git a/libc/newhdrgen/yaml/unistd.yaml b/libc/newhdrgen/yaml/unistd.yaml
index 511746aa19e85..94b1368531657 100644
--- a/libc/newhdrgen/yaml/unistd.yaml
+++ b/libc/newhdrgen/yaml/unistd.yaml
@@ -100,22 +100,26 @@ functions:
standards:
- POSIX
return_type: uid_t
- arguments: []
+ arguments:
+ - type: void
- name: getpid
standards:
- POSIX
return_type: int
- arguments: []
+ arguments:
+ - type: void
- name: getppid
standards:
- POSIX
return_type: int
- arguments: []
+ arguments:
+ - type: void
- name: getuid
standards:
- POSIX
return_type: uid_t
- arguments: []
+ arguments:
+ - type: void
- name: isatty
standards:
- POSIX
@@ -186,16 +190,16 @@ functions:
- POSIX
return_type: ssize_t
arguments:
- - type: const char * __restrict
- - type: char * __restrict
+ - type: const char *__restrict
+ - type: char *__restrict
- type: size_t
- name: readlinkat
standards:
- POSIX
return_type: ssize_t
arguments:
- - type: const char * __restrict
- - type: char * __restrict
+ - type: const char *__restrict
+ - type: char *__restrict
- type: size_t
- name: rmdir
standards:
@@ -273,7 +277,8 @@ functions:
standards:
- POSIX
return_type: pid_t
- arguments: []
+ arguments:
+ - type: void
- name: __llvm_libc_syscall
standards:
- POSIX
@@ -299,31 +304,7 @@ functions:
- POSIX
return_type: void
arguments:
- - type: const void * __restrict
+ - type: const void *__restrict
- type: void *
- type: ssize_t
- - name: enivron
- standards:
- - POSIX
- return_type: extern char **
- arguments: []
- - name: optarg
- standards:
- - POSIX
- return_type: extern char *
- arguments: []
- - name: optind
- standards:
- - POSIX
- return_type: extern int
- arguments: []
- - name: optopt
- standards:
- - POSIX
- return_type: extern int
- arguments: []
- - name: opterr
- standards:
- - POSIX
- return_type: extern int
- arguments: []
+
\ No newline at end of file
More information about the libc-commits
mailing list