mirror of
https://github.com/ziglang/zig.git
synced 2025-12-17 19:53:06 +00:00
fix self-hosted build on windows
This commit is contained in:
parent
477e3f64fc
commit
0cd63b28f3
19
build.zig
19
build.zig
@ -209,8 +209,19 @@ pub fn installCHeaders(b: &Builder, c_header_files: []const u8) {
|
|||||||
|
|
||||||
fn nextValue(index: &usize, build_info: []const u8) -> []const u8 {
|
fn nextValue(index: &usize, build_info: []const u8) -> []const u8 {
|
||||||
const start = *index;
|
const start = *index;
|
||||||
while (build_info[*index] != '\n' and build_info[*index] != '\r') : (*index += 1) { }
|
while (true) : (*index += 1) {
|
||||||
const result = build_info[start..*index];
|
switch (build_info[*index]) {
|
||||||
*index += 1;
|
'\n' => {
|
||||||
return result;
|
const result = build_info[start..*index];
|
||||||
|
*index += 1;
|
||||||
|
return result;
|
||||||
|
},
|
||||||
|
'\r' => {
|
||||||
|
const result = build_info[start..*index];
|
||||||
|
*index += 2;
|
||||||
|
return result;
|
||||||
|
},
|
||||||
|
else => continue,
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@ -15,6 +15,7 @@ const LinkedList = std.LinkedList;
|
|||||||
|
|
||||||
error PermissionDenied;
|
error PermissionDenied;
|
||||||
error ProcessNotFound;
|
error ProcessNotFound;
|
||||||
|
error InvalidName;
|
||||||
|
|
||||||
var children_nodes = LinkedList(&ChildProcess).init();
|
var children_nodes = LinkedList(&ChildProcess).init();
|
||||||
|
|
||||||
@ -643,6 +644,7 @@ fn windowsCreateProcess(app_name: &u8, cmd_line: &u8, envp_ptr: ?&u8, cwd_ptr: ?
|
|||||||
return switch (err) {
|
return switch (err) {
|
||||||
windows.ERROR.FILE_NOT_FOUND, windows.ERROR.PATH_NOT_FOUND => error.FileNotFound,
|
windows.ERROR.FILE_NOT_FOUND, windows.ERROR.PATH_NOT_FOUND => error.FileNotFound,
|
||||||
windows.ERROR.INVALID_PARAMETER => unreachable,
|
windows.ERROR.INVALID_PARAMETER => unreachable,
|
||||||
|
windows.ERROR.INVALID_NAME => error.InvalidName,
|
||||||
else => os.unexpectedErrorWindows(err),
|
else => os.unexpectedErrorWindows(err),
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
|||||||
@ -1516,8 +1516,8 @@ const unexpected_error_tracing = false;
|
|||||||
/// and you get an unexpected error.
|
/// and you get an unexpected error.
|
||||||
pub fn unexpectedErrorPosix(errno: usize) -> error {
|
pub fn unexpectedErrorPosix(errno: usize) -> error {
|
||||||
if (unexpected_error_tracing) {
|
if (unexpected_error_tracing) {
|
||||||
io.stderr.printf("unexpected errno: {}\n", errno) %% return error.Unexpected;
|
debug.warn("unexpected errno: {}\n", errno);
|
||||||
debug.printStackTrace() %% return error.Unexpected;
|
debug.dumpStackTrace();
|
||||||
}
|
}
|
||||||
return error.Unexpected;
|
return error.Unexpected;
|
||||||
}
|
}
|
||||||
@ -1526,8 +1526,8 @@ pub fn unexpectedErrorPosix(errno: usize) -> error {
|
|||||||
/// and you get an unexpected error.
|
/// and you get an unexpected error.
|
||||||
pub fn unexpectedErrorWindows(err: windows.DWORD) -> error {
|
pub fn unexpectedErrorWindows(err: windows.DWORD) -> error {
|
||||||
if (unexpected_error_tracing) {
|
if (unexpected_error_tracing) {
|
||||||
io.stderr.printf("unexpected GetLastError(): {}\n", err) %% return error.Unexpected;
|
debug.warn("unexpected GetLastError(): {}\n", err);
|
||||||
debug.printStackTrace() %% return error.Unexpected;
|
debug.dumpStackTrace();
|
||||||
}
|
}
|
||||||
return error.Unexpected;
|
return error.Unexpected;
|
||||||
}
|
}
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user