[PATCH v2] newlib/libc/include/setjmp.h: Add returns_twice attribute to setjmp()

Joel Sherrill <[email protected]>
Newsgroups gmane.comp.lib.newlib
Message-ID <[email protected]>
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 | 14 +++++++++-----
 1 file changed, 9 insertions(+), 5 deletions(-)

diff --git a/newlib/libc/include/setjmp.h b/newlib/libc/include/setjmp.h
index a2830b275..9e9138162 100644
--- a/newlib/libc/include/setjmp.h
+++ b/newlib/libc/include/setjmp.h
@@ -11,13 +11,17 @@
 
 _BEGIN_STD_C
 
-#ifdef __GNUC__
 void	longjmp (jmp_buf __jmpb, int __retval)
-			__attribute__ ((__noreturn__));
-#else
-void	longjmp (jmp_buf __jmpb, int __retval);
+#ifdef __GNUC__
+		__attribute__ ((__noreturn__))
+#endif
+	;
+
+int	setjmp (jmp_buf __jmpb)
+#ifdef __GNUC__
+		__attribute__ ((returns_twice))
 #endif
-int	setjmp (jmp_buf __jmpb);
+	;
 
 _END_STD_C
 
-- 
2.47.3
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.