[libc-commits] [libc] [libc][setjmp] fix setjmp test (PR #88054)

via libc-commits libc-commits at lists.llvm.org
Mon Apr 8 14:52:33 PDT 2024


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 af34a5d382bc7cd93c620efa00dce449de252a0a 56505cb5281beb94cea5b6146e2aeb5df8962fa1 -- libc/src/setjmp/x86_64/setjmp.cpp
``````````

</details>

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

``````````diff
diff --git a/libc/src/setjmp/x86_64/setjmp.cpp b/libc/src/setjmp/x86_64/setjmp.cpp
index 1380777b8e..7d05b6eb76 100644
--- a/libc/src/setjmp/x86_64/setjmp.cpp
+++ b/libc/src/setjmp/x86_64/setjmp.cpp
@@ -16,8 +16,7 @@
 
 namespace LIBC_NAMESPACE {
 
-__attribute__((naked))
-LLVM_LIBC_FUNCTION(int, setjmp, (__jmp_buf * buf)) {
+__attribute__((naked)) LLVM_LIBC_FUNCTION(int, setjmp, (__jmp_buf * buf)) {
   asm("mov %%rbx, %c[rbx](%%rdi)\n\t"
       "mov %%rbp, %c[rbp](%%rdi)\n\t"
       "mov %%r12, %c[r12](%%rdi)\n\t"
@@ -31,13 +30,13 @@ LLVM_LIBC_FUNCTION(int, setjmp, (__jmp_buf * buf)) {
       "mov %[read_rip], %c[rip](%%rdi)\n\t"
 
       "xorl %%eax, %%eax\n\t"
-      "retq"
-      ::
-      [rbx] "i"(offsetof(__jmp_buf, rbx)), [r12] "i"(offsetof(__jmp_buf, r12)),
-      [r13] "i"(offsetof(__jmp_buf, r13)), [r14] "i"(offsetof(__jmp_buf, r14)),
-      [r15] "i"(offsetof(__jmp_buf, r15)), [rbp] "i"(offsetof(__jmp_buf, rbp)),
-      [rsp] "i"(offsetof(__jmp_buf, rsp)), [rip] "i"(offsetof(__jmp_buf, rip)),
-      [read_rip] "r" (reinterpret_cast<__UINTPTR_TYPE__>(__builtin_return_address(0)))
+      "retq" ::[rbx] "i"(offsetof(__jmp_buf, rbx)),
+      [r12] "i"(offsetof(__jmp_buf, r12)), [r13] "i"(offsetof(__jmp_buf, r13)),
+      [r14] "i"(offsetof(__jmp_buf, r14)), [r15] "i"(offsetof(__jmp_buf, r15)),
+      [rbp] "i"(offsetof(__jmp_buf, rbp)), [rsp] "i"(offsetof(__jmp_buf, rsp)),
+      [rip] "i"(offsetof(__jmp_buf, rip)),
+      [read_rip] "r"(
+          reinterpret_cast<__UINTPTR_TYPE__>(__builtin_return_address(0)))
       : "rax");
 }
 

``````````

</details>


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


More information about the libc-commits mailing list