[clang] [libc] Fix `nanosleep` definition in the posix spec (PR #67855)
https://github.com/jhuber6 closed https://github.com/llvm/llvm-project/pull/67855 ___ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits
[clang] [libc] Fix `nanosleep` definition in the posix spec (PR #67855)
https://github.com/michaelrj-google approved this pull request. LGTM from the libc side. https://github.com/llvm/llvm-project/pull/67855 ___ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits
[clang] [libc] Fix `nanosleep` definition in the posix spec (PR #67855)
llvmbot wrote: @llvm/pr-subscribers-backend-x86 Changes 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 +#include #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; def StructTimeSpec : NamedType<"struct timespec">; def StructTimeSpecPtr : PtrType; +def ConstStructTimeSpecPtr : ConstType; def StructSchedParam : NamedType<"struct sched_param">; def StructSchedParamPtr : PtrType; @@ -1192,7 +1193,7 @@ def POSIX : StandardSpec<"POSIX"> { FunctionSpec< "nanosleep", RetValSpec, - [ArgSpec, ArgSpec] + [ArgSpec, ArgSpec] >, ] >; `` https://github.com/llvm/llvm-project/pull/67855 ___ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits
[clang] [libc] Fix `nanosleep` definition in the posix spec (PR #67855)
https://github.com/jhuber6 created https://github.com/llvm/llvm-project/pull/67855 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. >From dc61d147265b036c7b439ebff80c4319e5330100 Mon Sep 17 00:00:00 2001 From: Joseph Huber Date: Fri, 29 Sep 2023 16:20:40 -0500 Subject: [PATCH] [libc] Fix `nanosleep` definition in the posix spec 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. --- clang/lib/Headers/llvm_libc_wrappers/time.h | 2 +- libc/spec/posix.td | 3 ++- 2 files changed, 3 insertions(+), 2 deletions(-) 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 +#include #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; def StructTimeSpec : NamedType<"struct timespec">; def StructTimeSpecPtr : PtrType; +def ConstStructTimeSpecPtr : ConstType; def StructSchedParam : NamedType<"struct sched_param">; def StructSchedParamPtr : PtrType; @@ -1192,7 +1193,7 @@ def POSIX : StandardSpec<"POSIX"> { FunctionSpec< "nanosleep", RetValSpec, - [ArgSpec, ArgSpec] + [ArgSpec, ArgSpec] >, ] >; ___ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits