* [PATCH] tools/nolibc: add stdbool.h header
@ 2024-07-25 17:10 Thomas Weißschuh
2024-07-25 17:14 ` Willy Tarreau
2024-07-27 8:50 ` Thomas Weißschuh
0 siblings, 2 replies; 3+ messages in thread
From: Thomas Weißschuh @ 2024-07-25 17:10 UTC (permalink / raw)
To: Willy Tarreau; +Cc: linux-kernel, Thomas Weißschuh
stdbool.h is very simple.
Provide an implementation for the user convenience.
Signed-off-by: Thomas Weißschuh <linux@weissschuh.net>
---
tools/include/nolibc/Makefile | 1 +
tools/include/nolibc/nolibc.h | 3 ++-
tools/include/nolibc/stdbool.h | 16 ++++++++++++++++
3 files changed, 19 insertions(+), 1 deletion(-)
diff --git a/tools/include/nolibc/Makefile b/tools/include/nolibc/Makefile
index e69c26abe1ea..a1f55fb24bb3 100644
--- a/tools/include/nolibc/Makefile
+++ b/tools/include/nolibc/Makefile
@@ -35,6 +35,7 @@ all_files := \
stackprotector.h \
std.h \
stdarg.h \
+ stdbool.h \
stdint.h \
stdlib.h \
string.h \
diff --git a/tools/include/nolibc/nolibc.h b/tools/include/nolibc/nolibc.h
index 989e707263a4..92436b1e4441 100644
--- a/tools/include/nolibc/nolibc.h
+++ b/tools/include/nolibc/nolibc.h
@@ -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
index 000000000000..709abed93425
--- /dev/null
+++ b/tools/include/nolibc/stdbool.h
@@ -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 */
---
base-commit: 6ca8f2e20bd1ced8a7cd12b3ae4b1ceca85cfc2b
change-id: 20240725-nolibc-stdbool-15ea482d1b42
Best regards,
--
Thomas Weißschuh <linux@weissschuh.net>
^ permalink raw reply [flat|nested] 3+ messages in thread
* Re: [PATCH] tools/nolibc: add stdbool.h header
2024-07-25 17:10 [PATCH] tools/nolibc: add stdbool.h header Thomas Weißschuh
@ 2024-07-25 17:14 ` Willy Tarreau
2024-07-27 8:50 ` Thomas Weißschuh
1 sibling, 0 replies; 3+ messages in thread
From: Willy Tarreau @ 2024-07-25 17:14 UTC (permalink / raw)
To: Thomas Weißschuh; +Cc: linux-kernel
On Thu, Jul 25, 2024 at 07:10:44PM +0200, Thomas Weißschuh wrote:
> stdbool.h is very simple.
> Provide an implementation for the user convenience.
>
> Signed-off-by: Thomas Weißschuh <linux@weissschuh.net>
Acked-by: Willy Tarreau <w@1wt.eu>
Thank you for this one as well!
Willy
^ permalink raw reply [flat|nested] 3+ messages in thread
* Re: [PATCH] tools/nolibc: add stdbool.h header
2024-07-25 17:10 [PATCH] tools/nolibc: add stdbool.h header Thomas Weißschuh
2024-07-25 17:14 ` Willy Tarreau
@ 2024-07-27 8:50 ` Thomas Weißschuh
1 sibling, 0 replies; 3+ messages in thread
From: Thomas Weißschuh @ 2024-07-27 8:50 UTC (permalink / raw)
To: Willy Tarreau; +Cc: linux-kernel
On 2024-07-25 19:10:44+0000, Thomas Weißschuh wrote:
> stdbool.h is very simple.
> Provide an implementation for the user convenience.
>
> Signed-off-by: Thomas Weißschuh <linux@weissschuh.net>
> ---
> tools/include/nolibc/Makefile | 1 +
> tools/include/nolibc/nolibc.h | 3 ++-
> tools/include/nolibc/stdbool.h | 16 ++++++++++++++++
> 3 files changed, 19 insertions(+), 1 deletion(-)
<snip>
> diff --git a/tools/include/nolibc/stdbool.h b/tools/include/nolibc/stdbool.h
> new file mode 100644
> index 000000000000..709abed93425
> --- /dev/null
> +++ b/tools/include/nolibc/stdbool.h
> @@ -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
For the record:
The claim "stdbool.h is very simple" didn't hold up very well.
I managed to switch up this #define.
I'll fix it up when applying.
> +#define true 1
> +#define false 0
> +
> +#define __bool_true_false_are_defined 1
> +
> +#endif /* _NOLIBC_STDBOOL_H */
^ permalink raw reply [flat|nested] 3+ messages in thread
end of thread, other threads:[~2024-07-27 8:50 UTC | newest]
Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2024-07-25 17:10 [PATCH] tools/nolibc: add stdbool.h header Thomas Weißschuh
2024-07-25 17:14 ` Willy Tarreau
2024-07-27 8:50 ` Thomas Weißschuh
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox
all inboxes | Powered by JetHome®