Patchwork Patch for 'set but not used' variable in atapi.c

login
register
mail settings
Submitter Yaniv Kaul
Date April 27, 2011, 6:37 p.m.
Message ID <4DB8624F.9060504@redhat.com>
Download mbox | patch
Permalink /patch/93108/
State New
Headers show

Comments

Yaniv Kaul - April 27, 2011, 6:37 p.m.
I'm pretty sure it's not in the right format, without signed-off, etc, 
but perhaps it could be put into the trivial or block branches.

Fixes the following error (with gcc 4.6, default settings):
/home/ykaul/qemu/hw/ide/atapi.c: In function ‘ide_atapi_cmd’:
/home/ykaul/qemu/hw/ide/atapi.c:1083:20: error: variable ‘packet’ set 
but not used [-Werror=unused-but-set-variable]
cc1: all warnings being treated as errors

Regretfully, there are more to fix, with or without KVM support. The tcg 
one puzzles me a bit:
CC x86_64-softmmu/tcg/tcg.o
/home/ykaul/qemu/tcg/tcg.c: In function ‘tcg_gen_callN’:
/home/ykaul/qemu/tcg/tcg.c:589:9: error: variable ‘call_type’ set but 
not used [-Werror=unused-but-set-variable]
cc1: all warnings being treated as errors

Removing the variable and the set line actually works, although I see 
the variables used few lines later. Some #ifdef I'm not seeing, probably.

Thanks,
Y.


Signed-off-by: Yaniv Kaul<address@hidden>
---

Patch

diff --git a/hw/ide/atapi.c b/hw/ide/atapi.c
index 690a0ab..334d6fd 100644
--- a/hw/ide/atapi.c
+++ b/hw/ide/atapi.c
@@ -1080,10 +1080,12 @@  static const struct {

void ide_atapi_cmd(IDEState *s)
{
- const uint8_t *packet;
uint8_t *buf;
+#ifdef DEBUG_IDE_ATAPI
+ const uint8_t *packet;

packet = s->io_buffer;
+#endif
buf = s->io_buffer;
#ifdef DEBUG_IDE_ATAPI
{