From owner-svn-src-all@FreeBSD.ORG Mon Oct 15 18:09:42 2012 Return-Path: Delivered-To: svn-src-all@FreeBSD.org Received: from mx1.freebsd.org (mx1.freebsd.org [69.147.83.52]) by hub.freebsd.org (Postfix) with ESMTP id ADB1C319; Mon, 15 Oct 2012 18:09:42 +0000 (UTC) (envelope-from brde@optusnet.com.au) Received: from mail18.syd.optusnet.com.au (mail18.syd.optusnet.com.au [211.29.132.199]) by mx1.freebsd.org (Postfix) with ESMTP id 3DF688FC12; Mon, 15 Oct 2012 18:09:41 +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 mail18.syd.optusnet.com.au (8.13.1/8.13.1) with ESMTP id q9FI9VUl008873 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-SHA bits=256 verify=NO); Tue, 16 Oct 2012 05:09:33 +1100 Date: Tue, 16 Oct 2012 05:09:31 +1100 (EST) From: Bruce Evans X-X-Sender: bde@besplex.bde.org To: Jilles Tjoelker Subject: Re: svn commit: r241546 - head/sys/contrib/ipfilter/netinet In-Reply-To: <20121015151147.GA92923@stack.nl> Message-ID: <20121016045904.Q15233@besplex.bde.org> References: <201210141503.q9EF37rE087018@svn.freebsd.org> <201210150834.09553.jhb@freebsd.org> <20121015143658.GU89655@FreeBSD.org> <20121015151147.GA92923@stack.nl> MIME-Version: 1.0 Content-Type: TEXT/PLAIN; charset=US-ASCII; format=flowed X-CMAE-Score: 0 X-CMAE-Analysis: v=2.0 cv=f7kQn5OM 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=WLNeoykpRNQgHBetxKEA:9 a=CjuIK1q_8ugA:10 a=bxQHXO5Py4tHmhUgaywp5w==:117 Cc: svn-src-head@FreeBSD.org, svn-src-all@FreeBSD.org, Gleb Smirnoff , src-committers@FreeBSD.org, John Baldwin X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.14 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 15 Oct 2012 18:09:42 -0000 On Mon, 15 Oct 2012, Jilles Tjoelker wrote: > On Mon, Oct 15, 2012 at 06:36:58PM +0400, Gleb Smirnoff wrote: >> On Mon, Oct 15, 2012 at 08:34:09AM -0400, John Baldwin wrote: >> J> On Sunday, October 14, 2012 11:03:07 am Gleb Smirnoff wrote: >> J> > Author: glebius >> J> > Date: Sun Oct 14 15:03:06 2012 >> J> > New Revision: 241546 >> J> > URL: http://svn.freebsd.org/changeset/base/241546 > >> J> > Log: >> J> > Fix defines in r241245. We actually don't define FreeBSD. > >> J> > Reported & tested by: Oleg Ginzburg > >> J> Seems like it should be using 'defined(__FreeBSD_version)' instead? > >> AFAIU, the construction which left after r241546 works fine. Anything >> undefined resolves to zero, so in case of non-FreeBSD build we test >> if (0 > 10000019) and this fails which is what we expect. > >> I have used this construction several times already without any side >> effects. I have also seen it in some software in ports, where it works >> okay, too. > > The C standard indeed permits this, but gcc -Wundef will warn about it. > That compiler warning is in CWARNFLAGS in sys/conf/kern.mk so I suggest > adding the 'defined(__FreeBSD_version) &&'. The C standard requires this, but some misconfigured compilers like gcc -Wundef warn about it, and some non-C compilers like gcc -Wundef -Werror fail on it. The bug is sometimes hidden by -Wno-system-headers, but FreeBSD wants to detect bugs in system headers so it sets -Wsystem-headers at WARNS >= 1, and then the buggy compilers find this non-bug in system headers. The result is uglification of many system headers to use if `defined(__FOO) && ...' instead of depending on this standard and useful feature. Bruce