]> git.ipfire.org Git - thirdparty/kernel/linux.git/commitdiff
tools/nolibc: add stdbool.h header
authorThomas Weißschuh <linux@weissschuh.net>
Thu, 25 Jul 2024 17:10:44 +0000 (19:10 +0200)
committerThomas Weißschuh <linux@weissschuh.net>
Mon, 29 Jul 2024 05:52:57 +0000 (07:52 +0200)
stdbool.h is very simple.
Provide an implementation for the user convenience.

Acked-by: Willy Tarreau <w@1wt.eu>
Link: https://lore.kernel.org/r/20240725-nolibc-stdbool-v1-1-a6ee2c80bcde@weissschuh.net
Signed-off-by: Thomas Weißschuh <linux@weissschuh.net>
tools/include/nolibc/Makefile
tools/include/nolibc/nolibc.h
tools/include/nolibc/stdbool.h [new file with mode: 0644]

index e69c26abe1ea5fdeb8e6e5c3ddcb3e05e700fa0c..a1f55fb24bb38c1f49c653af5825e8bcc569a56d 100644 (file)
@@ -35,6 +35,7 @@ all_files := \
                stackprotector.h \
                std.h \
                stdarg.h \
+               stdbool.h \
                stdint.h \
                stdlib.h \
                string.h \
index 989e707263a4faba22014175e4664a8fbef283e5..92436b1e44413e659b3cca592930aad8b458cb74 100644 (file)
@@ -74,7 +74,8 @@
  *            -I../nolibc -o hello hello.c -lgcc
  *
  * The available standard (but limited) include files are:
- *   ctype.h, errno.h, signal.h, stdarg.h, stdio.h, stdlib.h, string.h, time.h
+ *   ctype.h, errno.h, signal.h, stdarg.h, stdbool.h stdio.h, stdlib.h,
+ *   string.h, time.h
  *
  * In addition, the following ones are expected to be provided by the compiler:
  *   float.h, stddef.h
diff --git a/tools/include/nolibc/stdbool.h b/tools/include/nolibc/stdbool.h
new file mode 100644 (file)
index 0000000..60feece
--- /dev/null
@@ -0,0 +1,16 @@
+/* SPDX-License-Identifier: LGPL-2.1 OR MIT */
+/*
+ * Boolean types support for NOLIBC
+ * Copyright (C) 2024 Thomas Weißschuh <linux@weissschuh.net>
+ */
+
+#ifndef _NOLIBC_STDBOOL_H
+#define _NOLIBC_STDBOOL_H
+
+#define bool _Bool
+#define true 1
+#define false 0
+
+#define __bool_true_false_are_defined 1
+
+#endif /* _NOLIBC_STDBOOL_H */