authorgravatar for andrew@ziglang.orgAndrew Kelley <andrew@ziglang.org> 2024-01-07 16:18:18-07:00
committergravatar for andrew@ziglang.orgAndrew Kelley <andrew@ziglang.org> 2024-01-08 11:52:38-07:00
loge2a8fe721dbf31a8edd06c8273bee8a8e69381f2
treeafac039e3eb989f8e2faea3bf75cc18d09992e1a
parent3f4c73ae938f228e13ccc4f2442d7a6cd38111be

mingw: add comments so that I don't regress this code later

Martin Storsjö kindly took the time to discuss things at length with me, and the results are that this status quo is correct. I added comments so that I don't think it should be changed later.

1 files changed, 12 insertions(+), 2 deletions(-)

src/mingw.zig+12-2
...@@ -87,6 +87,9 @@ pub fn buildCRTFile(comp: *Compilation, crt_file: CRTFile, prog_node: *std.Progr...@@ -87,6 +87,9 @@ pub fn buildCRTFile(comp: *Compilation, crt_file: CRTFile, prog_node: *std.Progr
8787
88 "-std=gnu99",88 "-std=gnu99",
89 "-D_CRTBLD",89 "-D_CRTBLD",
90 // According to Martin Storsjö,
91 // > the files under mingw-w64-crt are designed to always
92 // be built with __MSVCRT_VERSION__=0x700
90 "-D__MSVCRT_VERSION__=0x700",93 "-D__MSVCRT_VERSION__=0x700",
91 "-D__USE_MINGW_ANSI_STDIO=0",94 "-D__USE_MINGW_ANSI_STDIO=0",
92 });95 });
...@@ -113,9 +116,11 @@ pub fn buildCRTFile(comp: *Compilation, crt_file: CRTFile, prog_node: *std.Progr...@@ -113,9 +116,11 @@ pub fn buildCRTFile(comp: *Compilation, crt_file: CRTFile, prog_node: *std.Progr
113116
114 "-std=gnu99",117 "-std=gnu99",
115 "-D_CRTBLD",118 "-D_CRTBLD",
119 // According to Martin Storsjö,
120 // > the files under mingw-w64-crt are designed to always
121 // be built with __MSVCRT_VERSION__=0x700
116 "-D__MSVCRT_VERSION__=0x700",122 "-D__MSVCRT_VERSION__=0x700",
117 "-D__USE_MINGW_ANSI_STDIO=0",123 "-D__USE_MINGW_ANSI_STDIO=0",
118
119 "-isystem",124 "-isystem",
120 try comp.zig_lib_directory.join(arena, &[_][]const u8{ "libc", "include", "any-windows-any" }),125 try comp.zig_lib_directory.join(arena, &[_][]const u8{ "libc", "include", "any-windows-any" }),
121 });126 });
...@@ -179,9 +184,11 @@ pub fn buildCRTFile(comp: *Compilation, crt_file: CRTFile, prog_node: *std.Progr...@@ -179,9 +184,11 @@ pub fn buildCRTFile(comp: *Compilation, crt_file: CRTFile, prog_node: *std.Progr
179184
180 "-std=gnu99",185 "-std=gnu99",
181 "-D_CRTBLD",186 "-D_CRTBLD",
187 // According to Martin Storsjö,
188 // > the files under mingw-w64-crt are designed to always
189 // be built with __MSVCRT_VERSION__=0x700
182 "-D__MSVCRT_VERSION__=0x700",190 "-D__MSVCRT_VERSION__=0x700",
183 "-D__USE_MINGW_ANSI_STDIO=0",191 "-D__USE_MINGW_ANSI_STDIO=0",
184
185 "-isystem",192 "-isystem",
186 try comp.zig_lib_directory.join(arena, &[_][]const u8{193 try comp.zig_lib_directory.join(arena, &[_][]const u8{
187 "libc", "include", "any-windows-any",194 "libc", "include", "any-windows-any",
...@@ -225,6 +232,9 @@ fn add_cc_args(...@@ -225,6 +232,9 @@ fn add_cc_args(
225 try args.appendSlice(&[_][]const u8{232 try args.appendSlice(&[_][]const u8{
226 "-std=gnu11",233 "-std=gnu11",
227 "-D_CRTBLD",234 "-D_CRTBLD",
235 // According to Martin Storsjö,
236 // > the files under mingw-w64-crt are designed to always
237 // be built with __MSVCRT_VERSION__=0x700
228 "-D__MSVCRT_VERSION__=0x700",238 "-D__MSVCRT_VERSION__=0x700",
229 "-D__USE_MINGW_ANSI_STDIO=0",239 "-D__USE_MINGW_ANSI_STDIO=0",
230 });240 });