From 19302b27bdacfe87e861ff46fc0fbad60dd6602d Mon Sep 17 00:00:00 2001 From: Joseph Myers Date: Mon, 5 Oct 2020 16:46:46 +0000 Subject: Fix GCC 11 -Warray-parameter warning for __sigsetjmp (bug 26647) This patch fixes part of bug 26647 (-Werror=array-parameter error building with GCC 11 because of __sigsetjmp being declared using an array parameter in one header and a pointer parameter in another). The fix is to split the struct __jmp_buf_tag definition out to a separate bits/types/ header so it can be included in pthread.h, so that pthread.h can declare __sigsetjmp with the type contents visible, so can use an array (as in setjmp.h) rather than a pointer in the declaration. Note that several other build failures with GCC 11 remain. This does not fix the jmp_buf-related -Wstringop-overflow errors (also discussed in bug 26647), or -Warray-parameter errors for other functions (bug 26686), or -Warray-bounds errors (bug 26687). Tested, with older compilers, natively for x86_64 and with build-many-glibc.py for aarch64-linux-gnu. Tested with build-many-glibcs.py with GCC mainline for aarch64-linux-gnu that this gets past the -Warray-parameter issue for __sigsetjmp (with the next build failure being the other one discussed in bug 26647). --- sysdeps/nptl/pthread.h | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) (limited to 'sysdeps/nptl') diff --git a/sysdeps/nptl/pthread.h b/sysdeps/nptl/pthread.h index 8a403cbf36..d4194da776 100644 --- a/sysdeps/nptl/pthread.h +++ b/sysdeps/nptl/pthread.h @@ -28,6 +28,7 @@ #include #include #include +#include /* Detach state. */ @@ -730,8 +731,8 @@ extern void __pthread_unwind_next (__pthread_unwind_buf_t *__buf) #endif /* Function used in the macros. */ -struct __jmp_buf_tag; -extern int __sigsetjmp (struct __jmp_buf_tag *__env, int __savemask) __THROWNL; +extern int __sigsetjmp (struct __jmp_buf_tag __env[1], + int __savemask) __THROWNL; /* Mutex handling. */ -- cgit v1.2.3