From owner-freebsd-arch@FreeBSD.ORG Sat Nov 19 17:56:29 2011 Return-Path: Delivered-To: freebsd-arch@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id D14461065673; Sat, 19 Nov 2011 17:56:29 +0000 (UTC) (envelope-from kostikbel@gmail.com) Received: from mail.zoral.com.ua (mx0.zoral.com.ua [91.193.166.200]) by mx1.freebsd.org (Postfix) with ESMTP id 5915F8FC15; Sat, 19 Nov 2011 17:56:28 +0000 (UTC) Received: from alf.home (alf.kiev.zoral.com.ua [10.1.1.177]) by mail.zoral.com.ua (8.14.2/8.14.2) with ESMTP id pAJHuKtU091923 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-SHA bits=256 verify=NO); Sat, 19 Nov 2011 19:56:20 +0200 (EET) (envelope-from kostikbel@gmail.com) Received: from alf.home (kostik@localhost [127.0.0.1]) by alf.home (8.14.5/8.14.5) with ESMTP id pAJHuKtm027532; Sat, 19 Nov 2011 19:56:20 +0200 (EET) (envelope-from kostikbel@gmail.com) Received: (from kostik@localhost) by alf.home (8.14.5/8.14.5/Submit) id pAJHuKLL027531; Sat, 19 Nov 2011 19:56:20 +0200 (EET) (envelope-from kostikbel@gmail.com) X-Authentication-Warning: alf.home: kostik set sender to kostikbel@gmail.com using -f Date: Sat, 19 Nov 2011 19:56:20 +0200 From: Kostik Belousov To: Robert Millan Message-ID: <20111119175620.GV50300@deviant.kiev.zoral.com.ua> References: <201111170959.56767.jhb@freebsd.org> <201111171632.34979.jhb@freebsd.org> Mime-Version: 1.0 Content-Type: multipart/signed; micalg=pgp-sha1; protocol="application/pgp-signature"; boundary="U9/8TDFnS6G07P4u" Content-Disposition: inline In-Reply-To: User-Agent: Mutt/1.4.2.3i X-Virus-Scanned: clamav-milter 0.95.2 at skuns.kiev.zoral.com.ua X-Virus-Status: Clean X-Spam-Status: No, score=-3.9 required=5.0 tests=ALL_TRUSTED,AWL,BAYES_00 autolearn=ham version=3.2.5 X-Spam-Checker-Version: SpamAssassin 3.2.5 (2008-06-10) on skuns.kiev.zoral.com.ua Cc: Adrian Chadd , freebsd-current@freebsd.org, freebsd-arch@freebsd.org Subject: Re: [PATCH] Detect GNU/kFreeBSD in user-visible kernel headers X-BeenThere: freebsd-arch@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: Discussion related to FreeBSD architecture List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sat, 19 Nov 2011 17:56:30 -0000 --U9/8TDFnS6G07P4u Content-Type: text/plain; charset=us-ascii Content-Disposition: inline Content-Transfer-Encoding: quoted-printable On Sat, Nov 19, 2011 at 10:32:50AM +0100, Robert Millan wrote: > 2011/11/18 Robert Millan : > > 2011/11/17 John Baldwin : > >> Hmm, I wonder if it's better to use the #ifndef approach rather than #= undef > >> so that when compilers are updated to DTRT we will honor their setting= s? > > > > Well, the compiler is supposed to know better than sys/param.h, >=20 > I gave this a bit more thought.... >=20 > The compiler knows about the system it was intended to build for, but > sys/param.h *is* part of the system we're building for. It's > impossible for sys/param.h to have the wrong information unless it's > out of sync with the rest of the headers. >=20 > As for the compiler, on FreeBSD it's hard for the compiler to be out > of sync, because the system (in comparison with others) is tightly > packaed and upgrade procedures are well defined. >=20 > But if you take Debian, for example, we use the same compiler to build > 8-STABLE, 9-STABLE and 10-CURRENT kernels. The compiler has no idea > which version of FreeBSD the sources it is building come from. >=20 > I wouldn't put compilers in general in a position where they're forced > to know the FreeBSD major version beforehand because sys/param.h will > give preference to the information coming from compiler. >=20 > I propose this alternate patch which derives the major number from > __FreeBSD_version instead. 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. --U9/8TDFnS6G07P4u Content-Type: application/pgp-signature Content-Disposition: inline -----BEGIN PGP SIGNATURE----- Version: GnuPG v2.0.18 (FreeBSD) iEYEARECAAYFAk7H7cQACgkQC3+MBN1Mb4jt8QCeKe7cMDkJUgAl1cprocxvpoE9 khMAniVomr/Laq0OfqDRj4yk5wB1Cbog =WiER -----END PGP SIGNATURE----- --U9/8TDFnS6G07P4u--