All of lore.kernel.org
 help / color / mirror / Atom feed
* Compile errors with gcc 4.8
@ 2013-02-06 20:37 M A Young
  2013-02-07  0:55 ` Andrew Cooper
  2013-02-07 10:02 ` Jan Beulich
  0 siblings, 2 replies; 14+ messages in thread
From: M A Young @ 2013-02-06 20:37 UTC (permalink / raw)
  To: xen-devel

[-- Attachment #1: Type: TEXT/PLAIN, Size: 1706 bytes --]

Fedora rawhide has just moved onto gcc 4.8, and I have had to apply the 
attached patch to get it to build (I constructed the patch against 4.2.1 
but I believe it will apply to xen-unstable).

There are two types of problem, the first is from 
xen/common/compat/memory.c where the error is

memory.c: In function 'compat_memory_op':
/builddir/build/BUILD/xen-4.2.1/xen/include/public/arch-x86/xen.h:35:33: 
error: typedef '__guest_handle_const_compat_memory_exchange_t' locally 
defined but not used [-Werror=unused-local-typedefs]
      typedef struct { type *p; } __guest_handle_ ## name
                                  ^
/builddir/build/BUILD/xen-4.2.1/xen/include/public/arch-x86/xen.h:43:5: 
note: in expansion of macro '___DEFINE_XEN_GUEST_HANDLE'
      ___DEFINE_XEN_GUEST_HANDLE(const_##name, const type)
      ^
/builddir/build/BUILD/xen-4.2.1/xen/include/public/arch-x86/xen.h:44:41: 
note: in expansion of macro '__DEFINE_XEN_GUEST_HANDLE'
  #define DEFINE_XEN_GUEST_HANDLE(name)   __DEFINE_XEN_GUEST_HANDLE(name, 
name)
                                          ^
memory.c:261:13: note: in expansion of macro 'DEFINE_XEN_GUEST_HANDLE'
              DEFINE_XEN_GUEST_HANDLE(compat_memory_exchange_t);
              ^

so we are defining something that isn't used.

Secondly gcc 4.8 objects to lines like

memset(ctxt, 0, sizeof(ctxt));

where I think you are just zeroing a pointer's worth of memory. There are 
a few cases of this in the xen code fixed in the patch, and I am also 
suspicious of line 630 of 
stubdom/grub-upstream/stage2/fsys_reiserfs.c which is

memset (INFO->blocks, 0, sizeof (INFO->blocks));

which is noted in the build log but not flagged as an error.

 	Michael Young

[-- Attachment #2: Type: TEXT/PLAIN, Size: 3328 bytes --]

--- xen-4.2.1/xen/common/compat/memory.c.orig	2012-12-17 15:01:54.000000000 +0000
+++ xen-4.2.1/xen/common/compat/memory.c	2013-01-28 21:24:36.971241229 +0000
@@ -258,7 +258,7 @@
 
         case XENMEM_exchange:
         {
-            DEFINE_XEN_GUEST_HANDLE(compat_memory_exchange_t);
+            DEFINE_XEN_GUEST_HANDLE(compat_memory_exchange_t) __attribute__((unused));
             int order_delta;
 
             BUG_ON(split >= 0 && rc);
--- xen-4.2.1/tools/libxc/xc_dom_boot.c.orig	2012-12-17 15:00:48.000000000 +0000
+++ xen-4.2.1/tools/libxc/xc_dom_boot.c	2013-01-28 22:21:13.215782329 +0000
@@ -266,7 +266,7 @@
         return rc;
 
     /* let the vm run */
-    memset(ctxt, 0, sizeof(ctxt));
+    memset(ctxt, 0, sizeof(*ctxt));
     if ( (rc = dom->arch_hooks->vcpu(dom, ctxt)) != 0 )
         return rc;
     xc_dom_unmap_all(dom);
--- xen-4.2.1/tools/blktap2/drivers/md5.c.orig	2012-12-17 15:00:11.000000000 +0000
+++ xen-4.2.1/tools/blktap2/drivers/md5.c	2013-01-28 23:49:51.940289123 +0000
@@ -174,7 +174,7 @@
     MD5Transform(ctx->buf, (uint32_t *) ctx->in);
     byteReverse((unsigned char *) ctx->buf, 4);
     memcpy(digest, ctx->buf, 16);
-    memset(ctx, 0, sizeof(ctx));     /* In case it's sensitive */
+    memset(ctx, 0, sizeof(*ctx));     /* In case it's sensitive */
 }
 
 /* The four core functions - F1 is optimized somewhat */
--- xen-4.2.1/tools/libxl/libxl_qmp.c.orig	2012-12-17 15:01:09.000000000 +0000
+++ xen-4.2.1/tools/libxl/libxl_qmp.c	2013-01-29 21:28:27.763650073 +0000
@@ -377,7 +377,7 @@
     ret = libxl_fd_set_cloexec(qmp->ctx, qmp->qmp_fd, 1);
     if (ret) return -1;
 
-    memset(&qmp->addr, 0, sizeof (&qmp->addr));
+    memset(&qmp->addr, 0, sizeof (qmp->addr));
     qmp->addr.sun_family = AF_UNIX;
     strncpy(qmp->addr.sun_path, qmp_socket_path,
             sizeof (qmp->addr.sun_path));
--- xen-4.2.1/tools/xenstat/libxenstat/src/xenstat_linux.c.orig	2012-12-17 15:01:35.000000000 +0000
+++ xen-4.2.1/tools/xenstat/libxenstat/src/xenstat_linux.c	2013-01-29 21:43:46.044169987 +0000
@@ -113,7 +113,7 @@
 
 	/* Initialize all variables called has passed as non-NULL to zeros */
 	if (iface != NULL)
-		memset(iface, 0, sizeof(iface));
+		memset(iface, 0, sizeof(*iface));
 	if (rxBytes != NULL)
 		*rxBytes = 0;
 	if (rxPackets != NULL)
--- xen-4.2.1/tools/debugger/kdd/kdd-xen.c.orig	2012-12-17 15:00:22.000000000 +0000
+++ xen-4.2.1/tools/debugger/kdd/kdd-xen.c	2013-01-29 21:45:12.652087239 +0000
@@ -333,7 +333,7 @@
     if (!cpu) 
         return -1;
 
-    memset(r, 0, sizeof(r));
+    memset(r, 0, sizeof(*r));
     
     if (w64)
         kdd_get_regs_x86_64(cpu, &r->r64);
--- xen-4.2.1/tools/python/xen/lowlevel/netlink/libnetlink.c.orig	2012-12-17 15:01:24.000000000 +0000
+++ xen-4.2.1/tools/python/xen/lowlevel/netlink/libnetlink.c	2013-01-29 21:47:59.524001053 +0000
@@ -37,7 +37,7 @@
        int sndbuf = 32768;
        int rcvbuf = 32768;
 
-       memset(rth, 0, sizeof(rth));
+       memset(rth, 0, sizeof(*rth));
 
        rth->fd = socket(AF_NETLINK, SOCK_RAW, protocol);
        if (rth->fd < 0) {
@@ -264,7 +264,7 @@
                return -1;
        }
 
-       memset(buf,0,sizeof(buf));
+       memset(buf,0,sizeof(*buf));
 
        iov.iov_base = buf;
 

[-- Attachment #3: Type: text/plain, Size: 126 bytes --]

_______________________________________________
Xen-devel mailing list
Xen-devel@lists.xen.org
http://lists.xen.org/xen-devel

^ permalink raw reply	[flat|nested] 14+ messages in thread

end of thread, other threads:[~2013-02-08 20:56 UTC | newest]

Thread overview: 14+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2013-02-06 20:37 Compile errors with gcc 4.8 M A Young
2013-02-07  0:55 ` Andrew Cooper
2013-02-07  8:59   ` M A Young
2013-02-07  9:06     ` Ian Campbell
2013-02-07  9:57       ` Jan Beulich
2013-02-07 11:55         ` Keir Fraser
2013-02-07 23:20           ` [PATCH 1/2] " M A Young
2013-02-08  8:11             ` Jan Beulich
2013-02-08 20:56               ` [PATCH 1/2 v2] " M A Young
2013-02-07  9:07     ` M A Young
2013-02-07  9:08   ` Frediano Ziglio
2013-02-07 10:02 ` Jan Beulich
2013-02-07 23:25   ` [Patch 2/2] " M A Young
2013-02-08  8:13     ` Jan Beulich

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.