diff options
author | Francois-Xavier Coudert <fxcoudert@gcc.gnu.org> | 2025-06-13 17:24:10 +0200 |
---|---|---|
committer | Francois-Xavier Coudert <fxcoudert@gcc.gnu.org> | 2025-08-15 08:54:29 +0200 |
commit | b1f9ab40cbcc6ecd53a2be3e01052cee096e1a00 (patch) | |
tree | e634e1c2528868ff598c837ca9b49e5c9ab0a7b0 | |
parent | 5b60bb6dc70e7f94f9c9a8d7584981ecf0720641 (diff) | |
download | gcc-b1f9ab40cbcc6ecd53a2be3e01052cee096e1a00.zip gcc-b1f9ab40cbcc6ecd53a2be3e01052cee096e1a00.tar.gz gcc-b1f9ab40cbcc6ecd53a2be3e01052cee096e1a00.tar.bz2 |
fixincludes: skip stdio_stdarg_h on modern darwin
All macOS SDK since at least macOS 10.9, and until macOS 10.12
(included), feature these lines in <stdio.h>:
/* DO NOT REMOVE THIS COMMENT: fixincludes needs to see:
* __gnuc_va_list and include <stdarg.h> */
The clear intent (and effect) was to bypass gcc’s stdio_stdarg_h
fixinclude.
However, since macOS 10.13, these lines have been moved to <_stdio.h>,
which is itself included at the top of <stdio.h>. The unintended
consequence is that the stdio_stdarg_h fixinclude is now applied to
macOS <stdio.h>, where it is not needed. This useless fixinclude makes
the compiler more fragile and less portable.
A previous attempt to skip the stdio_stdarg_h fix entirely had to be
reverted, since it broken some very old macOS versions. The new fix is
to bypass the fix based on the detection of <_stdio.h> inclusion, which
is more robust.
fixincludes/ChangeLog:
* fixincl.x: Regenerate.
* inclhack.def (stdio_stdarg_h): Skip on darwin.
-rw-r--r-- | fixincludes/fixincl.x | 6 | ||||
-rw-r--r-- | fixincludes/inclhack.def | 6 |
2 files changed, 6 insertions, 6 deletions
diff --git a/fixincludes/fixincl.x b/fixincludes/fixincl.x index 9dc05ea..2299721 100644 --- a/fixincludes/fixincl.x +++ b/fixincludes/fixincl.x @@ -2,11 +2,11 @@ * * DO NOT EDIT THIS FILE (fixincl.x) * - * It has been AutoGen-ed July 10, 2024 at 02:49:05 PM by AutoGen 5.18.16 + * It has been AutoGen-ed June 13, 2025 at 01:47:24 PM by AutoGen 5.18.16 * From the definitions inclhack.def * and the template file fixincl */ -/* DO NOT SVN-MERGE THIS FILE, EITHER Wed Jul 10 14:49:05 CEST 2024 +/* DO NOT SVN-MERGE THIS FILE, EITHER Fri Jun 13 13:47:24 CEST 2025 * * You must regenerate it. Use the ./genfixes script. * @@ -8981,7 +8981,7 @@ tSCC* apzStdio_Stdarg_HMachs[] = { * content bypass pattern - skip fix if pattern found */ tSCC zStdio_Stdarg_HBypass0[] = - "include.*(stdarg.h|machine/ansi.h)"; + "include.*(stdarg.h|machine/ansi.h|_stdio.h)"; #define STDIO_STDARG_H_TEST_CT 1 static tTestDesc aStdio_Stdarg_HTests[] = { diff --git a/fixincludes/inclhack.def b/fixincludes/inclhack.def index 1ac8e33..d9f1521 100644 --- a/fixincludes/inclhack.def +++ b/fixincludes/inclhack.def @@ -4472,13 +4472,13 @@ fix = { /* * Arrange for stdio.h to use stdarg.h to define __gnuc_va_list. - * On 4BSD-derived systems, stdio.h defers to machine/ansi.h; that's - * OK too. + * On 4BSD-derived systems, stdio.h defers to machine/ansi.h, that's + * OK too. modern macOS includes _stdio.h, and does not need the fix. */ fix = { hackname = stdio_stdarg_h; files = stdio.h; - bypass = "include.*(stdarg\.h|machine/ansi\.h)"; + bypass = "include.*(stdarg\.h|machine/ansi\.h|_stdio\.h)"; /* * On Solaris 10, this fix is unncessary; <stdio.h> includes * <iso/stdio_iso.h>, which includes <sys/va_list.h>. |