authorgravatar for kubkon@jakubkonka.comJakub Konka <kubkon@jakubkonka.com> 2020-06-29 18:09:22+02:00
committergravatar for kubkon@jakubkonka.comJakub Konka <kubkon@jakubkonka.com> 2020-06-29 18:09:22+02:00
logb96882c57a20d3f9f19640dbb6b2483d7dea5dfe
tree344bd41f00e1025b1f5dd9e8f69f3bbc8926d8ff
parentbf8bf528c6c131f61de4af24c3599486a59c5868

Fix compilation errors


5 files changed, 13 insertions(+), 6 deletions(-)

lib/std/child_process.zig+1
...@@ -364,6 +364,7 @@ pub const ChildProcess = struct {...@@ -364,6 +364,7 @@ pub const ChildProcess = struct {
364 error.FileTooBig => unreachable,364 error.FileTooBig => unreachable,
365 error.DeviceBusy => unreachable,365 error.DeviceBusy => unreachable,
366 error.FileLocksNotSupported => unreachable,366 error.FileLocksNotSupported => unreachable,
367 error.NotCapable => unreachable, // until WASI comes up with multi-processing (if ever)
367 else => |e| return e,368 else => |e| return e,
368 }369 }
369 else370 else
lib/std/elf.zig+1
...@@ -551,6 +551,7 @@ fn preadNoEof(file: std.fs.File, buf: []u8, offset: u64) !void {...@@ -551,6 +551,7 @@ fn preadNoEof(file: std.fs.File, buf: []u8, offset: u64) !void {
551 error.InputOutput => return error.FileSystem,551 error.InputOutput => return error.FileSystem,
552 error.Unexpected => return error.Unexpected,552 error.Unexpected => return error.Unexpected,
553 error.WouldBlock => return error.Unexpected,553 error.WouldBlock => return error.Unexpected,
554 error.NotCapable => unreachable, // NotCapable mainly pertains WASI target so it's a bug if we hit it here
554 };555 };
555 if (len == 0) return error.UnexpectedEndOfFile;556 if (len == 0) return error.UnexpectedEndOfFile;
556 i += len;557 i += len;
lib/std/fs.zig+2
...@@ -1272,6 +1272,7 @@ pub const Dir = struct {...@@ -1272,6 +1272,7 @@ pub const Dir = struct {
1272 if (self.deleteFile(sub_path)) {1272 if (self.deleteFile(sub_path)) {
1273 return;1273 return;
1274 } else |err| switch (err) {1274 } else |err| switch (err) {
1275 error.DirNotEmpty => unreachable,
1275 error.FileNotFound => return,1276 error.FileNotFound => return,
1276 error.IsDir => {},1277 error.IsDir => {},
1277 error.AccessDenied => got_access_denied = true,1278 error.AccessDenied => got_access_denied = true,
...@@ -1341,6 +1342,7 @@ pub const Dir = struct {...@@ -1341,6 +1342,7 @@ pub const Dir = struct {
13411342
1342 // Impossible because we do not pass any path separators.1343 // Impossible because we do not pass any path separators.
1343 error.NotDir => unreachable,1344 error.NotDir => unreachable,
1345 error.DirNotEmpty => unreachable,
13441346
1345 error.IsDir => {},1347 error.IsDir => {},
1346 error.AccessDenied => got_access_denied = true,1348 error.AccessDenied => got_access_denied = true,
lib/std/os.zig+6-6
...@@ -1589,11 +1589,11 @@ pub fn symlinkZ(target_path: [*:0]const u8, sym_link_path: [*:0]const u8) SymLin...@@ -1589,11 +1589,11 @@ pub fn symlinkZ(target_path: [*:0]const u8, sym_link_path: [*:0]const u8) SymLin
1589 }1589 }
1590}1590}
15911591
1592pub const SymlinkatError = error{1592pub const SymLinkAtError = error{
1593 /// WASI-only. This error occurs when the file descriptor does1593 /// WASI-only. This error occurs when the file descriptor does
1594 /// not hold the required rights to create a new symbolic link relative to it.1594 /// not hold the required rights to create a new symbolic link relative to it.
1595 NotCapable,1595 NotCapable,
1596} || SymlinkError;1596} || SymLinkError;
15971597
1598/// Similar to `symlink`, however, creates a symbolic link named `sym_link_path` which contains the string1598/// Similar to `symlink`, however, creates a symbolic link named `sym_link_path` which contains the string
1599/// `target_path` **relative** to `newdirfd` directory handle.1599/// `target_path` **relative** to `newdirfd` directory handle.
...@@ -1601,7 +1601,7 @@ pub const SymlinkatError = error{...@@ -1601,7 +1601,7 @@ pub const SymlinkatError = error{
1601/// one; the latter case is known as a dangling link.1601/// one; the latter case is known as a dangling link.
1602/// If `sym_link_path` exists, it will not be overwritten.1602/// If `sym_link_path` exists, it will not be overwritten.
1603/// See also `symlinkatWasi`, `symlinkatZ` and `symlinkatW`.1603/// See also `symlinkatWasi`, `symlinkatZ` and `symlinkatW`.
1604pub fn symlinkat(target_path: []const u8, newdirfd: fd_t, sym_link_path: []const u8) SymLinkatError!void {1604pub fn symlinkat(target_path: []const u8, newdirfd: fd_t, sym_link_path: []const u8) SymLinkAtError!void {
1605 if (builtin.os.tag == .wasi) {1605 if (builtin.os.tag == .wasi) {
1606 return symlinkatWasi(target_path, newdirfd, sym_link_path);1606 return symlinkatWasi(target_path, newdirfd, sym_link_path);
1607 }1607 }
...@@ -1619,7 +1619,7 @@ pub const symlinkatC = @compileError("deprecated: renamed to symlinkatZ");...@@ -1619,7 +1619,7 @@ pub const symlinkatC = @compileError("deprecated: renamed to symlinkatZ");
16191619
1620/// WASI-only. The same as `symlinkat` but targeting WASI.1620/// WASI-only. The same as `symlinkat` but targeting WASI.
1621/// See also `symlinkat`.1621/// See also `symlinkat`.
1622pub fn symlinkatWasi(target_path: []const u8, newdirfd: fd_t, sym_link_path: []const u8) SymLinkatError!void {1622pub fn symlinkatWasi(target_path: []const u8, newdirfd: fd_t, sym_link_path: []const u8) SymLinkAtError!void {
1623 switch (wasi.path_symlink(target_path.ptr, target_path.len, newdirfd, sym_link_path.ptr, sym_link_path.len)) {1623 switch (wasi.path_symlink(target_path.ptr, target_path.len, newdirfd, sym_link_path.ptr, sym_link_path.len)) {
1624 wasi.ESUCCESS => {},1624 wasi.ESUCCESS => {},
1625 wasi.EFAULT => unreachable,1625 wasi.EFAULT => unreachable,
...@@ -1643,13 +1643,13 @@ pub fn symlinkatWasi(target_path: []const u8, newdirfd: fd_t, sym_link_path: []c...@@ -1643,13 +1643,13 @@ pub fn symlinkatWasi(target_path: []const u8, newdirfd: fd_t, sym_link_path: []c
16431643
1644/// Windows-only. The same as `symlinkat` except the paths are null-terminated, WTF-16 encoded.1644/// Windows-only. The same as `symlinkat` except the paths are null-terminated, WTF-16 encoded.
1645/// See also `symlinkat`.1645/// See also `symlinkat`.
1646pub fn symlinkatW(target_path: [*:0]const u16, newdirfd: fd_t, sym_link_path: [*:0]const u16) SymlinkatError!void {1646pub fn symlinkatW(target_path: [*:0]const u16, newdirfd: fd_t, sym_link_path: [*:0]const u16) SymLinkAtError!void {
1647 @compileError("TODO implement on Windows");1647 @compileError("TODO implement on Windows");
1648}1648}
16491649
1650/// The same as `symlinkat` except the parameters are null-terminated pointers.1650/// The same as `symlinkat` except the parameters are null-terminated pointers.
1651/// See also `symlinkat`.1651/// See also `symlinkat`.
1652pub fn symlinkatZ(target_path: [*:0]const u8, newdirfd: fd_t, sym_link_path: [*:0]const u8) SymLinkatError!void {1652pub fn symlinkatZ(target_path: [*:0]const u8, newdirfd: fd_t, sym_link_path: [*:0]const u8) SymLinkAtError!void {
1653 if (builtin.os.tag == .windows) {1653 if (builtin.os.tag == .windows) {
1654 const target_path_w = try windows.cStrToPrefixedFileW(target_path);1654 const target_path_w = try windows.cStrToPrefixedFileW(target_path);
1655 const sym_link_path_w = try windows.cStrToPrefixedFileW(sym_link_path);1655 const sym_link_path_w = try windows.cStrToPrefixedFileW(sym_link_path);
src-self-hosted/stage2.zig+3
...@@ -163,6 +163,7 @@ export fn stage2_render_ast(tree: *ast.Tree, output_file: *FILE) Error {...@@ -163,6 +163,7 @@ export fn stage2_render_ast(tree: *ast.Tree, output_file: *FILE) Error {
163 error.OutOfMemory => return .OutOfMemory,163 error.OutOfMemory => return .OutOfMemory,
164 error.Unexpected => return .Unexpected,164 error.Unexpected => return .Unexpected,
165 error.InputOutput => return .FileSystem,165 error.InputOutput => return .FileSystem,
166 error.NotCapable => unreachable, // we should handle this when we're able to cross-compile Zig to WASI
166 };167 };
167 return .None;168 return .None;
168}169}
...@@ -606,6 +607,7 @@ export fn stage2_libc_parse(stage1_libc: *Stage2LibCInstallation, libc_file_z: [...@@ -606,6 +607,7 @@ export fn stage2_libc_parse(stage1_libc: *Stage2LibCInstallation, libc_file_z: [
606 error.NotDir => return .NotDir,607 error.NotDir => return .NotDir,
607 error.DeviceBusy => return .DeviceBusy,608 error.DeviceBusy => return .DeviceBusy,
608 error.FileLocksNotSupported => unreachable,609 error.FileLocksNotSupported => unreachable,
610 error.NotCapable => unreachable, // we should handle this when we're able to cross-compile Zig to WASI
609 };611 };
610 stage1_libc.initFromStage2(libc);612 stage1_libc.initFromStage2(libc);
611 return .None;613 return .None;
...@@ -649,6 +651,7 @@ export fn stage2_libc_render(stage1_libc: *Stage2LibCInstallation, output_file:...@@ -649,6 +651,7 @@ export fn stage2_libc_render(stage1_libc: *Stage2LibCInstallation, output_file:
649 error.AccessDenied => return .AccessDenied,651 error.AccessDenied => return .AccessDenied,
650 error.Unexpected => return .Unexpected,652 error.Unexpected => return .Unexpected,
651 error.InputOutput => return .FileSystem,653 error.InputOutput => return .FileSystem,
654 error.NotCapable => unreachable, // we should handle this when we're able to cross-compile Zig to WASI
652 };655 };
653 return .None;656 return .None;
654}657}