]> www.infradead.org Git - users/jedix/linux-maple.git/commit
tools/nolibc: include nolibc.h early from all header files
authorThomas Weißschuh <thomas.weissschuh@linutronix.de>
Thu, 24 Apr 2025 11:48:12 +0000 (13:48 +0200)
committerThomas Weißschuh <linux@weissschuh.net>
Wed, 21 May 2025 13:31:50 +0000 (15:31 +0200)
commit3785289f97e2118b157332ffaae9fd2ec71237c8
treeb7c8310fa6399bb3a38cbb8a61024dcb34820399
parenta6a054c8ad32b04c2e5d3cc5592fa737a2bb771f
tools/nolibc: include nolibc.h early from all header files

Inclusion of any nolibc header file should also bring all other headers.
On the other hand it should also be possible to include any nolibc header
files
in any order.

Currently this is implemented by including the catch-all nolibc.h after the
headers own definitions.
This is problematic if one nolibc header depends on another one.
The first header has to include the other one before defining any symbols.
That in turn will include the rest of nolibc while the current header has
not defined anything yet. If any other part of nolibc depends on
definitions from the current header, errors are encountered.
This is already the case today. Effectively nolibc can only be included in
the order of nolibc.h.

Restructure the way "nolibc.h" is included.
Move it to the beginning of the header files and before the include guards.
Now any header will behave exactly like "nolibc.h" while the include
guards prevent any duplicate definitions.

Signed-off-by: Thomas Weißschuh <thomas.weissschuh@linutronix.de>
Acked-by: Willy Tarreau <w@1wt.eu>
Link: https://lore.kernel.org/r/20250424-nolibc-header-check-v1-2-011576b6ed6f@linutronix.de
20 files changed:
tools/include/nolibc/ctype.h
tools/include/nolibc/dirent.h
tools/include/nolibc/elf.h
tools/include/nolibc/errno.h
tools/include/nolibc/fcntl.h
tools/include/nolibc/getopt.h
tools/include/nolibc/signal.h
tools/include/nolibc/stdio.h
tools/include/nolibc/stdlib.h
tools/include/nolibc/string.h
tools/include/nolibc/sys.h
tools/include/nolibc/sys/auxv.h
tools/include/nolibc/sys/mman.h
tools/include/nolibc/sys/stat.h
tools/include/nolibc/sys/syscall.h
tools/include/nolibc/sys/time.h
tools/include/nolibc/sys/wait.h
tools/include/nolibc/time.h
tools/include/nolibc/types.h
tools/include/nolibc/unistd.h