[libvirt] [PATCH] build: avoid compiler failure

Eric Blake eblake at redhat.com
Fri Jun 24 03:58:52 UTC 2011


GCC complained about a C99 for-loop declaration outside of C99 mode
when compiling on RHEL 5.

* src/qemu/qemu_driver.c (qemudDomainPinVcpuFlags): Avoid C99 for
loop, since gcc 4.1.2 hates it.
---

Pushing under the build-breaker rule.

 src/qemu/qemu_driver.c |    3 ++-
 1 files changed, 2 insertions(+), 1 deletions(-)

diff --git a/src/qemu/qemu_driver.c b/src/qemu/qemu_driver.c
index 01587e8..2f416c8 100644
--- a/src/qemu/qemu_driver.c
+++ b/src/qemu/qemu_driver.c
@@ -2952,6 +2952,7 @@ qemudDomainPinVcpuFlags(virDomainPtr dom,
     bool isActive;
     qemuDomainObjPrivatePtr priv;
     bool canResetting = true;
+    int pcpu;

     virCheckFlags(VIR_DOMAIN_AFFECT_LIVE |
                   VIR_DOMAIN_AFFECT_CONFIG, -1);
@@ -3011,7 +3012,7 @@ qemudDomainPinVcpuFlags(virDomainPtr dom,
     /* pinning to all physical cpus means resetting,
      * so check if we can reset setting.
      */
-    for (int pcpu = 0; pcpu < hostcpus; pcpu++) {
+    for (pcpu = 0; pcpu < hostcpus; pcpu++) {
         if ((cpumap[pcpu/8] & (1 << (pcpu % 8))) == 0) {
             canResetting = false;
             break;
-- 
1.7.4.4




More information about the libvir-list mailing list