git: 917c0541e4cc - main - cross-tools: Document a rather bizarre looking construct
- Go to: [ bottom of page ] [ top of archives ] [ this month ]
Date: Sun, 26 May 2024 17:40:21 UTC
The branch main has been updated by imp: URL: https://cgit.FreeBSD.org/src/commit/?id=917c0541e4cc60fc4ea6fe434dabe0699ca7c2fd commit 917c0541e4cc60fc4ea6fe434dabe0699ca7c2fd Author: Warner Losh <imp@FreeBSD.org> AuthorDate: 2024-05-26 17:38:46 +0000 Commit: Warner Losh <imp@FreeBSD.org> CommitDate: 2024-05-26 17:38:46 +0000 cross-tools: Document a rather bizarre looking construct On Linux, stddef.h will define __size_t to something when size_t is defined. On FreeBSD, __size_t is an actual typedef which we need for other parts of the system. If __size_t isn't defined, that tells us we need to define the fallback __size_t typedef (if it is defined, then we can't easily redefine it without issues because glob.h will define it to something different than stddef.h defines it). Add a comment to this effect. Sponsored by: Netflix Reviewed by: val_packett.cool Differential Revision: https://reviews.freebsd.org/D45350 --- tools/build/cross-build/include/linux/sys/types.h | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/tools/build/cross-build/include/linux/sys/types.h b/tools/build/cross-build/include/linux/sys/types.h index 770b3057f8a8..222560167a71 100644 --- a/tools/build/cross-build/include/linux/sys/types.h +++ b/tools/build/cross-build/include/linux/sys/types.h @@ -37,6 +37,13 @@ #include_next <sys/types.h> +/* + * stddef.h for both gcc and clang will define __size_t when size_t has + * been defined (except on *BSD where it doesn't touch __size_t). So if + * we're building on Linux, we know that if that's not defined, we have + * to typedef __size_t for FreeBSD's use of __size_t in places to work + * during bootstrapping. + */ #ifndef __size_t typedef __SIZE_TYPE__ __size_t; #endif