[libc-commits] [libc] [libc] Define 'size_t' in `time.h` and `uchar.h` (PR #103441)
Joseph Huber via libc-commits
libc-commits at lists.llvm.org
Tue Aug 13 13:45:01 PDT 2024
https://github.com/jhuber6 created https://github.com/llvm/llvm-project/pull/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`.
>From 69cd754b93e97adf417afa65b3864ec13066ad53 Mon Sep 17 00:00:00 2001
From: Joseph Huber <huberjn at outlook.com>
Date: Tue, 13 Aug 2024 15:42:15 -0500
Subject: [PATCH] [libc] Define 'size_t' in `time.h` and `uchar.h`
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`.
---
libc/include/time.h.def | 2 --
libc/include/uchar.h.def | 1 -
libc/newhdrgen/yaml/time.yaml | 1 +
libc/newhdrgen/yaml/uchar.yaml | 1 +
libc/spec/stdc.td | 2 ++
5 files changed, 4 insertions(+), 3 deletions(-)
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