* [Qemu-devel] [PATCH] qemu-pr-helper: Do not use {0} for initialization
@ 2017-10-20 11:21 Paolo Bonzini
2017-10-23 17:05 ` Stefan Hajnoczi
0 siblings, 1 reply; 2+ messages in thread
From: Paolo Bonzini @ 2017-10-20 11:21 UTC (permalink / raw)
To: qemu-devel
The first field in struct dm_ioctl is an array, and old GCC warns
about it with -Wmissing-braces (GCC <= 4.8). The "{0}" universal
zero initializer is only useful if the other side might be a scalar;
for a struct, "{}" is enough and shuts up the compiler.
Suggested-by: Peter Maydell <peter.maydell@linaro.org>
Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
---
scsi/qemu-pr-helper.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/scsi/qemu-pr-helper.c b/scsi/qemu-pr-helper.c
index dd9785143b..8e475f676e 100644
--- a/scsi/qemu-pr-helper.c
+++ b/scsi/qemu-pr-helper.c
@@ -258,12 +258,12 @@ static void *dm_dev_ioctl(int fd, int ioc, struct dm_ioctl *dm)
static void dm_init(void)
{
+ struct dm_ioctl dm = {};
control_fd = open(CONTROL_PATH, O_RDWR);
if (control_fd < 0) {
perror("Cannot open " CONTROL_PATH);
exit(1);
}
- struct dm_ioctl dm = { 0 };
if (!dm_ioctl(DM_VERSION, &dm)) {
perror("ioctl");
exit(1);
--
2.14.2
^ permalink raw reply related [flat|nested] 2+ messages in thread
* Re: [Qemu-devel] [PATCH] qemu-pr-helper: Do not use {0} for initialization
2017-10-20 11:21 [Qemu-devel] [PATCH] qemu-pr-helper: Do not use {0} for initialization Paolo Bonzini
@ 2017-10-23 17:05 ` Stefan Hajnoczi
0 siblings, 0 replies; 2+ messages in thread
From: Stefan Hajnoczi @ 2017-10-23 17:05 UTC (permalink / raw)
To: Paolo Bonzini; +Cc: qemu-devel
On Fri, Oct 20, 2017 at 01:21:21PM +0200, Paolo Bonzini wrote:
> The first field in struct dm_ioctl is an array, and old GCC warns
> about it with -Wmissing-braces (GCC <= 4.8). The "{0}" universal
> zero initializer is only useful if the other side might be a scalar;
> for a struct, "{}" is enough and shuts up the compiler.
>
> Suggested-by: Peter Maydell <peter.maydell@linaro.org>
> Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
> ---
> scsi/qemu-pr-helper.c | 2 +-
> 1 file changed, 1 insertion(+), 1 deletion(-)
Reviewed-by: Stefan Hajnoczi <stefanha@redhat.com>
^ permalink raw reply [flat|nested] 2+ messages in thread
end of thread, other threads:[~2017-10-23 17:05 UTC | newest]
Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2017-10-20 11:21 [Qemu-devel] [PATCH] qemu-pr-helper: Do not use {0} for initialization Paolo Bonzini
2017-10-23 17:05 ` Stefan Hajnoczi
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).