On 11/3/20 2:52 AM, Chen Qun wrote:
> After the WITH_QEMU_LOCK_GUARD macro is added, the compiler cannot identify
> that the statements in the macro must be executed. As a result, some
> variables
> assignment statements in the macro may be considered as unexecuted by the
> compiler.
>
> The compiler showed warning:
> util/qemu-timer.c: In function ‘timer_mod_anticipate_ns’:
> util/qemu-timer.c:474:8: warning: ‘rearm’ may be used uninitialized in this
> function [-Wmaybe-uninitialized]
> 474 | if (rearm) {
> | ^
>
> Change the default value assignment place to prevented the warning.
>
> Reported-by: Euler Robot <[email protected]>
> Signed-off-by: Chen Qun <[email protected]>
> ---
> Cc: Paolo Bonzini <[email protected]>
> ---
> util/qemu-timer.c | 4 +---
> 1 file changed, 1 insertion(+), 3 deletions(-)
Reviewed-by: Philippe Mathieu-Daudé <[email protected]>