libvirt/b164db62-xen-compile-warnings.patch

58 lines
2.2 KiB
Diff

commit b164db623c7dce2d75b100abae3be6ffd162c4e4
Author: Eric Blake <eblake@redhat.com>
Date: Mon Nov 1 12:18:06 2010 -0600
build: avoid compiler warning in xen code
* 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.
diff --git a/src/xen/xend_internal.c b/src/xen/xend_internal.c
index 614c036..5c3a4bd 100644
--- a/src/xen/xend_internal.c
+++ b/src/xen/xend_internal.c
@@ -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);
diff --git a/src/xen/xm_internal.c b/src/xen/xm_internal.c
index 6c5df0f..a4d1a30 100644
--- a/src/xen/xm_internal.c
+++ b/src/xen/xm_internal.c
@@ -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;