[libc-commits] [libc] [libc] Move `struct timespec` from POSIX to StdC (PR #85010)
Petr Hosek via libc-commits
libc-commits at lists.llvm.org
Tue Mar 12 18:38:50 PDT 2024
https://github.com/petrhosek created https://github.com/llvm/llvm-project/pull/85010
`struct timespec` is actually defined in the C standard, not POSIX.
>From 4d7de950681888424f4046d4917a126a8988e8d9 Mon Sep 17 00:00:00 2001
From: Petr Hosek <phosek at google.com>
Date: Tue, 12 Mar 2024 18:36:27 -0700
Subject: [PATCH] [libc] Move `struct timespec` from POSIX to StdC
`struct timespec` is actually defined in the C standard, not POSIX.
---
libc/spec/posix.td | 4 ----
libc/spec/spec.td | 4 ++++
libc/spec/stdc.td | 1 +
3 files changed, 5 insertions(+), 4 deletions(-)
diff --git a/libc/spec/posix.td b/libc/spec/posix.td
index d0f5a4584dd45b..591919aac95dd5 100644
--- a/libc/spec/posix.td
+++ b/libc/spec/posix.td
@@ -42,10 +42,6 @@ def StructDirentPtr : PtrType<StructDirent>;
def StructDirentPtrPtr : PtrType<StructDirentPtr>;
def ConstStructDirentPtrPtr : ConstType<StructDirentPtrPtr>;
-def StructTimeSpec : NamedType<"struct timespec">;
-def StructTimeSpecPtr : PtrType<StructTimeSpec>;
-def ConstStructTimeSpecPtr : ConstType<StructTimeSpecPtr>;
-
def StructSchedParam : NamedType<"struct sched_param">;
def StructSchedParamPtr : PtrType<StructSchedParam>;
def ConstStructSchedParamPtr : ConstType<StructSchedParamPtr>;
diff --git a/libc/spec/spec.td b/libc/spec/spec.td
index a44a7ae131b5d9..580bd9c8c3c1c6 100644
--- a/libc/spec/spec.td
+++ b/libc/spec/spec.td
@@ -118,6 +118,10 @@ def SigHandlerT : NamedType<"__sighandler_t">;
def TimeTType : NamedType<"time_t">;
+def StructTimeSpec : NamedType<"struct timespec">;
+def StructTimeSpecPtr : PtrType<StructTimeSpec>;
+def ConstStructTimeSpecPtr : ConstType<StructTimeSpecPtr>;
+
def BSearchCompareT : NamedType<"__bsearchcompare_t">;
def QSortCompareT : NamedType<"__qsortcompare_t">;
diff --git a/libc/spec/stdc.td b/libc/spec/stdc.td
index e012d0dee08982..e8f73dde88fcc8 100644
--- a/libc/spec/stdc.td
+++ b/libc/spec/stdc.td
@@ -1202,6 +1202,7 @@ def StdC : StandardSpec<"stdc"> {
[ // Types
ClockT,
StructTmType,
+ StructTimeSpec,
TimeTType,
],
[], // Enumerations
More information about the libc-commits
mailing list