[libvirt] [PATCH] build: silence clang false positive

Eric Blake eblake at redhat.com
Thu May 12 01:44:44 UTC 2011


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 |    2 ++
 1 files changed, 2 insertions(+), 0 deletions(-)

diff --git a/src/libxl/libxl_driver.c b/src/libxl/libxl_driver.c
index aedee97..a08732b 100644
--- a/src/libxl/libxl_driver.c
+++ b/src/libxl/libxl_driver.c
@@ -1549,6 +1549,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);
     }
-- 
1.7.4.4




More information about the libvir-list mailing list