[Bug target/126782] [Darwin] sys/_types/_rsize_t.h does not define rsize_t with -fmodules

hello at bjornpagen dot com via Gcc-bugs <[email protected]>
Newsgroups gmane.comp.gcc.bugs
Message-ID <[email protected]/bugzilla/>
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=126782

--- Comment #5 from Bjorn Pagen <hello at bjornpagen dot com> ---
USE_CLANG_STDDEF tells these SDK headers to obtain selected fundamental
typedefs from the compiler-provided <stddef.h> rather than defining them
directly in the SDK header.

In this case, _rsize_t.h defines __need_rsize_t and includes <stddef.h>.
Clang's <stddef.h> recognizes that request and defines:

typedef __SIZE_TYPE__ rsize_t;

GCC's <stddef.h> supports the same selective-inclusion pattern for types such
as size_t, ptrdiff_t, and wchar_t, but it does not currently recognize
__need_rsize_t. Consequently, the include returns without defining the type.

This does not require GCC or the C library to implement all of Annex K. It only
provides the rsize_t typedef when the system header explicitly requests it. For
an ordinary full inclusion of <stddef.h>, it could continue to expose rsize_t
only when __STDC_WANT_LIB_EXT1__ >= 1, matching Clang's behavior.

I agree that supporting __need_rsize_t in GCC's <stddef.h> is preferable to a
Darwin fixincludes rule, particularly because the SDK can be selected at build
time.
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.