[PATCH 1/1] newlib/libc/include/setjmp.h: Add returns_twice attribute to setjmp()
Joel Sherrill
joel@rtems.org
Tue Sep 30 14:49:19 GMT 2025
The setjmp() function needs this attribute to help GCC avoid false
positives for the -Wclobbered warning. The -Wclobbered warning is
part of -Wextra.
---
newlib/libc/include/setjmp.h | 7 ++++++-
1 file changed, 6 insertions(+), 1 deletion(-)
diff --git a/newlib/libc/include/setjmp.h b/newlib/libc/include/setjmp.h
index a2830b275..5c16321a4 100644
--- a/newlib/libc/include/setjmp.h
+++ b/newlib/libc/include/setjmp.h
@@ -17,7 +17,12 @@ void longjmp (jmp_buf __jmpb, int __retval)
#else
void longjmp (jmp_buf __jmpb, int __retval);
#endif
-int setjmp (jmp_buf __jmpb);
+
+#ifdef __GNUC__
+int setjmp (jmp_buf __jmpb)
+ __attribute__ ((returns_twice));;
+#else
+#endif
_END_STD_C
--
2.47.3
More information about the Newlib
mailing list