[libc-commits] [libc] [libc] Fix `nanosleep` definition in the posix spec (PR #67855)
via libc-commits
libc-commits at lists.llvm.org
Fri Sep 29 14:23:40 PDT 2023
llvmbot wrote:
<!--LLVM PR SUMMARY COMMENT-->
@llvm/pr-subscribers-backend-x86
<details>
<summary>Changes</summary>
Summary:
The POSIX standard expects the first argument to this function to be
constant, e.g. https://man7.org/linux/man-pages/man2/nanosleep.2.html.
This fixes that problem and also corrects an obvious problem with
enabling this for offloading.
---
Full diff: https://github.com/llvm/llvm-project/pull/67855.diff
2 Files Affected:
- (modified) clang/lib/Headers/llvm_libc_wrappers/time.h (+1-1)
- (modified) libc/spec/posix.td (+2-1)
``````````diff
diff --git a/clang/lib/Headers/llvm_libc_wrappers/time.h b/clang/lib/Headers/llvm_libc_wrappers/time.h
index 894f6f6c7aaf774..9d1340c4eb748f0 100644
--- a/clang/lib/Headers/llvm_libc_wrappers/time.h
+++ b/clang/lib/Headers/llvm_libc_wrappers/time.h
@@ -25,7 +25,7 @@
_Static_assert(sizeof(clock_t) == sizeof(long), "ABI mismatch!");
-#include <llvm-libc-decls/ctype.h>
+#include <llvm-libc-decls/time.h>
#pragma omp end declare target
diff --git a/libc/spec/posix.td b/libc/spec/posix.td
index d09c7228549dfc7..a367cf2a6935c02 100644
--- a/libc/spec/posix.td
+++ b/libc/spec/posix.td
@@ -44,6 +44,7 @@ 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>;
@@ -1192,7 +1193,7 @@ def POSIX : StandardSpec<"POSIX"> {
FunctionSpec<
"nanosleep",
RetValSpec<IntType>,
- [ArgSpec<StructTimeSpecPtr>, ArgSpec<StructTimeSpecPtr>]
+ [ArgSpec<ConstStructTimeSpecPtr>, ArgSpec<StructTimeSpecPtr>]
>,
]
>;
``````````
</details>
https://github.com/llvm/llvm-project/pull/67855
More information about the libc-commits
mailing list