[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: [PATCH v3 1/2] migration: Fix incorrect integer->float conversion ca
From: |
Richard Henderson |
Subject: |
Re: [PATCH v3 1/2] migration: Fix incorrect integer->float conversion caught by clang |
Date: |
Fri, 22 Nov 2019 08:13:37 +0000 |
User-agent: |
Mozilla/5.0 (X11; Linux x86_64; rv:60.0) Gecko/20100101 Thunderbird/60.9.0 |
On 11/22/19 9:00 AM, Markus Armbruster wrote:
> From: Fangrui Song <address@hidden>
>
> Clang does not like qmp_migrate_set_downtime()'s code to clamp double
> @value to 0..INT64_MAX:
>
> qemu/migration/migration.c:2038:24: error: implicit conversion from
> 'long' to 'double' changes value from 9223372036854775807 to
> 9223372036854775808 [-Werror,-Wimplicit-int-float-conversion]
>
> The warning will be enabled by default in clang 10. It is not
> available for clang <= 9.
>
> The clamp is actually useless; @value is checked to be within
> 0..MAX_MIGRATE_DOWNTIME_SECONDS immediately before. Delete it.
>
> While there, make the conversion from double to int64_t explicit.
>
> Signed-off-by: Fangrui Song <address@hidden>
> Reviewed-by: Markus Armbruster <address@hidden>
> [Patch split, commit message improved]
> Signed-off-by: Markus Armbruster <address@hidden>
> ---
> migration/migration.c | 3 +--
> 1 file changed, 1 insertion(+), 2 deletions(-)
Reviewed-by: Richard Henderson <address@hidden>
r~