| author | |
| committer | |
| log | 32c988a2d7920fcd3da50a13a1ae9abcd57daf50 |
| tree | 68c847a2648eed20a70f1d2d01de795dfda98b0b |
| parent | 916d24cd2111559b0694d9579872832f4764a391 |
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 | ... | @@ -543,6 +543,7 @@ TypeTableEntry *get_error_union_type(CodeGen *g, TypeTableEntry *err_set_type, T |
| 543 | if (type_has_bits(err_set_type)) { | 543 | if (type_has_bits(err_set_type)) { |
| 544 | entry->type_ref = err_set_type->type_ref; | 544 | entry->type_ref = err_set_type->type_ref; |
| 545 | entry->di_type = err_set_type->di_type; | 545 | entry->di_type = err_set_type->di_type; |
| 546 | g->error_di_types.append(&entry->di_type); | ||
| 546 | } else { | 547 | } else { |
| 547 | entry->zero_bits = true; | 548 | entry->zero_bits = true; |
| 548 | entry->di_type = g->builtin_types.entry_void->di_type; | 549 | 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) { | ... | @@ -4622,6 +4622,8 @@ static void validate_inline_fns(CodeGen *g) { |
| 4622 | static void do_code_gen(CodeGen *g) { | 4622 | static void do_code_gen(CodeGen *g) { |
| 4623 | assert(!g->errors.length); | 4623 | assert(!g->errors.length); |
| 4624 | 4624 | ||
| 4625 | codegen_add_time_event(g, "Code Generation"); | ||
| 4626 | |||
| 4625 | { | 4627 | { |
| 4626 | // create debug type for error sets | 4628 | // create debug type for error sets |
| 4627 | assert(g->err_enumerators.length == g->errors_by_index.length); | 4629 | assert(g->err_enumerators.length == g->errors_by_index.length); |
| ... | @@ -4644,8 +4646,6 @@ static void do_code_gen(CodeGen *g) { | ... | @@ -4644,8 +4646,6 @@ static void do_code_gen(CodeGen *g) { |
| 4644 | } | 4646 | } |
| 4645 | } | 4647 | } |
| 4646 | 4648 | ||
| 4647 | codegen_add_time_event(g, "Code Generation"); | ||
| 4648 | |||
| 4649 | generate_error_name_table(g); | 4649 | generate_error_name_table(g); |
| 4650 | generate_enum_name_tables(g); | 4650 | generate_enum_name_tables(g); |
| 4651 | 4651 |
std/os/child_process.zig+1-1| ... | @@ -160,7 +160,7 @@ pub const ChildProcess = struct { | ... | @@ -160,7 +160,7 @@ pub const ChildProcess = struct { |
| 160 | else => os.unexpectedErrorWindows(err), | 160 | else => os.unexpectedErrorWindows(err), |
| 161 | }; | 161 | }; |
| 162 | } | 162 | } |
| 163 | self.waitUnwrappedWindows(); | 163 | try self.waitUnwrappedWindows(); |
| 164 | return ??self.term; | 164 | return ??self.term; |
| 165 | } | 165 | } |
| 166 | 166 |
std/os/index.zig+27-3| ... | @@ -38,6 +38,7 @@ pub const windowsLoadDll = windows_util.windowsLoadDll; | ... | @@ -38,6 +38,7 @@ pub const windowsLoadDll = windows_util.windowsLoadDll; |
| 38 | pub const windowsUnloadDll = windows_util.windowsUnloadDll; | 38 | pub const windowsUnloadDll = windows_util.windowsUnloadDll; |
| 39 | pub const createWindowsEnvBlock = windows_util.createWindowsEnvBlock; | 39 | pub const createWindowsEnvBlock = windows_util.createWindowsEnvBlock; |
| 40 | 40 | ||
| 41 | pub const WindowsWaitError = windows_util.WaitError; | ||
| 41 | pub const WindowsOpenError = windows_util.OpenError; | 42 | pub const WindowsOpenError = windows_util.OpenError; |
| 42 | pub const WindowsWriteError = windows_util.WriteError; | 43 | pub const WindowsWriteError = windows_util.WriteError; |
| 43 | 44 | ||
| ... | @@ -605,7 +606,9 @@ test "os.getCwd" { | ... | @@ -605,7 +606,9 @@ test "os.getCwd" { |
| 605 | _ = getCwd(debug.global_allocator); | 606 | _ = getCwd(debug.global_allocator); |
| 606 | } | 607 | } |
| 607 | 608 | ||
| 608 | pub fn symLink(allocator: &Allocator, existing_path: []const u8, new_path: []const u8) !void { | 609 | pub const SymLinkError = PosixSymLinkError || WindowsSymLinkError; |
| 610 | |||
| 611 | pub fn symLink(allocator: &Allocator, existing_path: []const u8, new_path: []const u8) SymLinkError!void { | ||
| 609 | if (is_windows) { | 612 | if (is_windows) { |
| 610 | return symLinkWindows(allocator, existing_path, new_path); | 613 | return symLinkWindows(allocator, existing_path, new_path); |
| 611 | } else { | 614 | } else { |
| ... | @@ -613,7 +616,12 @@ pub fn symLink(allocator: &Allocator, existing_path: []const u8, new_path: []con | ... | @@ -613,7 +616,12 @@ pub fn symLink(allocator: &Allocator, existing_path: []const u8, new_path: []con |
| 613 | } | 616 | } |
| 614 | } | 617 | } |
| 615 | 618 | ||
| 616 | pub fn symLinkWindows(allocator: &Allocator, existing_path: []const u8, new_path: []const u8) !void { | 619 | pub const WindowsSymLinkError = error { |
| 620 | OutOfMemory, | ||
| 621 | Unexpected, | ||
| 622 | }; | ||
| 623 | |||
| 624 | pub fn symLinkWindows(allocator: &Allocator, existing_path: []const u8, new_path: []const u8) WindowsSymLinkError!void { | ||
| 617 | const existing_with_null = try cstr.addNullByte(allocator, existing_path); | 625 | const existing_with_null = try cstr.addNullByte(allocator, existing_path); |
| 618 | defer allocator.free(existing_with_null); | 626 | defer allocator.free(existing_with_null); |
| 619 | const new_with_null = try cstr.addNullByte(allocator, new_path); | 627 | 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 | ... | @@ -627,7 +635,23 @@ pub fn symLinkWindows(allocator: &Allocator, existing_path: []const u8, new_path |
| 627 | } | 635 | } |
| 628 | } | 636 | } |
| 629 | 637 | ||
| 630 | pub fn symLinkPosix(allocator: &Allocator, existing_path: []const u8, new_path: []const u8) !void { | 638 | pub 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 | |||
| 654 | pub fn symLinkPosix(allocator: &Allocator, existing_path: []const u8, new_path: []const u8) PosixSymLinkError!void { | ||
| 631 | const full_buf = try allocator.alloc(u8, existing_path.len + new_path.len + 2); | 655 | const full_buf = try allocator.alloc(u8, existing_path.len + new_path.len + 2); |
| 632 | defer allocator.free(full_buf); | 656 | defer allocator.free(full_buf); |
| 633 | 657 |
std/os/windows/util.zig+7-1| ... | @@ -7,7 +7,13 @@ const mem = std.mem; | ... | @@ -7,7 +7,13 @@ const mem = std.mem; |
| 7 | const BufMap = std.BufMap; | 7 | const BufMap = std.BufMap; |
| 8 | const cstr = std.cstr; | 8 | const cstr = std.cstr; |
| 9 | 9 | ||
| 10 | pub fn windowsWaitSingle(handle: windows.HANDLE, milliseconds: windows.DWORD) !void { | 10 | pub const WaitError = error { |
| 11 | WaitAbandoned, | ||
| 12 | WaitTimeOut, | ||
| 13 | Unexpected, | ||
| 14 | }; | ||
| 15 | |||
| 16 | pub fn windowsWaitSingle(handle: windows.HANDLE, milliseconds: windows.DWORD) WaitError!void { | ||
| 11 | const result = windows.WaitForSingleObject(handle, milliseconds); | 17 | const result = windows.WaitForSingleObject(handle, milliseconds); |
| 12 | return switch (result) { | 18 | return switch (result) { |
| 13 | windows.WAIT_ABANDONED => error.WaitAbandoned, | 19 | windows.WAIT_ABANDONED => error.WaitAbandoned, |