[libc-commits] [libc] [libc] Add `returns_twice` attribute to `setjmp(3)` (PR #124370)

Nick Desaulniers via libc-commits libc-commits at lists.llvm.org
Wed Feb 5 09:57:49 PST 2025


================
@@ -29,7 +29,8 @@ namespace LIBC_NAMESPACE_DECL {
 #ifdef LIBC_COMPILER_IS_GCC
 [[gnu::nothrow]]
 #endif
-int setjmp(jmp_buf buf);
+[[gnu::returns_twice]] int
----------------
nickdesaulniers wrote:

Changing this here won't make a difference in the generated code for `setjmp`; this internal header isn't what's presented to users of llvm-libc's setjmp.h (the modification you made to libc/include/setjmp.yaml is what is). Reading your bug report, this fn attr is necessary for callers, not the definition of the callee.

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


More information about the libc-commits mailing list