[libc-commits] [libc] [libc] corrected yaml files in newhdrgen (PR #98069)
via libc-commits
libc-commits at lists.llvm.org
Mon Jul 8 12:48:04 PDT 2024
https://github.com/aaryanshukla created https://github.com/llvm/llvm-project/pull/98069
- fixed little issues in yaml issues through testing
- corrected function class in the case there is no attribute
>From a25f35e723116f826e66ea824734184a83764f21 Mon Sep 17 00:00:00 2001
From: Aaryan Shukla <aaryanshukla at google.com>
Date: Mon, 8 Jul 2024 19:44:15 +0000
Subject: [PATCH] [libc] corrected yaml files in newhdrgen
- fixed little issues in yaml issues through testing
- corrected function class in the case there is no attribute
---
.../class_implementation/classes/function.py | 2 +-
libc/newhdrgen/tests/test_integration.py | 2 +-
libc/newhdrgen/yaml/inttypes.yaml | 2 +-
libc/newhdrgen/yaml/pthread.yaml | 48 +++++-----
libc/newhdrgen/yaml/sched.yaml | 3 +-
libc/newhdrgen/yaml/signal.yaml | 16 ++--
libc/newhdrgen/yaml/stdio.yaml | 87 ++++++++-----------
libc/newhdrgen/yaml/stdlib.yaml | 50 ++++++-----
libc/newhdrgen/yaml/string.yaml | 12 +--
libc/newhdrgen/yaml/termios.yaml | 4 +-
10 files changed, 107 insertions(+), 119 deletions(-)
diff --git a/libc/newhdrgen/class_implementation/classes/function.py b/libc/newhdrgen/class_implementation/classes/function.py
index f79b53de9ade..c73fe8db6bb1 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 228fecc7f41c..49deac83c59f 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 772a1a0e06b2..6e3d1346f600 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 9ffcf454035f..14a562082d5d 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 11a55b7d993b..7b164bfeee39 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 a95273419dbd..980bd5d90c4b 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 2fdc772da122..6d2a8557f9b9 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 032b47f8291e..478c65bfce3d 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 7080a9b7cb3a..f0e8efb5b77d 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/termios.yaml b/libc/newhdrgen/yaml/termios.yaml
index 17986f8c0fc6..045279f5e9ff 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
More information about the libc-commits
mailing list