Skip to contentSkip to conversation

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

Qemu-devel Yaniv Kaul 1 participant 1 message Apr 27, 2011

lore
Share & tools
lore

Yaniv Kaul

author
#0 lore raw

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.

---

hw/ide/atapi.c +0 -0
index 690a0ab..334d6fd 100644
@@ -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
{