[libc-commits] [libc] 101acff - [libc] Define 'size_t' in `time.h`	and `uchar.h` (#103441)
    via libc-commits 
    libc-commits at lists.llvm.org
       
    Tue Aug 13 14:02:46 PDT 2024
    
    
  
Author: Joseph Huber
Date: 2024-08-13T16:02:43-05:00
New Revision: 101acff2e5df21378b5764660afc0ec84ce6a1a6
URL: https://github.com/llvm/llvm-project/commit/101acff2e5df21378b5764660afc0ec84ce6a1a6
DIFF: https://github.com/llvm/llvm-project/commit/101acff2e5df21378b5764660afc0ec84ce6a1a6.diff
LOG: [libc] Define 'size_t' in `time.h` and `uchar.h` (#103441)
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`.
Added: 
    
Modified: 
    libc/include/time.h.def
    libc/include/uchar.h.def
    libc/newhdrgen/yaml/time.yaml
    libc/newhdrgen/yaml/uchar.yaml
    libc/spec/stdc.td
Removed: 
    
################################################################################
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
       []
        
    
    
More information about the libc-commits
mailing list