diff options
author | Jonathan Gray <jsg@cvs.openbsd.org> | 2013-01-09 12:17:39 +0000 |
---|---|---|
committer | Jonathan Gray <jsg@cvs.openbsd.org> | 2013-01-09 12:17:39 +0000 |
commit | b421c57c5e66e85cc87d8c04bfd25162a9e45752 (patch) | |
tree | ad9c9207376742c1327705627ed7e2c50a51add0 /sys | |
parent | a1baf0719f96a51846f8d6dfb6998b134cbd9d05 (diff) |
add support for using c99 bool in the kernel based on our stdbool.h
ok deraadt@ millert@ espie@
Diffstat (limited to 'sys')
-rw-r--r-- | sys/sys/types.h | 29 |
1 files changed, 28 insertions, 1 deletions
diff --git a/sys/sys/types.h b/sys/sys/types.h index fcf9caa2354..30579aea2f9 100644 --- a/sys/sys/types.h +++ b/sys/sys/types.h @@ -1,4 +1,4 @@ -/* $OpenBSD: types.h,v 1.34 2012/12/10 22:32:00 deraadt Exp $ */ +/* $OpenBSD: types.h,v 1.35 2013/01/09 12:17:38 jsg Exp $ */ /* $NetBSD: types.h,v 1.29 1996/11/15 22:48:25 jtc Exp $ */ /*- @@ -237,4 +237,31 @@ struct tty; struct uio; #endif +#ifdef _KERNEL +#if (defined(__GNUC__) && __GNUC__ >= 3) || defined(__PCC__) || defined(lint) +/* Support for _C99: type _Bool is already built-in. */ +#define false 0 +#define true 1 + +#else +/* `_Bool' type must promote to `int' or `unsigned int'. */ +typedef enum { + false = 0, + true = 1 +} _Bool; + +/* And those constants must also be available as macros. */ +#define false false +#define true true + +#endif + +/* User visible type `bool' is provided as a macro which may be redefined */ +#define bool _Bool + +/* Inform that everything is fine */ +#define __bool_true_false_are_defined 1 + +#endif /* _KERNEL */ + #endif /* !_SYS_TYPES_H_ */ |