From owner-svn-src-head@FreeBSD.ORG Tue Oct 16 03:12:12 2012 Return-Path: Delivered-To: svn-src-head@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [69.147.83.52]) by hub.freebsd.org (Postfix) with ESMTP id AF3511AE; Tue, 16 Oct 2012 03:12:12 +0000 (UTC) (envelope-from brde@optusnet.com.au) Received: from mail03.syd.optusnet.com.au (mail03.syd.optusnet.com.au [211.29.132.184]) by mx1.freebsd.org (Postfix) with ESMTP id 34C9E8FC16; Tue, 16 Oct 2012 03:12:12 +0000 (UTC) Received: from c122-106-175-26.carlnfd1.nsw.optusnet.com.au (c122-106-175-26.carlnfd1.nsw.optusnet.com.au [122.106.175.26]) by mail03.syd.optusnet.com.au (8.13.1/8.13.1) with ESMTP id q9G3C8rG032286 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-SHA bits=256 verify=NO); Tue, 16 Oct 2012 14:12:09 +1100 Date: Tue, 16 Oct 2012 14:12:08 +1100 (EST) From: Bruce Evans X-X-Sender: bde@besplex.bde.org To: Garrett Cooper Subject: Re: svn commit: r241546 - head/sys/contrib/ipfilter/netinet In-Reply-To: Message-ID: <20121016140607.Y1358@besplex.bde.org> References: <201210141503.q9EF37rE087018@svn.freebsd.org> <201210150834.09553.jhb@freebsd.org> <20121015143658.GU89655@FreeBSD.org> <20121015151147.GA92923@stack.nl> <20121016045904.Q15233@besplex.bde.org> <20121015222333.GY89655@FreeBSD.org> MIME-Version: 1.0 Content-Type: TEXT/PLAIN; charset=US-ASCII; format=flowed X-CMAE-Score: 0 X-CMAE-Analysis: v=2.0 cv=fsSE/yEf c=1 sm=1 a=qS4vZm_gVugA:10 a=kj9zAlcOel0A:10 a=PO7r1zJSAAAA:8 a=JzwRw_2MAAAA:8 a=20xahBMZJpIA:10 a=6I5d2MoRAAAA:8 a=9o6XcbDuoQn1XFczO7MA:9 a=CjuIK1q_8ugA:10 a=SV7veod9ZcQA:10 a=bxQHXO5Py4tHmhUgaywp5w==:117 Cc: src-committers@freebsd.org, Jilles Tjoelker , John Baldwin , svn-src-all@freebsd.org, Gleb Smirnoff , Bruce Evans , svn-src-head@freebsd.org X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.14 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 16 Oct 2012 03:12:12 -0000 On Mon, 15 Oct 2012, Garrett Cooper wrote: > On Mon, Oct 15, 2012 at 3:23 PM, Gleb Smirnoff wrote: >> On Tue, Oct 16, 2012 at 05:09:31AM +1100, Bruce Evans wrote: >> B> > On Mon, Oct 15, 2012 at 06:36:58PM +0400, Gleb Smirnoff wrote: >[>]* >> B> >> I have used this construction several times already without any side >> B> >> effects. I have also seen it in some software in ports, where it works >> B> >> okay, too. >> B> > >> B> > The C standard indeed permits this, but gcc -Wundef will warn about it. >> B> > That compiler warning is in CWARNFLAGS in sys/conf/kern.mk so I suggest >> B> > adding the 'defined(__FreeBSD_version) &&'. >> B> >> B> The C standard requires this, but some misconfigured compilers like >> B> gcc -Wundef warn about it, and some non-C compilers like gcc -Wundef >> B> -Werror fail on it. The bug is sometimes hidden by -Wno-system-headers, >> B> but FreeBSD wants to detect bugs in system headers so it sets >> B> -Wsystem-headers at WARNS >= 1, and then the buggy compilers find this >> B> non-bug in system headers. The result is uglification of many system >> B> headers to use if `defined(__FOO) && ...' instead of depending on this >> B> standard and useful feature. >> >> Shouldn't we then remove -Wundef from CWARNFLAGS in kern.mk? I objected when it was committed... It still isn't in bsd.sys.mk. It's not too bad for the kernel, since we control all the sources. > There is some value to -Wundef if used properly: > > -Wundef > Warn whenever an identifier which is not a macro is encountered in > an #if directive, outside of defined. Such identifiers are > replaced with zero. Like the -u option in sh. It is useful mainly for avoiding bugs in quickly written code. It is most useful in ineractive sh since quickly written command lines are normal and go live immediately. Bruce