Skip to contentSkip to conversation

Fix "defined but not used" warning

PATCH Applied Luiz Capitulino 4 participants 4 messages Jun 9, 2009 – Jun 10, 2009

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 Fix "defined but not used" warning

The function qemu_calculate_timeout() is only used when CONFIG_IOTHREAD is not defined. When CONFIG_IOTHREAD is defined, we have the following warning:

vl.c:4389: warning: ‘qemu_calculate_timeout’ defined but not used

This change fixes that by moving the #ifdef/#endif from main_loop() into qemu_calculate_timeout(). This encapsulates the logic and allow us to use qemu_calculate_timeout() when CONFIG_IOTHREAD is defined or not (suggested by Glauber Costa).

---
 vl.c |    8 ++++----
 1 files changed, 4 insertions(+), 4 deletions(-)
vl.c +4 -4
index f08f0f3..69a9f91 100644
@@ -4388,6 +4388,7 @@ static int tcg_has_work(void)
 
 static int qemu_calculate_timeout(void)
 {
+#ifndef CONFIG_IOTHREAD
     int timeout;
 
     if (!vm_running)
@@ -4433,6 +4434,9 @@ static int qemu_calculate_timeout(void)
     }
 
     return timeout;
+#else /* CONFIG_IOTHREAD */
+    return 1000;
+#endif
 }
 
 static int vm_can_run(void)
@@ -4468,11 +4472,7 @@ static void main_loop(void)
 #ifdef CONFIG_PROFILER
             ti = profile_getclock();
 #endif
-#ifdef CONFIG_IOTHREAD
-            main_loop_wait(1000);
-#else
             main_loop_wait(qemu_calculate_timeout());
-#endif
 #ifdef CONFIG_PROFILER
             dev_time += profile_getclock() - ti;
 #endif
Signature · 6 lines
1.6.3.GIT



-- 
Luiz
Reviewed-by on v1 1/1
#1 lore raw
Quoted 4 lines · Luiz Capitulino

The function qemu_calculate_timeout() is only used when CONFIG_IOTHREAD is not defined. When CONFIG_IOTHREAD is defined, we have the following warning:

Quoted 8 lines

vl.c:4389: warning: ‘qemu_calculate_timeout’ defined but not used

This change fixes that by moving the #ifdef/#endif from main_loop() into qemu_calculate_timeout(). This encapsulates the logic and allow us to use qemu_calculate_timeout() when CONFIG_IOTHREAD is defined or not (suggested by Glauber Costa).

Looks correct and is a good cleanup too. Moves us closer to being able to build with --enable-werror always :-)

Cheers,
Mark.

#2 lore raw
In reply to Luiz Capitulino
Quoted 11 lines · Luiz Capitulino

The function qemu_calculate_timeout() is only used when CONFIG_IOTHREAD is not defined. When CONFIG_IOTHREAD is defined, we have the following warning:

vl.c:4389: warning: ‘qemu_calculate_timeout’ defined but not used

This change fixes that by moving the #ifdef/#endif from main_loop() into qemu_calculate_timeout(). This encapsulates the logic and allow us to use qemu_calculate_timeout() when CONFIG_IOTHREAD is defined or not (suggested by Glauber Costa).

ACK

Applied
#3 lore raw
In reply to Luiz Capitulino
Quoted 5 lines · Luiz Capitulino

The function qemu_calculate_timeout() is only used when CONFIG_IOTHREAD is not defined. When CONFIG_IOTHREAD is defined, we have the following warning:

Quoted 8 lines

vl.c:4389: warning: ‘qemu_calculate_timeout’ defined but not used

This change fixes that by moving the #ifdef/#endif from main_loop() into qemu_calculate_timeout(). This encapsulates the logic and allow us to use qemu_calculate_timeout() when CONFIG_IOTHREAD is defined or not (suggested by Glauber Costa).

Thanks, applied.