Subject: kern/34811: A few more unused variable fixes
To: None <kern-bug-people@netbsd.org, gnats-admin@netbsd.org,>
From: None <khym@azeotrope.org>
List: netbsd-bugs
Date: 10/14/2006 08:35:01
>Number:         34811
>Category:       kern
>Synopsis:       A few more unused variable fixes
>Confidential:   no
>Severity:       non-critical
>Priority:       medium
>Responsible:    kern-bug-people
>State:          open
>Class:          sw-bug
>Submitter-Id:   net
>Arrival-Date:   Sat Oct 14 08:35:01 +0000 2006
>Originator:     Dave Huang
>Release:        NetBSD 4.99.3 as of October 13, 2006
>Organization:
Name: Dave Huang         |  Mammal, mammal / their names are called /
INet: khym@azeotrope.org |  they raise a paw / the bat, the cat /
FurryMUCK: Dahan         |  dolphin and dog / koala bear and hog -- TMBG
Dahan: Hani G Y+C 30 Y++ L+++ W- C++ T++ A+ E+ S++ V++ F- Q+++ P+ B+ PA+ PL++
>Environment:
	
	
Architecture: i386
Machine: i386
>Description:
	i386 kernels fail to build due to unused variable errors with
certain kernel configurations:

If MROUTING is enabled, but DIAGNOSTIC is not, proto is unused in
netinet/ip_mroute.c

If IPSEC is enabled, but IPSEC_NAT_T is not, sport and dport are
unused in netkey/key.c

>How-To-Repeat:
	Try to compile an i386 kernel with MROUTING and IPSEC, but no
DIAGNOSTIC or IPSEC_NAT_T.
>Fix:
Index: ip_mroute.c
===================================================================
RCS file: /cvsroot/src/sys/netinet/ip_mroute.c,v
retrieving revision 1.99
diff -u -r1.99 ip_mroute.c
--- ip_mroute.c	12 Oct 2006 01:32:38 -0000	1.99
+++ ip_mroute.c	14 Oct 2006 06:45:51 -0000
@@ -2008,6 +2008,8 @@
 #ifdef DIAGNOSTIC
 	if (!arg || proto != IPPROTO_IPV4)
 		panic("unexpected arg in vif_encapcheck");
+#else
+	do { if (&proto) {} } while (/* CONSTCOND */ 0);
 #endif
 
 	/*
Index: key.c
===================================================================
RCS file: /cvsroot/src/sys/netkey/key.c,v
retrieving revision 1.143
diff -u -r1.143 key.c
--- key.c	12 Oct 2006 01:32:46 -0000	1.143
+++ key.c	14 Oct 2006 06:46:53 -0000
@@ -765,6 +765,9 @@
 #ifdef IPSEC_NAT_T
 	if ((sport != 0) && (dport != 0))
 		chkport = 1;
+#else
+	do { if (&sport) {} } while (/* CONSTCOND */ 0);
+	do { if (&dport) {} } while (/* CONSTCOND */ 0);
 #endif
 	/* sanity check */
 	if (src == NULL || dst == NULL)

>Unformatted: