[libc-commits] [libc] [libc] Add proxy header for hsearch_data (PR #241000)
via libc-commits
libc-commits at lists.llvm.org
Tue Nov 10 12:51:57 PST 2026
llvmorg-github-actions[bot] wrote:
<!--LLVM PR SUMMARY COMMENT-->
@llvm/pr-subscribers-libc
Author: Sachin 🗲 (s4chinjha)
<details>
<summary>Changes</summary>
---
Full diff: https://github.com/llvm/llvm-project/pull/241000.diff
7 Files Affected:
- (modified) libc/hdr/types/CMakeLists.txt (+8)
- (added) libc/hdr/types/hsearch_data.h (+22)
- (modified) libc/include/llvm-libc-types/struct_hsearch_data.h (-1)
- (modified) libc/src/search/CMakeLists.txt (+3-3)
- (modified) libc/src/search/hcreate_r.h (+2-1)
- (modified) libc/src/search/hdestroy_r.h (+1-1)
- (modified) libc/src/search/hsearch_r.h (+1-1)
``````````diff
diff --git a/libc/hdr/types/CMakeLists.txt b/libc/hdr/types/CMakeLists.txt
index f038bcfb380004..bb4e96324a642d 100644
--- a/libc/hdr/types/CMakeLists.txt
+++ b/libc/hdr/types/CMakeLists.txt
@@ -1318,6 +1318,14 @@ add_proxy_header_library(
libc.include.llvm-libc-types.VISIT
)
+add_proxy_header_library(
+ hsearch_data
+ HDRS
+ hsearch_data.h
+ FULL_BUILD_DEPENDS
+ libc.include.llvm-libc-types.struct_hsearch_data
+)
+
add_proxy_header_library(
glob_t
HDRS
diff --git a/libc/hdr/types/hsearch_data.h b/libc/hdr/types/hsearch_data.h
new file mode 100644
index 00000000000000..e3736830fa3a53
--- /dev/null
+++ b/libc/hdr/types/hsearch_data.h
@@ -0,0 +1,22 @@
+//===-- Proxy header for hsearch_data -------------------------------------===//
+//
+// 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_HDR_TYPES_HSEARCH_DATA_H
+#define LLVM_LIBC_HDR_TYPES_HSEARCH_DATA_H
+
+#ifdef LIBC_FULL_BUILD
+
+#include "include/llvm-libc-types/struct_hsearch_data.h"
+
+#else // Overlay mode
+
+#include <search.h>
+
+#endif // LIBC_FULL_BUILD
+
+#endif // LLVM_LIBC_HDR_TYPES_HSEARCH_DATA_H
diff --git a/libc/include/llvm-libc-types/struct_hsearch_data.h b/libc/include/llvm-libc-types/struct_hsearch_data.h
index cdb1d0c5da14c4..5bb52cd1d412cb 100644
--- a/libc/include/llvm-libc-types/struct_hsearch_data.h
+++ b/libc/include/llvm-libc-types/struct_hsearch_data.h
@@ -11,7 +11,6 @@
struct hsearch_data {
void *__opaque;
- unsigned int __unused[2];
};
#endif // LLVM_LIBC_TYPES_STRUCT_HSEARCH_DATA_H
diff --git a/libc/src/search/CMakeLists.txt b/libc/src/search/CMakeLists.txt
index a872515b9af45f..7b90061d576555 100644
--- a/libc/src/search/CMakeLists.txt
+++ b/libc/src/search/CMakeLists.txt
@@ -24,7 +24,7 @@ add_entrypoint_object(
libc.src.__support.HashTable.table
libc.src.__support.HashTable.randomness
libc.src.errno.errno
- libc.include.search
+ libc.hdr.types.hsearch_data
)
add_entrypoint_object(
@@ -51,7 +51,7 @@ add_entrypoint_object(
DEPENDS
libc.hdr.types.ACTION
libc.hdr.types.ENTRY
- libc.include.llvm-libc-types.struct_hsearch_data
+ libc.hdr.types.hsearch_data
libc.src.__support.HashTable.table
libc.src.errno.errno
)
@@ -77,7 +77,7 @@ add_entrypoint_object(
DEPENDS
libc.src.errno.errno
libc.src.__support.HashTable.table
- libc.include.search
+ libc.hdr.types.hsearch_data
)
add_entrypoint_object(
diff --git a/libc/src/search/hcreate_r.h b/libc/src/search/hcreate_r.h
index 9606077b3e8304..29171a25a7d519 100644
--- a/libc/src/search/hcreate_r.h
+++ b/libc/src/search/hcreate_r.h
@@ -9,8 +9,9 @@
#ifndef LLVM_LIBC_SRC_SEARCH_HCREATE_R_H
#define LLVM_LIBC_SRC_SEARCH_HCREATE_R_H
+#include "hdr/types/hsearch_data.h"
+#include <stddef.h> // size_t
#include "src/__support/macros/config.h"
-#include <search.h>
namespace LIBC_NAMESPACE_DECL {
int hcreate_r(size_t capacity, struct hsearch_data *htab);
diff --git a/libc/src/search/hdestroy_r.h b/libc/src/search/hdestroy_r.h
index c9a4ddf018f386..ca0a6f4d57bba6 100644
--- a/libc/src/search/hdestroy_r.h
+++ b/libc/src/search/hdestroy_r.h
@@ -9,8 +9,8 @@
#ifndef LLVM_LIBC_SRC_SEARCH_HDESTROY_R_H
#define LLVM_LIBC_SRC_SEARCH_HDESTROY_R_H
+#include "hdr/types/hsearch_data.h"
#include "src/__support/macros/config.h"
-#include <search.h>
namespace LIBC_NAMESPACE_DECL {
void hdestroy_r(struct hsearch_data *htab);
diff --git a/libc/src/search/hsearch_r.h b/libc/src/search/hsearch_r.h
index 692bc3cb5f370a..375ad600f1dcba 100644
--- a/libc/src/search/hsearch_r.h
+++ b/libc/src/search/hsearch_r.h
@@ -11,7 +11,7 @@
#include "hdr/types/ACTION.h"
#include "hdr/types/ENTRY.h"
-#include "include/llvm-libc-types/struct_hsearch_data.h"
+#include "hdr/types/hsearch_data.h"
#include "src/__support/macros/config.h"
namespace LIBC_NAMESPACE_DECL {
``````````
</details>
https://github.com/llvm/llvm-project/pull/241000
More information about the libc-commits
mailing list