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

via libc-commits libc-commits at lists.llvm.org
Thu Oct 30 16:07:24 PDT 2025


llvmbot wrote:


<!--LLVM PR SUMMARY COMMENT-->

@llvm/pr-subscribers-libc

Author: Alexey Samsonov (vonosmas)

<details>
<summary>Changes</summary>

`<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.

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


1 Files Affected:

- (modified) libc/include/wchar.yaml (+1) 


``````````diff
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

``````````

</details>


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


More information about the libc-commits mailing list