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
This commit is contained in:
Warner Losh 2024-05-26 11:38:46 -06:00
parent 364c014d9b
commit 917c0541e4

View File

@ -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