[libc-commits] [libc] [libc][signal] clean up usage of sighandler_t (PR #125745)

via libc-commits libc-commits at lists.llvm.org
Tue Feb 4 11:09:45 PST 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 953354c7afcc375e441e0e3ab4099de1b992d954 19e518a20a1acae3113efcd22ce87a82c73461b6 --extensions h,cpp -- libc/include/llvm-libc-macros/gpu/signal-macros.h libc/include/llvm-libc-macros/linux/signal-macros.h libc/include/llvm-libc-types/__sighandler_t.h libc/include/llvm-libc-types/struct_sigaction.h libc/src/signal/linux/signal.cpp libc/src/signal/signal.h libc/test/UnitTest/FPExceptMatcher.cpp libc/test/src/signal/signal_test.cpp
``````````

</details>

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

``````````diff
diff --git a/libc/include/llvm-libc-macros/linux/signal-macros.h b/libc/include/llvm-libc-macros/linux/signal-macros.h
index 6afa7facd8..b4193bcfcf 100644
--- a/libc/include/llvm-libc-macros/linux/signal-macros.h
+++ b/libc/include/llvm-libc-macros/linux/signal-macros.h
@@ -88,7 +88,7 @@
 
 #define SIG_DFL ((void (*)(int))0)
 #define SIG_IGN ((void (*)(int))1)
-#define SIG_ERR ((void (*)(int))-1)
+#define SIG_ERR ((void (*)(int)) - 1)
 
 // SIGCHLD si_codes
 #define CLD_EXITED 1    // child has exited
diff --git a/libc/src/signal/linux/signal.cpp b/libc/src/signal/linux/signal.cpp
index f196aa5263..7c8ea16c6c 100644
--- a/libc/src/signal/linux/signal.cpp
+++ b/libc/src/signal/linux/signal.cpp
@@ -17,7 +17,8 @@ namespace LIBC_NAMESPACE_DECL {
 // Our LLVM_LIBC_FUNCTION macro doesn't handle function pointer return types.
 using signal_handler = void (*)(int);
 
-LLVM_LIBC_FUNCTION(signal_handler, signal, (int signum, signal_handler handler)) {
+LLVM_LIBC_FUNCTION(signal_handler, signal,
+                   (int signum, signal_handler handler)) {
   struct sigaction action, old;
   action.sa_handler = handler;
   action.sa_flags = SA_RESTART;

``````````

</details>


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


More information about the libc-commits mailing list