On Thu, Mar 01, 2018 at 15:40:01 +0100, Michal Privoznik wrote: > On 03/01/2018 03:29 PM, Daniel P. Berrangé wrote: > > On Thu, Mar 01, 2018 at 03:12:39PM +0100, Michal Privoznik wrote: > >> On 03/01/2018 02:15 PM, Peter Krempa wrote: > >>> On Thu, Mar 01, 2018 at 14:08:29 +0100, Michal Privoznik wrote: > >>>> Signed-off-by: --help <mprivozn@xxxxxxxxxx> [...] > >> problem with enums in switch() statements is we have to be 100% sure > >> value fits into the enum. For instance: > >> > >> int x = VIR_DOMAIN_DEVICE_LAST + 1; > >> > >> switch ((virDomainDeviceType) x) { > >> ... > >> } > >> > >> is obviously problematic. > >> And no, it's gcc 8. > > > > Well yes & no. GCC complained about cases where we fell-through case: > > statements, due to us not including enough cases. This caused me to > > notice the more general problem with us not handling enum values which > > didn't correspond to named constants. > > > > So the general addition of case/default everywhere was not specifically > > required by gcc 8. It is just something I chose todo to make us more > > robust after realizing the implications of what gcc8 identified. The > > warning flags we use to validate this have existed in ancient gcc versions. > > Looks like Peter has opinion on this too. So should I leave this item > out or reword it? Leave it in.
Attachment:
signature.asc
Description: PGP signature
-- libvir-list mailing list libvir-list@xxxxxxxxxx https://www.redhat.com/mailman/listinfo/libvir-list