Commit b319820d4099ec6b98c9c260e06d519fc41d544c
Committed by
Blue Swirl
1 parent
4590fd80
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). Signed-off-by: Luiz Capitulino <lcapitulino@redhat.com>
Showing
1 changed file
with
4 additions
and
4 deletions
vl.c
... | ... | @@ -4388,6 +4388,7 @@ static int tcg_has_work(void) |
4388 | 4388 | |
4389 | 4389 | static int qemu_calculate_timeout(void) |
4390 | 4390 | { |
4391 | +#ifndef CONFIG_IOTHREAD | |
4391 | 4392 | int timeout; |
4392 | 4393 | |
4393 | 4394 | if (!vm_running) |
... | ... | @@ -4433,6 +4434,9 @@ static int qemu_calculate_timeout(void) |
4433 | 4434 | } |
4434 | 4435 | |
4435 | 4436 | return timeout; |
4437 | +#else /* CONFIG_IOTHREAD */ | |
4438 | + return 1000; | |
4439 | +#endif | |
4436 | 4440 | } |
4437 | 4441 | |
4438 | 4442 | static int vm_can_run(void) |
... | ... | @@ -4468,11 +4472,7 @@ static void main_loop(void) |
4468 | 4472 | #ifdef CONFIG_PROFILER |
4469 | 4473 | ti = profile_getclock(); |
4470 | 4474 | #endif |
4471 | -#ifdef CONFIG_IOTHREAD | |
4472 | - main_loop_wait(1000); | |
4473 | -#else | |
4474 | 4475 | main_loop_wait(qemu_calculate_timeout()); |
4475 | -#endif | |
4476 | 4476 | #ifdef CONFIG_PROFILER |
4477 | 4477 | dev_time += profile_getclock() - ti; |
4478 | 4478 | #endif | ... | ... |