[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]

[libvirt] [PATCH 3/3] 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>
---
 src/conf/domain_conf.c       |  2 +-
 src/conf/nwfilter_conf.c     | 14 +++++++-------
 src/cpu/cpu_ppc64.c          |  2 +-
 src/libvirt-domain.c         |  2 +-
 src/libxl/libxl_conf.c       |  2 +-
 src/network/leaseshelper.c   |  4 ++--
 src/qemu/qemu_command.c      |  2 +-
 src/qemu/qemu_domain.c       |  4 ++--
 src/qemu/qemu_driver.c       |  4 ++--
 src/qemu/qemu_hotplug.c      |  4 ++--
 src/qemu/qemu_migration.c    |  2 +-
 src/remote/remote_driver.c   |  2 +-
 src/rpc/virnetservermdns.c   |  2 +-
 src/storage/storage_driver.c |  2 +-
 src/util/virconf.c           |  2 +-
 src/util/virhashcode.c       |  6 +++---
 src/util/virnetdevbridge.c   |  1 +
 src/util/virutil.c           | 10 +++++-----
 tools/virsh-domain.c         |  4 ++--
 tools/virsh.c                |  2 +-
 tools/virt-admin.c           |  2 +-
 21 files changed, 38 insertions(+), 37 deletions(-)

diff --git a/src/conf/domain_conf.c b/src/conf/domain_conf.c
index 958a5b7..560c626 100644
--- a/src/conf/domain_conf.c
+++ b/src/conf/domain_conf.c
@@ -17524,7 +17524,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:
diff --git a/src/conf/nwfilter_conf.c b/src/conf/nwfilter_conf.c
index 032700c..9be0724 100644
--- a/src/conf/nwfilter_conf.c
+++ b/src/conf/nwfilter_conf.c
@@ -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);
diff --git a/src/cpu/cpu_ppc64.c b/src/cpu/cpu_ppc64.c
index f64592b..b68540d 100644
--- a/src/cpu/cpu_ppc64.c
+++ b/src/cpu/cpu_ppc64.c
@@ -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:
diff --git a/src/libvirt-domain.c b/src/libvirt-domain.c
index 310b91b..0298d0a 100644
--- a/src/libvirt-domain.c
+++ b/src/libvirt-domain.c
@@ -7955,7 +7955,7 @@ virDomainSetMetadata(virDomainPtr domain,
                                   "newlines"));
             goto error;
         }
-        /* fallthrough */
+        ATTRIBUTE_FALLTHROUGH;
     case VIR_DOMAIN_METADATA_DESCRIPTION:
         virCheckNullArgGoto(uri, error);
         virCheckNullArgGoto(key, error);
diff --git a/src/libxl/libxl_conf.c b/src/libxl/libxl_conf.c
index 886dc62..81db634 100644
--- a/src/libxl/libxl_conf.c
+++ b/src/libxl/libxl_conf.c
@@ -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;
diff --git a/src/network/leaseshelper.c b/src/network/leaseshelper.c
index a0262dd..b4d87ee 100644
--- a/src/network/leaseshelper.c
+++ b/src/network/leaseshelper.c
@@ -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",
diff --git a/src/qemu/qemu_command.c b/src/qemu/qemu_command.c
index 015af10..060b4ee 100644
--- a/src/qemu/qemu_command.c
+++ b/src/qemu/qemu_command.c
@@ -9049,7 +9049,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;
diff --git a/src/qemu/qemu_domain.c b/src/qemu/qemu_domain.c
index 6986324..2c9aa70 100644
--- a/src/qemu/qemu_domain.c
+++ b/src/qemu/qemu_domain.c
@@ -166,7 +166,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";
@@ -190,7 +190,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"))
diff --git a/src/qemu/qemu_driver.c b/src/qemu/qemu_driver.c
index f0cdea6..c293911 100644
--- a/src/qemu/qemu_driver.c
+++ b/src/qemu/qemu_driver.c
@@ -4063,7 +4063,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,
@@ -4080,7 +4080,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);
diff --git a/src/qemu/qemu_hotplug.c b/src/qemu/qemu_hotplug.c
index 4a7d997..85e4de8 100644
--- a/src/qemu/qemu_hotplug.c
+++ b/src/qemu/qemu_hotplug.c
@@ -2741,7 +2741,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;
     }
@@ -4941,7 +4941,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;
     }
diff --git a/src/qemu/qemu_migration.c b/src/qemu/qemu_migration.c
index 3c0d7e9..4bfc740 100644
--- a/src/qemu/qemu_migration.c
+++ b/src/qemu/qemu_migration.c
@@ -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);
diff --git a/src/remote/remote_driver.c b/src/remote/remote_driver.c
index 9c3ec2c..b452e8b 100644
--- a/src/remote/remote_driver.c
+++ b/src/remote/remote_driver.c
@@ -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)
diff --git a/src/rpc/virnetservermdns.c b/src/rpc/virnetservermdns.c
index 8d7df24..0a2bc87 100644
--- a/src/rpc/virnetservermdns.c
+++ b/src/rpc/virnetservermdns.c
@@ -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
diff --git a/src/storage/storage_driver.c b/src/storage/storage_driver.c
index 1b0d776..9677766 100644
--- a/src/storage/storage_driver.c
+++ b/src/storage/storage_driver.c
@@ -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)))
diff --git a/src/util/virconf.c b/src/util/virconf.c
index 4498d25..c1f41b7 100644
--- a/src/util/virconf.c
+++ b/src/util/virconf.c
@@ -1026,7 +1026,7 @@ int virConfGetValueStringList(virConfPtr conf,
             }
             break;
         }
-        /* fallthrough */
+        ATTRIBUTE_FALLTHROUGH;
 
     default:
         virReportError(VIR_ERR_INTERNAL_ERROR,
diff --git a/src/util/virhashcode.c b/src/util/virhashcode.c
index 357c05f..310ec89 100644
--- a/src/util/virhashcode.c
+++ b/src/util/virhashcode.c
@@ -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;
     }
diff --git a/src/util/virnetdevbridge.c b/src/util/virnetdevbridge.c
index ebe9dba..11b03b4 100644
--- a/src/util/virnetdevbridge.c
+++ b/src/util/virnetdevbridge.c
@@ -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"),
diff --git a/src/util/virutil.c b/src/util/virutil.c
index 79db1d8..aba7c6d 100644
--- a/src/util/virutil.c
+++ b/src/util/virutil.c
@@ -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;
diff --git a/tools/virsh-domain.c b/tools/virsh-domain.c
index ccb514e..4a774c5 100644
--- a/tools/virsh-domain.c
+++ b/tools/virsh-domain.c
@@ -2496,14 +2496,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;
             }
diff --git a/tools/virsh.c b/tools/virsh.c
index 1f5c2b1..3da9534 100644
--- a/tools/virsh.c
+++ b/tools/virsh.c
@@ -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);
diff --git a/tools/virt-admin.c b/tools/virt-admin.c
index 0fa1c00..6157ed2 100644
--- a/tools/virt-admin.c
+++ b/tools/virt-admin.c
@@ -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);
-- 
2.5.5


[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]