Skip site navigation (1)Skip section navigation (2)
Date:      Thu, 8 Dec 2011 16:36:58 -0800
From:      Matthew Fleming <mdf356@gmail.com>
To:        freebsd-current@freebsd.org
Cc:        jfv@freebsd.org, Zack Kirsch <zack@freebsd.org>
Subject:   Adding bool, true, and false to the kernel
Message-ID:  <CAMBSHm8hfBoQRgkh5Fh_4rC840FAkeQa7VCKyzLcd8UfUZ2x4g@mail.gmail.com>

next in thread | raw e-mail | index | archive | help
Hello -current!

Recently on -arch@, we discussed adding the C99 keywords bool, true,
and false to the kernel.  I now have patches to do this as well as fix
up some build issues.

The original thread was here:

http://lists.freebsd.org/pipermail/freebsd-arch/2011-November/011937.html

I split the patches in three:

http://people.freebsd.org/~mdf/0001-e1000-ixgbe-fix-code-to-not-define-bool-true-false-w.patch

fixes up the e1000 and ixgbe code.  Jack, can you please let me know
if there are any issues.  This should work to build whether or not
sys/types.h has the new defines; I am testing make universe right now.

http://people.freebsd.org/~mdf/0002-Fix-code-to-not-define-bool-true-false-when-already-.patch

fixes the other code in the sys/ directory that gives build conflicts.
 Since I wasn't sure of the origin of the drivers, I conservatively
left all their defines alone to allow the same driver code to build on
both CURRENT and 9.0.  If some of the drivers are wholly-owned by
FreeBSD (unlike e1000 and ixgbe) and are not expected to be built on
older releases, then the use of the old defines can be removed.  If
anyone knows the provenance of these files, please advise.

http://people.freebsd.org/~mdf/0003-Define-bool-true-and-false-in-types.h-for-_KERNEL-co.patch

actually defines bool, true, and false, and adds some extra paranoia
in <stdbool.h> for anyone who has hacked their local build system and
project repo to include <stdbool.h> in a kernel file.  I also bumped
__FreeBSD_version, though this is probably not necessary since
__bool_true_false_are_defined is a better check than the
__FreeBSD_version.

This code should be MFC-able to stable/9 after 9.0 is released.

Thanks,
matthew



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?CAMBSHm8hfBoQRgkh5Fh_4rC840FAkeQa7VCKyzLcd8UfUZ2x4g>