authorgravatar for andrew@ziglang.orgAndrew Kelley <andrew@ziglang.org> 2018-02-09 00:24:23-05:00
committergravatar for andrew@ziglang.orgAndrew Kelley <andrew@ziglang.org> 2018-02-09 00:24:23-05:00
log32c988a2d7920fcd3da50a13a1ae9abcd57daf50
tree68c847a2648eed20a70f1d2d01de795dfda98b0b
parent916d24cd2111559b0694d9579872832f4764a391

fix build runner on windows


5 files changed, 38 insertions(+), 7 deletions(-)

src/analyze.cpp+1
......@@ -543,6 +543,7 @@ TypeTableEntry *get_error_union_type(CodeGen *g, TypeTableEntry *err_set_type, T
543543 if (type_has_bits(err_set_type)) {
544544 entry->type_ref = err_set_type->type_ref;
545545 entry->di_type = err_set_type->di_type;
546 g->error_di_types.append(&entry->di_type);
546547 } else {
547548 entry->zero_bits = true;
548549 entry->di_type = g->builtin_types.entry_void->di_type;
src/codegen.cpp+2-2
......@@ -4622,6 +4622,8 @@ static void validate_inline_fns(CodeGen *g) {
46224622static void do_code_gen(CodeGen *g) {
46234623 assert(!g->errors.length);
46244624
4625 codegen_add_time_event(g, "Code Generation");
4626
46254627 {
46264628 // create debug type for error sets
46274629 assert(g->err_enumerators.length == g->errors_by_index.length);
......@@ -4644,8 +4646,6 @@ static void do_code_gen(CodeGen *g) {
46444646 }
46454647 }
46464648
4647 codegen_add_time_event(g, "Code Generation");
4648
46494649 generate_error_name_table(g);
46504650 generate_enum_name_tables(g);
46514651
std/os/child_process.zig+1-1
......@@ -160,7 +160,7 @@ pub const ChildProcess = struct {
160160 else => os.unexpectedErrorWindows(err),
161161 };
162162 }
163 self.waitUnwrappedWindows();
163 try self.waitUnwrappedWindows();
164164 return ??self.term;
165165 }
166166
std/os/index.zig+27-3
......@@ -38,6 +38,7 @@ pub const windowsLoadDll = windows_util.windowsLoadDll;
3838pub const windowsUnloadDll = windows_util.windowsUnloadDll;
3939pub const createWindowsEnvBlock = windows_util.createWindowsEnvBlock;
4040
41pub const WindowsWaitError = windows_util.WaitError;
4142pub const WindowsOpenError = windows_util.OpenError;
4243pub const WindowsWriteError = windows_util.WriteError;
4344
......@@ -605,7 +606,9 @@ test "os.getCwd" {
605606 _ = getCwd(debug.global_allocator);
606607}
607608
608pub fn symLink(allocator: &Allocator, existing_path: []const u8, new_path: []const u8) !void {
609pub const SymLinkError = PosixSymLinkError || WindowsSymLinkError;
610
611pub fn symLink(allocator: &Allocator, existing_path: []const u8, new_path: []const u8) SymLinkError!void {
609612 if (is_windows) {
610613 return symLinkWindows(allocator, existing_path, new_path);
611614 } else {
......@@ -613,7 +616,12 @@ pub fn symLink(allocator: &Allocator, existing_path: []const u8, new_path: []con
613616 }
614617}
615618
616pub fn symLinkWindows(allocator: &Allocator, existing_path: []const u8, new_path: []const u8) !void {
619pub const WindowsSymLinkError = error {
620 OutOfMemory,
621 Unexpected,
622};
623
624pub fn symLinkWindows(allocator: &Allocator, existing_path: []const u8, new_path: []const u8) WindowsSymLinkError!void {
617625 const existing_with_null = try cstr.addNullByte(allocator, existing_path);
618626 defer allocator.free(existing_with_null);
619627 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
627635 }
628636}
629637
630pub fn symLinkPosix(allocator: &Allocator, existing_path: []const u8, new_path: []const u8) !void {
638pub const PosixSymLinkError = error {
639 OutOfMemory,
640 AccessDenied,
641 DiskQuota,
642 PathAlreadyExists,
643 FileSystem,
644 SymLinkLoop,
645 NameTooLong,
646 FileNotFound,
647 SystemResources,
648 NoSpaceLeft,
649 ReadOnlyFileSystem,
650 NotDir,
651 Unexpected,
652};
653
654pub fn symLinkPosix(allocator: &Allocator, existing_path: []const u8, new_path: []const u8) PosixSymLinkError!void {
631655 const full_buf = try allocator.alloc(u8, existing_path.len + new_path.len + 2);
632656 defer allocator.free(full_buf);
633657
std/os/windows/util.zig+7-1
......@@ -7,7 +7,13 @@ const mem = std.mem;
77const BufMap = std.BufMap;
88const cstr = std.cstr;
99
10pub fn windowsWaitSingle(handle: windows.HANDLE, milliseconds: windows.DWORD) !void {
10pub const WaitError = error {
11 WaitAbandoned,
12 WaitTimeOut,
13 Unexpected,
14};
15
16pub fn windowsWaitSingle(handle: windows.HANDLE, milliseconds: windows.DWORD) WaitError!void {
1117 const result = windows.WaitForSingleObject(handle, milliseconds);
1218 return switch (result) {
1319 windows.WAIT_ABANDONED => error.WaitAbandoned,