[RFC v2 1/3] cdefs: Add __bool
Alejandro Colomar
alx@kernel.org
Tue Sep 2 10:43:48 GMT 2025
Signed-off-by: Alejandro Colomar <alx@kernel.org>
---
misc/sys/cdefs.h | 12 ++++++++++++
1 file changed, 12 insertions(+)
diff --git a/misc/sys/cdefs.h b/misc/sys/cdefs.h
index 215ff937ee..1cd8f1e85b 100644
--- a/misc/sys/cdefs.h
+++ b/misc/sys/cdefs.h
@@ -57,6 +57,18 @@
# define __glibc_has_extension(ext) 0
#endif
+#if defined __cplusplus
+# define __bool bool
+#elif defined __GNUC__ || defined __clang__
+# if __GNUC_PREREQ (3, 0)
+# define __bool _Bool
+# else
+# define __bool int
+# endif
+#else
+# define __bool _Bool
+#endif
+
#if defined __GNUC__ || defined __clang__
/* All functions, except those with callbacks or those that
--
2.50.1
More information about the Libc-alpha
mailing list