[PATCH] build: avoid compiler warning in xen code

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



* 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.
---

> Making it use  verify_true() instead, works though

Not really, as that then triggers an unused expression warning.

But hoisting outside of a function works.  I'm pushing this now, under
the build-breaker rule, and then focusing on fixing things for the xen
4 headers in a separate patch (as I still don't have that one fixed
locally yet).

 src/xen/xend_internal.c |    5 ++++-
 src/xen/xm_internal.c   |    5 ++++-
 2 files changed, 8 insertions(+), 2 deletions(-)

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;
-- 
1.7.2.3

--
libvir-list mailing list
libvir-list@xxxxxxxxxx
https://www.redhat.com/mailman/listinfo/libvir-list


[Index of Archives]     [Virt Tools]     [Libvirt Users]     [Lib OS Info]     [Fedora Users]     [Fedora Desktop]     [Fedora SELinux]     [Big List of Linux Books]     [Yosemite News]     [KDE Users]     [Fedora Tools]