[PATCH v3 1/1] newlib/libc/include/setjmp.h: Add returns_twice attribute to setjmp()
Joel Sherrill
joel@rtems.org
Mon Oct 13 19:08:21 GMT 2025
This has been unanswered since Oct 2. I think all feedback has been
incorporated.
It is certainly simpler now.
OK to commit?
Thanks.
--joel
On Thu, Oct 2, 2025 at 5:23 PM Joel Sherrill <joel@rtems.org> wrote:
> 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 | 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
>
> --
> 2.47.3
>
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <https://sourceware.org/pipermail/newlib/attachments/20251013/f335b7a3/attachment.htm>
More information about the Newlib
mailing list