[libc-commits] [libc] [libc] Remove trivial .h.def files (PR #149466)
via libc-commits
libc-commits at lists.llvm.org
Fri Jul 18 00:08:21 PDT 2025
llvmbot wrote:
<!--LLVM PR SUMMARY COMMENT-->
@llvm/pr-subscribers-libc
Author: Roland McGrath (frobtech)
<details>
<summary>Changes</summary>
Remove all the .h.def files that already express nothing
whatsoever not already expressed in YAML. Clean up a few YAML
files without materially changing any generated header output.
Many more .h.def files remain that need a bit of conversion in
YAML to express macro requirements and such.
---
Patch is 22.07 KiB, truncated to 20.00 KiB below, full version: https://github.com/llvm/llvm-project/pull/149466.diff
25 Files Affected:
- (removed) libc/include/dirent.h.def (-16)
- (modified) libc/include/dirent.yaml (+8-10)
- (removed) libc/include/search.h.def (-18)
- (modified) libc/include/search.yaml (+12-12)
- (removed) libc/include/setjmp.h.def (-16)
- (modified) libc/include/setjmp.yaml (+4-6)
- (removed) libc/include/spawn.h.def (-16)
- (modified) libc/include/spawn.yaml (+8-10)
- (removed) libc/include/string.h.def (-16)
- (modified) libc/include/string.yaml (+9-8)
- (removed) libc/include/strings.h.def (-16)
- (modified) libc/include/strings.yaml (+11-20)
- (removed) libc/include/sys/sendfile.h.def (-16)
- (modified) libc/include/sys/sendfile.yaml (+2-10)
- (removed) libc/include/sys/statvfs.h.def (-16)
- (modified) libc/include/sys/statvfs.yaml (+4-6)
- (modified) libc/include/sys/types.yaml (+18-22)
- (removed) libc/include/sys/uio.h.def (-16)
- (modified) libc/include/sys/uio.yaml (+4-6)
- (removed) libc/include/sys/utsname.h.def (-16)
- (modified) libc/include/sys/utsname.yaml (+3-5)
- (removed) libc/include/threads.h.def (-16)
- (modified) libc/include/threads.yaml (+2-1)
- (removed) libc/include/uchar.h.def (-16)
- (modified) libc/include/uchar.yaml (-5)
``````````diff
diff --git a/libc/include/dirent.h.def b/libc/include/dirent.h.def
deleted file mode 100644
index 6786578fbd067..0000000000000
--- a/libc/include/dirent.h.def
+++ /dev/null
@@ -1,16 +0,0 @@
-//===-- POSIX header dirent.h ---------------------------------------------===//
-//
-// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
-// See https://llvm.org/LICENSE.txt for license information.
-// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
-//
-//===----------------------------------------------------------------------===//
-
-#ifndef LLVM_LIBC_DIRENT_H
-#define LLVM_LIBC_DIRENT_H
-
-#include "__llvm-libc-common.h"
-
-%%public_api()
-
-#endif // LLVM_LIBC_DIRENT_H
diff --git a/libc/include/dirent.yaml b/libc/include/dirent.yaml
index 3fc522fda80e4..66570bca6c495 100644
--- a/libc/include/dirent.yaml
+++ b/libc/include/dirent.yaml
@@ -1,47 +1,45 @@
header: dirent.h
-header_template: dirent.h.def
-macros: []
+standards:
+ - posix
types:
- type_name: struct_dirent
- type_name: DIR
- type_name: ino_t
-enums: []
-objects: []
functions:
- name: alphasort
standards:
- - POSIX
+ - posix
return_type: int
arguments:
- type: const struct dirent **
- type: const struct dirent **
- name: closedir
standards:
- - POSIX
+ - posix
return_type: int
arguments:
- type: DIR *
- name: dirfd
standards:
- - POSIX
+ - posix
return_type: int
arguments:
- type: DIR *
- name: fdopendir
standards:
- - POSIX
+ - posix
return_type: DIR *
arguments:
- type: int
- name: opendir
standards:
- - POSIX
+ - posix
return_type: DIR *
arguments:
- type: const char *
- name: readdir
standards:
- - POSIX
+ - posix
return_type: struct dirent *
arguments:
- type: DIR *
diff --git a/libc/include/search.h.def b/libc/include/search.h.def
deleted file mode 100644
index 6301ba7b656ce..0000000000000
--- a/libc/include/search.h.def
+++ /dev/null
@@ -1,18 +0,0 @@
-//===-- POSIX header search.h ---------------------------------------------===//
-//
-// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
-// See https://llvm.org/LICENSE.txt for license information.
-// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
-//
-//===----------------------------------------------------------------------===//
-
-#ifndef LLVM_LIBC_SEARCH_H
-#define LLVM_LIBC_SEARCH_H
-
-#include "__llvm-libc-common.h"
-#define __need_size_t
-#include <stddef.h>
-
-%%public_api()
-
-#endif // LLVM_LIBC_SEARCH_H
diff --git a/libc/include/search.yaml b/libc/include/search.yaml
index e0247afad2cd6..8a3a0c50af60f 100644
--- a/libc/include/search.yaml
+++ b/libc/include/search.yaml
@@ -1,6 +1,6 @@
header: search.h
-header_template: search.h.def
-macros: []
+standards:
+ - posix
types:
- type_name: ACTION
- type_name: ENTRY
@@ -12,35 +12,35 @@ objects: []
functions:
- name: hcreate
standards:
- - POSIX
+ - posix
return_type: int
arguments:
- type: size_t
- name: hcreate_r
- standards: GNUExtensions
+ standards: gnu
return_type: int
arguments:
- type: size_t
- type: struct hsearch_data *
- name: hdestroy
- standards: GNUExtensions
+ standards: gnu
return_type: void
arguments: []
- name: hdestroy_r
standards:
- - POSIX
+ - posix
return_type: void
arguments:
- type: struct hsearch_data *
- name: hsearch
standards:
- - POSIX
+ - posix
return_type: ENTRY *
arguments:
- type: ENTRY
- type: ACTION
- name: hsearch_r
- standards: GNUExtensions
+ standards: gnu
return_type: int
arguments:
- type: ENTRY
@@ -49,20 +49,20 @@ functions:
- type: struct hsearch_data *
- name: insque
standards:
- - POSIX
+ - posix
return_type: void
arguments:
- type: void *
- type: void *
- name: remque
standards:
- - POSIX
+ - posix
return_type: void
arguments:
- type: void *
- name: lfind
standards:
- - POSIX
+ - posix
return_type: void *
arguments:
- type: const void *
@@ -72,7 +72,7 @@ functions:
- type: __search_compare_t
- name: lsearch
standards:
- - POSIX
+ - posix
return_type: void *
arguments:
- type: const void *
diff --git a/libc/include/setjmp.h.def b/libc/include/setjmp.h.def
deleted file mode 100644
index 670bc1ac0fe24..0000000000000
--- a/libc/include/setjmp.h.def
+++ /dev/null
@@ -1,16 +0,0 @@
-//===-- C standard library header setjmp.h --------------------------------===//
-//
-// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
-// See https://llvm.org/LICENSE.txt for license information.
-// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
-//
-//===----------------------------------------------------------------------===//
-
-#ifndef LLVM_LIBC_SETJMP_H
-#define LLVM_LIBC_SETJMP_H
-
-#include "__llvm-libc-common.h"
-
-%%public_api()
-
-#endif // LLVM_LIBC_SETJMP_H
diff --git a/libc/include/setjmp.yaml b/libc/include/setjmp.yaml
index 00049e58c86c8..55e03470e33ca 100644
--- a/libc/include/setjmp.yaml
+++ b/libc/include/setjmp.yaml
@@ -1,10 +1,8 @@
header: setjmp.h
-header_template: setjmp.h.def
-macros: []
+standards:
+ - stdc
types:
- type_name: jmp_buf
-enums: []
-objects: []
functions:
- name: longjmp
standards:
@@ -23,7 +21,7 @@ functions:
- type: jmp_buf
- name: sigsetjmp
standards:
- - POSIX
+ - posix
return_type: int
attributes:
- _Returns_twice
@@ -32,7 +30,7 @@ functions:
- type: int
- name: siglongjmp
standards:
- - POSIX
+ - posix
return_type: _Noreturn void
arguments:
- type: sigjmp_buf
diff --git a/libc/include/spawn.h.def b/libc/include/spawn.h.def
deleted file mode 100644
index a8d7015852868..0000000000000
--- a/libc/include/spawn.h.def
+++ /dev/null
@@ -1,16 +0,0 @@
-//===-- POSIX header spawn.h ----------------------------------------------===//
-//
-// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
-// See https://llvm.org/LICENSE.txt for license information.
-// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
-//
-//===----------------------------------------------------------------------===//
-
-#ifndef LLVM_LIBC_SPAWN_H
-#define LLVM_LIBC_SPAWN_H
-
-#include "__llvm-libc-common.h"
-
-%%public_api()
-
-#endif // LLVM_LIBC_SPAWN_H
diff --git a/libc/include/spawn.yaml b/libc/include/spawn.yaml
index c763cc76fd094..ef39f66d080f6 100644
--- a/libc/include/spawn.yaml
+++ b/libc/include/spawn.yaml
@@ -1,17 +1,15 @@
header: spawn.h
-header_template: spawn.h.def
-macros: []
+standards:
+ - posix
types:
- type_name: posix_spawn_file_actions_t
- type_name: posix_spawnattr_t
- type_name: pid_t
- type_name: mode_t
-enums: []
-objects: []
functions:
- name: posix_spawn
standards:
- - POSIX
+ - posix
return_type: int
arguments:
- type: pid_t *__restrict
@@ -22,14 +20,14 @@ functions:
- type: char * const * __restrict
- name: posix_spawn_file_actions_addclose
standards:
- - POSIX
+ - posix
return_type: int
arguments:
- type: posix_spawn_file_actions_t *
- type: int
- name: posix_spawn_file_actions_adddup2
standards:
- - POSIX
+ - posix
return_type: int
arguments:
- type: posix_spawn_file_actions_t *
@@ -37,7 +35,7 @@ functions:
- type: int
- name: posix_spawn_file_actions_addopen
standards:
- - POSIX
+ - posix
return_type: int
arguments:
- type: posix_spawn_file_actions_t *__restrict
@@ -47,13 +45,13 @@ functions:
- type: mode_t
- name: posix_spawn_file_actions_destroy
standards:
- - POSIX
+ - posix
return_type: int
arguments:
- type: posix_spawn_file_actions_t *
- name: posix_spawn_file_actions_init
standards:
- - POSIX
+ - posix
return_type: int
arguments:
- type: posix_spawn_file_actions_t *
diff --git a/libc/include/string.h.def b/libc/include/string.h.def
deleted file mode 100644
index 339d005e43a4f..0000000000000
--- a/libc/include/string.h.def
+++ /dev/null
@@ -1,16 +0,0 @@
-//===-- C standard library header string.h --------------------------------===//
-//
-// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
-// See https://llvm.org/LICENSE.txt for license information.
-// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
-//
-//===----------------------------------------------------------------------===//
-
-#ifndef LLVM_LIBC_STRING_H
-#define LLVM_LIBC_STRING_H
-
-#include "__llvm-libc-common.h"
-
-%%public_api()
-
-#endif // LLVM_LIBC_STRING_H
diff --git a/libc/include/string.yaml b/libc/include/string.yaml
index 736deceb453de..0bf297ee747a4 100644
--- a/libc/include/string.yaml
+++ b/libc/include/string.yaml
@@ -1,5 +1,6 @@
header: string.h
-header_template: string.h.def
+standards:
+ - stdc
macros:
- macro_name: NULL
macro_header: null-macro.h
@@ -11,7 +12,7 @@ objects: []
functions:
- name: memccpy
standards:
- - POSIX
+ - posix
return_type: void *
arguments:
- type: void *__restrict
@@ -61,7 +62,7 @@ functions:
- type: size_t
- name: mempcpy
standards:
- - POSIX
+ - posix
return_type: void *
arguments:
- type: void *__restrict
@@ -93,14 +94,14 @@ functions:
- type: size_t
- name: stpcpy
standards:
- - POSIX
+ - posix
return_type: char *
arguments:
- type: char *__restrict
- type: const char *__restrict
- name: stpncpy
standards:
- - POSIX
+ - posix
return_type: char *
arguments:
- type: char *__restrict
@@ -243,7 +244,7 @@ functions:
- type: size_t
- name: strnlen
standards:
- - POSIX
+ - posix
return_type: size_t
arguments:
- type: const char *
@@ -271,7 +272,7 @@ functions:
- type: const char *__restrict
- name: strsignal
standards:
- - POSIX
+ - posix
return_type: char *
arguments:
- type: int
@@ -298,7 +299,7 @@ functions:
- type: const char *__restrict
- name: strtok_r
standards:
- - POSIX
+ - posix
return_type: char *
arguments:
- type: char *__restrict
diff --git a/libc/include/strings.h.def b/libc/include/strings.h.def
deleted file mode 100644
index 9b016bf0bc50b..0000000000000
--- a/libc/include/strings.h.def
+++ /dev/null
@@ -1,16 +0,0 @@
-//===-- C standard library header strings.h -------------------------------===//
-//
-// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
-// See https://llvm.org/LICENSE.txt for license information.
-// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
-//
-//===----------------------------------------------------------------------===//
-
-#ifndef LLVM_LIBC_STRINGS_H
-#define LLVM_LIBC_STRINGS_H
-
-#include "__llvm-libc-common.h"
-
-%%public_api()
-
-#endif // LLVM_LIBC_STRINGS_H
diff --git a/libc/include/strings.yaml b/libc/include/strings.yaml
index 855800d9dbc3d..1e78f0e48aa59 100644
--- a/libc/include/strings.yaml
+++ b/libc/include/strings.yaml
@@ -1,15 +1,14 @@
header: strings.h
-header_template: strings.h.def
-macros: []
+standards:
+ - bsd
+ - posix
types:
- type_name: size_t
- type_name: locale_t
-enums: []
-objects: []
functions:
- name: bcmp
standards:
- - llvm_libc_ext
+ - bsd
return_type: int
arguments:
- type: const void *
@@ -17,7 +16,7 @@ functions:
- type: size_t
- name: bcopy
standards:
- - llvm_libc_ext
+ - bsd
return_type: void
arguments:
- type: const void *
@@ -25,69 +24,61 @@ functions:
- type: size_t
- name: bzero
standards:
- - llvm_libc_ext
+ - bsd
return_type: void
arguments:
- type: void *
- type: size_t
- name: ffs
standards:
- - POSIX
+ - posix
return_type: int
arguments:
- type: int
- name: ffsl
standards:
- - POSIX
+ - posix
return_type: int
arguments:
- type: long
- name: ffsll
standards:
- - POSIX
+ - posix
return_type: int
arguments:
- type: long long
- name: index
standards:
- - BSDExtensions
+ - bsd
return_type: char *
arguments:
- type: const char *
- type: int
- name: rindex
standards:
- - BSDExtensions
+ - bsd
return_type: char *
arguments:
- type: const char *
- type: int
- name: strcasecmp
- standards:
- - BSDExtensions
return_type: int
arguments:
- type: const char *
- type: const char *
- name: strcasecmp_l
- standards:
- - BSDExtensions
return_type: int
arguments:
- type: const char *
- type: const char *
- type: locale_t
- name: strncasecmp
- standards:
- - BSDExtensions
return_type: int
arguments:
- type: const char *
- type: const char *
- type: size_t
- name: strncasecmp_l
- standards:
- - BSDExtensions
return_type: int
arguments:
- type: const char *
diff --git a/libc/include/sys/sendfile.h.def b/libc/include/sys/sendfile.h.def
deleted file mode 100644
index d7f21f91f95ed..0000000000000
--- a/libc/include/sys/sendfile.h.def
+++ /dev/null
@@ -1,16 +0,0 @@
-//===-- Linux sys/sendfile.h ----------------------------------------------===//
-//
-// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
-// See https://llvm.org/LICENSE.txt for license information.
-// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
-//
-//===----------------------------------------------------------------------===//
-
-#ifndef LLVM_LIBC_SYS_SENDFILE_H
-#define LLVM_LIBC_SYS_SENDFILE_H
-
-#include "__llvm-libc-common.h"
-
-%%public_api()
-
-#endif // LLVM_LIBC_SYS_SENDFILE_H
diff --git a/libc/include/sys/sendfile.yaml b/libc/include/sys/sendfile.yaml
index 259ab83dff54b..a845dab580483 100644
--- a/libc/include/sys/sendfile.yaml
+++ b/libc/include/sys/sendfile.yaml
@@ -1,16 +1,8 @@
header: sys/sendfile.h
-header_template: sendfile.h.def
-macros: []
-types:
- - type_name: ssize_t
- - type_name: size_t
- - type_name: off_t
-enums: []
-objects: []
+standards:
+ - linux
functions:
- name: sendfile
- standards:
- - GNUExtensions
return_type: ssize_t
arguments:
- type: int
diff --git a/libc/include/sys/statvfs.h.def b/libc/include/sys/statvfs.h.def
deleted file mode 100644
index f23c9a3d5b1f9..0000000000000
--- a/libc/include/sys/statvfs.h.def
+++ /dev/null
@@ -1,16 +0,0 @@
-//===-- POSIX header statvfs.h --------------------------------------------===//
-//
-// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
-// See https://llvm.org/LICENSE.txt for license information.
-// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
-//
-//===----------------------------------------------------------------------===//
-
-#ifndef LLVM_LIBC_SYS_STATVFS_H
-#define LLVM_LIBC_SYS_STATVFS_H
-
-#include <__llvm-libc-common.h>
-
-%%public_api()
-
-#endif // LLVM_LIBC_SYS_STATVFS_H
diff --git a/libc/include/sys/statvfs.yaml b/libc/include/sys/statvfs.yaml
index 8c1d254add37f..e083677beee89 100644
--- a/libc/include/sys/statvfs.yaml
+++ b/libc/include/sys/statvfs.yaml
@@ -1,23 +1,21 @@
header: sys/statvfs.h
-header_template: statvfs.h.def
-macros: []
+standards:
+ - posix
types:
- type_name: struct_statvfs
- type_name: fsblkcnt_t
- type_name: fsfilcnt_t
-enums: []
-objects: []
functions:
- name: fstatvfs
standards:
- - POSIX
+ - posix
return_type: int
arguments:
- type: int
- type: struct statvfs *
- name: statvfs
standards:
- - POSIX
+ - posix
return_type: int
arguments:
- type: const char *__restrict
diff --git a/libc/include/sys/types.yaml b/libc/include/sys/types.yaml
index 6fa0b448fcd38..a00429d3817e1 100644
--- a/libc/include/sys/types.yaml
+++ b/libc/include/sys/types.yaml
@@ -1,32 +1,28 @@
header: sys/types.h
-header_template: types.h.def
-standards: POSIX
-macros: []
+standards:
+ - posix
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
- type_name: blksize_t
- type_name: clockid_t
- - type_name: ssize_t
- - type_name: pthread_mutexattr_t
- - type_name: ino_t
- - type_name: pthread_once_t
- - type_name: mode_t
- type_name: dev_t
- - type_name: pthread_attr_t
- type_name: gid_t
- - type_name: pid_t
+ - type_name: ino_t
+ - type_name: mode_t
- type_name: nlink_t
- - type_name: suseconds_t
- type_name: off_t
- - type_name: size_t
- - type_name: pthread_key_t
+ - type_name: pid_t
+ - type_name: pthread_attr_t
- type_name: pthread_condattr_t
-enums: []
-objects: []
-functions: []
+ - type_name: pthread_key_t
+ - type_name: pthread_mutex_t
+ - type_name: pthread_mutexattr_t
+ - type_name: pthread_once_t
+ - type_name: pthread_rwlock_t
+ - type_name: pthread_rwlockattr_t
+ - type_name: pthread_t
+ - type_name: size_t
+ - type_name: ssize_t
+ - type_name: suseconds_t
+ - type_name: time_t
+ - type_name: uid_t
diff --git a/libc/include/sys/uio.h.def b/libc/include/sys/uio.h.def
deleted file mode 100644
index 76496cb2310f7..0000000000000
--- a/libc/include/sys/uio.h.def
+++ /dev/null
@@ -1,16 +0,0 @@
-//===-- POSIX header uio.h ------------------------------------------------===//
-//
-// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
-// See https://llvm.org/LICENSE.txt for license information.
-// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
-//
-//===----------------------------------------------------------------------===//
-
-#ifndef LLVM_LIBC_SYS_UIO_H
-#define LLVM_LIBC_SYS_UIO_H
-
-#include "__llvm-libc-common.h"
-
-%%public_api()
-
-#endif // LLVM_LIBC_SYS_UIO_H
diff --git a/libc/include/sys/uio.yaml b/libc/include/sys/uio.yaml
index 6d3f336b2b520..929911e669386 100644
--- a/libc/include/sys/uio.yaml
+++ b/libc/include/sys/uio.yaml
@@ -1,15 +1,13 @@
header: sys/uio.h
-header_template: uio.h.def
-macros: []
+standards:
+ - posix
types:
- type_name: struct_iovec
- type_name: ssize_t
-enums: []
-objects: []
functions:
- name: writev
standards:
- - POSIX
+ - posix
return_type: ssize_t
arguments:
- type: int
@@ -17,7 +15,7 @@ functions:
- type: int
- name: readv
standards:
- - POSIX
+ - posix
return_type: ssize_t
arguments:
- type: int
diff --git a/libc/include/sys/utsname.h.def b/libc/include/sys/utsname.h.def
deleted file mode 100644
index 08dbbfc062453..0000000000000
--- a/libc/include/sys/utsname.h.def
+++ /dev/null
@@ -1,16 +0,0 @@
-//===-- Linux sys/utsname.h -----------------------------------------------===//
-//
-// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
-// See https://llvm.org/LICENSE.txt for license information.
-// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
-//
-//===----------------------------------------------------------------------===//
-
-#ifndef LLVM_LIBC_SYS_UTSNAME_H
-#define LLVM_LIBC_SYS_UTSNAME_H
-
-#include "__llvm-libc-common.h"
-
-%%public_api()
-
-#endif // LLVM_LIBC_SYS_UTSNAME_H
diff --git a/libc/include/sys/utsname.yaml b/libc/include/sys/utsname.yaml
index 6c7cb71f9a34f..0f0e4cdb38952 100644
--- a/libc/include/sys/utsname.yaml
+++ b/libc/include/sys/utsname.yaml
@@ -1,14 +1,12 @@
header: sys/utsname.h
-header_template: utsname.h.def
-macros: []
+standards:
+ - posix
types:
- type_name: struct_utsname
-enums: []
-objects: []
functions:
- name: uname
standards:
- - POSIX
+ - posix
return_type: int
arguments:
- type: struct utsname *
diff --git a/libc/include/threads.h.def b/libc/include/...
[truncated]
``````````
</details>
https://github.com/llvm/llvm-project/pull/149466
More information about the libc-commits
mailing list