authorgravatar for andrew@ziglang.orgAndrew Kelley <andrew@ziglang.org> 2019-07-05 12:53:36-04:00
committergravatar for andrew@ziglang.orgAndrew Kelley <andrew@ziglang.org> 2019-07-05 12:53:36-04:00
log0d84d52e37923aab3c7f44b20b1490d6c0fbaac5
tree5dcd0270c7916a60d5442025bce70140fa3af78e
parent72800f176e7065ea68a86a3aa0c3dfab33a24702
signaturelock-open Commit is signed but in an unrecognized format.

std.os.abort no longer calls msvcrt abort() when linking libc

closes #2071

1 files changed, 6 insertions(+), 3 deletions(-)

std/os.zig+6-3
...@@ -138,15 +138,18 @@ fn getRandomBytesDevURandom(buf: []u8) !void {...@@ -138,15 +138,18 @@ fn getRandomBytesDevURandom(buf: []u8) !void {
138/// it raises SIGABRT followed by SIGKILL and finally lo138/// it raises SIGABRT followed by SIGKILL and finally lo
139pub fn abort() noreturn {139pub fn abort() noreturn {
140 @setCold(true);140 @setCold(true);
141 if (builtin.link_libc) {141 // MSVCRT abort() sometimes opens a popup window which is undesirable, so
142 system.abort();142 // even when linking libc on Windows we use our own abort implementation.
143 }143 // See https://github.com/ziglang/zig/issues/2071 for more details.
144 if (windows.is_the_target) {144 if (windows.is_the_target) {
145 if (builtin.mode == .Debug) {145 if (builtin.mode == .Debug) {
146 @breakpoint();146 @breakpoint();
147 }147 }
148 windows.kernel32.ExitProcess(3);148 windows.kernel32.ExitProcess(3);
149 }149 }
150 if (builtin.link_libc) {
151 system.abort();
152 }
150 if (builtin.os == .uefi) {153 if (builtin.os == .uefi) {
151 // TODO there must be a better thing to do here than loop forever154 // TODO there must be a better thing to do here than loop forever
152 while (true) {}155 while (true) {}