Skip to content

[libc] Add proxy header for ACTION type. #139796

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 1 commit into from
May 13, 2025
Merged

[libc] Add proxy header for ACTION type. #139796

merged 1 commit into from
May 13, 2025

Conversation

lntue
Copy link
Contributor

@lntue lntue commented May 13, 2025

@llvmbot
Copy link
Member

llvmbot commented May 13, 2025

@llvm/pr-subscribers-libc

Author: None (lntue)

Changes

#139561


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

5 Files Affected:

  • (added) libc/hdr/types/ACTION.h (+22)
  • (modified) libc/hdr/types/CMakeLists.txt (+9)
  • (modified) libc/src/search/CMakeLists.txt (+2)
  • (modified) libc/src/search/hsearch.h (+1-1)
  • (modified) libc/src/search/hsearch_r.h (+2-1)
diff --git a/libc/hdr/types/ACTION.h b/libc/hdr/types/ACTION.h
new file mode 100644
index 0000000000000..0b63521dff64d
--- /dev/null
+++ b/libc/hdr/types/ACTION.h
@@ -0,0 +1,22 @@
+//===-- Proxy header for ACTION -------------------------------------------===//
+//
+// 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_ACTION_H
+#define LLVM_LIBC_HDR_TYPES_ACTION_H
+
+#ifdef LIBC_FULL_BUILD
+
+#include "include/llvm-libc-types/ACTION.h"
+
+#else // Overlay mode
+
+#include <search.h>
+
+#endif // LLVM_LIBC_FULL_BUILD
+
+#endif // LLVM_LIBC_HDR_TYPES_ACTION_H
diff --git a/libc/hdr/types/CMakeLists.txt b/libc/hdr/types/CMakeLists.txt
index b2890871902f2..5f6197c93d445 100644
--- a/libc/hdr/types/CMakeLists.txt
+++ b/libc/hdr/types/CMakeLists.txt
@@ -383,3 +383,12 @@ add_proxy_header_library(
     libc.include.llvm-libc-types.ENTRY
     libc.include.search
 )
+
+add_proxy_header_library(
+  ACTION
+  HDRS
+    ACTION.h
+  FULL_BUILD_DEPENDS
+    libc.include.llvm-libc-types.ACTION
+    libc.include.search
+)
diff --git a/libc/src/search/CMakeLists.txt b/libc/src/search/CMakeLists.txt
index 6b7fe3ae5e123..0ed513e648ed1 100644
--- a/libc/src/search/CMakeLists.txt
+++ b/libc/src/search/CMakeLists.txt
@@ -34,6 +34,7 @@ add_entrypoint_object(
   HDRS
     hsearch.h
   DEPENDS
+    libc.hdr.types.ACTION
     libc.hdr.types.ENTRY
     libc.src.search.hsearch.global
     libc.src.__support.HashTable.table
@@ -48,6 +49,7 @@ add_entrypoint_object(
   HDRS
     hsearch_r.h
   DEPENDS
+    libc.hdr.types.ACTION
     libc.hdr.types.ENTRY
     libc.src.__support.HashTable.table
     libc.src.errno.errno
diff --git a/libc/src/search/hsearch.h b/libc/src/search/hsearch.h
index 6619451580940..820ebde522231 100644
--- a/libc/src/search/hsearch.h
+++ b/libc/src/search/hsearch.h
@@ -9,9 +9,9 @@
 #ifndef LLVM_LIBC_SRC_SEARCH_HSEARCH_H
 #define LLVM_LIBC_SRC_SEARCH_HSEARCH_H
 
+#include "hdr/types/ACTION.h"
 #include "hdr/types/ENTRY.h"
 #include "src/__support/macros/config.h"
-#include <search.h> // ACTION
 
 namespace LIBC_NAMESPACE_DECL {
 ENTRY *hsearch(ENTRY item, ACTION action);
diff --git a/libc/src/search/hsearch_r.h b/libc/src/search/hsearch_r.h
index db2f5a8d3cbe1..98f956fc6c6a7 100644
--- a/libc/src/search/hsearch_r.h
+++ b/libc/src/search/hsearch_r.h
@@ -9,9 +9,10 @@
 #ifndef LLVM_LIBC_SRC_SEARCH_HSEARCH_R_H
 #define LLVM_LIBC_SRC_SEARCH_HSEARCH_R_H
 
+#include "hdr/types/ACTION.h"
 #include "hdr/types/ENTRY.h"
 #include "src/__support/macros/config.h"
-#include <search.h> // ACTION
+#include <search.h> // hsearch_data
 
 namespace LIBC_NAMESPACE_DECL {
 int hsearch_r(ENTRY item, ACTION action, ENTRY **retval,

@lntue lntue merged commit 79e8e27 into llvm:main May 13, 2025
16 of 17 checks passed
@lntue lntue deleted the action branch May 13, 2025 21:50
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.

4 participants