[libvirt] [PATCH 3/3] Fix libvirt_proxy.c warnings from gcc-4.4

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

 



 libvirt_proxy.c: In function 'proxyReadClientSocket':
 libvirt_proxy.c:659: error: dereferencing pointer 'req' does break strict-aliasing rules
 libvirt_proxy.c:657: error: dereferencing pointer 'req' does break strict-aliasing rules
 libvirt_proxy.c:655: error: dereferencing pointer 'req' does break strict-aliasing rules
 libvirt_proxy.c:654: error: dereferencing pointer 'req' does break strict-aliasing rules
 libvirt_proxy.c:650: error: dereferencing pointer 'req' does break strict-aliasing rules
 libvirt_proxy.c:649: error: dereferencing pointer 'req' does break strict-aliasing rules
 libvirt_proxy.c:644: error: dereferencing pointer 'req' does break strict-aliasing rules
 libvirt_proxy.c:636: error: dereferencing pointer 'req' does break strict-aliasing rules
 libvirt_proxy.c:634: error: dereferencing pointer 'req' does break strict-aliasing rules
 libvirt_proxy.c:632: error: dereferencing pointer 'req' does break strict-aliasing rules
 libvirt_proxy.c:631: error: dereferencing pointer 'req' does break strict-aliasing rules
 libvirt_proxy.c:627: error: dereferencing pointer 'req' does break strict-aliasing rules
 libvirt_proxy.c:626: error: dereferencing pointer 'req' does break strict-aliasing rules
 libvirt_proxy.c:622: error: dereferencing pointer 'req' does break strict-aliasing rules
 libvirt_proxy.c:621: error: dereferencing pointer 'req' does break strict-aliasing rules
 libvirt_proxy.c:610: error: dereferencing pointer 'req' does break strict-aliasing rules
 libvirt_proxy.c:603: error: dereferencing pointer 'req' does break strict-aliasing rules
 libvirt_proxy.c:601: error: dereferencing pointer 'req' does break strict-aliasing rules
 libvirt_proxy.c:599: error: dereferencing pointer 'req' does break strict-aliasing rules
 libvirt_proxy.c:598: error: dereferencing pointer 'req' does break strict-aliasing rules
 libvirt_proxy.c:594: error: dereferencing pointer 'req' does break strict-aliasing rules
 libvirt_proxy.c:593: error: dereferencing pointer 'req' does break strict-aliasing rules
 libvirt_proxy.c:588: error: dereferencing pointer 'req' does break strict-aliasing rules
 libvirt_proxy.c:583: error: dereferencing pointer 'req' does break strict-aliasing rules
 libvirt_proxy.c:582: error: dereferencing pointer 'req' does break strict-aliasing rules
 libvirt_proxy.c:580: error: dereferencing pointer 'req' does break strict-aliasing rules
 libvirt_proxy.c:579: error: dereferencing pointer 'req' does break strict-aliasing rules
 libvirt_proxy.c:569: error: dereferencing pointer 'req' does break strict-aliasing rules
 libvirt_proxy.c:562: error: dereferencing pointer 'req' does break strict-aliasing rules
 libvirt_proxy.c:560: error: dereferencing pointer 'req' does break strict-aliasing rules
 libvirt_proxy.c:559: error: dereferencing pointer 'req' does break strict-aliasing rules
 libvirt_proxy.c:552: error: dereferencing pointer 'req' does break strict-aliasing rules
 libvirt_proxy.c:543: error: dereferencing pointer 'req' does break strict-aliasing rules
 libvirt_proxy.c:541: error: dereferencing pointer 'req' does break strict-aliasing rules
 libvirt_proxy.c:534: error: dereferencing pointer 'req' does break strict-aliasing rules
 libvirt_proxy.c:533: error: dereferencing pointer 'req' does break strict-aliasing rules
 libvirt_proxy.c:511: error: dereferencing pointer 'req' does break strict-aliasing rules
 libvirt_proxy.c:497: error: dereferencing pointer 'req' does break strict-aliasing rules
 libvirt_proxy.c:497: error: dereferencing pointer 'req' does break strict-aliasing rules
 libvirt_proxy.c:490: error: dereferencing pointer 'req' does break strict-aliasing rules
 libvirt_proxy.c:489: error: dereferencing pointer 'req' does break strict-aliasing rules
 libvirt_proxy.c:486: error: dereferencing pointer 'req' does break strict-aliasing rules
 libvirt_proxy.c:478: error: dereferencing pointer 'req' does break strict-aliasing rules
 libvirt_proxy.c:478: error: dereferencing pointer 'req' does break strict-aliasing rules
 libvirt_proxy.c:476: error: dereferencing pointer 'req' does break strict-aliasing rules
 libvirt_proxy.c:473: error: dereferencing pointer 'req' does break strict-aliasing rules
 libvirt_proxy.c:470: error: dereferencing pointer 'req' does break strict-aliasing rules
 libvirt_proxy.c:467: error: dereferencing pointer 'req' does break strict-aliasing rules
 libvirt_proxy.c:467: error: dereferencing pointer 'req' does break strict-aliasing rules
 libvirt_proxy.c:465: error: dereferencing pointer 'req' does break strict-aliasing rules
 libvirt_proxy.c:462: error: dereferencing pointer 'req' does break strict-aliasing rules
 libvirt_proxy.c:460: error: dereferencing pointer 'req' does break strict-aliasing rules
 libvirt_proxy.c:454: error: dereferencing pointer 'req' does break strict-aliasing rules
 libvirt_proxy.c:452: error: dereferencing pointer 'req' does break strict-aliasing rules
 libvirt_proxy.c:451: error: dereferencing pointer 'req' does break strict-aliasing rules
 libvirt_proxy.c:445: error: dereferencing pointer 'req' does break strict-aliasing rules
 libvirt_proxy.c:440: error: dereferencing pointer 'req' does break strict-aliasing rules
 libvirt_proxy.c:438: error: dereferencing pointer 'req' does break strict-aliasing rules
 libvirt_proxy.c:434: error: dereferencing pointer 'req' does break strict-aliasing rules
 libvirt_proxy.c:432: error: dereferencing pointer 'req' does break strict-aliasing rules
 libvirt_proxy.c:399: error: dereferencing pointer 'req' does break strict-aliasing rules
 libvirt_proxy.c:393: error: dereferencing pointer 'req' does break strict-aliasing rules
 libvirt_proxy.c:388: error: dereferencing pointer 'req' does break strict-aliasing rules
 libvirt_proxy.c:387: error: dereferencing pointer 'req' does break strict-aliasing rules
 libvirt_proxy.c:386: error: dereferencing pointer 'req' does break strict-aliasing rules
 libvirt_proxy.c:455: error: dereferencing pointer 'req' does break strict-aliasing rules
 libvirt_proxy.c:564: error: dereferencing pointer 'req' does break strict-aliasing rules
 libvirt_proxy.c:310: error: dereferencing pointer 'req' does break strict-aliasing rules
 libvirt_proxy.c:311: error: dereferencing pointer 'req' does break strict-aliasing rules
 libvirt_proxy.c:318: error: dereferencing pointer 'req' does break strict-aliasing rules
 libvirt_proxy.c:321: error: dereferencing pointer 'req' does break strict-aliasing rules
 libvirt_proxy.c:333: error: dereferencing pointer 'req' does break strict-aliasing rules
 libvirt_proxy.c:335: error: dereferencing pointer 'req' does break strict-aliasing rules
 libvirt_proxy.c:404: error: dereferencing pointer 'req' does break strict-aliasing rules
 libvirt_proxy.c:405: error: dereferencing pointer 'req' does break strict-aliasing rules
 libvirt_proxy.c:355: note: initialized from here
 cc1: error: dereferencing pointer 'req' does break strict-aliasing rules
 libvirt_proxy.c:355: note: initialized from here

