Skip to content

[libc] fix lfind old hdrgen #115760

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 3 commits into from
Nov 11, 2024
Merged

Conversation

nickdesaulniers
Copy link
Member

Fixes: #114692

@llvmbot
Copy link
Member

llvmbot commented Nov 11, 2024

@llvm/pr-subscribers-libc

Author: Nick Desaulniers (nickdesaulniers)

Changes

Fixes: #114692


Full diff: https://github.com/llvm/llvm-project/pull/115760.diff

2 Files Affected:

  • (modified) libc/config/linux/api.td (+1-1)
  • (modified) libc/spec/posix.td (+3-4)
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
     [

@nickdesaulniers nickdesaulniers merged commit 582a479 into llvm:main Nov 11, 2024
5 of 6 checks passed
@nickdesaulniers nickdesaulniers deleted the fix_lfind branch November 11, 2024 19:51
Groverkss pushed a commit to iree-org/llvm-project that referenced this pull request Nov 15, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants