mirror of https://gitee.com/openkylin/libvirt.git
conf: Add compile time check that devices were checked for ABI stability
As in the device info iterator add a switch that will force the compiler to check that new device types are added to the ABI stability checker.
This commit is contained in:
parent
e7d67e7bad
commit
3d6c07f7f8
|
@ -15449,6 +15449,39 @@ virDomainDefCheckABIStability(virDomainDefPtr src,
|
|||
goto error;
|
||||
}
|
||||
|
||||
/* Coverity is not very happy with this - all dead_error_condition */
|
||||
#if !STATIC_ANALYSIS
|
||||
/* This switch statement is here to trigger compiler warning when adding
|
||||
* a new device type. When you are adding a new field to the switch you
|
||||
* also have to add an check above. Otherwise the switch statement has no
|
||||
* real function here and should be optimized out by the compiler. */
|
||||
i = VIR_DOMAIN_DEVICE_LAST;
|
||||
switch ((virDomainDeviceType) i) {
|
||||
case VIR_DOMAIN_DEVICE_DISK:
|
||||
case VIR_DOMAIN_DEVICE_LEASE:
|
||||
case VIR_DOMAIN_DEVICE_FS:
|
||||
case VIR_DOMAIN_DEVICE_NET:
|
||||
case VIR_DOMAIN_DEVICE_INPUT:
|
||||
case VIR_DOMAIN_DEVICE_SOUND:
|
||||
case VIR_DOMAIN_DEVICE_VIDEO:
|
||||
case VIR_DOMAIN_DEVICE_HOSTDEV:
|
||||
case VIR_DOMAIN_DEVICE_WATCHDOG:
|
||||
case VIR_DOMAIN_DEVICE_CONTROLLER:
|
||||
case VIR_DOMAIN_DEVICE_GRAPHICS:
|
||||
case VIR_DOMAIN_DEVICE_HUB:
|
||||
case VIR_DOMAIN_DEVICE_REDIRDEV:
|
||||
case VIR_DOMAIN_DEVICE_NONE:
|
||||
case VIR_DOMAIN_DEVICE_SMARTCARD:
|
||||
case VIR_DOMAIN_DEVICE_CHR:
|
||||
case VIR_DOMAIN_DEVICE_MEMBALLOON:
|
||||
case VIR_DOMAIN_DEVICE_NVRAM:
|
||||
case VIR_DOMAIN_DEVICE_LAST:
|
||||
case VIR_DOMAIN_DEVICE_RNG:
|
||||
case VIR_DOMAIN_DEVICE_SHMEM:
|
||||
break;
|
||||
}
|
||||
#endif
|
||||
|
||||
return true;
|
||||
|
||||
error:
|
||||
|
|
Loading…
Reference in New Issue