mirror of
https://github.com/ziglang/zig.git
synced 2025-12-06 14:23:09 +00:00
mingw-w64: pass -D__USE_MINGW_ANSI_STDIO=0 for crt files
Thanks to Martin Storsjö for explaining this to me on IRC: __USE_MINGW_ANSI_STDIO redirects stdio functions towards mingw-w64 reimplementations of them (since msvcrt.dll lacks lots of things). For x86 with "long double", this is also needed to get long doubles formatted properly. It's enabled by default by headers when building in C99 mode, unless you're targeting UCRT. The headers normally enable this automatically - or you can request it enabled with -D__USE_MINGW_ANSI_STDIO=1. However, the mingw-w64-crt files are expected to be built with this explicitly turned off. Since there's a half dozen various ways of configuring the CRT and various features, the mingw-w64-crt files specifically need to be built in a very hardcoded configuration, which is different from how end user source files are compiled. This commit removes a patch that we were carrying previously. See #7356
This commit is contained in:
parent
3108b8010e
commit
b020d83265
@ -91,6 +91,7 @@ pub fn buildCRTFile(comp: *Compilation, crt_file: CRTFile) !void {
|
|||||||
"-D_CRTBLD",
|
"-D_CRTBLD",
|
||||||
"-D_WIN32_WINNT=0x0f00",
|
"-D_WIN32_WINNT=0x0f00",
|
||||||
"-D__MSVCRT_VERSION__=0x700",
|
"-D__MSVCRT_VERSION__=0x700",
|
||||||
|
"-D__USE_MINGW_ANSI_STDIO=0",
|
||||||
});
|
});
|
||||||
c_source_files[i] = .{
|
c_source_files[i] = .{
|
||||||
.src_path = try comp.zig_lib_directory.join(arena, &[_][]const u8{
|
.src_path = try comp.zig_lib_directory.join(arena, &[_][]const u8{
|
||||||
@ -114,6 +115,7 @@ pub fn buildCRTFile(comp: *Compilation, crt_file: CRTFile) !void {
|
|||||||
"-D_CRTBLD",
|
"-D_CRTBLD",
|
||||||
"-D_WIN32_WINNT=0x0f00",
|
"-D_WIN32_WINNT=0x0f00",
|
||||||
"-D__MSVCRT_VERSION__=0x700",
|
"-D__MSVCRT_VERSION__=0x700",
|
||||||
|
"-D__USE_MINGW_ANSI_STDIO=0",
|
||||||
|
|
||||||
"-isystem",
|
"-isystem",
|
||||||
try comp.zig_lib_directory.join(arena, &[_][]const u8{ "libc", "include", "any-windows-any" }),
|
try comp.zig_lib_directory.join(arena, &[_][]const u8{ "libc", "include", "any-windows-any" }),
|
||||||
@ -162,6 +164,7 @@ pub fn buildCRTFile(comp: *Compilation, crt_file: CRTFile) !void {
|
|||||||
"-D_CRTBLD",
|
"-D_CRTBLD",
|
||||||
"-D_WIN32_WINNT=0x0f00",
|
"-D_WIN32_WINNT=0x0f00",
|
||||||
"-D__MSVCRT_VERSION__=0x700",
|
"-D__MSVCRT_VERSION__=0x700",
|
||||||
|
"-D__USE_MINGW_ANSI_STDIO=0",
|
||||||
|
|
||||||
"-isystem",
|
"-isystem",
|
||||||
try comp.zig_lib_directory.join(arena, &[_][]const u8{ "libc", "include", "any-windows-any" }),
|
try comp.zig_lib_directory.join(arena, &[_][]const u8{ "libc", "include", "any-windows-any" }),
|
||||||
@ -224,6 +227,7 @@ pub fn buildCRTFile(comp: *Compilation, crt_file: CRTFile) !void {
|
|||||||
"-D_CRTBLD",
|
"-D_CRTBLD",
|
||||||
"-D_WIN32_WINNT=0x0f00",
|
"-D_WIN32_WINNT=0x0f00",
|
||||||
"-D__MSVCRT_VERSION__=0x700",
|
"-D__MSVCRT_VERSION__=0x700",
|
||||||
|
"-D__USE_MINGW_ANSI_STDIO=0",
|
||||||
|
|
||||||
"-isystem",
|
"-isystem",
|
||||||
try comp.zig_lib_directory.join(arena, &[_][]const u8{
|
try comp.zig_lib_directory.join(arena, &[_][]const u8{
|
||||||
@ -269,6 +273,7 @@ fn add_cc_args(
|
|||||||
"-D_CRTBLD",
|
"-D_CRTBLD",
|
||||||
"-D_WIN32_WINNT=0x0f00",
|
"-D_WIN32_WINNT=0x0f00",
|
||||||
"-D__MSVCRT_VERSION__=0x700",
|
"-D__MSVCRT_VERSION__=0x700",
|
||||||
|
"-D__USE_MINGW_ANSI_STDIO=0",
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user