* [Qemu-devel] [PATCH] Fix QEMU_WARN_UNUSED_RESULT
@ 2010-01-15 11:56 Kevin Wolf
2010-01-15 16:45 ` Markus Armbruster
2010-01-19 22:40 ` Anthony Liguori
0 siblings, 2 replies; 3+ messages in thread
From: Kevin Wolf @ 2010-01-15 11:56 UTC (permalink / raw)
To: qemu-devel; +Cc: Kevin Wolf, kraxel
Since commit 747bbdf7 QEMU_WARN_UNUSED_RESULT is never defined as it is
conditional on a define from config-host.h which is included only later.
Include that file earlier to get the warnings back.
Reactivating it unfortunately leads to some warnings about unused qdev_init
results. These calls are changed to qdev_init_nofail to avoid build failures.
Signed-off-by: Kevin Wolf <kwolf@redhat.com>
---
Gerd, can you please check if using nofail is appropriate or should be replaced
by some real error checks (and if so, which)?
hw/usb-net.c | 2 +-
hw/usb-serial.c | 4 ++--
qemu-common.h | 3 ++-
usb-linux.c | 2 +-
4 files changed, 6 insertions(+), 5 deletions(-)
diff --git a/hw/usb-net.c b/hw/usb-net.c
index 9744dfa..cfd2f62 100644
--- a/hw/usb-net.c
+++ b/hw/usb-net.c
@@ -1492,7 +1492,7 @@ static USBDevice *usb_net_init(const char *cmdline)
dev = usb_create(NULL /* FIXME */, "usb-net");
qdev_set_nic_properties(&dev->qdev, &nd_table[idx]);
- qdev_init(&dev->qdev);
+ qdev_init_nofail(&dev->qdev);
return dev;
}
diff --git a/hw/usb-serial.c b/hw/usb-serial.c
index 2775cf0..37293ea 100644
--- a/hw/usb-serial.c
+++ b/hw/usb-serial.c
@@ -583,7 +583,7 @@ static USBDevice *usb_serial_init(const char *filename)
qdev_prop_set_uint16(&dev->qdev, "vendorid", vendorid);
if (productid)
qdev_prop_set_uint16(&dev->qdev, "productid", productid);
- qdev_init(&dev->qdev);
+ qdev_init_nofail(&dev->qdev);
return dev;
}
@@ -599,7 +599,7 @@ static USBDevice *usb_braille_init(const char *unused)
dev = usb_create(NULL /* FIXME */, "usb-braille");
qdev_prop_set_chr(&dev->qdev, "chardev", cdrv);
- qdev_init(&dev->qdev);
+ qdev_init_nofail(&dev->qdev);
return dev;
}
diff --git a/qemu-common.h b/qemu-common.h
index 8630f8c..d96060a 100644
--- a/qemu-common.h
+++ b/qemu-common.h
@@ -2,6 +2,8 @@
#ifndef QEMU_COMMON_H
#define QEMU_COMMON_H
+#include "config-host.h"
+
#define QEMU_NORETURN __attribute__ ((__noreturn__))
#ifdef CONFIG_GCC_ATTRIBUTE_WARN_UNUSED_RESULT
#define QEMU_WARN_UNUSED_RESULT __attribute__((warn_unused_result))
@@ -29,7 +31,6 @@
#include <fcntl.h>
#include <sys/stat.h>
#include <assert.h>
-#include "config-host.h"
#ifndef O_LARGEFILE
#define O_LARGEFILE 0
diff --git a/usb-linux.c b/usb-linux.c
index 88728e9..5619b30 100644
--- a/usb-linux.c
+++ b/usb-linux.c
@@ -1036,7 +1036,7 @@ USBDevice *usb_host_device_open(const char *devname)
qdev_prop_set_uint32(&dev->qdev, "hostaddr", filter.addr);
qdev_prop_set_uint32(&dev->qdev, "vendorid", filter.vendor_id);
qdev_prop_set_uint32(&dev->qdev, "productid", filter.product_id);
- qdev_init(&dev->qdev);
+ qdev_init_nofail(&dev->qdev);
return dev;
fail:
--
1.6.2.5
^ permalink raw reply related [flat|nested] 3+ messages in thread
* Re: [Qemu-devel] [PATCH] Fix QEMU_WARN_UNUSED_RESULT
2010-01-15 11:56 [Qemu-devel] [PATCH] Fix QEMU_WARN_UNUSED_RESULT Kevin Wolf
@ 2010-01-15 16:45 ` Markus Armbruster
2010-01-19 22:40 ` Anthony Liguori
1 sibling, 0 replies; 3+ messages in thread
From: Markus Armbruster @ 2010-01-15 16:45 UTC (permalink / raw)
To: Kevin Wolf; +Cc: qemu-devel, kraxel
Kevin Wolf <kwolf@redhat.com> writes:
> Since commit 747bbdf7 QEMU_WARN_UNUSED_RESULT is never defined as it is
> conditional on a define from config-host.h which is included only later.
> Include that file earlier to get the warnings back.
>
> Reactivating it unfortunately leads to some warnings about unused qdev_init
> results. These calls are changed to qdev_init_nofail to avoid build failures.
>
> Signed-off-by: Kevin Wolf <kwolf@redhat.com>
The use of qdev_init_nofail() is correct, because the relevant device
init methods can't fail.
Acked-by: Markus Armbruster <armbru@redhat.com>
^ permalink raw reply [flat|nested] 3+ messages in thread
* Re: [Qemu-devel] [PATCH] Fix QEMU_WARN_UNUSED_RESULT
2010-01-15 11:56 [Qemu-devel] [PATCH] Fix QEMU_WARN_UNUSED_RESULT Kevin Wolf
2010-01-15 16:45 ` Markus Armbruster
@ 2010-01-19 22:40 ` Anthony Liguori
1 sibling, 0 replies; 3+ messages in thread
From: Anthony Liguori @ 2010-01-19 22:40 UTC (permalink / raw)
To: Kevin Wolf; +Cc: qemu-devel, kraxel
On 01/15/2010 05:56 AM, Kevin Wolf wrote:
> Since commit 747bbdf7 QEMU_WARN_UNUSED_RESULT is never defined as it is
> conditional on a define from config-host.h which is included only later.
> Include that file earlier to get the warnings back.
>
> Reactivating it unfortunately leads to some warnings about unused qdev_init
> results. These calls are changed to qdev_init_nofail to avoid build failures.
>
> Signed-off-by: Kevin Wolf<kwolf@redhat.com>
>
Applied. Thanks.
Regards,
Anthony Liguori
> ---
>
> Gerd, can you please check if using nofail is appropriate or should be replaced
> by some real error checks (and if so, which)?
>
> hw/usb-net.c | 2 +-
> hw/usb-serial.c | 4 ++--
> qemu-common.h | 3 ++-
> usb-linux.c | 2 +-
> 4 files changed, 6 insertions(+), 5 deletions(-)
>
> diff --git a/hw/usb-net.c b/hw/usb-net.c
> index 9744dfa..cfd2f62 100644
> --- a/hw/usb-net.c
> +++ b/hw/usb-net.c
> @@ -1492,7 +1492,7 @@ static USBDevice *usb_net_init(const char *cmdline)
>
> dev = usb_create(NULL /* FIXME */, "usb-net");
> qdev_set_nic_properties(&dev->qdev,&nd_table[idx]);
> - qdev_init(&dev->qdev);
> + qdev_init_nofail(&dev->qdev);
> return dev;
> }
>
> diff --git a/hw/usb-serial.c b/hw/usb-serial.c
> index 2775cf0..37293ea 100644
> --- a/hw/usb-serial.c
> +++ b/hw/usb-serial.c
> @@ -583,7 +583,7 @@ static USBDevice *usb_serial_init(const char *filename)
> qdev_prop_set_uint16(&dev->qdev, "vendorid", vendorid);
> if (productid)
> qdev_prop_set_uint16(&dev->qdev, "productid", productid);
> - qdev_init(&dev->qdev);
> + qdev_init_nofail(&dev->qdev);
>
> return dev;
> }
> @@ -599,7 +599,7 @@ static USBDevice *usb_braille_init(const char *unused)
>
> dev = usb_create(NULL /* FIXME */, "usb-braille");
> qdev_prop_set_chr(&dev->qdev, "chardev", cdrv);
> - qdev_init(&dev->qdev);
> + qdev_init_nofail(&dev->qdev);
>
> return dev;
> }
> diff --git a/qemu-common.h b/qemu-common.h
> index 8630f8c..d96060a 100644
> --- a/qemu-common.h
> +++ b/qemu-common.h
> @@ -2,6 +2,8 @@
> #ifndef QEMU_COMMON_H
> #define QEMU_COMMON_H
>
> +#include "config-host.h"
> +
> #define QEMU_NORETURN __attribute__ ((__noreturn__))
> #ifdef CONFIG_GCC_ATTRIBUTE_WARN_UNUSED_RESULT
> #define QEMU_WARN_UNUSED_RESULT __attribute__((warn_unused_result))
> @@ -29,7 +31,6 @@
> #include<fcntl.h>
> #include<sys/stat.h>
> #include<assert.h>
> -#include "config-host.h"
>
> #ifndef O_LARGEFILE
> #define O_LARGEFILE 0
> diff --git a/usb-linux.c b/usb-linux.c
> index 88728e9..5619b30 100644
> --- a/usb-linux.c
> +++ b/usb-linux.c
> @@ -1036,7 +1036,7 @@ USBDevice *usb_host_device_open(const char *devname)
> qdev_prop_set_uint32(&dev->qdev, "hostaddr", filter.addr);
> qdev_prop_set_uint32(&dev->qdev, "vendorid", filter.vendor_id);
> qdev_prop_set_uint32(&dev->qdev, "productid", filter.product_id);
> - qdev_init(&dev->qdev);
> + qdev_init_nofail(&dev->qdev);
> return dev;
>
> fail:
>
^ permalink raw reply [flat|nested] 3+ messages in thread
end of thread, other threads:[~2010-01-19 22:40 UTC | newest]
Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2010-01-15 11:56 [Qemu-devel] [PATCH] Fix QEMU_WARN_UNUSED_RESULT Kevin Wolf
2010-01-15 16:45 ` Markus Armbruster
2010-01-19 22:40 ` Anthony Liguori
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).