Re: [PATCH] tools/nolibc: add stdbool.h header

From: Thomas Weißschuh
Date: Sat Jul 27 2024 - 04:50:53 EST


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@xxxxxxxxxxxxxx>
> ---
> 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@xxxxxxxxxxxxxx>
> + */
> +
> +#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 */