[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: [PATCH v3 2/9] s390x: fix clang 11 warnings in cpu_models.c
|
From: |
Cornelia Huck |
|
Subject: |
Re: [PATCH v3 2/9] s390x: fix clang 11 warnings in cpu_models.c |
|
Date: |
Mon, 9 Nov 2020 12:12:54 +0100 |
On Thu, 5 Nov 2020 17:18:58 -0500
Daniele Buono <dbuono@linux.vnet.ibm.com> wrote:
> There are void * pointers that get casted to enums, in cpu_models.c
> Such casts can result in a small integer type and are caught as
> warnings with clang, starting with version 11:
>
> Clang 11 finds a bunch of spots in the code that trigger this new warnings:
>
> ../qemu-base/target/s390x/cpu_models.c:985:21: error: cast to smaller integer
> type 'S390Feat' from 'void *' [-Werror,-Wvoid-pointer-to-enum-cast]
> S390Feat feat = (S390Feat) opaque;
> ^~~~~~~~~~~~~~~~~
> ../qemu-base/target/s390x/cpu_models.c:1002:21: error: cast to smaller
> integer type 'S390Feat' from 'void *' [-Werror,-Wvoid-pointer-to-enum-cast]
> S390Feat feat = (S390Feat) opaque;
> ^~~~~~~~~~~~~~~~~
> ../qemu-base/target/s390x/cpu_models.c:1036:27: error: cast to smaller
> integer type 'S390FeatGroup' from 'void *'
> [-Werror,-Wvoid-pointer-to-enum-cast]
> S390FeatGroup group = (S390FeatGroup) opaque;
> ^~~~~~~~~~~~~~~~~~~~~~
> ../qemu-base/target/s390x/cpu_models.c:1057:27: error: cast to smaller
> integer type 'S390FeatGroup' from 'void *'
> [-Werror,-Wvoid-pointer-to-enum-cast]
> S390FeatGroup group = (S390FeatGroup) opaque;
> ^~~~~~~~~~~~~~~~~~~~~~
> 4 errors generated.
>
> Avoid this warning by casting the pointer to uintptr_t first.
>
> Signed-off-by: Daniele Buono <dbuono@linux.vnet.ibm.com>
> ---
> target/s390x/cpu_models.c | 8 ++++----
> 1 file changed, 4 insertions(+), 4 deletions(-)
Acked-by: Cornelia Huck <cohuck@redhat.com>
- [PATCH v3 0/9] Add support for Control-Flow Integrity, Daniele Buono, 2020/11/05
- [PATCH v3 1/9] fuzz: Make fork_fuzz.ld compatible with LLVM's LLD, Daniele Buono, 2020/11/05
- [PATCH v3 2/9] s390x: fix clang 11 warnings in cpu_models.c, Daniele Buono, 2020/11/05
- Re: [PATCH v3 2/9] s390x: fix clang 11 warnings in cpu_models.c,
Cornelia Huck <=
- [PATCH v3 4/9] s390x: Avoid variable size warning in ipl.h, Daniele Buono, 2020/11/05
- [PATCH v3 6/9] configure,meson: add option to enable LTO, Daniele Buono, 2020/11/05
- [PATCH v3 5/9] scsi: fix overflow in scsi_disk_new_request_dump, Daniele Buono, 2020/11/05
[PATCH v3 7/9] cfi: Initial support for cfi-icall in QEMU, Daniele Buono, 2020/11/05
[PATCH v3 8/9] check-block: enable iotests with cfi-icall, Daniele Buono, 2020/11/05