[libc-commits] [libc] [libc][nfc] Fix ucontext buildbot failure with noexcept (#192343) (PR #192601)
via libc-commits
libc-commits at lists.llvm.org
Thu Apr 16 23:54:44 PDT 2026
llvmbot wrote:
<!--LLVM PR SUMMARY COMMENT-->
@llvm/pr-subscribers-libc
Author: Jeff Bailey (kaladron)
<details>
<summary>Changes</summary>
Added noexcept to getcontext and setcontext declarations and definitions to resolve missing attribute warning on aliases.
This fixes failures on builders using GCC like libc-x86_64-debian-gcc-fullbuild-dbg.
---
Full diff: https://github.com/llvm/llvm-project/pull/192601.diff
4 Files Affected:
- (modified) libc/src/ucontext/getcontext.h (+1-1)
- (modified) libc/src/ucontext/setcontext.h (+1-1)
- (modified) libc/src/ucontext/x86_64/getcontext.cpp (+2-1)
- (modified) libc/src/ucontext/x86_64/setcontext.cpp (+1-1)
``````````diff
diff --git a/libc/src/ucontext/getcontext.h b/libc/src/ucontext/getcontext.h
index 337e360f77d31..00efbe04717bd 100644
--- a/libc/src/ucontext/getcontext.h
+++ b/libc/src/ucontext/getcontext.h
@@ -14,7 +14,7 @@
namespace LIBC_NAMESPACE_DECL {
-int getcontext(ucontext_t *ucp);
+int getcontext(ucontext_t *ucp) noexcept;
} // namespace LIBC_NAMESPACE_DECL
diff --git a/libc/src/ucontext/setcontext.h b/libc/src/ucontext/setcontext.h
index fc4cc5f74ee8f..86a25b3a41245 100644
--- a/libc/src/ucontext/setcontext.h
+++ b/libc/src/ucontext/setcontext.h
@@ -14,7 +14,7 @@
namespace LIBC_NAMESPACE_DECL {
-int setcontext(const ucontext_t *ucp);
+int setcontext(const ucontext_t *ucp) noexcept;
} // namespace LIBC_NAMESPACE_DECL
diff --git a/libc/src/ucontext/x86_64/getcontext.cpp b/libc/src/ucontext/x86_64/getcontext.cpp
index 43f353b4556ca..26fce6447ffe8 100644
--- a/libc/src/ucontext/x86_64/getcontext.cpp
+++ b/libc/src/ucontext/x86_64/getcontext.cpp
@@ -19,7 +19,8 @@ namespace LIBC_NAMESPACE_DECL {
// We use naked because we need to capture the exact register state
// at the moment of the function call, avoiding any compiler prologue/epilogue.
-__attribute__((naked)) LLVM_LIBC_FUNCTION(int, getcontext, (ucontext_t * ucp)) {
+__attribute__((naked)) LLVM_LIBC_FUNCTION(int, getcontext,
+ (ucontext_t * ucp)) noexcept {
asm(R"(
# ucp is in rdi
diff --git a/libc/src/ucontext/x86_64/setcontext.cpp b/libc/src/ucontext/x86_64/setcontext.cpp
index 0fa7715ce0f65..408298bed3d35 100644
--- a/libc/src/ucontext/x86_64/setcontext.cpp
+++ b/libc/src/ucontext/x86_64/setcontext.cpp
@@ -18,7 +18,7 @@
namespace LIBC_NAMESPACE_DECL {
__attribute__((naked)) LLVM_LIBC_FUNCTION(int, setcontext,
- (const ucontext_t *ucp)) {
+ (const ucontext_t *ucp)) noexcept {
asm(R"(
# ucp is in rdi
``````````
</details>
https://github.com/llvm/llvm-project/pull/192601
More information about the libc-commits
mailing list