I found another useless fixincludes on darwin, but this one was a bit harder to diagnose. GCC trunk applies a fix to <stdio.h> on modern Darwin: it is stdio_stdarg_h. That fix is actually part of a pair, along with stdio_va_list, and they appear to work around issues with some old Unix (or BSD?) headers and the definition of va_list. It is not entirely clear to me what they fix, but they have been here forever.
They use various bypass mechanisms, but those are fragile. I have no idea if the fix is actually needed on any still-supported system, and maybe some global reviewer might want to remove it. But for now, I only want to bypass the fix on Darwin: it is useless there, and applying it makes our builds more fragile (and sensitive to the SDK version). Solaris has already opted out years ago, and now we do the same. To show the madness of this fix, the macOS headers actually contain a comment that is supposed to trigger the bypass: /* DO NOT REMOVE THIS COMMENT: fixincludes needs to see: * __gnuc_va_list and include <stdarg.h> */ This kludge was added to the Apple headers in Libc-391 released around 2004. But it recently became ineffective, due to the majority of the content of <stdio.h> being moved into <_stdio.h> (which is not covered by fixincludes). Anyway, the only sane thing to do is to disarm this fix on darwin, as the attached patch does. Tested on aarch64-apple-darwin24, OK to push? FX PS: With that patch, only two fixincludes remain active for latest darwin: - handling of __FLT_EVAL_METHOD__ == 16 in math.h (I have reported this as a bug) - handling of Apple’s “deprecated” functions: gets, sprintf, tmpnam, vsprintf, tempnam
0001-fixincludes-skip-stdio_stdarg_h-on-darwin.patch
Description: Binary data