fix build runner on windows

This commit is contained in:
Andrew Kelley 2018-02-09 00:24:23 -05:00
parent 916d24cd21
commit 32c988a2d7
5 changed files with 38 additions and 7 deletions

View File

@ -543,6 +543,7 @@ TypeTableEntry *get_error_union_type(CodeGen *g, TypeTableEntry *err_set_type, T
if (type_has_bits(err_set_type)) {
entry->type_ref = err_set_type->type_ref;
entry->di_type = err_set_type->di_type;
g->error_di_types.append(&entry->di_type);
} else {
entry->zero_bits = true;
entry->di_type = g->builtin_types.entry_void->di_type;

View File

@ -4622,6 +4622,8 @@ static void validate_inline_fns(CodeGen *g) {
static void do_code_gen(CodeGen *g) {
assert(!g->errors.length);
codegen_add_time_event(g, "Code Generation");
{
// create debug type for error sets
assert(g->err_enumerators.length == g->errors_by_index.length);
@ -4644,8 +4646,6 @@ static void do_code_gen(CodeGen *g) {
}
}
codegen_add_time_event(g, "Code Generation");
generate_error_name_table(g);
generate_enum_name_tables(g);

View File

@ -160,7 +160,7 @@ pub const ChildProcess = struct {
else => os.unexpectedErrorWindows(err),
};
}
self.waitUnwrappedWindows();
try self.waitUnwrappedWindows();
return ??self.term;
}

View File

@ -38,6 +38,7 @@ pub const windowsLoadDll = windows_util.windowsLoadDll;
pub const windowsUnloadDll = windows_util.windowsUnloadDll;
pub const createWindowsEnvBlock = windows_util.createWindowsEnvBlock;
pub const WindowsWaitError = windows_util.WaitError;
pub const WindowsOpenError = windows_util.OpenError;
pub const WindowsWriteError = windows_util.WriteError;
@ -605,7 +606,9 @@ test "os.getCwd" {
_ = getCwd(debug.global_allocator);
}
pub fn symLink(allocator: &Allocator, existing_path: []const u8, new_path: []const u8) !void {
pub const SymLinkError = PosixSymLinkError || WindowsSymLinkError;
pub fn symLink(allocator: &Allocator, existing_path: []const u8, new_path: []const u8) SymLinkError!void {
if (is_windows) {
return symLinkWindows(allocator, existing_path, new_path);
} else {
@ -613,7 +616,12 @@ pub fn symLink(allocator: &Allocator, existing_path: []const u8, new_path: []con
}
}
pub fn symLinkWindows(allocator: &Allocator, existing_path: []const u8, new_path: []const u8) !void {
pub const WindowsSymLinkError = error {
OutOfMemory,
Unexpected,
};
pub fn symLinkWindows(allocator: &Allocator, existing_path: []const u8, new_path: []const u8) WindowsSymLinkError!void {
const existing_with_null = try cstr.addNullByte(allocator, existing_path);
defer allocator.free(existing_with_null);
const new_with_null = try cstr.addNullByte(allocator, new_path);
@ -627,7 +635,23 @@ pub fn symLinkWindows(allocator: &Allocator, existing_path: []const u8, new_path
}
}
pub fn symLinkPosix(allocator: &Allocator, existing_path: []const u8, new_path: []const u8) !void {
pub const PosixSymLinkError = error {
OutOfMemory,
AccessDenied,
DiskQuota,
PathAlreadyExists,
FileSystem,
SymLinkLoop,
NameTooLong,
FileNotFound,
SystemResources,
NoSpaceLeft,
ReadOnlyFileSystem,
NotDir,
Unexpected,
};
pub fn symLinkPosix(allocator: &Allocator, existing_path: []const u8, new_path: []const u8) PosixSymLinkError!void {
const full_buf = try allocator.alloc(u8, existing_path.len + new_path.len + 2);
defer allocator.free(full_buf);

View File

@ -7,7 +7,13 @@ const mem = std.mem;
const BufMap = std.BufMap;
const cstr = std.cstr;
pub fn windowsWaitSingle(handle: windows.HANDLE, milliseconds: windows.DWORD) !void {
pub const WaitError = error {
WaitAbandoned,
WaitTimeOut,
Unexpected,
};
pub fn windowsWaitSingle(handle: windows.HANDLE, milliseconds: windows.DWORD) WaitError!void {
const result = windows.WaitForSingleObject(handle, milliseconds);
return switch (result) {
windows.WAIT_ABANDONED => error.WaitAbandoned,