[libc-commits] [libc] [libc] fix lfind old hdrgen (PR #115760)

Nick Desaulniers via libc-commits libc-commits at lists.llvm.org
Mon Nov 11 11:42:31 PST 2024


https://github.com/nickdesaulniers updated https://github.com/llvm/llvm-project/pull/115760

>From a5594aafe00d9b2f4e12435bd2d2e782dacdf0e6 Mon Sep 17 00:00:00 2001
From: Nick Desaulniers <ndesaulniers at google.com>
Date: Mon, 11 Nov 2024 11:39:51 -0800
Subject: [PATCH 1/2] [libc] fix lfind old hdrgen

Fixes: #114692
---
 libc/config/linux/api.td | 2 +-
 libc/spec/posix.td       | 7 +++----
 2 files changed, 4 insertions(+), 5 deletions(-)

diff --git a/libc/config/linux/api.td b/libc/config/linux/api.td
index 46523b4ca4b8df..a00e0f61b90df7 100644
--- a/libc/config/linux/api.td
+++ b/libc/config/linux/api.td
@@ -268,7 +268,7 @@ def SetJmpAPI : PublicAPI<"setjmp.h"> {
 }
 
 def SearchAPI : PublicAPI<"search.h"> {
-  let Types = ["ACTION", "ENTRY", "struct hsearch_data"];
+  let Types = ["ACTION", "ENTRY", "struct hsearch_data", "__lsearchcompare_t"];
 }
 
 def SysStatvfsAPI : PublicAPI<"sys/statvfs.h"> {
diff --git a/libc/spec/posix.td b/libc/spec/posix.td
index d4712dc0c5d701..c9399ba6f4d15e 100644
--- a/libc/spec/posix.td
+++ b/libc/spec/posix.td
@@ -100,9 +100,6 @@ def StructStatvfs : NamedType<"struct statvfs">;
 def StructStatvfsPtr : PtrType<StructStatvfs>;
 def RestrictedStructStatvfsPtr : RestrictedPtrType<StructStatvfs>;
 
-// The function pointer type for the predicate for lsearch, lfind
-def LSearchCompareT : NamedType<"__lsearchcompare_t">;
-
 def POSIX : StandardSpec<"POSIX"> {
   PtrType CharPtr = PtrType<CharType>;
   RestrictedPtrType RestrictedCharPtr = RestrictedPtrType<CharType>;
@@ -1577,12 +1574,14 @@ def POSIX : StandardSpec<"POSIX"> {
     ]
   >;
 
+  NamedType LSearchCompareT = NamedType<"__lsearchcompare_t">;
   HeaderSpec Search = HeaderSpec<
     "search.h",
     [], // Macros
     [
         ActionType,
-        EntryType
+        EntryType,
+        LSearchCompareT,
     ], // Types
     [], // Enumerations
     [

>From 6b902092edabc9be2f59edd87ef5932e5bf65a7d Mon Sep 17 00:00:00 2001
From: Nick Desaulniers <ndesaulniers at google.com>
Date: Mon, 11 Nov 2024 11:42:14 -0800
Subject: [PATCH 2/2] put back old location

---
 libc/spec/posix.td | 4 +++-
 1 file changed, 3 insertions(+), 1 deletion(-)

diff --git a/libc/spec/posix.td b/libc/spec/posix.td
index c9399ba6f4d15e..a35d8e8cb41333 100644
--- a/libc/spec/posix.td
+++ b/libc/spec/posix.td
@@ -100,6 +100,9 @@ def StructStatvfs : NamedType<"struct statvfs">;
 def StructStatvfsPtr : PtrType<StructStatvfs>;
 def RestrictedStructStatvfsPtr : RestrictedPtrType<StructStatvfs>;
 
+// The function pointer type for the predicate for lsearch, lfin
+def LSearchCompareT : NamedType<"__lsearchcompare_t">;
+
 def POSIX : StandardSpec<"POSIX"> {
   PtrType CharPtr = PtrType<CharType>;
   RestrictedPtrType RestrictedCharPtr = RestrictedPtrType<CharType>;
@@ -1574,7 +1577,6 @@ def POSIX : StandardSpec<"POSIX"> {
     ]
   >;
 
-  NamedType LSearchCompareT = NamedType<"__lsearchcompare_t">;
   HeaderSpec Search = HeaderSpec<
     "search.h",
     [], // Macros



More information about the libc-commits mailing list