* [PATCH 0/2] linux-user: Fix a pair of -Wextra warnings
@ 2022-12-20 14:42 Philippe Mathieu-Daudé
2022-12-20 14:42 ` [PATCH 1/2] linux-user/syscall: Silent -Wmissing-field-initializers warnings Philippe Mathieu-Daudé
2022-12-20 14:42 ` [PATCH 2/2] linux-user/signal: Silent -Winitializer-overrides warnings Philippe Mathieu-Daudé
0 siblings, 2 replies; 4+ messages in thread
From: Philippe Mathieu-Daudé @ 2022-12-20 14:42 UTC (permalink / raw)
To: qemu-devel; +Cc: Laurent Vivier, Philippe Mathieu-Daudé
Philippe Mathieu-Daudé (2):
linux-user/syscall: Silent -Wmissing-field-initializers warnings
linux-user/signal: Silent -Winitializer-overrides warnings
linux-user/signal-common.h | 2 +-
linux-user/syscall.c | 10 +++++-----
2 files changed, 6 insertions(+), 6 deletions(-)
--
2.38.1
^ permalink raw reply [flat|nested] 4+ messages in thread
* [PATCH 1/2] linux-user/syscall: Silent -Wmissing-field-initializers warnings
2022-12-20 14:42 [PATCH 0/2] linux-user: Fix a pair of -Wextra warnings Philippe Mathieu-Daudé
@ 2022-12-20 14:42 ` Philippe Mathieu-Daudé
2022-12-20 14:42 ` [PATCH 2/2] linux-user/signal: Silent -Winitializer-overrides warnings Philippe Mathieu-Daudé
1 sibling, 0 replies; 4+ messages in thread
From: Philippe Mathieu-Daudé @ 2022-12-20 14:42 UTC (permalink / raw)
To: qemu-devel; +Cc: Laurent Vivier, Philippe Mathieu-Daudé
Silent when compiling with -Wextra:
In file included from ../../linux-user/syscall.c:5742:
../linux-user/ioctls.h:694:3: warning: missing field 'access' initializer [-Wmissing-field-initializers]
IOCTL_IGNORE(TIOCSTART)
^
../linux-user/syscall.c:5741:31: note: expanded from macro 'IOCTL_IGNORE'
{ TARGET_ ## cmd, 0, #cmd },
^
../linux-user/syscall.c:5743:13: warning: missing field 'name' initializer [-Wmissing-field-initializers]
{ 0, 0, },
^
../linux-user/syscall.c:12949:44: warning: missing field 'sigev_signo' initializer [-Wmissing-field-initializers]
struct sigevent host_sevp = { {0}, }, *phost_sevp = NULL;
^
Signed-off-by: Philippe Mathieu-Daudé <philmd@linaro.org>
---
linux-user/syscall.c | 10 +++++-----
1 file changed, 5 insertions(+), 5 deletions(-)
diff --git a/linux-user/syscall.c b/linux-user/syscall.c
index 1f8c10f8ef..f3ab6bf5a6 100644
--- a/linux-user/syscall.c
+++ b/linux-user/syscall.c
@@ -5738,9 +5738,9 @@ IOCTLEntry ioctl_entries[] = {
#define IOCTL_SPECIAL(cmd, access, dofn, ...) \
{ TARGET_ ## cmd, cmd, #cmd, access, dofn, { __VA_ARGS__ } },
#define IOCTL_IGNORE(cmd) \
- { TARGET_ ## cmd, 0, #cmd },
+ { TARGET_ ## cmd, 0, #cmd, 0, NULL, { } },
#include "ioctls.h"
- { 0, 0, },
+ { /* end of list */ }
};
/* ??? Implement proper locking for ioctls. */
@@ -12946,7 +12946,7 @@ static abi_long do_syscall1(CPUArchState *cpu_env, int num, abi_long arg1,
{
/* args: clockid_t clockid, struct sigevent *sevp, timer_t *timerid */
- struct sigevent host_sevp = { {0}, }, *phost_sevp = NULL;
+ struct sigevent host_sevp = { }, *phost_sevp = NULL;
int clkid = arg1;
int timer_index = next_free_host_timer();
@@ -12993,7 +12993,7 @@ static abi_long do_syscall1(CPUArchState *cpu_env, int num, abi_long arg1,
ret = -TARGET_EINVAL;
} else {
timer_t htimer = g_posix_timers[timerid];
- struct itimerspec hspec_new = {{0},}, hspec_old = {{0},};
+ struct itimerspec hspec_new = { }, hspec_old = { };
if (target_to_host_itimerspec(&hspec_new, arg3)) {
return -TARGET_EFAULT;
@@ -13019,7 +13019,7 @@ static abi_long do_syscall1(CPUArchState *cpu_env, int num, abi_long arg1,
ret = -TARGET_EINVAL;
} else {
timer_t htimer = g_posix_timers[timerid];
- struct itimerspec hspec_new = {{0},}, hspec_old = {{0},};
+ struct itimerspec hspec_new = { }, hspec_old = { };
if (target_to_host_itimerspec64(&hspec_new, arg3)) {
return -TARGET_EFAULT;
--
2.38.1
^ permalink raw reply related [flat|nested] 4+ messages in thread
* [PATCH 2/2] linux-user/signal: Silent -Winitializer-overrides warnings
2022-12-20 14:42 [PATCH 0/2] linux-user: Fix a pair of -Wextra warnings Philippe Mathieu-Daudé
2022-12-20 14:42 ` [PATCH 1/2] linux-user/syscall: Silent -Wmissing-field-initializers warnings Philippe Mathieu-Daudé
@ 2022-12-20 14:42 ` Philippe Mathieu-Daudé
2022-12-20 15:47 ` Peter Maydell
1 sibling, 1 reply; 4+ messages in thread
From: Philippe Mathieu-Daudé @ 2022-12-20 14:42 UTC (permalink / raw)
To: qemu-devel; +Cc: Laurent Vivier, Philippe Mathieu-Daudé
The target SIGIOT signal is sometimes aliased with SIGABRT,
producing the following warning when compiling with -Wextra:
../linux-user/signal.c:57:9: warning: initializer overrides prior initialization of this subobject [-Winitializer-overrides]
MAKE_SIGNAL_LIST
^~~~~~~~~~~~~~~~
../linux-user/signal-common.h:165:9: note: expanded from macro 'MAKE_SIGNAL_LIST'
MAKE_SIG_ENTRY_SIGIOT
^~~~~~~~~~~~~~~~~~~~~
../linux-user/signal-common.h:128:41: note: expanded from macro 'MAKE_SIG_ENTRY_SIGIOT'
#define MAKE_SIG_ENTRY_SIGIOT MAKE_SIG_ENTRY(SIGIOT)
^~~~~~~~~~~~~~~~~~~~~~
../linux-user/signal.c:56:41: note: expanded from macro 'MAKE_SIG_ENTRY'
#define MAKE_SIG_ENTRY(sig) [sig] = TARGET_##sig,
^~~~~~~~~~~~
<scratch space>:81:1: note: expanded from here
TARGET_SIGIOT
^~~~~~~~~~~~~
../linux-user/sh4/../generic/signal.h:26:34: note: expanded from macro 'TARGET_SIGIOT'
#define TARGET_SIGIOT 6
^
<scratch space>:55:1: note: expanded from here
TARGET_SIGABRT
^~~~~~~~~~~~~~
../linux-user/sh4/../generic/signal.h:25:34: note: expanded from macro 'TARGET_SIGABRT'
#define TARGET_SIGABRT 6
^
Signed-off-by: Philippe Mathieu-Daudé <philmd@linaro.org>
---
linux-user/signal-common.h | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/linux-user/signal-common.h b/linux-user/signal-common.h
index 3e2dc604c2..a168ea4851 100644
--- a/linux-user/signal-common.h
+++ b/linux-user/signal-common.h
@@ -124,7 +124,7 @@ static inline void finish_sigsuspend_mask(int ret)
#define MAKE_SIG_ENTRY_SIGSTKFLT
#endif
-#if defined(SIGIOT) && defined(TARGET_SIGIOT)
+#if defined(SIGIOT) && defined(TARGET_SIGIOT) && TARGET_SIGABRT != TARGET_SIGIOT
#define MAKE_SIG_ENTRY_SIGIOT MAKE_SIG_ENTRY(SIGIOT)
#else
#define MAKE_SIG_ENTRY_SIGIOT
--
2.38.1
^ permalink raw reply related [flat|nested] 4+ messages in thread
* Re: [PATCH 2/2] linux-user/signal: Silent -Winitializer-overrides warnings
2022-12-20 14:42 ` [PATCH 2/2] linux-user/signal: Silent -Winitializer-overrides warnings Philippe Mathieu-Daudé
@ 2022-12-20 15:47 ` Peter Maydell
0 siblings, 0 replies; 4+ messages in thread
From: Peter Maydell @ 2022-12-20 15:47 UTC (permalink / raw)
To: Philippe Mathieu-Daudé; +Cc: qemu-devel, Laurent Vivier
On Tue, 20 Dec 2022 at 14:43, Philippe Mathieu-Daudé <philmd@linaro.org> wrote:
>
> The target SIGIOT signal is sometimes aliased with SIGABRT,
> producing the following warning when compiling with -Wextra:
>
> ../linux-user/signal.c:57:9: warning: initializer overrides prior initialization of this subobject [-Winitializer-overrides]
> MAKE_SIGNAL_LIST
> ^~~~~~~~~~~~~~~~
> ../linux-user/signal-common.h:165:9: note: expanded from macro 'MAKE_SIGNAL_LIST'
> MAKE_SIG_ENTRY_SIGIOT
> ^~~~~~~~~~~~~~~~~~~~~
> ../linux-user/signal-common.h:128:41: note: expanded from macro 'MAKE_SIG_ENTRY_SIGIOT'
> #define MAKE_SIG_ENTRY_SIGIOT MAKE_SIG_ENTRY(SIGIOT)
> ^~~~~~~~~~~~~~~~~~~~~~
> ../linux-user/signal.c:56:41: note: expanded from macro 'MAKE_SIG_ENTRY'
> #define MAKE_SIG_ENTRY(sig) [sig] = TARGET_##sig,
> ^~~~~~~~~~~~
> <scratch space>:81:1: note: expanded from here
> TARGET_SIGIOT
> ^~~~~~~~~~~~~
> ../linux-user/sh4/../generic/signal.h:26:34: note: expanded from macro 'TARGET_SIGIOT'
> #define TARGET_SIGIOT 6
> ^
> <scratch space>:55:1: note: expanded from here
> TARGET_SIGABRT
> ^~~~~~~~~~~~~~
> ../linux-user/sh4/../generic/signal.h:25:34: note: expanded from macro 'TARGET_SIGABRT'
> #define TARGET_SIGABRT 6
> ^
>
> Signed-off-by: Philippe Mathieu-Daudé <philmd@linaro.org>
> ---
> linux-user/signal-common.h | 2 +-
> 1 file changed, 1 insertion(+), 1 deletion(-)
>
> diff --git a/linux-user/signal-common.h b/linux-user/signal-common.h
> index 3e2dc604c2..a168ea4851 100644
> --- a/linux-user/signal-common.h
> +++ b/linux-user/signal-common.h
> @@ -124,7 +124,7 @@ static inline void finish_sigsuspend_mask(int ret)
> #define MAKE_SIG_ENTRY_SIGSTKFLT
> #endif
>
> -#if defined(SIGIOT) && defined(TARGET_SIGIOT)
> +#if defined(SIGIOT) && defined(TARGET_SIGIOT) && TARGET_SIGABRT != TARGET_SIGIOT
> #define MAKE_SIG_ENTRY_SIGIOT MAKE_SIG_ENTRY(SIGIOT)
> #else
> #define MAKE_SIG_ENTRY_SIGIOT
This suppresses the array entry in the case where TARGET_SIGABRT ==
TARGET_SIGIOT,
but the compiler error is I think complaining about the case where
host SIGABRT == SIGIOT.
The MAKE_SIG_ENTRY macros are used to construct both the host-to-target signal
table in signal.c and also a target-signal-to-string table in strace.c;
so whether you want to check "target signals the same?" or "host signals
the same?" to suppress the overriding entry varies depending on which table.
However, this is all a bit moot because:
(1) we deliberately do not enable the -Winitializer-overrides
warning, because it produces false positives on the various
cases where we want to use the coding pattern "initialize a range
first, then override some specific members within it"
(2) There is no Linux architecture where SIGIOT is not a synonym
for SIGABRT, so the right thing to do here is just to
delete MAKE_SIG_ENTRY_SIGIOT entirely.
thanks
-- PMM
^ permalink raw reply [flat|nested] 4+ messages in thread
end of thread, other threads:[~2022-12-20 15:49 UTC | newest]
Thread overview: 4+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2022-12-20 14:42 [PATCH 0/2] linux-user: Fix a pair of -Wextra warnings Philippe Mathieu-Daudé
2022-12-20 14:42 ` [PATCH 1/2] linux-user/syscall: Silent -Wmissing-field-initializers warnings Philippe Mathieu-Daudé
2022-12-20 14:42 ` [PATCH 2/2] linux-user/signal: Silent -Winitializer-overrides warnings Philippe Mathieu-Daudé
2022-12-20 15:47 ` Peter Maydell
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).