[libc-commits] [libc] [libc] Fix ucontext buildbot failure with noexcept (#192343) (PR #192601)

Jeff Bailey via libc-commits libc-commits at lists.llvm.org
Thu Apr 16 23:53:39 PDT 2026


https://github.com/kaladron updated https://github.com/llvm/llvm-project/pull/192601

>From 3cbdef0d0b5860c355ae89d3581513977ad95781 Mon Sep 17 00:00:00 2001
From: Jeff Bailey <jbailey at raspberryginger.com>
Date: Fri, 17 Apr 2026 07:06:47 +0100
Subject: [PATCH] [libc] Fix ucontext buildbot failure with noexcept (#192343)

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.
---
 libc/src/ucontext/getcontext.h          | 2 +-
 libc/src/ucontext/setcontext.h          | 2 +-
 libc/src/ucontext/x86_64/getcontext.cpp | 3 ++-
 libc/src/ucontext/x86_64/setcontext.cpp | 2 +-
 4 files changed, 5 insertions(+), 4 deletions(-)

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
       



More information about the libc-commits mailing list