From: driver1998 <driver1998@foxmail.com>
To: qemu-devel <qemu-devel@nongnu.org>, "Eric Blake" <eblake@redhat.com>
Subject: Re: [Qemu-devel] [PATCH v2 2/4] qga: Fix an enum conversion warningin commands-win32.c, hit by clang.
Date: Fri, 3 May 2019 05:18:16 +0800 [thread overview]
Message-ID: <tencent_9962D5F9426BA267581CCB79DB1FE17AD508@qq.com> (raw)
On 5/1/19 2:25 AM, Eric Blake wrote:
> This adds lots of explicit casts. Are they actually necessary? Without
> seeing the actual warning, it seems fishy to have to be this explicit.
So here are the warnings, on clang version 9.0.0 (trunk 351977).
qga/commands-win32.c:461:24: error: implicit conversion from enumeration type 'enum GuestDiskBusType' to different
enumeration type 'STORAGE_BUS_TYPE' (aka 'enum _STORAGE_BUS_TYPE') [-Werror,-Wenum-conversion]
[BusTypeUnknown] = GUEST_DISK_BUS_TYPE_UNKNOWN,
^~~~~~~~~~~~~~~~~~~~~~~~~~~
qga/commands-win32.c:462:21: error: implicit conversion from enumeration type 'enum GuestDiskBusType' to different
enumeration type 'STORAGE_BUS_TYPE' (aka 'enum _STORAGE_BUS_TYPE') [-Werror,-Wenum-conversion]
[BusTypeScsi] = GUEST_DISK_BUS_TYPE_SCSI,
^~~~~~~~~~~~~~~~~~~~~~~~
qga/commands-win32.c:463:22: error: implicit conversion from enumeration type 'enum GuestDiskBusType' to different
enumeration type 'STORAGE_BUS_TYPE' (aka 'enum _STORAGE_BUS_TYPE') [-Werror,-Wenum-conversion]
[BusTypeAtapi] = GUEST_DISK_BUS_TYPE_IDE,
^~~~~~~~~~~~~~~~~~~~~~~
qga/commands-win32.c:464:20: error: implicit conversion from enumeration type 'enum GuestDiskBusType' to different
enumeration type 'STORAGE_BUS_TYPE' (aka 'enum _STORAGE_BUS_TYPE') [-Werror,-Wenum-conversion]
[BusTypeAta] = GUEST_DISK_BUS_TYPE_IDE,
^~~~~~~~~~~~~~~~~~~~~~~
qga/commands-win32.c:465:21: error: implicit conversion from enumeration type 'enum GuestDiskBusType' to different
enumeration type 'STORAGE_BUS_TYPE' (aka 'enum _STORAGE_BUS_TYPE') [-Werror,-Wenum-conversion]
[BusType1394] = GUEST_DISK_BUS_TYPE_IEEE1394,
^~~~~~~~~~~~~~~~~~~~~~~~~~~~
qga/commands-win32.c:466:20: error: implicit conversion from enumeration type 'enum GuestDiskBusType' to different
enumeration type 'STORAGE_BUS_TYPE' (aka 'enum _STORAGE_BUS_TYPE') [-Werror,-Wenum-conversion]
[BusTypeSsa] = GUEST_DISK_BUS_TYPE_SSA,
^~~~~~~~~~~~~~~~~~~~~~~
qga/commands-win32.c:467:22: error: implicit conversion from enumeration type 'enum GuestDiskBusType' to different
enumeration type 'STORAGE_BUS_TYPE' (aka 'enum _STORAGE_BUS_TYPE') [-Werror,-Wenum-conversion]
[BusTypeFibre] = GUEST_DISK_BUS_TYPE_SSA,
^~~~~~~~~~~~~~~~~~~~~~~
qga/commands-win32.c:468:20: error: implicit conversion from enumeration type 'enum GuestDiskBusType' to different
enumeration type 'STORAGE_BUS_TYPE' (aka 'enum _STORAGE_BUS_TYPE') [-Werror,-Wenum-conversion]
[BusTypeUsb] = GUEST_DISK_BUS_TYPE_USB,
^~~~~~~~~~~~~~~~~~~~~~~
qga/commands-win32.c:469:21: error: implicit conversion from enumeration type 'enum GuestDiskBusType' to different
enumeration type 'STORAGE_BUS_TYPE' (aka 'enum _STORAGE_BUS_TYPE') [-Werror,-Wenum-conversion]
[BusTypeRAID] = GUEST_DISK_BUS_TYPE_RAID,
^~~~~~~~~~~~~~~~~~~~~~~~
qga/commands-win32.c:470:22: error: implicit conversion from enumeration type 'enum GuestDiskBusType' to different
enumeration type 'STORAGE_BUS_TYPE' (aka 'enum _STORAGE_BUS_TYPE') [-Werror,-Wenum-conversion]
[BusTypeiScsi] = GUEST_DISK_BUS_TYPE_ISCSI,
CC qga/qapi-generated/qga-qapi-visit.o
^~~~~~~~~~~~~~~~~~~~~~~~~
qga/commands-win32.c:471:20: error: implicit conversion from enumeration type 'enum GuestDiskBusType' to different
enumeration type 'STORAGE_BUS_TYPE' (aka 'enum _STORAGE_BUS_TYPE') [-Werror,-Wenum-conversion]
[BusTypeSas] = GUEST_DISK_BUS_TYPE_SAS,
^~~~~~~~~~~~~~~~~~~~~~~
qga/commands-win32.c:472:21: error: implicit conversion from enumeration type 'enum GuestDiskBusType' to different
enumeration type 'STORAGE_BUS_TYPE' (aka 'enum _STORAGE_BUS_TYPE') [-Werror,-Wenum-conversion]
[BusTypeSata] = GUEST_DISK_BUS_TYPE_SATA,
^~~~~~~~~~~~~~~~~~~~~~~~
qga/commands-win32.c:473:20: error: implicit conversion from enumeration type 'enum GuestDiskBusType' to different
enumeration type 'STORAGE_BUS_TYPE' (aka 'enum _STORAGE_BUS_TYPE') [-Werror,-Wenum-conversion]
[BusTypeSd] = GUEST_DISK_BUS_TYPE_SD,
^~~~~~~~~~~~~~~~~~~~~~
qga/commands-win32.c:474:20: error: implicit conversion from enumeration type 'enum GuestDiskBusType' to different
enumeration type 'STORAGE_BUS_TYPE' (aka 'enum _STORAGE_BUS_TYPE') [-Werror,-Wenum-conversion]
[BusTypeMmc] = GUEST_DISK_BUS_TYPE_MMC,
^~~~~~~~~~~~~~~~~~~~~~~
qga/commands-win32.c:486:12: error: implicit conversion from enumeration type 'STORAGE_BUS_TYPE'
(aka 'enum _STORAGE_BUS_TYPE') to different enumeration type 'GuestDiskBusType' (aka 'enum GuestDiskBusType')
[-Werror,-Wenum-conversion]
return win2qemu[(int)bus];
~~~~~~ ^~~~~~~~~~~~~~~~~~
> Or is it complaining that GuestDiskBusType and STORAGE_BUS_TYPE are
> distinct types, and that we are indeed cross-assigning between the two
> enums because we intentionally want them to share values?
It looks like it is, according to the last warning.
next reply other threads:[~2019-05-02 21:18 UTC|newest]
Thread overview: 6+ messages / expand[flat|nested] mbox.gz Atom feed top
2019-05-02 21:18 driver1998 [this message]
2019-05-02 21:18 ` [Qemu-devel] [PATCH v2 2/4] qga: Fix an enum conversion warningin commands-win32.c, hit by clang driver1998
2019-05-02 21:52 ` Eric Blake
2019-05-02 21:52 ` Eric Blake
2019-05-02 22:24 ` [Qemu-devel] [PATCH v2 2/4] qga: Fix an enum conversion warningincommands-win32.c, " GH Cao
2019-05-02 22:24 ` GH Cao
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=tencent_9962D5F9426BA267581CCB79DB1FE17AD508@qq.com \
--to=driver1998@foxmail.com \
--cc=eblake@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).