Skip to content

[libc] Define 'size_t' in time.h and uchar.h #103441

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 1 commit into from
Aug 13, 2024
Merged

Conversation

jhuber6
Copy link
Contributor

@jhuber6 jhuber6 commented Aug 13, 2024

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.

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`.
@llvmbot
Copy link
Member

llvmbot commented Aug 13, 2024

@llvm/pr-subscribers-libc

Author: Joseph Huber (jhuber6)

Changes

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 --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
       []

@jhuber6 jhuber6 merged commit 101acff into llvm:main Aug 13, 2024
7 of 8 checks passed
@jhuber6 jhuber6 deleted the size_t branch September 23, 2024 13:26
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants