[libc-commits] [libc] 80034dd - [libc][annex_k] Add rsize_t (#163238)
via libc-commits
libc-commits at lists.llvm.org
Wed Mar 18 16:59:34 PDT 2026
Author: Muhammad Bassiouni
Date: 2026-03-19T01:59:30+02:00
New Revision: 80034dd582d32092380a81529f51ed86c38514cb
URL: https://github.com/llvm/llvm-project/commit/80034dd582d32092380a81529f51ed86c38514cb
DIFF: https://github.com/llvm/llvm-project/commit/80034dd582d32092380a81529f51ed86c38514cb.diff
LOG: [libc][annex_k] Add rsize_t (#163238)
RFC
https://discourse.llvm.org/t/rfc-bounds-checking-interfaces-for-llvm-libc/87685
Add `rsize_t` type required by Annex K interface in LLVM libc.
Added:
libc/hdr/types/rsize_t.h
libc/include/llvm-libc-types/rsize_t.h
Modified:
libc/hdr/types/CMakeLists.txt
libc/include/llvm-libc-types/CMakeLists.txt
Removed:
################################################################################
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..b03e4fa830b05 100644
--- a/libc/include/llvm-libc-types/CMakeLists.txt
+++ b/libc/include/llvm-libc-types/CMakeLists.txt
@@ -1,5 +1,13 @@
add_header(off64_t HDR off64_t.h)
add_header(size_t HDR size_t.h)
+add_header(
+ rsize_t
+ HDR
+ rsize_t.h
+ DEPENDS
+ .size_t
+ libc.include.llvm-libc-macros.annex_k_macros
+)
add_header(ssize_t HDR ssize_t.h)
add_header(__atfork_callback_t HDR __atfork_callback_t.h)
add_header(__search_compare_t HDR __search_compare_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..c03d00043bc3e
--- /dev/null
+++ b/libc/include/llvm-libc-types/rsize_t.h
@@ -0,0 +1,22 @@
+//===-- Definition of rsize_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
+
+#include "../llvm-libc-macros/annex-k-macros.h"
+
+#ifdef LIBC_HAS_ANNEX_K
+
+#include "size_t.h"
+
+typedef size_t rsize_t;
+
+#endif // LIBC_HAS_ANNEX_K
+
+#endif // LLVM_LIBC_TYPES_RSIZE_T_H
More information about the libc-commits
mailing list