mirror_ubuntu-kernels/tools/include/nolibc
Thomas Weißschuh 02a62b551c tools/nolibc: compiler: introduce __nolibc_has_attribute()
Recent compilers support __has_attribute() to check if a certain
compiler attribute is supported.
Unfortunately we have to first check if __has_attribute is supported in
the first place and then if a specific attribute is present.
These two checks can't be folded into a single condition as that would
lead to errors.

Nesting the two conditions like below works, but becomes ugly as soon
as #else blocks are used as those need to be duplicated for both levels
of #if.

    #if defined __has_attribute
    #  if __has_attribute (nonnull)
    #    define ATTR_NONNULL __attribute__ ((nonnull))
    #  endif
    #endif

Introduce a new helper which makes the usage of __has_attribute() nicer
and migrate the current user to it.

Acked-by: Willy Tarreau <w@1wt.eu>
Link: https://lore.kernel.org/r/20240807-nolibc-llvm-v2-4-c20f2f5fc7c2@weissschuh.net
Signed-off-by: Thomas Weißschuh <linux@weissschuh.net>
2024-08-10 17:08:19 +02:00
..
.gitignore tools/nolibc: Add gitignore to avoid git complaints about sysroot 2023-03-20 08:45:21 -07:00
arch-aarch64.h tools/nolibc: automatically detect necessity to use pselect6 2023-10-12 21:14:13 +02:00
arch-arm.h tools/nolibc: arm: use clang-compatible asm syntax 2024-08-10 17:08:04 +02:00
arch-i386.h tools/nolibc: i386: Fix a stack misalign bug on _start 2023-10-12 21:10:37 +02:00
arch-loongarch.h tools/nolibc: automatically detect necessity to use pselect6 2023-10-12 21:14:13 +02:00
arch-mips.h tools/nolibc: mips: load current function to $t9 2024-08-10 17:08:10 +02:00
arch-powerpc.h tools/nolibc: powerpc: limit stack-protector workaround to GCC 2024-08-10 17:08:15 +02:00
arch-riscv.h tools/nolibc: automatically detect necessity to use pselect6 2023-10-12 21:14:13 +02:00
arch-s390.h tools/nolibc: s390: shrink _start with _start_c 2023-08-23 04:40:22 +02:00
arch-x86_64.h tools/nolibc: x86-64: Use rep stosb for memset() 2023-10-12 21:14:00 +02:00
arch.h tools/nolibc: move MIPS ABI validation into arch-mips.h 2023-12-11 22:38:21 +01:00
compiler.h tools/nolibc: compiler: introduce __nolibc_has_attribute() 2024-08-10 17:08:19 +02:00
crt.h tools/nolibc: pass argc, argv and envp to constructors 2024-08-09 07:40:18 +02:00
ctype.h tools/nolibc: fix missing includes causing build issues at -O0 2023-01-09 09:36:05 -08:00
errno.h tools/nolibc: make errno a weak symbol instead of a static one 2023-01-10 13:33:55 -08:00
Makefile tools/nolibc: add stdbool.h header 2024-07-29 07:52:57 +02:00
nolibc.h tools/nolibc: add stdbool.h header 2024-07-29 07:52:57 +02:00
signal.h tools/nolibc: fix missing includes causing build issues at -O0 2023-01-09 09:36:05 -08:00
stackprotector.h tools/nolibc: stackprotector.h: make __stack_chk_init static 2023-08-23 05:17:07 +02:00
std.h tools/nolibc: add stdint.h 2023-03-20 08:45:21 -07:00
stdarg.h tools/nolibc: add stdarg.h header 2023-10-12 21:13:52 +02:00
stdbool.h tools/nolibc: add stdbool.h header 2024-07-29 07:52:57 +02:00
stdint.h tools/nolibc: add limits for {u,}intmax_t, ulong and {u,}llong 2024-06-29 09:44:54 +02:00
stdio.h tools/nolibc: implement strerror() 2024-06-29 09:44:57 +02:00
stdlib.h tools/nolibc: implement strtol() and friends 2024-06-29 09:44:55 +02:00
string.h tools/nolibc: include arch.h from string.h 2024-07-29 07:52:56 +02:00
sys.h tools/nolibc: add support for uname(2) 2024-04-14 20:28:54 +02:00
time.h tools/nolibc: fix missing includes causing build issues at -O0 2023-01-09 09:36:05 -08:00
types.h tools/nolibc: drop custom definition of struct rusage 2023-12-11 22:38:34 +01:00
unistd.h tools/nolibc: unistd.h: reorder the syscall macros 2023-08-06 12:27:53 +02:00