Skip to content

Commit ae1f550

Browse files
committed
tools/nolibc: add stdbool.h header
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>
1 parent 6ea2987 commit ae1f550

3 files changed

Lines changed: 19 additions & 1 deletion

File tree

tools/include/nolibc/Makefile

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -35,6 +35,7 @@ all_files := \
3535
stackprotector.h \
3636
std.h \
3737
stdarg.h \
38+
stdbool.h \
3839
stdint.h \
3940
stdlib.h \
4041
string.h \

tools/include/nolibc/nolibc.h

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -74,7 +74,8 @@
7474
* -I../nolibc -o hello hello.c -lgcc
7575
*
7676
* The available standard (but limited) include files are:
77-
* ctype.h, errno.h, signal.h, stdarg.h, stdio.h, stdlib.h, string.h, time.h
77+
* ctype.h, errno.h, signal.h, stdarg.h, stdbool.h stdio.h, stdlib.h,
78+
* string.h, time.h
7879
*
7980
* In addition, the following ones are expected to be provided by the compiler:
8081
* float.h, stddef.h

tools/include/nolibc/stdbool.h

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,16 @@
1+
/* SPDX-License-Identifier: LGPL-2.1 OR MIT */
2+
/*
3+
* Boolean types support for NOLIBC
4+
* Copyright (C) 2024 Thomas Weißschuh <linux@weissschuh.net>
5+
*/
6+
7+
#ifndef _NOLIBC_STDBOOL_H
8+
#define _NOLIBC_STDBOOL_H
9+
10+
#define bool _Bool
11+
#define true 1
12+
#define false 0
13+
14+
#define __bool_true_false_are_defined 1
15+
16+
#endif /* _NOLIBC_STDBOOL_H */

0 commit comments

Comments
 (0)