From owner-svn-src-all@FreeBSD.ORG Mon Oct 15 23:26:51 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 C021146D; Mon, 15 Oct 2012 23:26:51 +0000 (UTC) (envelope-from yanegomi@gmail.com) Received: from mail-ob0-f182.google.com (mail-ob0-f182.google.com [209.85.214.182]) by mx1.freebsd.org (Postfix) with ESMTP id 34F8A8FC14; Mon, 15 Oct 2012 23:26:50 +0000 (UTC) Received: by mail-ob0-f182.google.com with SMTP id wc20so7375145obb.13 for ; Mon, 15 Oct 2012 16:26:50 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113; h=mime-version:in-reply-to:references:date:message-id:subject:from:to :cc:content-type; bh=fQu9NLg918E01ivRzU6hzg0+W1mqCreFOaoEAHBJmCQ=; b=VMQmh8m3h2WGA77fY7e2dyyRZJqEXpLCgLk0ZdoX4JMERN/Blt8YGxtJWUUNjjPvLw T85+A8olishF6nUEpOTkB6nck/uzQy7JbOFWgdSQZABrA8iLjLPjhW1GVk9kh5HiJT36 dQOTQP3vLActVnPWVOp4K2qu4TBHHxMewCVSTHun6Kli4yMs8qaLzI6cACNB3pySPlV9 opJs92gjAlKOcc+4ldYl0dx+5I/Wn+EKLSA7hnzoaQNaPbPkQcFjj88/mN1W40zlVJl2 4BX8K7zy8vDFYYRTu/dQVVPGJ2EXVoALURBzGP8Qk7/MpdCuf1EeiqULREbJZsB9AbDq 3+Rg== MIME-Version: 1.0 Received: by 10.182.218.37 with SMTP id pd5mr10970641obc.24.1350343610387; Mon, 15 Oct 2012 16:26:50 -0700 (PDT) Received: by 10.76.167.202 with HTTP; Mon, 15 Oct 2012 16:26:50 -0700 (PDT) In-Reply-To: <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> <20121015222333.GY89655@FreeBSD.org> Date: Mon, 15 Oct 2012 16:26:50 -0700 Message-ID: Subject: Re: svn commit: r241546 - head/sys/contrib/ipfilter/netinet From: Garrett Cooper To: Gleb Smirnoff Content-Type: text/plain; charset=ISO-8859-1 Cc: src-committers@freebsd.org, John Baldwin , Jilles Tjoelker , svn-src-all@freebsd.org, Bruce Evans , svn-src-head@freebsd.org 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 23:26:51 -0000 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> >> 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? 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. Thanks, -Garrett