[libc-commits] [libc] [LibC] Add `sigsetjmp` and `siglongjmp` for arm/x64 darwin (PR #138417)

via libc-commits libc-commits at lists.llvm.org
Sat May 3 10:28:05 PDT 2025


github-actions[bot] wrote:

<!--LLVM CODE FORMAT COMMENT: {clang-format}-->


:warning: C/C++ code formatter, clang-format found issues in your code. :warning:

<details>
<summary>
You can test this locally with the following command:
</summary>

``````````bash
git-clang-format --diff HEAD~1 HEAD --extensions cpp -- libc/src/setjmp/darwin/X86_64/sigsetjmp.cpp libc/src/setjmp/darwin/arm/sigsetjmp.cpp libc/src/setjmp/darwin/sigsetjmp_epilogue.cpp
``````````

</details>

<details>
<summary>
View the diff from clang-format here.
</summary>

``````````diff
diff --git a/libc/src/setjmp/darwin/X86_64/sigsetjmp.cpp b/libc/src/setjmp/darwin/X86_64/sigsetjmp.cpp
index b358e5d95..3049eefe8 100644
--- a/libc/src/setjmp/darwin/X86_64/sigsetjmp.cpp
+++ b/libc/src/setjmp/darwin/X86_64/sigsetjmp.cpp
@@ -35,7 +35,7 @@ LLVM_LIBC_FUNCTION(int, sigsetjmp, (sigjmp_buf buf, int save_mask)) {
 
 .Lnosave:
       jmp %P[setjmp]                // jump directly to setjmp if no save mask is provided
-  )" :: [retaddr] "i"(offsetof(__jmp_buf, sig_retaddr)),
+  )" ::[retaddr] "i"(offsetof(__jmp_buf, sig_retaddr)),
       [extra] "i"(offsetof(__jmp_buf, sig_extra)), [setjmp] "X"(setjmp),
       [epilogue] "X"(sigsetjmp_epilogue)
       : "rax", "rbx", "rdi", "rsi");
diff --git a/libc/src/setjmp/darwin/sigsetjmp_epilogue.cpp b/libc/src/setjmp/darwin/sigsetjmp_epilogue.cpp
index 4f8e4c39a..28d364289 100644
--- a/libc/src/setjmp/darwin/sigsetjmp_epilogue.cpp
+++ b/libc/src/setjmp/darwin/sigsetjmp_epilogue.cpp
@@ -15,10 +15,12 @@ namespace LIBC_NAMESPACE_DECL {
 [[gnu::returns_twice]] int sigsetjmp_epilogue(jmp_buf buffer, int retval) {
   if (retval) {
     // Restore signal mask from the buffer using syscall_impl for macOS
-    syscall_impl<long>(SYS_rt_sigprocmask, SIG_SETMASK, &buffer->sigmask, nullptr, sizeof(sigset_t));
+    syscall_impl<long>(SYS_rt_sigprocmask, SIG_SETMASK, &buffer->sigmask,
+                       nullptr, sizeof(sigset_t));
   } else {
     // Save the current signal mask to the buffer using syscall_impl for macOS
-    syscall_impl<long>(SYS_rt_sigprocmask, SIG_BLOCK, nullptr, &buffer->sigmask, sizeof(sigset_t));
+    syscall_impl<long>(SYS_rt_sigprocmask, SIG_BLOCK, nullptr, &buffer->sigmask,
+                       sizeof(sigset_t));
   }
   return retval;
 }

``````````

</details>


https://github.com/llvm/llvm-project/pull/138417


More information about the libc-commits mailing list