From owner-svn-src-all@FreeBSD.ORG  Mon Oct 15 22:23:36 2012
Return-Path: <owner-svn-src-all@FreeBSD.ORG>
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 E3241FB3;
 Mon, 15 Oct 2012 22:23:36 +0000 (UTC)
 (envelope-from glebius@FreeBSD.org)
Received: from cell.glebius.int.ru (glebius.int.ru [81.19.64.117])
 by mx1.freebsd.org (Postfix) with ESMTP id 3DFAC8FC08;
 Mon, 15 Oct 2012 22:23:36 +0000 (UTC)
Received: from cell.glebius.int.ru (localhost [127.0.0.1])
 by cell.glebius.int.ru (8.14.5/8.14.5) with ESMTP id q9FMNYKM022495;
 Tue, 16 Oct 2012 02:23:34 +0400 (MSK)
 (envelope-from glebius@FreeBSD.org)
Received: (from glebius@localhost)
 by cell.glebius.int.ru (8.14.5/8.14.5/Submit) id q9FMNX9S022494;
 Tue, 16 Oct 2012 02:23:33 +0400 (MSK)
 (envelope-from glebius@FreeBSD.org)
X-Authentication-Warning: cell.glebius.int.ru: glebius set sender to
 glebius@FreeBSD.org using -f
Date: Tue, 16 Oct 2012 02:23:33 +0400
From: Gleb Smirnoff <glebius@FreeBSD.org>
To: Bruce Evans <brde@optusnet.com.au>
Subject: Re: svn commit: r241546 - head/sys/contrib/ipfilter/netinet
Message-ID: <20121015222333.GY89655@FreeBSD.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>
MIME-Version: 1.0
Content-Type: text/plain; charset=koi8-r
Content-Disposition: inline
In-Reply-To: <20121016045904.Q15233@besplex.bde.org>
User-Agent: Mutt/1.5.21 (2010-09-15)
Cc: svn-src-head@FreeBSD.org, svn-src-all@FreeBSD.org,
 src-committers@FreeBSD.org, John Baldwin <jhb@FreeBSD.org>,
 Jilles Tjoelker <jilles@stack.nl>
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 &quot;
 user&quot; and &quot; projects&quot; \)" <svn-src-all.freebsd.org>
List-Unsubscribe: <http://lists.freebsd.org/mailman/options/svn-src-all>,
 <mailto:svn-src-all-request@freebsd.org?subject=unsubscribe>
List-Archive: <http://lists.freebsd.org/pipermail/svn-src-all>
List-Post: <mailto:svn-src-all@freebsd.org>
List-Help: <mailto:svn-src-all-request@freebsd.org?subject=help>
List-Subscribe: <http://lists.freebsd.org/mailman/listinfo/svn-src-all>,
 <mailto:svn-src-all-request@freebsd.org?subject=subscribe>
X-List-Received-Date: Mon, 15 Oct 2012 22:23:37 -0000

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> >> On Mon, Oct 15, 2012 at 08:34:09AM -0400, John Baldwin wrote:
B> >> J> On Sunday, October 14, 2012 11:03:07 am Gleb Smirnoff wrote:
B> >> J> > Author: glebius
B> >> J> > Date: Sun Oct 14 15:03:06 2012
B> >> J> > New Revision: 241546
B> >> J> > URL: http://svn.freebsd.org/changeset/base/241546
B> >
B> >> J> > Log:
B> >> J> >   Fix defines in r241245. We actually don't define FreeBSD.
B> >
B> >> J> >   Reported & tested by:	Oleg Ginzburg
B> >
B> >> J> Seems like it should be using 'defined(__FreeBSD_version)' instead?
B> >
B> >> AFAIU, the construction which left after r241546 works fine. Anything
B> >> undefined resolves to zero, so in case of non-FreeBSD build we test
B> >> if (0 > 10000019) and this fails which is what we expect.
B> >
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?

-- 
Totus tuus, Glebius.