[libc-commits] [libc] [libc] Add missing const qualifiers to a few functions in <time.h> (PR #185311)

via libc-commits libc-commits at lists.llvm.org
Sun Mar 8 11:35:33 PDT 2026


llvmbot wrote:


<!--LLVM PR SUMMARY COMMENT-->

@llvm/pr-subscribers-libc

Author: Alexey Samsonov (vonosmas)

<details>
<summary>Changes</summary>

`asctime_r`, `gmtime`, and `gmtime_r` were missing const-qualifiers for a first function argument. Add them to fix generated `<time.h>` header.

Implementation headers / source files are declaring arguments correctly.

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


1 Files Affected:

- (modified) libc/include/time.yaml (+3-3) 


``````````diff
diff --git a/libc/include/time.yaml b/libc/include/time.yaml
index c2b8a1e4cfb8e..bf68da326ccd4 100644
--- a/libc/include/time.yaml
+++ b/libc/include/time.yaml
@@ -26,7 +26,7 @@ functions:
       - stdc
     return_type: char *
     arguments:
-      - type: struct tm *
+      - type: const struct tm *
       - type: char *
   - name: ctime
     standard:
@@ -93,13 +93,13 @@ functions:
       - stdc
     return_type: struct tm *
     arguments:
-      - type: time_t *
+      - type: const time_t *
   - name: gmtime_r
     standard:
       - stdc
     return_type: struct tm *
     arguments:
-      - type: time_t *
+      - type: const time_t *
       - type: struct tm *
   - name: mktime
     standard:

``````````

</details>


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


More information about the libc-commits mailing list