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

Joel Sherrill <[email protected]>
Newsgroups gmane.comp.lib.newlib
Message-ID <CAF9ehCUwqhQtU-gwqD6A1dOGEqAyr599mEFYJs9qrZ-iiqNWhA@mail.gmail.com>
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 <[email protected]> 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
>
>
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.