[libc-commits] [libc] [libc] implement sigsetjmp/siglongjmp for x86-64 (PR #136072)
Michael Jones via libc-commits
libc-commits at lists.llvm.org
Thu Apr 17 09:32:59 PDT 2025
================
@@ -0,0 +1,76 @@
+//===-- Unittests for sigsetjmp and siglongjmp ----------------------------===//
+//
+// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
+// See https://llvm.org/LICENSE.txt for license information.
+// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
+//
+//===----------------------------------------------------------------------===//
+
+#include "src/setjmp/siglongjmp.h"
+#include "src/setjmp/sigsetjmp.h"
+#include "src/signal/sigprocmask.h"
+#include "src/string/memory_utils/inline_memcmp.h"
+#include "src/string/memory_utils/inline_memset.h"
+#include "test/UnitTest/Test.h"
+
+constexpr int MAX_LOOP = 123;
+int longjmp_called = 0;
+
+void jump_back(jmp_buf buf, int n) {
+ longjmp_called++;
+ LIBC_NAMESPACE::siglongjmp(buf, n); // Will return |n| out of setjmp
+}
+
+#define SMOKE_TESTS(SUFFIX, FLAG) \
----------------
michaelrj-google wrote:
since there would only be two copies of this, I'd recommend just writing them out explicitly. When a test fails, the main starting point for debugging is the line number, and when the line number is halfway through a macro it's less clear what happened.
https://github.com/llvm/llvm-project/pull/136072
More information about the libc-commits
mailing list