Subject: gcc4 warnings
To: None <tech-kern@netbsd.org>
From: Antoine Reilles <tonio@NetBSD.org>
List: tech-kern
Date: 10/22/2006 11:18:35
--p4qYPpj5QlsIQJ0K
Content-Type: multipart/mixed; boundary="zYM0uCDKw75PZbzx"
Content-Disposition: inline


--zYM0uCDKw75PZbzx
Content-Type: text/plain; charset=us-ascii
Content-Disposition: inline

Hi,

With the new gcc4, there are a few warnings that prevents from building
a macppc kernel

I had to add two const in sys/net/if.c, and also in
arch/powerpc/powerpc/sig_machdep.c

I'm not sure the patch here is correct

Best regards,
antoine


--zYM0uCDKw75PZbzx
Content-Type: text/plain; charset=us-ascii
Content-Disposition: attachment; filename="const.patch"
Content-Transfer-Encoding: quoted-printable

Index: arch/powerpc/powerpc/sig_machdep.c
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D
RCS file: /cvsroot/src/sys/arch/powerpc/powerpc/sig_machdep.c,v
retrieving revision 1.25
diff -u -r1.25 sig_machdep.c
--- arch/powerpc/powerpc/sig_machdep.c	26 Mar 2006 16:15:57 -0000	1.25
+++ arch/powerpc/powerpc/sig_machdep.c	22 Oct 2006 08:41:08 -0000
@@ -216,7 +216,7 @@
 cpu_setmcontext(struct lwp *l, const mcontext_t *mcp, unsigned int flags)
 {
 	struct trapframe *tf =3D trapframe(l);
-	__greg_t *gr =3D mcp->__gregs;
+	const __greg_t *gr =3D mcp->__gregs;
 #ifdef PPC_HAVE_FPU
 	struct pcb *pcb =3D &l->l_addr->u_pcb;
 #endif
@@ -228,21 +228,20 @@
 		 * userland should not need to know the machine-specific
 		 * MSR value.
 		 */
-		gr[_REG_MSR] =3D (gr[_REG_MSR] & PSL_USERMOD) | PSL_USERSET;
+		tf->srr1 =3D (gr[_REG_MSR] & PSL_USERMOD) | PSL_USERSET;
=20
 #ifdef PPC_HAVE_FPU
 		/*
 		 * Always save the FP exception mode in the PCB.
 		 */
 		pcb->pcb_flags &=3D ~(PCB_FE0|PCB_FE1);
-		pcb->pcb_flags |=3D gr[_REG_MSR] & (PCB_FE0|PCB_FE1);
+		pcb->pcb_flags |=3D tf->srr1 & (PCB_FE0|PCB_FE1);
 #endif
=20
 		(void)memcpy(&tf->fixreg, gr, 32 * sizeof (gr[0]));
 		tf->cr   =3D gr[_REG_CR];
 		tf->lr   =3D gr[_REG_LR];
 		tf->srr0 =3D gr[_REG_PC];
-		tf->srr1 =3D gr[_REG_MSR];
 		tf->ctr  =3D gr[_REG_CTR];
 		tf->xer  =3D gr[_REG_XER];
 #ifdef PPC_OEA
Index: net/if.c
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D
RCS file: /cvsroot/src/sys/net/if.c,v
retrieving revision 1.170
diff -u -r1.170 if.c
--- net/if.c	13 Oct 2006 10:29:41 -0000	1.170
+++ net/if.c	22 Oct 2006 08:41:09 -0000
@@ -971,7 +971,7 @@
 	const struct sockaddr_dl *sdl;
 	struct ifaddr *ifa_maybe =3D 0;
 	u_int af =3D addr->sa_family;
-	char *addr_data =3D addr->sa_data, *cplim;
+	const char *addr_data =3D addr->sa_data, *cplim;
=20
 	if (af =3D=3D AF_LINK) {
 		sdl =3D (const struct sockaddr_dl *)addr;
@@ -1008,7 +1008,7 @@
 			continue;
 		for (ifa =3D TAILQ_FIRST(&ifp->if_addrlist); ifa !=3D NULL;
 		     ifa =3D TAILQ_NEXT(ifa, ifa_list)) {
-			char *cp, *cp2, *cp3;
+			const char *cp, *cp2, *cp3;
=20
 			if (ifa->ifa_addr->sa_family !=3D af ||
 			    ifa->ifa_netmask =3D=3D 0)

--zYM0uCDKw75PZbzx--

--p4qYPpj5QlsIQJ0K
Content-Type: application/pgp-signature
Content-Disposition: inline

-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.4.5 (NetBSD)

iD8DBQFFOzdr4VqmoGDE/mwRAu72AJ0ZU7AqUegbu/Q61VSKOHeBrBVkiQCbBAtM
/oOx6PCSTIRI7PKjojpHla8=
=yeyF
-----END PGP SIGNATURE-----

--p4qYPpj5QlsIQJ0K--