qemu: silence clang false positive

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.
This commit is contained in:
Eric Blake 2011-08-05 09:10:18 -06:00
parent 4a6ffae3b6
commit 398ce48d5c
1 changed files with 3 additions and 0 deletions

View 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];