diff options
author | Pavel Kozlov <pavel.kozlov@synopsys.com> | 2023-10-17 16:45:56 +0400 |
---|---|---|
committer | Waldemar Brodkorb <wbx@openadk.org> | 2023-10-28 10:11:47 +0200 |
commit | 5e8f57c674e9f44b284818f3b897c54005d53329 (patch) | |
tree | 6a50fdb5eb9da8a565ad2184dcbc9ceb6990812c | |
parent | 8c2f6218f81ab5303e07bad4e13f181aa9581d92 (diff) |
Fix -Warray-parameter warning for __sigsetjmp
Fix the [-Warray-parameter=] warning for __sigsetjmp generated by GCC 11 and
later GCC versions:
|
| warning: argument 1 of type 'struct __jmp_buf_tag *' declared as a pointer [-Warray-parameter=]
| extern int __sigsetjmp (struct __jmp_buf_tag *__env, int __savemask) __THROWNL;
| ...
| note: previously declared as an array 'struct __jmp_buf_tag[1]'
| extern int __sigsetjmp (struct __jmp_buf_tag __env[1], int __savemask)
|
Use the same fix as in glibc. The fix is to move the struct __jmp_buf_tag
definition to a separate bits/ header so it can be included in
pthread.h, to allow to use an array (as in setjmp.h) rather than a pointer
in the declaration.
Signed-off-by: Pavel Kozlov <pavel.kozlov@synopsys.com>
-rw-r--r-- | include/setjmp.h | 16 | ||||
-rw-r--r-- | libc/sysdeps/linux/common/bits/jmp_buf_tag.h | 37 | ||||
-rw-r--r-- | libpthread/nptl/sysdeps/pthread/pthread.h | 4 |
3 files changed, 40 insertions, 17 deletions
diff --git a/include/setjmp.h b/include/setjmp.h index 27cac9500..e6f437b93 100644 --- a/include/setjmp.h +++ b/include/setjmp.h @@ -27,21 +27,7 @@ __BEGIN_DECLS #include <bits/setjmp.h> /* Get `__jmp_buf'. */ -#include <bits/sigset.h> /* Get `__sigset_t'. */ - - -/* 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. */ - }; - +#include <bits/jmp_buf_tag.h> __BEGIN_NAMESPACE_STD diff --git a/libc/sysdeps/linux/common/bits/jmp_buf_tag.h b/libc/sysdeps/linux/common/bits/jmp_buf_tag.h new file mode 100644 index 000000000..4e1a4310a --- /dev/null +++ b/libc/sysdeps/linux/common/bits/jmp_buf_tag.h @@ -0,0 +1,37 @@ +/* Define struct __jmp_buf_tag. + Copyright (C) 1991-2023 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> +#include <bits/sigset.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
\ No newline at end of file diff --git a/libpthread/nptl/sysdeps/pthread/pthread.h b/libpthread/nptl/sysdeps/pthread/pthread.h index 1fba7fca6..531e17322 100644 --- a/libpthread/nptl/sysdeps/pthread/pthread.h +++ b/libpthread/nptl/sysdeps/pthread/pthread.h @@ -28,6 +28,7 @@ #include <signal.h> #include <bits/pthreadtypes.h> #include <bits/setjmp.h> +#include <bits/jmp_buf_tag.h> #include <bits/wordsize.h> #if defined _LIBC && ( defined IS_IN_libc || !defined NOT_IN_libc ) #include <bits/uClibc_pthread.h> @@ -726,8 +727,7 @@ 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. */ |