[libvirt PATCH] libxl: Fix build with recent Xen that introduces new disk backend type

Marek Marczykowski-Górecki marmarek at invisiblethingslab.com
Tue Aug 2 11:39:31 UTC 2022


On Mon, Aug 01, 2022 at 10:36:07AM +0100, Daniel P. Berrangé wrote:
> 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.

Isn't that the exact purpose of 'default' label? If use of 'default'
means "any of the other 5 specific values, but lets save some characters
to not name them explicitly", then IMHO better to name them
explicitly...

I can see a value of -Werror=switch-enum when adding new (internal) enum
value, to find all the cases where code needs to be adjusted, but even
then a grep is probably sufficient enough. On the other hand, if there
are cases where indeed all the values of (internal API) enum needs to be
handled explicitly, maybe simply omit 'default' label and use
-Werror=switch?

Anyway, if tracking all the enums values of all the used 3rd-party APIs
is desirable (like, noticing when libxl adds new disk type), then it
probably should be a separate CI job, not the default devel build.
Otherwise breakages like this will happen from time to time, and will
be annoyed for people on involved in specific code part at all.

As a short term fix, maybe Xen's CI can build libvirt with
-Wno-error=switch-enum?

-- 
Best Regards,
Marek Marczykowski-Górecki
Invisible Things Lab
-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 488 bytes
Desc: not available
URL: <http://listman.redhat.com/archives/libvir-list/attachments/20220802/cbcc51b5/attachment.sig>


More information about the libvir-list mailing list