]> xenbits.xensource.com Git - libvirt.git/commitdiff
build: silence clang false positive
authorEric Blake <eblake@redhat.com>
Thu, 12 May 2011 01:41:46 +0000 (19:41 -0600)
committerEric Blake <eblake@redhat.com>
Wed, 18 May 2011 18:47:46 +0000 (12:47 -0600)
Clang couldn't quite see that the same condition of
(flags & VIR_DOMAIN_MEM_CONFIG) is used twice, such that
the second block is guaranteed that def was assigned in
the first block.

* src/libxl/libxl_driver.c (libxlDomainSetMemoryFlags): Add a hint
for clang.

src/libxl/libxl_driver.c

index 1d41e2d9f90465bceeb86d0d95a9d6e6cb5d5b32..b2cc0e8ace2a0e310394f8f9c9dd73b7717fffa5 100644 (file)
@@ -1535,6 +1535,8 @@ libxlDomainSetMemoryFlags(virDomainPtr dom, unsigned long memory,
     ret = 0;
 
     if (flags & VIR_DOMAIN_MEM_CONFIG) {
+        /* clang 2.9 needs an extra hint.  */
+        sa_assert(def);
         def->mem.cur_balloon = memory;
         ret = virDomainSaveConfig(driver->configDir, def);
     }