Eitan Adler <ead...@freebsd.org> wrote in <201202160517.q1g5h6z0000...@svn.freebsd.org>:
ea> Author: eadler ea> Date: Thu Feb 16 05:17:06 2012 ea> New Revision: 231817 ea> URL: http://svn.freebsd.org/changeset/base/231817 ea> ea> Log: ea> Fix warning when compiling with gcc46 ea> ea> Approved by: cperciva ea> MFC after: 3 days ea> ea> Modified: ea> head/usr.sbin/IPXrouted/tables.c (snip) ea> @@ -213,7 +211,6 @@ rtchange(struct rt_entry *rt, struct soc ea> short ticks) ea> { ea> int doioctl = 0, metricchanged = 0; ea> - struct rtuentry oldroute; ea> ea> FIXLEN(gate); ea> /* ea> @@ -281,7 +278,6 @@ rtchange(struct rt_entry *rt, struct soc ea> if (doioctl || metricchanged) { ea> TRACE_ACTION("CHANGE FROM", rt); ea> if (doioctl) { ea> - oldroute = rt->rt_rt; ea> rt->rt_router = *gate; ea> } ea> rt->rt_metric = metric; ea> The oldroute is still used in the #ifdef section at the end of this function. ea> Author: eadler ea> Date: Thu Feb 16 05:17:01 2012 ea> New Revision: 231816 ea> URL: http://svn.freebsd.org/changeset/base/231816 ea> ea> Log: ea> Removed unused code: fixes compiler warning with CC=gcc46 ea> error: parameter 'fd' set but not used ea> ea> Approved by: cperciva ea> MFC after: 1 week ea> ea> Modified: ea> head/usr.bin/gencat/gencat.c ea> ea> Modified: head/usr.bin/gencat/gencat.c ea> ============================================================================== ea> --- head/usr.bin/gencat/gencat.c Thu Feb 16 05:16:55 2012 (r231815) ea> +++ head/usr.bin/gencat/gencat.c Thu Feb 16 05:17:01 2012 (r231816) ea> @@ -462,89 +462,6 @@ MCParse(int fd) ea> } ea> } ea> ea> -void ea> -MCReadCat(int fd) ea> -{ ea> - fd = 0; This file was from NetBSD and this change just increased the diff. I do not understand why the prototype declaration of MCReadCat() was left while the main body was removed. IMHO it is not a good idea to remove unused code partially like this or unused code in one from another project if you just want to suppress a compiler warning. It may suppress the warning, but remaining bits in comments and/or conditional parts where the compiler does not complain make developers confused. I think it is more harmful than the warning. -- Hiroki
pgpCqgTpIfr4t.pgp
Description: PGP signature