Use ATTRIBUTE_FALLTHROUGH

Use ATTRIBUTE_FALLTHROUGH, introduced by commit
5d84f5961b8e28e802f600bb2d2c6903e219092e, 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>
(cherry picked from commit adf846d3c96ce5d45594c718003852684ddf0cb9)
This commit is contained in:
Marc Hartmayer 2017-06-07 10:46:41 +02:00 committed by Cole Robinson
parent d97cad04db
commit 35a7d5084b
19 changed files with 35 additions and 34 deletions

View File

@ -16454,7 +16454,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

@ -1868,7 +1868,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) {
@ -1885,7 +1885,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) {
@ -1902,7 +1902,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;
@ -2137,7 +2137,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;
@ -3371,7 +3371,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 */
@ -3382,7 +3382,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);
@ -3390,7 +3390,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

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

View File

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

View File

@ -900,7 +900,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

@ -206,7 +206,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;
@ -243,7 +243,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

@ -112,7 +112,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";
@ -136,7 +136,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

@ -4003,7 +4003,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,
@ -4020,7 +4020,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

@ -1915,7 +1915,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, disk);

View File

@ -906,7 +906,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

@ -3548,7 +3548,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

@ -1021,7 +1021,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

@ -313,19 +313,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

@ -2562,14 +2562,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

@ -844,7 +844,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

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