diff options
| author | Thomas Weißschuh <linux@weissschuh.net> | 2025-12-20 16:55:57 +0300 |
|---|---|---|
| committer | Thomas Weißschuh <linux@weissschuh.net> | 2026-01-06 14:08:08 +0300 |
| commit | 37219aa5b12326cd60f4586779c687f3394e80f5 (patch) | |
| tree | fe6ac215d896c6d90cb2285310c21ab18b1be84c /tools/include | |
| parent | dd6659efe0529e7177e9270a0fc044a0b17deb8a (diff) | |
| download | linux-37219aa5b12326cd60f4586779c687f3394e80f5.tar.xz | |
tools/nolibc: add __nolibc_static_assert()
Add a wrapper for _Static_assert() to use within nolibc.
While _Static_assert() itself was only standardized in C11,
in GCC and clang dialects it is also available in older standards.
Link: https://lore.kernel.org/lkml/20251203192330.GA12995@1wt.eu/
Signed-off-by: Thomas Weißschuh <linux@weissschuh.net>
Acked-by: Willy Tarreau <w@1wt.eu>
Reviewed-by: Arnd Bergmann <arnd@arndb.de>
Link: https://patch.msgid.link/20251220-nolibc-uapi-types-v3-13-c662992f75d7@weissschuh.net
Diffstat (limited to 'tools/include')
| -rw-r--r-- | tools/include/nolibc/compiler.h | 8 |
1 files changed, 8 insertions, 0 deletions
diff --git a/tools/include/nolibc/compiler.h b/tools/include/nolibc/compiler.h index c9ffd0496dae..a8c7619dcdde 100644 --- a/tools/include/nolibc/compiler.h +++ b/tools/include/nolibc/compiler.h @@ -63,4 +63,12 @@ # define __nolibc_clang_version 0 #endif /* __clang__ */ +#if __STDC_VERSION__ >= 201112L || \ + __nolibc_gnuc_version >= __nolibc_version(4, 6, 0) || \ + __nolibc_clang_version >= __nolibc_version(3, 0, 0) +# define __nolibc_static_assert(_t) _Static_assert(_t, "") +#else +# define __nolibc_static_assert(_t) +#endif + #endif /* _NOLIBC_COMPILER_H */ |
