[libc-commits] [libc] [libc] Add "struct tm" declaration to <wchar.h> (PR #165795)

Alexey Samsonov via libc-commits libc-commits at lists.llvm.org
Thu Oct 30 16:06:45 PDT 2025


https://github.com/vonosmas created https://github.com/llvm/llvm-project/pull/165795

`<wchar.h>` should at least include the forward declaration of `struct tm`,
since it's needed for the `wcsftime` declaration (also, see https://man7.org/linux/man-pages/man0/wchar.h.0p.html).

Even though we don't yet have `wcsftime`, some downstream users (notably - libcxx) expects to see `struct tm`
declaration there, to re-declare it under `std` namespace: https://github.com/llvm/llvm-project/blob/c46bfed1a484d30cd251a9a225649d74e3bf0af5/libcxx/include/cwchar#L135

So, add this type declaration to llvm-libc version of `wchar.h` now.

>From af45df1f4f137967141970813d0ba30e18f02f7b Mon Sep 17 00:00:00 2001
From: Alexey Samsonov <vonosmas at gmail.com>
Date: Thu, 30 Oct 2025 22:59:45 +0000
Subject: [PATCH] [libc] Add "struct tm" declaration to <wchar.h>

---
 libc/include/wchar.yaml | 1 +
 1 file changed, 1 insertion(+)

diff --git a/libc/include/wchar.yaml b/libc/include/wchar.yaml
index c8b9e21b56b28..77af0fd4219e7 100644
--- a/libc/include/wchar.yaml
+++ b/libc/include/wchar.yaml
@@ -6,6 +6,7 @@ macros:
 types:
   - type_name: FILE
   - type_name: size_t
+  - type_name: struct_tm
   - type_name: wint_t
   - type_name: wchar_t
   - type_name: mbstate_t



More information about the libc-commits mailing list