From owner-freebsd-current@FreeBSD.ORG Mon Nov 21 04:26:50 2011 Return-Path: Delivered-To: freebsd-current@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 82C9E106566C; Mon, 21 Nov 2011 04:26:50 +0000 (UTC) (envelope-from brde@optusnet.com.au) Received: from fallbackmx09.syd.optusnet.com.au (fallbackmx09.syd.optusnet.com.au [211.29.132.242]) by mx1.freebsd.org (Postfix) with ESMTP id 1732D8FC08; Mon, 21 Nov 2011 04:26:49 +0000 (UTC) Received: from mail03.syd.optusnet.com.au (mail03.syd.optusnet.com.au [211.29.132.184]) by fallbackmx09.syd.optusnet.com.au (8.13.1/8.13.1) with ESMTP id pAL2jYjf004081; Mon, 21 Nov 2011 13:45:34 +1100 Received: from c211-28-227-231.carlnfd1.nsw.optusnet.com.au (c211-28-227-231.carlnfd1.nsw.optusnet.com.au [211.28.227.231]) by mail03.syd.optusnet.com.au (8.13.1/8.13.1) with ESMTP id pAL2jTje008191 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-SHA bits=256 verify=NO); Mon, 21 Nov 2011 13:45:30 +1100 Date: Mon, 21 Nov 2011 13:45:29 +1100 (EST) From: Bruce Evans X-X-Sender: bde@besplex.bde.org To: Kostik Belousov In-Reply-To: <20111120174807.GY50300@deviant.kiev.zoral.com.ua> Message-ID: <20111121133954.A1108@besplex.bde.org> References: <201111170959.56767.jhb@freebsd.org> <201111171632.34979.jhb@freebsd.org> <20111119175620.GV50300@deviant.kiev.zoral.com.ua> <20111120114042.GA1256@thorin> <20111120174807.GY50300@deviant.kiev.zoral.com.ua> MIME-Version: 1.0 Content-Type: TEXT/PLAIN; charset=US-ASCII; format=flowed X-Mailman-Approved-At: Mon, 21 Nov 2011 05:48:22 +0000 Cc: freebsd-arch@freebsd.org, Adrian Chadd , freebsd-current@freebsd.org, Robert Millan Subject: Re: [PATCH] Detect GNU/kFreeBSD in user-visible kernel headers X-BeenThere: freebsd-current@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: Discussions about the use of FreeBSD-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 21 Nov 2011 04:26:50 -0000 On Sun, 20 Nov 2011, Kostik Belousov wrote: > On Sun, Nov 20, 2011 at 12:40:42PM +0100, Robert Millan wrote: >> On Sat, Nov 19, 2011 at 07:56:20PM +0200, Kostik Belousov wrote: >>> I fully agree with an idea that compiler is not an authorative source >>> of the knowledge of the FreeBSD version. Even more, I argue that we shall >>> not rely on compiler for this at all. Ideally, we should be able to >>> build FreeBSD using the stock compilers without local modifications. >>> Thus relying on the symbols defined by compiler, and not the source >>> is the thing to avoid and consistently remove. >>> >>> We must do this to be able to use third-party tooldchain for FreeBSD builds. >>> >>> That said, why not define __FreeBSD_kernel as equal to __FreeBSD_version ? >>> And then make more strong wording about other systems that use the macro, >>> e.g. remove 'may' from the kFreeBSD example. >>> Also, please remove the smile from comment. >> >> Ok. New patch attached. > > And the last, question, why not do > #ifndef __FreeBSD_kernel__ > #define __FreeBSD_kernel__ __FreeBSD_version > #endif > ? > > #undef is too big tools tool apply there, IMO. #ifndef is too big to apply here, IMO :-). __FreeBSD_kernel__ is in the implementation namespace, so any previous definition of it is a bug. The #ifndef breaks the warning for this bug. And why not use FreeBSD style? In KNF, the fields are separated by tabs, not spaces. In FreeBSD style, trailing underscores are not used for names in the implementation namespace, since they have no effect on namespaces. The name __FreeBSD_version is an example of this. Does existing practice require using the name with the trailing underscores? Bruce