]> git.ipfire.org Git - thirdparty/libvirt.git/commitdiff
qemu: silence clang false positive
authorEric Blake <eblake@redhat.com>
Fri, 5 Aug 2011 15:10:18 +0000 (09:10 -0600)
committerEric Blake <eblake@redhat.com>
Thu, 11 Aug 2011 19:04:25 +0000 (13:04 -0600)
Our logic throws off analyzer tools:

ptr var = NULL;
if (flags == 0) flags = live ? _LIVE : _CONFIG;
if (flags & _LIVE) do stuff
if (flags & _CONFIG) var = non-null;
if (flags & _LIVE) do more stuff
else if (flags & _CONFIG) use var

the tools keep thinking that var can still be NULL in the last
if clause, adding the hint shuts them up.

* src/qemu/qemu_driver.c (qemuDomainSetBlkioParameters): Add a
static analysis hint.

src/qemu/qemu_driver.c

index 19e749f1eb6b1dc37a057a9215d4e824371c173d..421a98ecd7077027f3efe64ec0e4f6f2f8841662 100644 (file)
@@ -5688,6 +5688,9 @@ static int qemuDomainSetBlkioParameters(virDomainPtr dom,
             }
         }
     } else if (flags & VIR_DOMAIN_AFFECT_CONFIG) {
+        /* Clang can't see that if we get here, persistentDef was set.  */
+        sa_assert(persistentDef);
+
         for (i = 0; i < nparams; i++) {
             virTypedParameterPtr param = &params[i];