svn commit: r241546 - head/sys/contrib/ipfilter/netinet
Bruce Evans
brde at optusnet.com.au
Mon Oct 15 18:09:42 UTC 2012
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
More information about the svn-src-all
mailing list