diff --git a/std/darwin.zig b/std/darwin.zig index 0bf8b62f58..9f00cc06dc 100644 --- a/std/darwin.zig +++ b/std/darwin.zig @@ -1,7 +1,7 @@ const arch = switch (@compileVar("arch")) { - x86_64 => @import("darwin_x86_64.zig"), - else => @compile_err("unsupported arch"), + Arch.x86_64 => @import("darwin_x86_64.zig"), + else => @compileError("unsupported arch"), }; const errno = @import("errno.zig"); @@ -88,7 +88,7 @@ pub fn fstat(fd: i32, stat_buf: &stat) -> usize { arch.syscall2(arch.SYS_fstat, usize(fd), usize(stat_buf)) } -pub error Unexpected; +error Unexpected; pub fn getrandom(buf: &u8, count: usize) -> usize { const rr = open_c(c"/dev/urandom", O_LARGEFILE | O_RDONLY, 0); diff --git a/std/darwin_x86_64.zig b/std/darwin_x86_64.zig index 2dc98513e9..742f937978 100644 --- a/std/darwin_x86_64.zig +++ b/std/darwin_x86_64.zig @@ -57,7 +57,7 @@ pub inline fn syscall3(number: usize, arg1: usize, arg2: usize, arg3: usize) -> -export struct stat { +pub const stat = extern struct { dev: u32, mode: u16, nlink: u16, @@ -78,9 +78,9 @@ export struct stat { lspare: i32, qspare: [2]u64, -} +}; -export struct timespec { +pub const timespec = extern struct { tv_sec: isize, tv_nsec: isize, -} +}; diff --git a/std/debug.zig b/std/debug.zig index 2f78a6c7ce..05e895db5d 100644 --- a/std/debug.zig +++ b/std/debug.zig @@ -5,9 +5,9 @@ const elf = @import("elf.zig"); const DW = @import("dwarf.zig"); const List = @import("list.zig").List; -pub error MissingDebugInfo; -pub error InvalidDebugInfo; -pub error UnsupportedDebugInfo; +error MissingDebugInfo; +error InvalidDebugInfo; +error UnsupportedDebugInfo; pub fn assert(b: bool) { if (!b) @unreachable() @@ -20,7 +20,7 @@ pub fn printStackTrace() -> %void { pub fn writeStackTrace(out_stream: &io.OutStream) -> %void { switch (@compileVar("object_format")) { - elf => { + ObjectFormat.elf => { var stack_trace = ElfStackTrace { .self_exe_stream = undefined, .elf = undefined, @@ -57,13 +57,13 @@ pub fn writeStackTrace(out_stream: &io.OutStream) -> %void { maybe_fp = *(&const ?&const u8)(fp); } }, - coff => { + ObjectFormat.coff => { out_stream.write("(stack trace unavailable for COFF object format)\n"); }, - macho => { + ObjectFormat.macho => { %return out_stream.write("(stack trace unavailable for Mach-O object format)\n"); }, - unknown => { + ObjectFormat.unknown => { out_stream.write("(stack trace unavailable for unknown object format)\n"); }, } diff --git a/std/elf.zig b/std/elf.zig index f2d597fb98..40e24f56af 100644 --- a/std/elf.zig +++ b/std/elf.zig @@ -4,7 +4,7 @@ const math = @import("math.zig"); const mem = @import("mem.zig"); const debug = @import("debug.zig"); -pub error InvalidFormat; +error InvalidFormat; pub const SHT_NULL = 0; pub const SHT_PROGBITS = 1; diff --git a/std/index.zig b/std/index.zig index 0b7333b138..0f6fe974ef 100644 --- a/std/index.zig +++ b/std/index.zig @@ -10,11 +10,11 @@ pub const hash_map = @import("hash_map.zig"); pub const mem = @import("mem.zig"); pub const debug = @import("debug.zig"); pub const linux = switch(@compileVar("os")) { - linux => @import("linux.zig"), + Os.linux => @import("linux.zig"), else => null_import, }; pub const darwin = switch(@compileVar("os")) { - darwin => @import("darwin.zig"), + Os.darwin => @import("darwin.zig"), else => null_import, }; const null_import = @import("empty.zig"); diff --git a/std/linux.zig b/std/linux.zig index 813a2ea824..de6712507c 100644 --- a/std/linux.zig +++ b/std/linux.zig @@ -456,9 +456,9 @@ pub fn accept4(fd: i32, noalias addr: &sockaddr, noalias len: &socklen_t, flags: arch.syscall4(arch.SYS_accept4, usize(fd), usize(addr), usize(len), flags) } -// pub error NameTooLong; -// pub error SystemResources; -// pub error Io; +// error NameTooLong; +// error SystemResources; +// error Io; // // pub fn if_nametoindex(name: []u8) -> %u32 { // var ifr: ifreq = undefined; diff --git a/std/mem.zig b/std/mem.zig index 03d131c95d..451e2c2167 100644 --- a/std/mem.zig +++ b/std/mem.zig @@ -5,7 +5,7 @@ const io = @import("io.zig"); pub const Cmp = math.Cmp; -pub error NoMem; +error NoMem; pub type Context = u8; pub const Allocator = struct { diff --git a/std/net.zig b/std/net.zig index d6ff2b7cff..7464e9c7e7 100644 --- a/std/net.zig +++ b/std/net.zig @@ -3,15 +3,15 @@ const errno = @import("errno.zig"); const assert = @import("debug.zig").assert; const endian = @import("endian.zig"); -pub error SigInterrupt; -pub error Unexpected; -pub error Io; -pub error TimedOut; -pub error ConnectionReset; -pub error ConnectionRefused; -pub error NoMem; -pub error NotSocket; -pub error BadFd; +error SigInterrupt; +error Unexpected; +error Io; +error TimedOut; +error ConnectionReset; +error ConnectionRefused; +error NoMem; +error NotSocket; +error BadFd; const Connection = struct { socket_fd: i32, @@ -139,7 +139,7 @@ pub fn connect(hostname: []const u8, port: u16) -> %Connection { return connectAddr(main_addr, port); } -pub error InvalidIpLiteral; +error InvalidIpLiteral; pub fn parseIpLiteral(buf: []const u8) -> %Address { switch (parseIp4(buf)) { diff --git a/std/os.zig b/std/os.zig index 8def16601d..6c2bcd71ea 100644 --- a/std/os.zig +++ b/std/os.zig @@ -1,11 +1,11 @@ const system = switch(@compileVar("os")) { - linux => @import("linux.zig"), - darwin => @import("darwin.zig"), + Os.linux => @import("linux.zig"), + Os.darwin => @import("darwin.zig"), else => @compileError("Unsupported OS"), }; const errno = @import("errno.zig"); -pub error Unexpected; +error Unexpected; pub fn getRandomBytes(buf: []u8) -> %void { while (true) {