Skip to content

[libc] Move struct timespec from POSIX to StdC #85010

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
Mar 13, 2024

Conversation

petrhosek
Copy link
Member

struct timespec is actually defined in the C standard, not POSIX.

`struct timespec` is actually defined in the C standard, not POSIX.
@llvmbot
Copy link
Member

llvmbot commented Mar 13, 2024

@llvm/pr-subscribers-libc

Author: Petr Hosek (petrhosek)

Changes

struct timespec is actually defined in the C standard, not POSIX.


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

3 Files Affected:

  • (modified) libc/spec/posix.td (-4)
  • (modified) libc/spec/spec.td (+4)
  • (modified) libc/spec/stdc.td (+1)
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

@SchrodingerZhu
Copy link
Contributor

Merge according to approval.

@SchrodingerZhu SchrodingerZhu merged commit 34cf684 into llvm:main Mar 13, 2024
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.

4 participants