Disable spurious -Wstringop-overflow for setjmp/longjmp (bug 26647)
DJ Delorie
dj@redhat.com
Fri Oct 30 19:47:27 GMT 2020
Joseph Myers <joseph@codesourcery.com> writes:
> diff --git a/csu/libc-start.c b/csu/libc-start.c
> +#include <libc-diag.h>
Ok.
> + DIAG_PUSH_NEEDS_COMMENT;
> +#if __GNUC_PREREQ (7, 0)
> + /* This call results in a -Wstringop-overflow warning because struct
> + pthread_unwind_buf is smaller than jmp_buf. setjmp and longjmp
> + do not use anything beyond the common prefix (they never access
> + the saved signal mask), so that is a false positive. */
> + DIAG_IGNORE_NEEDS_COMMENT (11, "-Wstringop-overflow=");
> +#endif
> not_first_call = setjmp ((struct __jmp_buf_tag *) unwind_buf.cancel_jmp_buf);
> + DIAG_POP_NEEDS_COMMENT;
Ok. Matches all other uses throughout the tree.
> diff --git a/nptl/pthread_create.c b/nptl/pthread_create.c
> +#include <libc-diag.h>
Ok.
> + DIAG_PUSH_NEEDS_COMMENT;
> +#if __GNUC_PREREQ (7, 0)
> + /* This call results in a -Wstringop-overflow warning because struct
> + pthread_unwind_buf is smaller than jmp_buf. setjmp and longjmp
> + do not use anything beyond the common prefix (they never access
> + the saved signal mask), so that is a false positive. */
> + DIAG_IGNORE_NEEDS_COMMENT (11, "-Wstringop-overflow=");
> +#endif
> not_first_call = setjmp ((struct __jmp_buf_tag *) unwind_buf.cancel_jmp_buf);
> + DIAG_POP_NEEDS_COMMENT;
Ok.
> diff --git a/nptl/unwind.c b/nptl/unwind.c
> +#include <libc-diag.h>
Ok.
> + DIAG_PUSH_NEEDS_COMMENT;
> +#if __GNUC_PREREQ (7, 0)
> + /* This call results in a -Wstringop-overflow warning because struct
> + pthread_unwind_buf is smaller than jmp_buf. setjmp and longjmp
> + do not use anything beyond the common prefix (they never access
> + the saved signal mask), so that is a false positive. */
> + DIAG_IGNORE_NEEDS_COMMENT (11, "-Wstringop-overflow=");
> +#endif
> if (do_longjump)
> __libc_unwind_longjmp ((struct __jmp_buf_tag *) buf->cancel_jmp_buf, 1);
> + DIAG_POP_NEEDS_COMMENT;
Ok.
LGTM.
Reviewed-by: DJ Delorie <dj@redhat.com>
More information about the Libc-alpha
mailing list