[libc] Combine the function prototype `int (*compar)(const void *, const void *)` (#134238)
Closes #134118.
diff --git a/libc/include/CMakeLists.txt b/libc/include/CMakeLists.txt
index d1e116a..e407de2 100644
--- a/libc/include/CMakeLists.txt
+++ b/libc/include/CMakeLists.txt
@@ -240,13 +240,13 @@
../libc/include/search.yaml
search.h
DEPENDS
- .llvm_libc_common_h
.llvm-libc-types.ACTION
.llvm-libc-types.ENTRY
- .llvm-libc-types.struct_hsearch_data
- .llvm-libc-types.size_t
.llvm-libc-types.VISIT
- .llvm-libc-types.__lsearchcompare_t
+ .llvm-libc-types.__search_compare_t
+ .llvm-libc-types.size_t
+ .llvm-libc-types.struct_hsearch_data
+ .llvm_libc_common_h
)
add_header_macro(
@@ -343,17 +343,17 @@
../libc/include/stdlib.yaml
stdlib.h
DEPENDS
- .llvm_libc_common_h
.llvm-libc-macros.stdlib_macros
+ .llvm-libc-types.__atexithandler_t
+ .llvm-libc-types.__qsortcompare_t
+ .llvm-libc-types.__qsortrcompare_t
+ .llvm-libc-types.__search_compare_t
.llvm-libc-types.div_t
.llvm-libc-types.ldiv_t
.llvm-libc-types.lldiv_t
- .llvm-libc-types.size_t
- .llvm-libc-types.__bsearchcompare_t
- .llvm-libc-types.__qsortcompare_t
- .llvm-libc-types.__qsortrcompare_t
- .llvm-libc-types.__atexithandler_t
.llvm-libc-types.locale_t
+ .llvm-libc-types.size_t
+ .llvm_libc_common_h
)
add_header_macro(
diff --git a/libc/include/llvm-libc-types/CMakeLists.txt b/libc/include/llvm-libc-types/CMakeLists.txt
index 66e8527..9ed39bc 100644
--- a/libc/include/llvm-libc-types/CMakeLists.txt
+++ b/libc/include/llvm-libc-types/CMakeLists.txt
@@ -2,8 +2,7 @@
add_header(size_t HDR size_t.h)
add_header(ssize_t HDR ssize_t.h)
add_header(__atfork_callback_t HDR __atfork_callback_t.h)
-add_header(__bsearchcompare_t HDR __bsearchcompare_t.h)
-add_header(__lsearchcompare_t HDR __lsearchcompare_t.h)
+add_header(__search_compare_t HDR __search_compare_t.h)
add_header(__call_once_func_t HDR __call_once_func_t.h)
add_header(__dl_iterate_phdr_callback_t HDR __dl_iterate_phdr_callback_t.h DEPENDS .size_t)
add_header(__exec_argv_t HDR __exec_argv_t.h)
diff --git a/libc/include/llvm-libc-types/__bsearchcompare_t.h b/libc/include/llvm-libc-types/__bsearchcompare_t.h
deleted file mode 100644
index 0b1987be..0000000
--- a/libc/include/llvm-libc-types/__bsearchcompare_t.h
+++ /dev/null
@@ -1,14 +0,0 @@
-//===-- Definition of type __bsearchcompare_t -----------------------------===//
-//
-// 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_TYPES___BSEARCHCOMPARE_T_H
-#define LLVM_LIBC_TYPES___BSEARCHCOMPARE_T_H
-
-typedef int (*__bsearchcompare_t)(const void *, const void *);
-
-#endif // LLVM_LIBC_TYPES___BSEARCHCOMPARE_T_H
diff --git a/libc/include/llvm-libc-types/__lsearchcompare_t.h b/libc/include/llvm-libc-types/__lsearchcompare_t.h
deleted file mode 100644
index 08dc2db..0000000
--- a/libc/include/llvm-libc-types/__lsearchcompare_t.h
+++ /dev/null
@@ -1,14 +0,0 @@
-//===-- Definition of type __lsearchcompare_t -----------------------------===//
-//
-// 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_TYPES___LSEARCHCOMPARE_T_H
-#define LLVM_LIBC_TYPES___LSEARCHCOMPARE_T_H
-
-typedef int (*__lsearchcompare_t)(const void *, const void *);
-
-#endif // LLVM_LIBC_TYPES___LSEARCHCOMPARE_T_H
diff --git a/libc/include/llvm-libc-types/__search_compare_t.h b/libc/include/llvm-libc-types/__search_compare_t.h
new file mode 100644
index 0000000..7033fef
--- /dev/null
+++ b/libc/include/llvm-libc-types/__search_compare_t.h
@@ -0,0 +1,14 @@
+//===-- Definition of type __search_compare_t -----------------------------===//
+//
+// 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_TYPES___SEARCH_COMPARE_T_H
+#define LLVM_LIBC_TYPES___SEARCH_COMPARE_T_H
+
+typedef int (*__search_compare_t)(const void *, const void *);
+
+#endif // LLVM_LIBC_TYPES___SEARCH_COMPARE_T_H
diff --git a/libc/include/search.yaml b/libc/include/search.yaml
index e2e711c..e0247af 100644
--- a/libc/include/search.yaml
+++ b/libc/include/search.yaml
@@ -2,11 +2,11 @@
header_template: search.h.def
macros: []
types:
- - type_name: struct_hsearch_data
- - type_name: ENTRY
- type_name: ACTION
+ - type_name: ENTRY
- type_name: VISIT
- - type_name: __lsearchcompare_t
+ - type_name: __search_compare_t
+ - type_name: struct_hsearch_data
enums: []
objects: []
functions:
@@ -69,7 +69,7 @@
- type: const void *
- type: size_t *
- type: size_t
- - type: __lsearchcompare_t
+ - type: __search_compare_t
- name: lsearch
standards:
- POSIX
@@ -79,4 +79,4 @@
- type: void *
- type: size_t *
- type: size_t
- - type: __lsearchcompare_t
+ - type: __search_compare_t
diff --git a/libc/include/stdlib.yaml b/libc/include/stdlib.yaml
index a6204ce..5690a94 100644
--- a/libc/include/stdlib.yaml
+++ b/libc/include/stdlib.yaml
@@ -7,9 +7,9 @@
macros: []
types:
- type_name: __atexithandler_t
- - type_name: __qsortrcompare_t
- type_name: __qsortcompare_t
- - type_name: __bsearchcompare_t
+ - type_name: __qsortrcompare_t
+ - type_name: __search_compare_t
- type_name: div_t
- type_name: ldiv_t
- type_name: lldiv_t
@@ -87,7 +87,7 @@
- type: const void *
- type: size_t
- type: size_t
- - type: __bsearchcompare_t
+ - type: __search_compare_t
- name: div
standards:
- stdc