[libc-commits] [libc] 27ba9e2 - [libc] Define Annex K's errno_t in specified headers (#187700)
via libc-commits
libc-commits at lists.llvm.org
Wed Mar 25 05:30:27 PDT 2026
Author: Victor Campos
Date: 2026-03-25T12:30:19Z
New Revision: 27ba9e2a44c11f8123528c350227db2c9a707c8f
URL: https://github.com/llvm/llvm-project/commit/27ba9e2a44c11f8123528c350227db2c9a707c8f
DIFF: https://github.com/llvm/llvm-project/commit/27ba9e2a44c11f8123528c350227db2c9a707c8f.diff
LOG: [libc] Define Annex K's errno_t in specified headers (#187700)
- Change `errno.h.def` to include a placeholder where hdrgen emits the
public API, which contains the `errno_t` definition.
- Make headers `stdio.h`, `stdlib.h`, `string.h` and `time.h` also
define `errno_t` as specified in the standard.
Added:
Modified:
libc/include/CMakeLists.txt
libc/include/errno.h.def
libc/include/stdio.yaml
libc/include/stdlib.yaml
libc/include/string.yaml
libc/include/time.yaml
Removed:
################################################################################
diff --git a/libc/include/CMakeLists.txt b/libc/include/CMakeLists.txt
index fb4de420e455a..18220de13d268 100644
--- a/libc/include/CMakeLists.txt
+++ b/libc/include/CMakeLists.txt
@@ -253,6 +253,7 @@ add_header_macro(
DEPENDS
.llvm_libc_common_h
.llvm-libc-macros.null_macro
+ .llvm-libc-types.errno_t
.llvm-libc-types.size_t
)
@@ -288,6 +289,7 @@ add_header_macro(
.llvm-libc-macros.null_macro
.llvm-libc-macros.time_macros
.llvm-libc-types.clock_t
+ .llvm-libc-types.errno_t
.llvm-libc-types.time_t
.llvm-libc-types.struct_tm
.llvm-libc-types.struct_timespec
@@ -366,6 +368,7 @@ add_header_macro(
.llvm-libc-macros.stdio_macros
.llvm-libc-types.FILE
.llvm-libc-types.cookie_io_functions_t
+ .llvm-libc-types.errno_t
.llvm-libc-types.off_t
.llvm-libc-types.size_t
.llvm-libc-types.ssize_t
@@ -385,6 +388,7 @@ add_header_macro(
.llvm-libc-types.__search_compare_t
.llvm-libc-types.constraint_handler_t
.llvm-libc-types.div_t
+ .llvm-libc-types.errno_t
.llvm-libc-types.ldiv_t
.llvm-libc-types.lldiv_t
.llvm-libc-types.locale_t
diff --git a/libc/include/errno.h.def b/libc/include/errno.h.def
index 0ac8e57f7a158..f731accc3b24b 100644
--- a/libc/include/errno.h.def
+++ b/libc/include/errno.h.def
@@ -31,6 +31,8 @@
#endif
+%%public_api()
+
__BEGIN_C_DECLS
int *__llvm_libc_errno(void) __NOEXCEPT;
diff --git a/libc/include/stdio.yaml b/libc/include/stdio.yaml
index 67eeeaf07bdd1..ad556e659f433 100644
--- a/libc/include/stdio.yaml
+++ b/libc/include/stdio.yaml
@@ -14,6 +14,7 @@ types:
- type_name: off_t
- type_name: cookie_io_functions_t
- type_name: FILE
+ - type_name: errno_t
enums: []
objects:
- object_name: stdin
diff --git a/libc/include/stdlib.yaml b/libc/include/stdlib.yaml
index ed189c3cd19ba..f7275a51b93db 100644
--- a/libc/include/stdlib.yaml
+++ b/libc/include/stdlib.yaml
@@ -18,7 +18,8 @@ types:
- type_name: lldiv_t
- type_name: locale_t
- type_name: size_t
- - type_name: wchar_t
+ - type_name: wchar_t
+ - type_name: errno_t
enums: []
objects: []
functions:
diff --git a/libc/include/string.yaml b/libc/include/string.yaml
index 22010f4afa812..c781060bb59b6 100644
--- a/libc/include/string.yaml
+++ b/libc/include/string.yaml
@@ -5,6 +5,7 @@ macros:
- macro_name: "NULL"
macro_header: null-macro.h
types:
+ - type_name: errno_t
- type_name: locale_t
- type_name: size_t
enums: []
diff --git a/libc/include/time.yaml b/libc/include/time.yaml
index bf68da326ccd4..26ce829939f64 100644
--- a/libc/include/time.yaml
+++ b/libc/include/time.yaml
@@ -6,6 +6,7 @@ macros:
types:
- type_name: struct_timeval
- type_name: clockid_t
+ - type_name: errno_t
- type_name: struct_timespec
- type_name: struct_tm
- type_name: time_t
More information about the libc-commits
mailing list