Subject: pkg/33979: sysutils/xentools20 fails to compile with gcc 4
To: None <pkg-manager@netbsd.org, gnats-admin@netbsd.org,>
From: None <shannonjr@NetBSD.org>
List: pkgsrc-bugs
Date: 07/11/2006 16:25:00
>Number:         33979
>Category:       pkg
>Synopsis:       sysutils/xentools20 fails to compile with gcc 4
>Confidential:   no
>Severity:       serious
>Priority:       medium
>Responsible:    pkg-manager
>State:          open
>Class:          sw-bug
>Submitter-Id:   net
>Arrival-Date:   Tue Jul 11 16:25:00 +0000 2006
>Originator:     John R. Shannon
>Release:        NetBSD 3.99.21
>Organization:
NetBSD.org
>Environment:
System: NetBSD colleen.internal.johnrshannon.com 3.99.21 NetBSD 3.99.21 (XEN0.COLEEN) #0: Fri Jul 7 09:16:38 MDT 2006 build@colleen.internal.johnrshannon.com:/usr/obj/import/CURRENT/src/sys/arch/i386/compile/XEN0.COLEEN i386
Architecture: i386
Machine: i386
Compiler: gcc version 4.1.2 20060628 prerelease (NetBSD nb1 20060628)
>Description:
	Several casts are required for a successful compilation with gcc4
>How-To-Repeat:
	make build
>Fix:
$NetBSD$

--- libxc/xc_linux_build.c.orig	2005-08-03 17:57:57.000000000 -0600
+++ libxc/xc_linux_build.c
@@ -324,7 +324,7 @@ static int setup_guestos(int xc_handle,
         start_info->mod_start    = vinitrd_start;
         start_info->mod_len      = initrd_len;
     }
-    strncpy(start_info->cmd_line, cmdline, MAX_CMDLINE);
+    strncpy((char *)start_info->cmd_line, cmdline, MAX_CMDLINE);
     start_info->cmd_line[MAX_CMDLINE-1] = '\0';
     munmap(start_info, PAGE_SIZE);
 
$NetBSD$

--- libxc/xc_plan9_build.c.orig	2005-08-03 17:57:57.000000000 -0600
+++ libxc/xc_plan9_build.c
@@ -108,14 +108,14 @@ void
 plan9header(Exec * header)
 {
 	/* header is big-endian */
-	swabby(&header->magic, "magic");
-	swabby(&header->text, "text");
-	swabby(&header->data, "data");
-	swabby(&header->bss, "bss");
-	swabby(&header->syms, "syms");
-	swabby(&header->entry, "entry");
-	swabby(&header->spsz, "spsz");
-	swabby(&header->pcsz, "pcsz");
+	swabby((unsigned long *)&header->magic, "magic");
+	swabby((unsigned long *)&header->text, "text");
+	swabby((unsigned long *)&header->data, "data");
+	swabby((unsigned long *)&header->bss, "bss");
+	swabby((unsigned long *)&header->syms, "syms");
+	swabby((unsigned long *)&header->entry, "entry");
+	swabby((unsigned long *)&header->spsz, "spsz");
+	swabby((unsigned long *)&header->pcsz, "pcsz");
 
 }
 
@@ -211,6 +211,9 @@ setup_guestos(int xc_handle,
 	unsigned long cpu0pdb, cpu0pte, cpu0ptelast;
 	unsigned long /*last_pfn, */ tot_pte_pages;
 
+	first_page_after_kernel = 0;
+	first_data_page = 0;
+
 	DPRINTF(("tot pages is %ld\n", tot_pages));
 	if ((cpage_array = malloc(tot_pages * sizeof (unsigned long))) == NULL) {
 		PERROR("Could not allocate cpage array");
@@ -431,7 +434,7 @@ setup_guestos(int xc_handle,
 	start_info->flags = 0;
 	DPRINTF((" control event channel is %d\n", control_evtchn));
 	start_info->domain_controller_evtchn = control_evtchn;
-	strncpy(start_info->cmd_line, cmdline, MAX_CMDLINE);
+	strncpy((char *)start_info->cmd_line, cmdline, MAX_CMDLINE);
 	start_info->cmd_line[MAX_CMDLINE - 1] = '\0';
 	munmap(start_info, PAGE_SIZE);
 
$NetBSD$

--- xfrd/lzi_stream.c.orig	2005-08-03 17:57:58.000000000 -0600
+++ xfrd/lzi_stream.c
@@ -242,7 +242,7 @@ int read_block(LZIState *s){
     int err = 0, k = 0;
     //dprintf(">\n");
     if(s->eof) goto exit;
-    err = unmarshal_uint32(s->io, &k);
+    err = unmarshal_uint32(s->io, (uint32_t *)&k);
     if(err) goto exit;
     if(k > s->inbuf_size){
         err = -EINVAL;
$NetBSD$

--- xfrd/marshal.c.orig	2005-08-03 17:57:58.000000000 -0600
+++ xfrd/marshal.c
@@ -166,7 +166,7 @@ int marshal_string(IOStream *io, char *s
 int unmarshal_string(IOStream *io, char *s, uint32_t s_n){
     int err = 0, val_n = 0;
     //dprintf(">\n");
-    err = unmarshal_uint32(io, &val_n);
+    err = unmarshal_uint32(io, (uint32_t *)&val_n);
     if(err) goto exit;
     if(val_n >= s_n){
         err = -EINVAL;
@@ -184,7 +184,7 @@ int unmarshal_new_string(IOStream *io, c
     int err = 0, val_n = 0;
     char *val = NULL;
     //dprintf(">\n");
-    err = unmarshal_uint32(io, &val_n);
+    err = unmarshal_uint32(io, (uint32_t *)&val_n);
     if(err) goto exit;
     val = allocate(val_n + 1);
     if(!val){
$NetBSD$

--- xfrd/xdr.c.orig	2005-08-03 17:57:58.000000000 -0600
+++ xfrd/xdr.c
@@ -283,7 +283,7 @@ int unpack_sxpr(IOStream *io, Sxpr *x){
         err = unpack_cons(io, &val);
         break;
     case T_BOOL:
-        err = unpack_bool(io, &u);
+        err = unpack_bool(io, (int *)&u);
         if(err) goto exit;
         val = (u ? OTRUE : OFALSE);
         break;