1
0
mirror of https://gitlab.com/libvirt/libvirt.git synced 2024-12-22 17:34:18 +03:00

Use ATTRIBUTE_FALLTHROUGH

Use ATTRIBUTE_FALLTHROUGH, introduced by commit
5d84f5961b, instead of comments to
indicate that the fall through is an intentional behavior.

Signed-off-by: Marc Hartmayer <mhartmay@linux.vnet.ibm.com>
Reviewed-by: Boris Fiuczynski <fiuczy@linux.vnet.ibm.com>
Reviewed-by: Bjoern Walk <bwalk@linux.vnet.ibm.com>
This commit is contained in:
Marc Hartmayer 2017-06-07 10:46:41 +02:00 committed by John Ferlan
parent 7363b2266c
commit adf846d3c9
21 changed files with 38 additions and 37 deletions

View File

@ -17666,7 +17666,7 @@ virDomainDefParseXML(xmlDocPtr xml,
def->apic_eoi = eoi;
VIR_FREE(tmp);
}
/* fallthrough */
ATTRIBUTE_FALLTHROUGH;
case VIR_DOMAIN_FEATURE_ACPI:
case VIR_DOMAIN_FEATURE_PAE:
case VIR_DOMAIN_FEATURE_VIRIDIAN:

View File

