Date: Sat, 19 Nov 2011 19:56:20 +0200 From: Kostik Belousov <kostikbel@gmail.com> To: Robert Millan <rmh@freebsd.org> Cc: Adrian Chadd <adrian@freebsd.org>, freebsd-current@freebsd.org, freebsd-arch@freebsd.org Subject: Re: [PATCH] Detect GNU/kFreeBSD in user-visible kernel headers Message-ID: <20111119175620.GV50300@deviant.kiev.zoral.com.ua> In-Reply-To: <CAOfDtXP6ShN3DezN0u4PUVt9ft__2a%2BYwo3in9w01eQnfAQ7sQ@mail.gmail.com> References: <CAOfDtXPX1Rv9T7%2B1jYQbkM14tRY7mqgCzPcUqvHxFaRObbwvEg@mail.gmail.com> <201111170959.56767.jhb@freebsd.org> <CAOfDtXNy8r5ww5xSwhH-4w7daWdzB0KsVbO75JAOT=-Wzi%2BdHw@mail.gmail.com> <201111171632.34979.jhb@freebsd.org> <CAOfDtXMFk%2BC_eUsb6190UHHM0cgu3jf1M_M9oq4ibuYuke4pYQ@mail.gmail.com> <CAOfDtXP6ShN3DezN0u4PUVt9ft__2a%2BYwo3in9w01eQnfAQ7sQ@mail.gmail.com>
next in thread | previous in thread | raw e-mail | index | archive | help
--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 <rmh@freebsd.org>: > > 2011/11/17 John Baldwin <jhb@freebsd.org>: > >> 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--
Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?20111119175620.GV50300>