On 21.07.2017 12:22, Peter Maydell wrote: > On 20 July 2017 at 19:26, Eric Blake <ebl...@redhat.com> wrote: >> 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. >>
Not necessarily broken compiler. According to strict C standard we need to initialize it in this case with "{{0}}"... which is ugly. A portable option is to go for memset(3). {} is also fine and I hope it will be added to C standard. >>> 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 <peter.mayd...@linaro.org> >>> --- >>> util/oslib-posix.c | 2 +- >>> 1 file changed, 1 insertion(+), 1 deletion(-) >> >> Reviewed-by: Eric Blake <ebl...@redhat.com> > > Thanks; applied to master. > Thank you! > -- PMM >
signature.asc
Description: OpenPGP digital signature