Signed-off-by: Mark McLoughlin <markmc@xxxxxxxxxx>
---
 proxy/libvirt_proxy.c |   47 +++++++++++++++++++++++++----------------------
 1 files changed, 25 insertions(+), 22 deletions(-)

diff --git a/proxy/libvirt_proxy.c b/proxy/libvirt_proxy.c
index 863dc32..9e2efbf 100644
--- a/proxy/libvirt_proxy.c
+++ b/proxy/libvirt_proxy.c
@@ -351,8 +351,11 @@ proxyWriteClientSocket(int nr, virProxyPacketPtr req) {
 static int
 proxyReadClientSocket(int nr) {
     virDomainDefPtr def;
-    virProxyFullPacket request;
-    virProxyPacketPtr req = (virProxyPacketPtr) &request;
+    union {
+      virProxyFullPacket full_request;
+      virProxyPacket request;
+    } r;
+    virProxyPacketPtr req = &r.request;
     int ret;
     char *xml, *ostype;
 
@@ -398,7 +401,7 @@ retry:
      */
     if (req->len > ret) {
         int total, extra;
-        char *base = (char *) &request;
+        char *base = (char *) &r;
 
         total = ret;
         while (total < req->len) {
@@ -444,8 +447,8 @@ retry2:
 
             if (req->len != sizeof(virProxyPacket))
                 goto comm_error;
-            maxids = sizeof(request.extra.arg) / sizeof(int);
-            ret = xenHypervisorListDomains(conn, &request.extra.arg[0],
+            maxids = sizeof(r.full_request.extra.arg) / sizeof(int);
+            ret = xenHypervisorListDomains(conn, &r.full_request.extra.arg[0],
                                            maxids);
             if (ret < 0) {
                 req->len = sizeof(virProxyPacket);
@@ -469,9 +472,9 @@ retry2:
         case VIR_PROXY_DOMAIN_INFO:
             if (req->len != sizeof(virProxyPacket))
                 goto comm_error;
-            memset(&request.extra.dinfo, 0, sizeof(virDomainInfo));
+            memset(&r.full_request.extra.dinfo, 0, sizeof(virDomainInfo));
             ret = xenHypervisorGetDomInfo(conn, req->data.arg,
-                                          &request.extra.dinfo);
+                                          &r.full_request.extra.dinfo);
             if (ret < 0) {
                 req->data.arg = -1;
             } else {
@@ -495,8 +498,8 @@ retry2:
                     name[1000] = 0;
                 }
                 req->len += VIR_UUID_BUFLEN + len + 1;
-                memcpy(&request.extra.str[0], uuid, VIR_UUID_BUFLEN);
-                strcpy(&request.extra.str[VIR_UUID_BUFLEN], name);
+                memcpy(&r.full_request.extra.str[0], uuid, VIR_UUID_BUFLEN);
+                strcpy(&r.full_request.extra.str[VIR_UUID_BUFLEN], name);
             }
         free(name);
             break;
@@ -521,7 +524,7 @@ retry2:
             if (names != NULL) {
                while (*tmp != NULL) {
                   ident = xenDaemonDomainLookupByName_ids(conn, *tmp, &uuid[0]);
-                  if (!memcmp(uuid, &request.extra.str[0], VIR_UUID_BUFLEN)) {
+                  if (!memcmp(uuid, &r.full_request.extra.str[0], VIR_UUID_BUFLEN)) {
                      name = *tmp;
                      break;
                   }
@@ -539,7 +542,7 @@ retry2:
                     name[1000] = 0;
                 }
                 req->len = sizeof(virProxyPacket) + len + 1;
-                strcpy(&request.extra.str[0], name);
+                strcpy(&r.full_request.extra.str[0], name);
                 req->data.arg = ident;
             }
             free(names);
@@ -553,14 +556,14 @@ retry2:
                 goto comm_error;
 
             ident = xenDaemonDomainLookupByName_ids(conn,
-                                            &request.extra.str[0], &uuid[0]);
+                                            &r.full_request.extra.str[0], &uuid[0]);
             if (ident < 0) {
                 /* not found */
                 req->data.arg = -1;
                 req->len = sizeof(virProxyPacket);
             } else {
                 req->len = sizeof(virProxyPacket) + VIR_UUID_BUFLEN;
-                memcpy(&request.extra.str[0], uuid, VIR_UUID_BUFLEN);
+                memcpy(&r.full_request.extra.str[0], uuid, VIR_UUID_BUFLEN);
                 req->data.arg = ident;
             }
             break;
@@ -574,7 +577,7 @@ retry2:
              * cache them ? Since it's probably an unfrequent call better
              * not make assumption and do the xend RPC each call.
              */
-            ret = xenDaemonNodeGetInfo(conn, &request.extra.ninfo);
+            ret = xenDaemonNodeGetInfo(conn, &r.full_request.extra.ninfo);
             if (ret < 0) {
                 req->data.arg = -1;
                 req->len = sizeof(virProxyPacket);
@@ -594,12 +597,12 @@ retry2:
             req->len = sizeof (virProxyPacket);
         } else {
             int xmllen = strlen (xml);
-            if (xmllen > (int) sizeof (request.extra.str)) {
+            if (xmllen > (int) sizeof (r.full_request.extra.str)) {
                 req->data.arg = -2;
                 req->len = sizeof (virProxyPacket);
             } else {
                 req->data.arg = 0;
-                memmove (request.extra.str, xml, xmllen);
+                memmove (r.full_request.extra.str, xml, xmllen);
                 req->len = sizeof (virProxyPacket) + xmllen;
             }
             free (xml);
@@ -616,7 +619,7 @@ retry2:
              * rather hard to get from that code path. So proxy
              * users won't see CPU pinning (last NULL arg)
              */
-            def = xenDaemonDomainFetch(conn, request.data.arg, NULL, NULL);
+            def = xenDaemonDomainFetch(conn, r.full_request.data.arg, NULL, NULL);
             if (!def) {
                 req->data.arg = -1;
                 req->len = sizeof(virProxyPacket);
@@ -627,12 +630,12 @@ retry2:
                     req->len = sizeof(virProxyPacket);
                 } else {
                     int xmllen = strlen(xml);
-                    if (xmllen > (int) sizeof(request.extra.str)) {
+                    if (xmllen > (int) sizeof(r.full_request.extra.str)) {
                         req->data.arg = -2;
                         req->len = sizeof(virProxyPacket);
                     } else {
                         req->data.arg = 0;
-                        memmove(&request.extra.str[0], xml, xmllen);
+                        memmove(&r.full_request.extra.str[0], xml, xmllen);
                         req->len = sizeof(virProxyPacket) + xmllen;
                     }
                     free(xml);
@@ -644,18 +647,18 @@ retry2:
             if (req->len != sizeof(virProxyPacket))
                 goto comm_error;
 
-            ostype = xenStoreDomainGetOSTypeID(conn, request.data.arg);
+            ostype = xenStoreDomainGetOSTypeID(conn, r.full_request.data.arg);
             if (!ostype) {
                 req->data.arg = -1;
                 req->len = sizeof(virProxyPacket);
             } else {
                 int ostypelen = strlen(ostype);
-                if (ostypelen > (int) sizeof(request.extra.str)) {
+                if (ostypelen > (int) sizeof(r.full_request.extra.str)) {
                     req->data.arg = -2;
                     req->len = sizeof(virProxyPacket);
                 } else {
                     req->data.arg = 0;
-                    memmove(&request.extra.str[0], ostype, ostypelen);
+                    memmove(&r.full_request.extra.str[0], ostype, ostypelen);
                     req->len = sizeof(virProxyPacket) + ostypelen;
                 }
                 free(ostype);
-- 
1.6.0.6

--
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]