Subject: Getting us off boolean_t
To: NetBSD Kernel Technical Discussion List <tech-kern@netbsd.org>
From: Jason Thorpe <thorpej@shagadelic.org>
List: tech-kern
Date: 02/03/2007 22:38:55
Anyone object to the following?
Index: sys/types.h
===================================================================
RCS file: /cvsroot/src/sys/sys/types.h,v
retrieving revision 1.71
diff -u -p -r1.71 types.h
--- sys/types.h 14 May 2006 21:38:18 -0000 1.71
+++ sys/types.h 4 Feb 2007 06:37:22 -0000
@@ -194,6 +194,17 @@ typedef __uid_t uid_t; /*
user id */
typedef int32_t dtime_t; /* on-disk time_t */
#if defined(_KERNEL) || defined(_STANDALONE)
+/*
+ * Boolean type definitions for the kernel environment. User-space
+ * boolean definitions are found in <stdbool.h>.
+ */
+#define bool _Bool
+#define true 1
+#define false 0
+
+/*
+ * Deprecated Mach-style boolean_t type. Should not be used by new
code.
+ */
typedef int boolean_t;
#ifndef TRUE
#define TRUE 1
@@ -201,7 +212,8 @@ typedef int boolean_t;
#ifndef FALSE
#define FALSE 0
#endif
-#endif
+
+#endif /* _KERNEL || _STANDALONE */
#if defined(_KERNEL) || defined(_LIBC)
/*
Index: lib/libkern/libkern.h
===================================================================
RCS file: /cvsroot/src/sys/lib/libkern/libkern.h,v
retrieving revision 1.67
diff -u -p -r1.67 libkern.h
--- lib/libkern/libkern.h 8 Oct 2006 03:14:55 -0000 1.67
+++ lib/libkern/libkern.h 4 Feb 2007 06:37:23 -0000
@@ -235,12 +235,6 @@ tolower(int ch)
((size_t)(unsigned long)(&(((type *)0)->member)))
#endif
-#if defined(__STDC__) && __GNUC_PREREQ__(3, 0)
-#define bool _Bool
-#define true 1
-#define false 0
-#endif
-
/* Prototypes for non-quad routines. */
/* XXX notyet #ifdef _STANDALONE */
int bcmp __P((const void *, const void *, size_t));
-- thorpej