[libc-commits] [libc] [libc][i386] setjmp/longjmp (PR #112437)

via libc-commits libc-commits at lists.llvm.org
Tue Oct 15 14:04:38 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 46200fcf941d16bc8a494a3915e1178502e37a3e 1d9d3d408ab24edfb58e2019e59c26a7b9aca9d2 --extensions cpp,h -- libc/include/llvm-libc-types/jmp_buf.h libc/src/setjmp/longjmp.h libc/src/setjmp/x86_64/longjmp.cpp 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/longjmp.cpp b/libc/src/setjmp/x86_64/longjmp.cpp
index f27e5f055d..5c23b3f7a9 100644
--- a/libc/src/setjmp/x86_64/longjmp.cpp
+++ b/libc/src/setjmp/x86_64/longjmp.cpp
@@ -6,10 +6,10 @@
 //
 //===----------------------------------------------------------------------===//
 
+#include "src/setjmp/longjmp.h"
 #include "include/llvm-libc-macros/offsetof-macro.h"
 #include "src/__support/common.h"
 #include "src/__support/macros/config.h"
-#include "src/setjmp/longjmp.h"
 
 #if !defined(LIBC_TARGET_ARCH_IS_X86)
 #error "Invalid file include"
@@ -30,16 +30,11 @@ LLVM_LIBC_FUNCTION(void, longjmp, (jmp_buf, int val)) {
       mov %c[esp](%%edx), %%esp
 
       jmp *%c[eip](%%edx)
-      )"
-      ::
-      [ebx] "i"(offsetof(__jmp_buf, ebx)),
-      [esi] "i"(offsetof(__jmp_buf, esi)),
-      [edi] "i"(offsetof(__jmp_buf, edi)),
-      [ebp] "i"(offsetof(__jmp_buf, ebp)),
-      [esp] "i"(offsetof(__jmp_buf, esp)),
-      [eip] "i"(offsetof(__jmp_buf, eip)),
-      [val] "a"(val == 0 ? 1 : val) :
-      "edx");
+      )" ::[ebx] "i"(offsetof(__jmp_buf, ebx)),
+      [esi] "i"(offsetof(__jmp_buf, esi)), [edi] "i"(offsetof(__jmp_buf, edi)),
+      [ebp] "i"(offsetof(__jmp_buf, ebp)), [esp] "i"(offsetof(__jmp_buf, esp)),
+      [eip] "i"(offsetof(__jmp_buf, eip)), [val] "a"(val == 0 ? 1 : val)
+      : "edx");
   __builtin_unreachable();
 }
 #else
diff --git a/libc/src/setjmp/x86_64/setjmp.cpp b/libc/src/setjmp/x86_64/setjmp.cpp
index 90532c5654..5ac10fa87b 100644
--- a/libc/src/setjmp/x86_64/setjmp.cpp
+++ b/libc/src/setjmp/x86_64/setjmp.cpp
@@ -35,12 +35,9 @@ LLVM_LIBC_FUNCTION(int, setjmp, (jmp_buf buf)) {
       mov %%ecx, %c[eip](%%eax)
 
       xorl %%eax, %%eax
-      retl)" ::
-      [ebx] "i"(offsetof(__jmp_buf, ebx)),
-      [esi] "i"(offsetof(__jmp_buf, esi)),
-      [edi] "i"(offsetof(__jmp_buf, edi)),
-      [ebp] "i"(offsetof(__jmp_buf, ebp)),
-      [esp] "i"(offsetof(__jmp_buf, esp)),
+      retl)" ::[ebx] "i"(offsetof(__jmp_buf, ebx)),
+      [esi] "i"(offsetof(__jmp_buf, esi)), [edi] "i"(offsetof(__jmp_buf, edi)),
+      [ebp] "i"(offsetof(__jmp_buf, ebp)), [esp] "i"(offsetof(__jmp_buf, esp)),
       [eip] "i"(offsetof(__jmp_buf, eip))
       : "eax", "ecx");
 }

``````````

</details>


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


More information about the libc-commits mailing list