-
Notifications
You must be signed in to change notification settings - Fork 369
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
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).
- Loading branch information
Showing
5 changed files
with
44 additions
and
17 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1 @@ | ||
| #include <setjmp/bits/types/struct___jmp_buf_tag.h> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,37 @@ | ||
| /* Define struct __jmp_buf_tag. | ||
| Copyright (C) 1991-2020 Free Software Foundation, Inc. | ||
| This file is part of the GNU C Library. | ||
| The GNU C Library is free software; you can redistribute it and/or | ||
| modify it under the terms of the GNU Lesser General Public | ||
| License as published by the Free Software Foundation; either | ||
| version 2.1 of the License, or (at your option) any later version. | ||
| The GNU C Library is distributed in the hope that it will be useful, | ||
| but WITHOUT ANY WARRANTY; without even the implied warranty of | ||
| MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU | ||
| Lesser General Public License for more details. | ||
| You should have received a copy of the GNU Lesser General Public | ||
| License along with the GNU C Library; if not, see | ||
| <https://www.gnu.org/licenses/>. */ | ||
|
|
||
| #ifndef __jmp_buf_tag_defined | ||
| #define __jmp_buf_tag_defined 1 | ||
|
|
||
| #include <bits/setjmp.h> /* Get `__jmp_buf'. */ | ||
| #include <bits/types/__sigset_t.h> | ||
|
|
||
| /* Calling environment, plus possibly a saved signal mask. */ | ||
| struct __jmp_buf_tag | ||
| { | ||
| /* NOTE: The machine-dependent definitions of `__sigsetjmp' | ||
| assume that a `jmp_buf' begins with a `__jmp_buf' and that | ||
| `__mask_was_saved' follows it. Do not move these members | ||
| or add others before it. */ | ||
| __jmp_buf __jmpbuf; /* Calling environment. */ | ||
| int __mask_was_saved; /* Saved the signal mask? */ | ||
| __sigset_t __saved_mask; /* Saved signal mask. */ | ||
| }; | ||
|
|
||
| #endif |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters