qemu-devel.nongnu.org archive mirror
 help / color / mirror / Atom feed
From: Luiz Capitulino <lcapitulino@redhat.com>
To: qemu-devel@nongnu.org
Cc: aliguori@us.ibm.com, glommer@redhat.com
Subject: [Qemu-devel] [PATCH]: Fix "defined but not used" warning
Date: Thu, 4 Jun 2009 15:29:19 -0300	[thread overview]
Message-ID: <20090604152919.486ba200@redhat.com> (raw)

 
    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).
    
    Signed-off-by: Luiz Capitulino <lcapitulino@redhat.com>

diff --git a/vl.c b/vl.c
index fcf8532..9e5cf4c 100644
--- a/vl.c
+++ b/vl.c
@@ -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


-- 
Luiz

             reply	other threads:[~2009-06-05  0:33 UTC|newest]

Thread overview: 5+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2009-06-04 18:29 Luiz Capitulino [this message]
  -- strict thread matches above, loose matches on Subject: below --
2009-06-09 21:24 [Qemu-devel] [PATCH] Fix "defined but not used" warning Luiz Capitulino
2009-06-09 21:53 ` Mark McLoughlin
2009-06-10  0:30 ` Marcelo Tosatti
2009-06-10 17:00 ` Blue Swirl

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20090604152919.486ba200@redhat.com \
    --to=lcapitulino@redhat.com \
    --cc=aliguori@us.ibm.com \
    --cc=glommer@redhat.com \
    --cc=qemu-devel@nongnu.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
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).