[PATCH] Detect GNU/kFreeBSD in user-visible kernel headers
kostikbel at gmail.com
Mon Nov 21 09:27:56 UTC 2011
On Mon, Nov 21, 2011 at 01:45:29PM +1100, Bruce Evans wrote:
> 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
> >>>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
> >#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.
FreeBSD does not need it at all. There are some implementations that
use FreeBSD kernel, and which could potentially benefit from providing
its own value for __FreeBSD_kernel. I was only tried to be nice for
the out-of-tree implementations, it boils down to kFreeBSD project
> 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?
-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Size: 196 bytes
Desc: not available
Url : http://lists.freebsd.org/pipermail/freebsd-current/attachments/20111121/f65d5754/attachment.pgp
More information about the freebsd-current