[llvm-branch-commits] [libc] [libc][annex_k] Add constraint_handler_t. (PR #163239)
Muhammad Bassiouni via llvm-branch-commits
llvm-branch-commits at lists.llvm.org
Wed Mar 18 15:01:52 PDT 2026
https://github.com/bassiounix updated https://github.com/llvm/llvm-project/pull/163239
>From 8f0d2c04515b3bd69137f35757bca5feade4c1b1 Mon Sep 17 00:00:00 2001
From: bassiounix <muhammad.m.bassiouni at gmail.com>
Date: Mon, 13 Oct 2025 21:14:40 +0300
Subject: [PATCH 1/3] [libc][annex_k] Add rsize_t.
---
libc/hdr/types/CMakeLists.txt | 8 +++++++
libc/hdr/types/rsize_t.h | 23 +++++++++++++++++++++
libc/include/llvm-libc-types/CMakeLists.txt | 1 +
libc/include/llvm-libc-types/rsize_t.h | 18 ++++++++++++++++
4 files changed, 50 insertions(+)
create mode 100644 libc/hdr/types/rsize_t.h
create mode 100644 libc/include/llvm-libc-types/rsize_t.h
diff --git a/libc/hdr/types/CMakeLists.txt b/libc/hdr/types/CMakeLists.txt
index ba99a02a10118..84a26ecf8fb5e 100644
--- a/libc/hdr/types/CMakeLists.txt
+++ b/libc/hdr/types/CMakeLists.txt
@@ -135,6 +135,14 @@ add_proxy_header_library(
libc.include.llvm-libc-types.struct_tm
)
+add_proxy_header_library(
+ rsize_t
+ HDRS
+ rsize_t.h
+ FULL_BUILD_DEPENDS
+ libc.include.llvm-libc-types.rsize_t
+)
+
add_proxy_header_library(
size_t
HDRS
diff --git a/libc/hdr/types/rsize_t.h b/libc/hdr/types/rsize_t.h
new file mode 100644
index 0000000000000..130e6c308e264
--- /dev/null
+++ b/libc/hdr/types/rsize_t.h
@@ -0,0 +1,23 @@
+//===-- Proxy for rsize_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_HDR_TYPES_SIZE_T_H
+#define LLVM_LIBC_HDR_TYPES_SIZE_T_H
+
+#ifdef LIBC_FULL_BUILD
+
+#include "include/llvm-libc-types/rsize_t.h"
+
+#else
+
+#define __need_rsize_t
+#include <stddef.h>
+#undef __need_rsize_t
+
+#endif // LIBC_FULL_BUILD
+
+#endif // LLVM_LIBC_HDR_TYPES_SIZE_T_H
diff --git a/libc/include/llvm-libc-types/CMakeLists.txt b/libc/include/llvm-libc-types/CMakeLists.txt
index 09f9d759f0dd8..d3a3c109aacc0 100644
--- a/libc/include/llvm-libc-types/CMakeLists.txt
+++ b/libc/include/llvm-libc-types/CMakeLists.txt
@@ -1,4 +1,5 @@
add_header(off64_t HDR off64_t.h)
+add_header(rsize_t HDR rsize_t.h)
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)
diff --git a/libc/include/llvm-libc-types/rsize_t.h b/libc/include/llvm-libc-types/rsize_t.h
new file mode 100644
index 0000000000000..dc8be02bee592
--- /dev/null
+++ b/libc/include/llvm-libc-types/rsize_t.h
@@ -0,0 +1,18 @@
+//===-- Definition of size_t types ----------------------------------------===//
+//
+// 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_RSIZE_T_H
+#define LLVM_LIBC_TYPES_RSIZE_T_H
+
+#ifdef LIBC_HAS_ANNEX_K
+
+typedef __SIZE_TYPE__ rsize_t;
+
+#endif // LIBC_HAS_ANNEX_K
+
+#endif // LLVM_LIBC_TYPES_RSIZE_T_H
>From d044f0f9db9ce651feec3e44cf864c53453fa211 Mon Sep 17 00:00:00 2001
From: bassiounix <muhammad.m.bassiouni at gmail.com>
Date: Mon, 13 Oct 2025 21:38:25 +0300
Subject: [PATCH 2/3] [libc][annex_k] Add constraint_handler_t.
---
libc/hdr/types/CMakeLists.txt | 9 ++++++++
libc/hdr/types/constraint_handler_t.h | 18 ++++++++++++++++
libc/include/CMakeLists.txt | 1 +
libc/include/llvm-libc-types/CMakeLists.txt | 2 ++
.../llvm-libc-types/constraint_handler_t.h | 21 +++++++++++++++++++
libc/include/stdlib.yaml | 1 +
6 files changed, 52 insertions(+)
create mode 100644 libc/hdr/types/constraint_handler_t.h
create mode 100644 libc/include/llvm-libc-types/constraint_handler_t.h
diff --git a/libc/hdr/types/CMakeLists.txt b/libc/hdr/types/CMakeLists.txt
index 84a26ecf8fb5e..46dee9baa59db 100644
--- a/libc/hdr/types/CMakeLists.txt
+++ b/libc/hdr/types/CMakeLists.txt
@@ -170,6 +170,15 @@ add_proxy_header_library(
libc.include.fcntl
)
+add_proxy_header_library(
+ constraint_handler_t
+ HDRS
+ constraint_handler_t.h
+ FULL_BUILD_DEPENDS
+ libc.include.llvm-libc-types.constraint_handler_t
+ libc.include.stdlib
+)
+
add_proxy_header_library(
errno_t
HDRS
diff --git a/libc/hdr/types/constraint_handler_t.h b/libc/hdr/types/constraint_handler_t.h
new file mode 100644
index 0000000000000..ca7798b84228e
--- /dev/null
+++ b/libc/hdr/types/constraint_handler_t.h
@@ -0,0 +1,18 @@
+//===-- Proxy for constraint_handler_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_HDR_TYPES_CONSTRAINT_HANDLER_T_H
+#define LLVM_LIBC_HDR_TYPES_CONSTRAINT_HANDLER_T_H
+
+#define LIBC_HAS_ANNEX_K
+
+#include "include/llvm-libc-types/constraint_handler_t.h"
+
+#undef LIBC_HAS_ANNEX_K
+
+#endif // LLVM_LIBC_HDR_TYPES_CONSTRAINT_HANDLER_T_H
diff --git a/libc/include/CMakeLists.txt b/libc/include/CMakeLists.txt
index 9eae20c820e98..a9012f5597119 100644
--- a/libc/include/CMakeLists.txt
+++ b/libc/include/CMakeLists.txt
@@ -382,6 +382,7 @@ add_header_macro(
.llvm-libc-types.__qsortcompare_t
.llvm-libc-types.__qsortrcompare_t
.llvm-libc-types.__search_compare_t
+ .llvm-libc-types.constraint_handler_t
.llvm-libc-types.div_t
.llvm-libc-types.ldiv_t
.llvm-libc-types.lldiv_t
diff --git a/libc/include/llvm-libc-types/CMakeLists.txt b/libc/include/llvm-libc-types/CMakeLists.txt
index d3a3c109aacc0..467f273b70f67 100644
--- a/libc/include/llvm-libc-types/CMakeLists.txt
+++ b/libc/include/llvm-libc-types/CMakeLists.txt
@@ -565,3 +565,5 @@ add_header(EFI_SYSTEM_TABLE
.EFI_TABLE_HEADER
.char16_t
)
+
+add_header(constraint_handler_t HDR constraint_handler_t.h DEPENDS .errno_t)
diff --git a/libc/include/llvm-libc-types/constraint_handler_t.h b/libc/include/llvm-libc-types/constraint_handler_t.h
new file mode 100644
index 0000000000000..efd21296cd399
--- /dev/null
+++ b/libc/include/llvm-libc-types/constraint_handler_t.h
@@ -0,0 +1,21 @@
+//===-- Definition of type constraint_handler_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_INCLUDE_LLVM_LIBC_TYPES_CONSTRAINT_HANDLER_T_H
+#define LLVM_LIBC_INCLUDE_LLVM_LIBC_TYPES_CONSTRAINT_HANDLER_T_H
+
+#include "errno_t.h"
+
+#ifdef LIBC_HAS_ANNEX_K
+
+typedef void (*constraint_handler_t)(const char *__restrict, void *__restrict,
+ errno_t);
+
+#endif // LIBC_HAS_ANNEX_K
+
+#endif // LLVM_LIBC_INCLUDE_LLVM_LIBC_TYPES_CONSTRAINT_HANDLER_T_H
diff --git a/libc/include/stdlib.yaml b/libc/include/stdlib.yaml
index 4752244279243..ed189c3cd19ba 100644
--- a/libc/include/stdlib.yaml
+++ b/libc/include/stdlib.yaml
@@ -12,6 +12,7 @@ types:
- type_name: __qsortcompare_t
- type_name: __qsortrcompare_t
- type_name: __search_compare_t
+ - type_name: constraint_handler_t
- type_name: div_t
- type_name: ldiv_t
- type_name: lldiv_t
>From 526567d8d0390b9da44a48e049b388aa4ada0f3e Mon Sep 17 00:00:00 2001
From: bassiounix <muhammad.m.bassiouni at gmail.com>
Date: Tue, 14 Oct 2025 00:55:56 +0300
Subject: [PATCH 3/3] change location
---
libc/include/llvm-libc-types/CMakeLists.txt | 3 +--
1 file changed, 1 insertion(+), 2 deletions(-)
diff --git a/libc/include/llvm-libc-types/CMakeLists.txt b/libc/include/llvm-libc-types/CMakeLists.txt
index 467f273b70f67..3cf1415695556 100644
--- a/libc/include/llvm-libc-types/CMakeLists.txt
+++ b/libc/include/llvm-libc-types/CMakeLists.txt
@@ -31,6 +31,7 @@ add_header(DIR HDR DIR.h)
add_header(dev_t HDR dev_t.h)
add_header(div_t HDR div_t.h)
add_header(errno_t HDR errno_t.h DEPENDS libc.include.llvm-libc-macros.annex_k_macros)
+add_header(constraint_handler_t HDR constraint_handler_t.h DEPENDS .errno_t)
add_header(ldiv_t HDR ldiv_t.h)
add_header(lldiv_t HDR lldiv_t.h)
add_header(FILE HDR FILE.h)
@@ -565,5 +566,3 @@ add_header(EFI_SYSTEM_TABLE
.EFI_TABLE_HEADER
.char16_t
)
-
-add_header(constraint_handler_t HDR constraint_handler_t.h DEPENDS .errno_t)
More information about the llvm-branch-commits
mailing list