]> git.ipfire.org Git - thirdparty/libvirt.git/commitdiff
build: avoid compiler warning in xen code
authorEric Blake <eblake@redhat.com>
Mon, 1 Nov 2010 18:18:06 +0000 (12:18 -0600)
committerEric Blake <eblake@redhat.com>
Mon, 1 Nov 2010 18:18:06 +0000 (12:18 -0600)
* src/xen/xend_internal.c (xenDaemonFormatSxpr): Hoist verify
outside of function to avoid a -Wnested-externs warning.
* src/xen/xm_internal.c (xenXMDomainConfigFormat): Likewise.
Reported by Daniel P. Berrange.

src/xen/xend_internal.c
src/xen/xm_internal.c

index 614c0367f5d77d3022a4e665bbb9753e23e219c1..5c3a4bdda3a79c0b2908803b1cd6975ecc82da07 100644 (file)
@@ -5744,6 +5744,10 @@ xenDaemonFormatSxprInput(virDomainInputDefPtr input,
 }
 
 
+/* Computing the vcpu_avail bitmask works because MAX_VIRT_CPUS is
+   either 32, or 64 on a platform where long is big enough.  */
+verify(MAX_VIRT_CPUS <= sizeof(1UL) * CHAR_BIT);
+
 /**
  * xenDaemonFormatSxpr:
  * @conn: pointer to the hypervisor connection
@@ -5772,7 +5776,6 @@ xenDaemonFormatSxpr(virConnectPtr conn,
     virBufferVSprintf(&buf, "(vcpus %u)", def->maxvcpus);
     /* Computing the vcpu_avail bitmask works because MAX_VIRT_CPUS is
        either 32, or 64 on a platform where long is big enough.  */
-    verify(MAX_VIRT_CPUS <= sizeof(1UL) * CHAR_BIT);
     if (def->vcpus < def->maxvcpus)
         virBufferVSprintf(&buf, "(vcpu_avail %lu)", (1UL << def->vcpus) - 1);
 
index 6c5df0f064d096b9379d077b7cacc8c244022a0e..a4d1a3097fd5739421b4276d0db2ad56bcca7bc6 100644 (file)
@@ -2304,6 +2304,10 @@ error:
 }
 
 
+/* Computing the vcpu_avail bitmask works because MAX_VIRT_CPUS is
+   either 32, or 64 on a platform where long is big enough.  */
+verify(MAX_VIRT_CPUS <= sizeof(1UL) * CHAR_BIT);
+
 virConfPtr xenXMDomainConfigFormat(virConnectPtr conn,
                                    virDomainDefPtr def) {
     virConfPtr conf = NULL;
@@ -2338,7 +2342,6 @@ virConfPtr xenXMDomainConfigFormat(virConnectPtr conn,
         goto no_memory;
     /* Computing the vcpu_avail bitmask works because MAX_VIRT_CPUS is
        either 32, or 64 on a platform where long is big enough.  */
-    verify(MAX_VIRT_CPUS <= sizeof(1UL) * CHAR_BIT);
     if (def->vcpus < def->maxvcpus &&
         xenXMConfigSetInt(conf, "vcpu_avail", (1UL << def->vcpus) - 1) < 0)
         goto no_memory;