[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: [Qemu-devel] [PATCH for-2.10] util/oslib-posix.c: Avoid warning on N
From: |
Eric Blake |
Subject: |
Re: [Qemu-devel] [PATCH for-2.10] util/oslib-posix.c: Avoid warning on NetBSD |
Date: |
Thu, 20 Jul 2017 13:26:50 -0500 |
User-agent: |
Mozilla/5.0 (X11; Linux x86_64; rv:52.0) Gecko/20100101 Thunderbird/52.2.1 |
On 07/20/2017 11:32 AM, Peter Maydell wrote:
> On NetBSD the compiler warns:
> util/oslib-posix.c: In function 'sigaction_invoke':
> util/oslib-posix.c:589:5: warning: missing braces around initializer
> [-Wmissing-braces]
> siginfo_t si = { 0 };
> ^
Uggh. That is a broken compiler. C99 declares that 'anything = {0}' is
supposed to be a valid way to zero-initialize anything.
> util/oslib-posix.c:589:5: warning: (near initialization for 'si.si_pad')
> [-Wmissing-braces]
>
> because on this platform siginfo_t is defined as
> typedef union siginfo {
> char si_pad[128]; /* Total size; for future expansion */
> struct _ksiginfo _info;
> } siginfo_t;
>
> Avoid this warning by initializing the struct with {} instead;
> this is a GCC extension but we use it all over the codebase already.
Well, I'm glad that works to shut up the broken compiler.
>
> Signed-off-by: Peter Maydell <address@hidden>
> ---
> util/oslib-posix.c | 2 +-
> 1 file changed, 1 insertion(+), 1 deletion(-)
Reviewed-by: Eric Blake <address@hidden>
>
> diff --git a/util/oslib-posix.c b/util/oslib-posix.c
> index b2dea48..cacf0ef 100644
> --- a/util/oslib-posix.c
> +++ b/util/oslib-posix.c
> @@ -586,7 +586,7 @@ void qemu_free_stack(void *stack, size_t sz)
> void sigaction_invoke(struct sigaction *action,
> struct qemu_signalfd_siginfo *info)
> {
> - siginfo_t si = { 0 };
> + siginfo_t si = {};
> si.si_signo = info->ssi_signo;
> si.si_errno = info->ssi_errno;
> si.si_code = info->ssi_code;
>
--
Eric Blake, Principal Software Engineer
Red Hat, Inc. +1-919-301-3266
Virtualization: qemu.org | libvirt.org
signature.asc
Description: OpenPGP digital signature