[libc-commits] [libc] [libc] Define 'size_t' in `time.h` and `uchar.h` (PR #103441)

via libc-commits libc-commits at lists.llvm.org
Tue Aug 13 13:45:39 PDT 2024


llvmbot wrote:


<!--LLVM PR SUMMARY COMMENT-->

@llvm/pr-subscribers-libc

Author: Joseph Huber (jhuber6)

<details>
<summary>Changes</summary>

Summary:
The standard says the following: The <time.h> header shall define the
clock_t, size_t, time_t, types as described in <sys/types.h>. I couldn't
find one for `uchar.h` but it needs it once we define things like
`mbrtoc8`.


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


5 Files Affected:

- (modified) libc/include/time.h.def (-2) 
- (modified) libc/include/uchar.h.def (-1) 
- (modified) libc/newhdrgen/yaml/time.yaml (+1) 
- (modified) libc/newhdrgen/yaml/uchar.yaml (+1) 
- (modified) libc/spec/stdc.td (+2) 


``````````diff
diff --git a/libc/include/time.h.def b/libc/include/time.h.def
index 3776dfcadad28e..2355e8822fad7a 100644
--- a/libc/include/time.h.def
+++ b/libc/include/time.h.def
@@ -11,8 +11,6 @@
 
 #include "__llvm-libc-common.h"
 #include "llvm-libc-macros/time-macros.h"
-#include "llvm-libc-types/clock_t.h"
-#include "llvm-libc-types/clockid_t.h"
 
 %%public_api()
 
diff --git a/libc/include/uchar.h.def b/libc/include/uchar.h.def
index 83400f4aba2eef..31b7fcb73ded6a 100644
--- a/libc/include/uchar.h.def
+++ b/libc/include/uchar.h.def
@@ -10,7 +10,6 @@
 #define LLVM_LIBC_UCHAR_H
 
 #include "__llvm-libc-common.h"
-#include "llvm-libc-types/mbstate_t.h"
 
 %%public_api()
 
diff --git a/libc/newhdrgen/yaml/time.yaml b/libc/newhdrgen/yaml/time.yaml
index 64a112be091fa5..d2344671831c7a 100644
--- a/libc/newhdrgen/yaml/time.yaml
+++ b/libc/newhdrgen/yaml/time.yaml
@@ -7,6 +7,7 @@ types:
   - type_name: struct_tm
   - type_name: time_t
   - type_name: clock_t
+  - type_name: size_t
 enums: []
 objects: []
 functions:
diff --git a/libc/newhdrgen/yaml/uchar.yaml b/libc/newhdrgen/yaml/uchar.yaml
index dd111af6294d7d..18ca840612e070 100644
--- a/libc/newhdrgen/yaml/uchar.yaml
+++ b/libc/newhdrgen/yaml/uchar.yaml
@@ -7,6 +7,7 @@ types:
   - type_name: char16_t
   - type_name: char8_t
   - type_name: mbstate_t
+  - type_name: size_t
 enums: []
 objects: []
 functions: []
diff --git a/libc/spec/stdc.td b/libc/spec/stdc.td
index e06a4f9b268e66..74afb60725b7f1 100644
--- a/libc/spec/stdc.td
+++ b/libc/spec/stdc.td
@@ -1475,6 +1475,7 @@ def StdC : StandardSpec<"stdc"> {
          StructTmType,
          StructTimeSpec,
          TimeTType,
+         SizeTType,
       ],
       [], // Enumerations
       [
@@ -1562,6 +1563,7 @@ def StdC : StandardSpec<"stdc"> {
         Char8TType,
         Char16TType,
         Char32TType,
+        SizeTType,
       ],
       [], // Enumerations
       []

``````````

</details>


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


More information about the libc-commits mailing list