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

Joel Sherrill joel@sourceware.org
Tue Nov 4 22:17:38 GMT 2025


https://sourceware.org/git/gitweb.cgi?p=newlib-cygwin.git;h=a90f9dfb9956b6358d5ec681c9ad30cd5b2c67cc

commit a90f9dfb9956b6358d5ec681c9ad30cd5b2c67cc
Author: Joel Sherrill <joel@rtems.org>
Date:   Tue Sep 30 09:44:18 2025 -0500

    newlib/libc/include/setjmp.h: Add returns_twice attribute to setjmp()
    
    The setjmp() function needs this attribute to help GCC avoid false
    positives for the -Wclobbered warning. The -Wclobbered warning is
    part of -Wextra.

Diff:
---
 newlib/libc/include/setjmp.h | 10 +++-------
 1 file changed, 3 insertions(+), 7 deletions(-)

diff --git a/newlib/libc/include/setjmp.h b/newlib/libc/include/setjmp.h
index a2830b275..62dd27ef4 100644
--- a/newlib/libc/include/setjmp.h
+++ b/newlib/libc/include/setjmp.h
@@ -7,17 +7,13 @@
 #define _SETJMP_H_
 
 #include "_ansi.h"
+#include <sys/cdefs.h>
 #include <machine/setjmp.h>
 
 _BEGIN_STD_C
 
-#ifdef __GNUC__
-void	longjmp (jmp_buf __jmpb, int __retval)
-			__attribute__ ((__noreturn__));
-#else
-void	longjmp (jmp_buf __jmpb, int __retval);
-#endif
-int	setjmp (jmp_buf __jmpb);
+void	longjmp (jmp_buf __jmpb, int __retval) __dead2;
+int	setjmp (jmp_buf __jmpb) __returns_twice;
 
 _END_STD_C


More information about the Newlib-cvs mailing list