@ -1852,7 +1852,7 @@ virNWFilterRuleDetailsParse(xmlNodePtr node,
switch (datatype) {
case DATATYPE_UINT8_HEX:
base = 16;
/* fallthrough */
ATTRIBUTE_FALLTHROUGH;
case DATATYPE_UINT8:
if (virStrToLong_ui(prop, NULL, base, &uint_val) >= 0) {
if (uint_val <= 0xff) {
@ -1869,7 +1869,7 @@ virNWFilterRuleDetailsParse(xmlNodePtr node,
case DATATYPE_UINT16_HEX:
base = 16;
/* fallthrough */
ATTRIBUTE_FALLTHROUGH;
case DATATYPE_UINT16:
if (virStrToLong_ui(prop, NULL, base, &uint_val) >= 0) {
if (uint_val <= 0xffff) {
@ -1886,7 +1886,7 @@ virNWFilterRuleDetailsParse(xmlNodePtr node,
case DATATYPE_UINT32_HEX:
base = 16;
/* fallthrough */
ATTRIBUTE_FALLTHROUGH;
case DATATYPE_UINT32:
if (virStrToLong_ui(prop, NULL, base, &uint_val) >= 0) {
item->u.u32 = uint_val;
@ -2120,7 +2120,7 @@ virNWFilterRuleValidate(virNWFilterRuleDefPtr rule)
portData = &rule->p.ipHdrFilter.portData;
protocol = "IP";
dataProtocolID = &rule->p.ipHdrFilter.ipHdr.dataProtocolID;
/* fall through */
ATTRIBUTE_FALLTHROUGH;
case VIR_NWFILTER_RULE_PROTOCOL_IPV6:
if (portData == NULL) {
portData = &rule->p.ipv6HdrFilter.portData;
@ -3030,7 +3030,7 @@ virNWFilterRuleDefDetailsFormat(virBufferPtr buf,
case DATATYPE_UINT8_HEX:
asHex = true;
/* fallthrough */
ATTRIBUTE_FALLTHROUGH;
case DATATYPE_IPMASK:
case DATATYPE_IPV6MASK:
/* display all masks in CIDR format */
@ -3041,7 +3041,7 @@ virNWFilterRuleDefDetailsFormat(virBufferPtr buf,
case DATATYPE_UINT16_HEX:
asHex = true;
/* fallthrough */
ATTRIBUTE_FALLTHROUGH;
case DATATYPE_UINT16:
virBufferAsprintf(buf, asHex ? "0x%x" : "%d",
item->u.u16);
@ -3049,7 +3049,7 @@ virNWFilterRuleDefDetailsFormat(virBufferPtr buf,
case DATATYPE_UINT32_HEX:
asHex = true;
/* fallthrough */
ATTRIBUTE_FALLTHROUGH;
case DATATYPE_UINT32:
virBufferAsprintf(buf, asHex ? "0x%x" : "%u",
item->u.u32);

View File

@ -576,7 +576,7 @@ ppc64Compute(virCPUDefPtr host,
ret = tmp;
goto cleanup;
}
/* fallthrough */
ATTRIBUTE_FALLTHROUGH;
case VIR_CPU_MODE_HOST_PASSTHROUGH:
/* host-model and host-passthrough:

View File

@ -7955,7 +7955,7 @@ virDomainSetMetadata(virDomainPtr domain,
"newlines"));
goto error;
}
/* fallthrough */
ATTRIBUTE_FALLTHROUGH;
case VIR_DOMAIN_METADATA_DESCRIPTION:
virCheckNullArgGoto(uri, error);
virCheckNullArgGoto(key, error);

View File

@ -1048,7 +1048,7 @@ libxlMakeNic(virDomainDefPtr def,
if (VIR_STRDUP(x_nic->bridge,
virDomainNetGetActualBridgeName(l_nic)) < 0)
goto cleanup;
/* fallthrough */
ATTRIBUTE_FALLTHROUGH;
case VIR_DOMAIN_NET_TYPE_ETHERNET:
if (VIR_STRDUP(x_nic->script, l_nic->script) < 0)
goto cleanup;

View File

@ -195,7 +195,7 @@ main(int argc, char **argv)
if (!lease_new)
break;
/* fallthrough */
ATTRIBUTE_FALLTHROUGH;
case VIR_LEASE_ACTION_DEL:
/* Delete the corresponding lease, if it already exists */
delete = true;
@ -232,7 +232,7 @@ main(int argc, char **argv)
}
lease_new = NULL;
/* fallthrough */
ATTRIBUTE_FALLTHROUGH;
case VIR_LEASE_ACTION_DEL:
if (!(leases_str = virJSONValueToString(leases_array_new, true))) {
virReportError(VIR_ERR_INTERNAL_ERROR, "%s",

View File

@ -9126,7 +9126,7 @@ qemuBuildShmemCommandLine(virLogManagerPtr logManager,
virCommandAddArgList(cmd, "-object", devstr, NULL);
VIR_FREE(devstr);
/* fall-through */
ATTRIBUTE_FALLTHROUGH;
case VIR_DOMAIN_SHMEM_MODEL_IVSHMEM_DOORBELL:
devstr = qemuBuildShmemDevStr(def, shmem, qemuCaps);
break;

View File

@ -174,7 +174,7 @@ qemuDomainAsyncJobPhaseToString(qemuDomainAsyncJob job,
case QEMU_ASYNC_JOB_START:
case QEMU_ASYNC_JOB_NONE:
case QEMU_ASYNC_JOB_LAST:
; /* fall through */
ATTRIBUTE_FALLTHROUGH;
}
return "none";
@ -198,7 +198,7 @@ qemuDomainAsyncJobPhaseFromString(qemuDomainAsyncJob job,
case QEMU_ASYNC_JOB_START:
case QEMU_ASYNC_JOB_NONE:
case QEMU_ASYNC_JOB_LAST:
; /* fall through */
ATTRIBUTE_FALLTHROUGH;
}
if (STREQ(phase, "none"))

View File

@ -4189,7 +4189,7 @@ processGuestPanicEvent(virQEMUDriverPtr driver,
case VIR_DOMAIN_LIFECYCLE_CRASH_COREDUMP_DESTROY:
if (doCoreDumpToAutoDumpPath(driver, vm, VIR_DUMP_MEMORY_ONLY) < 0)
goto endjob;
/* fall through */
ATTRIBUTE_FALLTHROUGH;
case VIR_DOMAIN_LIFECYCLE_CRASH_DESTROY:
qemuProcessStop(driver, vm, VIR_DOMAIN_SHUTOFF_CRASHED,
@ -4206,7 +4206,7 @@ processGuestPanicEvent(virQEMUDriverPtr driver,
case VIR_DOMAIN_LIFECYCLE_CRASH_COREDUMP_RESTART:
if (doCoreDumpToAutoDumpPath(driver, vm, VIR_DUMP_MEMORY_ONLY) < 0)
goto endjob;
/* fall through */
ATTRIBUTE_FALLTHROUGH;
case VIR_DOMAIN_LIFECYCLE_CRASH_RESTART:
qemuDomainSetFakeReboot(driver, vm, true);

View File

@ -2745,7 +2745,7 @@ qemuDomainAttachShmemDevice(virQEMUDriverPtr driver,
virReportError(VIR_ERR_OPERATION_UNSUPPORTED,
_("live attach of shmem model '%s' is not supported"),
virDomainShmemModelTypeToString(shmem->model));
/* fall-through */
ATTRIBUTE_FALLTHROUGH;
case VIR_DOMAIN_SHMEM_MODEL_LAST:
return -1;
}
@ -4951,7 +4951,7 @@ qemuDomainDetachShmemDevice(virQEMUDriverPtr driver,
virReportError(VIR_ERR_OPERATION_UNSUPPORTED,
_("live detach of shmem model '%s' is not supported"),
virDomainShmemModelTypeToString(shmem->model));
/* fall-through */
ATTRIBUTE_FALLTHROUGH;
case VIR_DOMAIN_SHMEM_MODEL_LAST:
return -1;
}

View File

@ -676,7 +676,7 @@ qemuMigrationDriveMirrorCancelled(virQEMUDriverPtr driver,
disk->dst);
failed = true;
}
/* fallthrough */
ATTRIBUTE_FALLTHROUGH;
case VIR_DOMAIN_BLOCK_JOB_CANCELED:
case VIR_DOMAIN_BLOCK_JOB_COMPLETED:
qemuBlockJobSyncEnd(driver, vm, asyncJob, disk);

View File

@ -947,7 +947,7 @@ doRemoteOpen(virConnectPtr conn,
goto failed;
#endif
/*FALLTHROUGH*/
ATTRIBUTE_FALLTHROUGH;
case trans_tcp:
priv->client = virNetClientNewTCP(priv->hostname, port, AF_UNSPEC);
if (!priv->client)

View File

@ -231,7 +231,7 @@ static void virNetServerMDNSClientCallback(AvahiClient *c,
* in AVAHI_SERVER_RUNNING state we will register them
* again with the new host name. */
/* Fallthrough */
ATTRIBUTE_FALLTHROUGH;
case AVAHI_CLIENT_S_REGISTERING:
/* The server records are now being established. This

View File

@ -3466,7 +3466,7 @@ virStorageTranslateDiskSourcePool(virConnectPtr conn,
case VIR_STORAGE_SOURCE_POOL_MODE_DEFAULT:
case VIR_STORAGE_SOURCE_POOL_MODE_LAST:
def->src->srcpool->mode = VIR_STORAGE_SOURCE_POOL_MODE_HOST;
/* fallthrough */
ATTRIBUTE_FALLTHROUGH;
case VIR_STORAGE_SOURCE_POOL_MODE_HOST:
def->src->srcpool->actualtype = VIR_STORAGE_TYPE_BLOCK;
if (!(def->src->path = virStorageVolGetPath(vol)))

View File

@ -1026,7 +1026,7 @@ int virConfGetValueStringList(virConfPtr conf,
}
break;
}
/* fallthrough */
ATTRIBUTE_FALLTHROUGH;
default:
virReportError(VIR_ERR_INTERNAL_ERROR,

View File

@ -97,17 +97,17 @@ uint32_t virHashCodeGen(const void *key, size_t len, uint32_t seed)
switch (len & 3) {
case 3:
k1 ^= tail[2] << 16;
/* fallthrough */
ATTRIBUTE_FALLTHROUGH;
case 2:
k1 ^= tail[1] << 8;
/* fallthrough */
ATTRIBUTE_FALLTHROUGH;
case 1:
k1 ^= tail[0];
k1 *= c1;
k1 = rotl32(k1, 15);
k1 *= c2;
h1 ^= k1;
/* fallthrough */
ATTRIBUTE_FALLTHROUGH;
default:
break;
}

View File

@ -482,6 +482,7 @@ virNetDevBridgeCreate(const char *brname)
/* intentionally fall through if virNetDevBridgeCreateWithIoctl()
* isn't available.
*/
ATTRIBUTE_FALLTHROUGH;
default:
virReportSystemError(-err->error,
_("error creating bridge interface %s"),

View File

@ -312,19 +312,19 @@ virScaleInteger(unsigned long long *value, const char *suffix,
switch (c_tolower(*suffix)) {
case 'e':
scale *= base;
/* fallthrough */
ATTRIBUTE_FALLTHROUGH;
case 'p':
scale *= base;
/* fallthrough */
ATTRIBUTE_FALLTHROUGH;
case 't':
scale *= base;
/* fallthrough */
ATTRIBUTE_FALLTHROUGH;
case 'g':
scale *= base;
/* fallthrough */
ATTRIBUTE_FALLTHROUGH;
case 'm':
scale *= base;
/* fallthrough */
ATTRIBUTE_FALLTHROUGH;
case 'k':
scale *= base;
break;

View File

@ -2504,14 +2504,14 @@ virshBlockJobInfo(vshControl *ctl,
switch (last_error->code) {
case VIR_ERR_INVALID_ARG:
priv->blockJobNoBytes = true;
/* fallthrough */
ATTRIBUTE_FALLTHROUGH;
case VIR_ERR_OVERFLOW:
if (!bytes && !raw) {
/* try again with MiB/s, unless forcing bytes */
vshResetLibvirtError();
break;
}
/* fallthrough */
ATTRIBUTE_FALLTHROUGH;
default:
goto cleanup;
}

View File

@ -777,7 +777,7 @@ virshParseArgv(vshControl *ctl, int argc, char **argv)
puts(VERSION);
exit(EXIT_SUCCESS);
}
/* fall through */
ATTRIBUTE_FALLTHROUGH;
case 'V':
virshShowVersion(ctl);
exit(EXIT_SUCCESS);

View File

@ -1300,7 +1300,7 @@ vshAdmParseArgv(vshControl *ctl, int argc, char **argv)
puts(VERSION);
exit(EXIT_SUCCESS);
}
/* fall through */
ATTRIBUTE_FALLTHROUGH;
case 'V':
vshAdmShowVersion(ctl);
exit(EXIT_SUCCESS);