
On Mon, Aug 01, 2022 at 09:51:11AM +0100, Julien Grall wrote:
Hi Michal,
On 01/08/2022 09:23, Michal Prívozník wrote:
On 7/29/22 17:50, Oleksandr Tyshchenko wrote:
From: Oleksandr Tyshchenko <oleksandr_tyshchenko@epam.com>
Xen toolstack has gained basic Virtio support recently which becides adding various virtio related stuff introduces new disk backend type LIBXL_DISK_BACKEND_STANDALONE [1].
Unfortunately, this caused a regression in libvirt build with Xen support enabled, reported by the osstest today [2]:
CC libxl/libvirt_driver_libxl_impl_la-xen_xl.lo ../../src/libxl/xen_xl.c: In function 'xenParseXLDisk': ../../src/libxl/xen_xl.c:779:17: error: enumeration value 'LIBXL_DISK_BACKEND_STANDALONE' not handled in switch [-Werror=switch-enum] switch (libxldisk->backend) { ^~~~~~ cc1: all warnings being treated as errors
The interesting fact is that switch already has a default branch (which ought to cover such new addition), but the error is triggered as -Wswitch-enum gives a warning about an omitted enumeration code even if there is a default label.
This is expected and in fact working correctly. We want compiler to warn us about enum members that are not handled in a switch() statement.
For us this is treated as an error. Is it intended?
Yes & no, but mostly yes. You can choose to build with -Werror or not. If building from .git then it defaults to enabled, but can be disabled if desired. Generally we want to see errors triggered from new enums arriving, as it can be a sign that libvirt code needs a semantic change in order to continue operating correctly. It isn't always correct to assume that the 'default' case gives the correct behaviour. With regards, Daniel -- |: https://berrange.com -o- https://www.flickr.com/photos/dberrange :| |: https://libvirt.org -o- https://fstop138.berrange.com :| |: https://entangle-photo.org -o- https://www.instagram.com/dberrange :|