authorgravatar for me@tadeo.caTadeo Kondrak <me@tadeo.ca> 2020-05-05 05:14:22-06:00
committergravatar for me@tadeo.caTadeo Kondrak <me@tadeo.ca> 2020-05-05 05:55:25-06:00
logaf00afed9844b9fb17478d33840fb4a312c4f07c
tree2199ced7be5a0234a18bdb57cac9309cd2f16cc0
parentb957dc29a4e3f025e446e717b0ae8c69602545ca
signaturelock-open Commit is signed but in an unrecognized format.

zig fmt


9 files changed, 61 insertions(+), 55 deletions(-)

lib/std/debug.zig+15-15
...@@ -62,7 +62,7 @@ pub fn warn(comptime fmt: []const u8, args: var) void {...@@ -62,7 +62,7 @@ pub fn warn(comptime fmt: []const u8, args: var) void {
62 const held = stderr_mutex.acquire();62 const held = stderr_mutex.acquire();
63 defer held.release();63 defer held.release();
64 const stderr = getStderrStream();64 const stderr = getStderrStream();
65 noasync stderr.print(fmt, args) catch return;65 nosuspend stderr.print(fmt, args) catch return;
66}66}
6767
68pub fn getStderrStream() *File.OutStream {68pub fn getStderrStream() *File.OutStream {
...@@ -112,7 +112,7 @@ pub fn detectTTYConfig() TTY.Config {...@@ -112,7 +112,7 @@ pub fn detectTTYConfig() TTY.Config {
112/// Tries to print the current stack trace to stderr, unbuffered, and ignores any error returned.112/// Tries to print the current stack trace to stderr, unbuffered, and ignores any error returned.
113/// TODO multithreaded awareness113/// TODO multithreaded awareness
114pub fn dumpCurrentStackTrace(start_addr: ?usize) void {114pub fn dumpCurrentStackTrace(start_addr: ?usize) void {
115 noasync {115 nosuspend {
116 const stderr = getStderrStream();116 const stderr = getStderrStream();
117 if (builtin.strip_debug_info) {117 if (builtin.strip_debug_info) {
118 stderr.print("Unable to dump stack trace: debug info stripped\n", .{}) catch return;118 stderr.print("Unable to dump stack trace: debug info stripped\n", .{}) catch return;
...@@ -133,7 +133,7 @@ pub fn dumpCurrentStackTrace(start_addr: ?usize) void {...@@ -133,7 +133,7 @@ pub fn dumpCurrentStackTrace(start_addr: ?usize) void {
133/// unbuffered, and ignores any error returned.133/// unbuffered, and ignores any error returned.
134/// TODO multithreaded awareness134/// TODO multithreaded awareness
135pub fn dumpStackTraceFromBase(bp: usize, ip: usize) void {135pub fn dumpStackTraceFromBase(bp: usize, ip: usize) void {
136 noasync {136 nosuspend {
137 const stderr = getStderrStream();137 const stderr = getStderrStream();
138 if (builtin.strip_debug_info) {138 if (builtin.strip_debug_info) {
139 stderr.print("Unable to dump stack trace: debug info stripped\n", .{}) catch return;139 stderr.print("Unable to dump stack trace: debug info stripped\n", .{}) catch return;
...@@ -203,7 +203,7 @@ pub fn captureStackTrace(first_address: ?usize, stack_trace: *builtin.StackTrace...@@ -203,7 +203,7 @@ pub fn captureStackTrace(first_address: ?usize, stack_trace: *builtin.StackTrace
203/// Tries to print a stack trace to stderr, unbuffered, and ignores any error returned.203/// Tries to print a stack trace to stderr, unbuffered, and ignores any error returned.
204/// TODO multithreaded awareness204/// TODO multithreaded awareness
205pub fn dumpStackTrace(stack_trace: builtin.StackTrace) void {205pub fn dumpStackTrace(stack_trace: builtin.StackTrace) void {
206 noasync {206 nosuspend {
207 const stderr = getStderrStream();207 const stderr = getStderrStream();
208 if (builtin.strip_debug_info) {208 if (builtin.strip_debug_info) {
209 stderr.print("Unable to dump stack trace: debug info stripped\n", .{}) catch return;209 stderr.print("Unable to dump stack trace: debug info stripped\n", .{}) catch return;
...@@ -261,7 +261,7 @@ pub fn panicExtra(trace: ?*const builtin.StackTrace, first_trace_addr: ?usize, c...@@ -261,7 +261,7 @@ pub fn panicExtra(trace: ?*const builtin.StackTrace, first_trace_addr: ?usize, c
261 resetSegfaultHandler();261 resetSegfaultHandler();
262 }262 }
263263
264 noasync switch (panic_stage) {264 nosuspend switch (panic_stage) {
265 0 => {265 0 => {
266 panic_stage = 1;266 panic_stage = 1;
267267
...@@ -447,7 +447,7 @@ pub const TTY = struct {...@@ -447,7 +447,7 @@ pub const TTY = struct {
447 windows_api,447 windows_api,
448448
449 fn setColor(conf: Config, out_stream: var, color: Color) void {449 fn setColor(conf: Config, out_stream: var, color: Color) void {
450 noasync switch (conf) {450 nosuspend switch (conf) {
451 .no_color => return,451 .no_color => return,
452 .escape_codes => switch (color) {452 .escape_codes => switch (color) {
453 .Red => out_stream.writeAll(RED) catch return,453 .Red => out_stream.writeAll(RED) catch return,
...@@ -604,7 +604,7 @@ fn printLineInfo(...@@ -604,7 +604,7 @@ fn printLineInfo(
604 tty_config: TTY.Config,604 tty_config: TTY.Config,
605 comptime printLineFromFile: var,605 comptime printLineFromFile: var,
606) !void {606) !void {
607 noasync {607 nosuspend {
608 tty_config.setColor(out_stream, .White);608 tty_config.setColor(out_stream, .White);
609609
610 if (line_info) |*li| {610 if (line_info) |*li| {
...@@ -651,7 +651,7 @@ pub const OpenSelfDebugInfoError = error{...@@ -651,7 +651,7 @@ pub const OpenSelfDebugInfoError = error{
651651
652/// TODO resources https://github.com/ziglang/zig/issues/4353652/// TODO resources https://github.com/ziglang/zig/issues/4353
653pub fn openSelfDebugInfo(allocator: *mem.Allocator) anyerror!DebugInfo {653pub fn openSelfDebugInfo(allocator: *mem.Allocator) anyerror!DebugInfo {
654 noasync {654 nosuspend {
655 if (builtin.strip_debug_info)655 if (builtin.strip_debug_info)
656 return error.MissingDebugInfo;656 return error.MissingDebugInfo;
657 if (@hasDecl(root, "os") and @hasDecl(root.os, "debug") and @hasDecl(root.os.debug, "openSelfDebugInfo")) {657 if (@hasDecl(root, "os") and @hasDecl(root.os, "debug") and @hasDecl(root.os.debug, "openSelfDebugInfo")) {
...@@ -672,7 +672,7 @@ pub fn openSelfDebugInfo(allocator: *mem.Allocator) anyerror!DebugInfo {...@@ -672,7 +672,7 @@ pub fn openSelfDebugInfo(allocator: *mem.Allocator) anyerror!DebugInfo {
672672
673/// TODO resources https://github.com/ziglang/zig/issues/4353673/// TODO resources https://github.com/ziglang/zig/issues/4353
674fn openCoffDebugInfo(allocator: *mem.Allocator, coff_file_path: [:0]const u16) !ModuleDebugInfo {674fn openCoffDebugInfo(allocator: *mem.Allocator, coff_file_path: [:0]const u16) !ModuleDebugInfo {
675 noasync {675 nosuspend {
676 const coff_file = try std.fs.openFileAbsoluteW(coff_file_path, .{ .intended_io_mode = .blocking });676 const coff_file = try std.fs.openFileAbsoluteW(coff_file_path, .{ .intended_io_mode = .blocking });
677 errdefer coff_file.close();677 errdefer coff_file.close();
678678
...@@ -853,7 +853,7 @@ fn chopSlice(ptr: []const u8, offset: u64, size: u64) ![]const u8 {...@@ -853,7 +853,7 @@ fn chopSlice(ptr: []const u8, offset: u64, size: u64) ![]const u8 {
853853
854/// TODO resources https://github.com/ziglang/zig/issues/4353854/// TODO resources https://github.com/ziglang/zig/issues/4353
855pub fn openElfDebugInfo(allocator: *mem.Allocator, elf_file_path: []const u8) !ModuleDebugInfo {855pub fn openElfDebugInfo(allocator: *mem.Allocator, elf_file_path: []const u8) !ModuleDebugInfo {
856 noasync {856 nosuspend {
857 const mapped_mem = try mapWholeFile(elf_file_path);857 const mapped_mem = try mapWholeFile(elf_file_path);
858 const hdr = @ptrCast(*const elf.Ehdr, &mapped_mem[0]);858 const hdr = @ptrCast(*const elf.Ehdr, &mapped_mem[0]);
859 if (!mem.eql(u8, hdr.e_ident[0..4], "\x7fELF")) return error.InvalidElfMagic;859 if (!mem.eql(u8, hdr.e_ident[0..4], "\x7fELF")) return error.InvalidElfMagic;
...@@ -1056,7 +1056,7 @@ const MachoSymbol = struct {...@@ -1056,7 +1056,7 @@ const MachoSymbol = struct {
1056};1056};
10571057
1058fn mapWholeFile(path: []const u8) ![]align(mem.page_size) const u8 {1058fn mapWholeFile(path: []const u8) ![]align(mem.page_size) const u8 {
1059 noasync {1059 nosuspend {
1060 const file = try fs.cwd().openFile(path, .{ .intended_io_mode = .blocking });1060 const file = try fs.cwd().openFile(path, .{ .intended_io_mode = .blocking });
1061 defer file.close();1061 defer file.close();
10621062
...@@ -1418,7 +1418,7 @@ pub const ModuleDebugInfo = switch (builtin.os.tag) {...@@ -1418,7 +1418,7 @@ pub const ModuleDebugInfo = switch (builtin.os.tag) {
1418 }1418 }
14191419
1420 fn getSymbolAtAddress(self: *@This(), address: usize) !SymbolInfo {1420 fn getSymbolAtAddress(self: *@This(), address: usize) !SymbolInfo {
1421 noasync {1421 nosuspend {
1422 // Translate the VA into an address into this object1422 // Translate the VA into an address into this object
1423 const relocated_address = address - self.base_address;1423 const relocated_address = address - self.base_address;
1424 assert(relocated_address >= 0x100000000);1424 assert(relocated_address >= 0x100000000);
...@@ -1643,14 +1643,14 @@ pub const ModuleDebugInfo = switch (builtin.os.tag) {...@@ -1643,14 +1643,14 @@ pub const ModuleDebugInfo = switch (builtin.os.tag) {
1643 // Translate the VA into an address into this object1643 // Translate the VA into an address into this object
1644 const relocated_address = address - self.base_address;1644 const relocated_address = address - self.base_address;
16451645
1646 if (noasync self.dwarf.findCompileUnit(relocated_address)) |compile_unit| {1646 if (nosuspend self.dwarf.findCompileUnit(relocated_address)) |compile_unit| {
1647 return SymbolInfo{1647 return SymbolInfo{
1648 .symbol_name = noasync self.dwarf.getSymbolName(relocated_address) orelse "???",1648 .symbol_name = nosuspend self.dwarf.getSymbolName(relocated_address) orelse "???",
1649 .compile_unit_name = compile_unit.die.getAttrString(&self.dwarf, DW.AT_name) catch |err| switch (err) {1649 .compile_unit_name = compile_unit.die.getAttrString(&self.dwarf, DW.AT_name) catch |err| switch (err) {
1650 error.MissingDebugInfo, error.InvalidDebugInfo => "???",1650 error.MissingDebugInfo, error.InvalidDebugInfo => "???",
1651 else => return err,1651 else => return err,
1652 },1652 },
1653 .line_info = noasync self.dwarf.getLineNumberInfo(compile_unit.*, relocated_address) catch |err| switch (err) {1653 .line_info = nosuspend self.dwarf.getLineNumberInfo(compile_unit.*, relocated_address) catch |err| switch (err) {
1654 error.MissingDebugInfo, error.InvalidDebugInfo => null,1654 error.MissingDebugInfo, error.InvalidDebugInfo => null,
1655 else => return err,1655 else => return err,
1656 },1656 },
lib/std/dwarf.zig+19-19
...@@ -252,13 +252,13 @@ fn readUnitLength(in_stream: var, endian: builtin.Endian, is_64: *bool) !u64 {...@@ -252,13 +252,13 @@ fn readUnitLength(in_stream: var, endian: builtin.Endian, is_64: *bool) !u64 {
252fn readAllocBytes(allocator: *mem.Allocator, in_stream: var, size: usize) ![]u8 {252fn readAllocBytes(allocator: *mem.Allocator, in_stream: var, size: usize) ![]u8 {
253 const buf = try allocator.alloc(u8, size);253 const buf = try allocator.alloc(u8, size);
254 errdefer allocator.free(buf);254 errdefer allocator.free(buf);
255 if ((try noasync in_stream.read(buf)) < size) return error.EndOfFile;255 if ((try nosuspend in_stream.read(buf)) < size) return error.EndOfFile;
256 return buf;256 return buf;
257}257}
258258
259// TODO the noasyncs here are workarounds259// TODO the noasyncs here are workarounds
260fn readAddress(in_stream: var, endian: builtin.Endian, is_64: bool) !u64 {260fn readAddress(in_stream: var, endian: builtin.Endian, is_64: bool) !u64 {
261 return noasync if (is_64)261 return nosuspend if (is_64)
262 try in_stream.readInt(u64, endian)262 try in_stream.readInt(u64, endian)
263 else263 else
264 @as(u64, try in_stream.readInt(u32, endian));264 @as(u64, try in_stream.readInt(u32, endian));
...@@ -271,7 +271,7 @@ fn parseFormValueBlockLen(allocator: *mem.Allocator, in_stream: var, size: usize...@@ -271,7 +271,7 @@ fn parseFormValueBlockLen(allocator: *mem.Allocator, in_stream: var, size: usize
271271
272// TODO the noasyncs here are workarounds272// TODO the noasyncs here are workarounds
273fn parseFormValueBlock(allocator: *mem.Allocator, in_stream: var, endian: builtin.Endian, size: usize) !FormValue {273fn parseFormValueBlock(allocator: *mem.Allocator, in_stream: var, endian: builtin.Endian, size: usize) !FormValue {
274 const block_len = try noasync in_stream.readVarInt(usize, endian, size);274 const block_len = try nosuspend in_stream.readVarInt(usize, endian, size);
275 return parseFormValueBlockLen(allocator, in_stream, block_len);275 return parseFormValueBlockLen(allocator, in_stream, block_len);
276}276}
277277
...@@ -282,16 +282,16 @@ fn parseFormValueConstant(allocator: *mem.Allocator, in_stream: var, signed: boo...@@ -282,16 +282,16 @@ fn parseFormValueConstant(allocator: *mem.Allocator, in_stream: var, signed: boo
282 .Const = Constant{282 .Const = Constant{
283 .signed = signed,283 .signed = signed,
284 .payload = switch (size) {284 .payload = switch (size) {
285 1 => try noasync in_stream.readInt(u8, endian),285 1 => try nosuspend in_stream.readInt(u8, endian),
286 2 => try noasync in_stream.readInt(u16, endian),286 2 => try nosuspend in_stream.readInt(u16, endian),
287 4 => try noasync in_stream.readInt(u32, endian),287 4 => try nosuspend in_stream.readInt(u32, endian),
288 8 => try noasync in_stream.readInt(u64, endian),288 8 => try nosuspend in_stream.readInt(u64, endian),
289 -1 => blk: {289 -1 => blk: {
290 if (signed) {290 if (signed) {
291 const x = try noasync leb.readILEB128(i64, in_stream);291 const x = try nosuspend leb.readILEB128(i64, in_stream);
292 break :blk @bitCast(u64, x);292 break :blk @bitCast(u64, x);
293 } else {293 } else {
294 const x = try noasync leb.readULEB128(u64, in_stream);294 const x = try nosuspend leb.readULEB128(u64, in_stream);
295 break :blk x;295 break :blk x;
296 }296 }
297 },297 },
...@@ -305,11 +305,11 @@ fn parseFormValueConstant(allocator: *mem.Allocator, in_stream: var, signed: boo...@@ -305,11 +305,11 @@ fn parseFormValueConstant(allocator: *mem.Allocator, in_stream: var, signed: boo
305fn parseFormValueRef(allocator: *mem.Allocator, in_stream: var, endian: builtin.Endian, size: i32) !FormValue {305fn parseFormValueRef(allocator: *mem.Allocator, in_stream: var, endian: builtin.Endian, size: i32) !FormValue {
306 return FormValue{306 return FormValue{
307 .Ref = switch (size) {307 .Ref = switch (size) {
308 1 => try noasync in_stream.readInt(u8, endian),308 1 => try nosuspend in_stream.readInt(u8, endian),
309 2 => try noasync in_stream.readInt(u16, endian),309 2 => try nosuspend in_stream.readInt(u16, endian),
310 4 => try noasync in_stream.readInt(u32, endian),310 4 => try nosuspend in_stream.readInt(u32, endian),
311 8 => try noasync in_stream.readInt(u64, endian),311 8 => try nosuspend in_stream.readInt(u64, endian),
312 -1 => try noasync leb.readULEB128(u64, in_stream),312 -1 => try nosuspend leb.readULEB128(u64, in_stream),
313 else => unreachable,313 else => unreachable,
314 },314 },
315 };315 };
...@@ -323,7 +323,7 @@ fn parseFormValue(allocator: *mem.Allocator, in_stream: var, form_id: u64, endia...@@ -323,7 +323,7 @@ fn parseFormValue(allocator: *mem.Allocator, in_stream: var, form_id: u64, endia
323 FORM_block2 => parseFormValueBlock(allocator, in_stream, endian, 2),323 FORM_block2 => parseFormValueBlock(allocator, in_stream, endian, 2),
324 FORM_block4 => parseFormValueBlock(allocator, in_stream, endian, 4),324 FORM_block4 => parseFormValueBlock(allocator, in_stream, endian, 4),
325 FORM_block => x: {325 FORM_block => x: {
326 const block_len = try noasync leb.readULEB128(usize, in_stream);326 const block_len = try nosuspend leb.readULEB128(usize, in_stream);
327 return parseFormValueBlockLen(allocator, in_stream, block_len);327 return parseFormValueBlockLen(allocator, in_stream, block_len);
328 },328 },
329 FORM_data1 => parseFormValueConstant(allocator, in_stream, false, endian, 1),329 FORM_data1 => parseFormValueConstant(allocator, in_stream, false, endian, 1),
...@@ -335,11 +335,11 @@ fn parseFormValue(allocator: *mem.Allocator, in_stream: var, form_id: u64, endia...@@ -335,11 +335,11 @@ fn parseFormValue(allocator: *mem.Allocator, in_stream: var, form_id: u64, endia
335 return parseFormValueConstant(allocator, in_stream, signed, endian, -1);335 return parseFormValueConstant(allocator, in_stream, signed, endian, -1);
336 },336 },
337 FORM_exprloc => {337 FORM_exprloc => {
338 const size = try noasync leb.readULEB128(usize, in_stream);338 const size = try nosuspend leb.readULEB128(usize, in_stream);
339 const buf = try readAllocBytes(allocator, in_stream, size);339 const buf = try readAllocBytes(allocator, in_stream, size);
340 return FormValue{ .ExprLoc = buf };340 return FormValue{ .ExprLoc = buf };
341 },341 },
342 FORM_flag => FormValue{ .Flag = (try noasync in_stream.readByte()) != 0 },342 FORM_flag => FormValue{ .Flag = (try nosuspend in_stream.readByte()) != 0 },
343 FORM_flag_present => FormValue{ .Flag = true },343 FORM_flag_present => FormValue{ .Flag = true },
344 FORM_sec_offset => FormValue{ .SecOffset = try readAddress(in_stream, endian, is_64) },344 FORM_sec_offset => FormValue{ .SecOffset = try readAddress(in_stream, endian, is_64) },
345345
...@@ -350,12 +350,12 @@ fn parseFormValue(allocator: *mem.Allocator, in_stream: var, form_id: u64, endia...@@ -350,12 +350,12 @@ fn parseFormValue(allocator: *mem.Allocator, in_stream: var, form_id: u64, endia
350 FORM_ref_udata => parseFormValueRef(allocator, in_stream, endian, -1),350 FORM_ref_udata => parseFormValueRef(allocator, in_stream, endian, -1),
351351
352 FORM_ref_addr => FormValue{ .RefAddr = try readAddress(in_stream, endian, is_64) },352 FORM_ref_addr => FormValue{ .RefAddr = try readAddress(in_stream, endian, is_64) },
353 FORM_ref_sig8 => FormValue{ .Ref = try noasync in_stream.readInt(u64, endian) },353 FORM_ref_sig8 => FormValue{ .Ref = try nosuspend in_stream.readInt(u64, endian) },
354354
355 FORM_string => FormValue{ .String = try in_stream.readUntilDelimiterAlloc(allocator, 0, math.maxInt(usize)) },355 FORM_string => FormValue{ .String = try in_stream.readUntilDelimiterAlloc(allocator, 0, math.maxInt(usize)) },
356 FORM_strp => FormValue{ .StrPtr = try readAddress(in_stream, endian, is_64) },356 FORM_strp => FormValue{ .StrPtr = try readAddress(in_stream, endian, is_64) },
357 FORM_indirect => {357 FORM_indirect => {
358 const child_form_id = try noasync leb.readULEB128(u64, in_stream);358 const child_form_id = try nosuspend leb.readULEB128(u64, in_stream);
359 const F = @TypeOf(async parseFormValue(allocator, in_stream, child_form_id, endian, is_64));359 const F = @TypeOf(async parseFormValue(allocator, in_stream, child_form_id, endian, is_64));
360 var frame = try allocator.create(F);360 var frame = try allocator.create(F);
361 defer allocator.destroy(frame);361 defer allocator.destroy(frame);
lib/std/event/batch.zig+2-2
...@@ -75,7 +75,7 @@ pub fn Batch(...@@ -75,7 +75,7 @@ pub fn Batch(
75 const job = &self.jobs[self.next_job_index];75 const job = &self.jobs[self.next_job_index];
76 self.next_job_index = (self.next_job_index + 1) % max_jobs;76 self.next_job_index = (self.next_job_index + 1) % max_jobs;
77 if (job.frame) |existing| {77 if (job.frame) |existing| {
78 job.result = if (async_ok) await existing else noasync await existing;78 job.result = if (async_ok) await existing else nosuspend await existing;
79 if (CollectedResult != void) {79 if (CollectedResult != void) {
80 job.result catch |err| {80 job.result catch |err| {
81 self.collected_result = err;81 self.collected_result = err;
...@@ -94,7 +94,7 @@ pub fn Batch(...@@ -94,7 +94,7 @@ pub fn Batch(
94 /// a time, however, it need not be the same thread.94 /// a time, however, it need not be the same thread.
95 pub fn wait(self: *Self) CollectedResult {95 pub fn wait(self: *Self) CollectedResult {
96 for (self.jobs) |*job| if (job.frame) |f| {96 for (self.jobs) |*job| if (job.frame) |f| {
97 job.result = if (async_ok) await f else noasync await f;97 job.result = if (async_ok) await f else nosuspend await f;
98 if (CollectedResult != void) {98 if (CollectedResult != void) {
99 job.result catch |err| {99 job.result catch |err| {
100 self.collected_result = err;100 self.collected_result = err;
lib/std/event/loop.zig+4-4
...@@ -195,7 +195,7 @@ pub const Loop = struct {...@@ -195,7 +195,7 @@ pub const Loop = struct {
195 const wakeup_bytes = [_]u8{0x1} ** 8;195 const wakeup_bytes = [_]u8{0x1} ** 8;
196196
197 fn initOsData(self: *Loop, extra_thread_count: usize) InitOsDataError!void {197 fn initOsData(self: *Loop, extra_thread_count: usize) InitOsDataError!void {
198 noasync switch (builtin.os.tag) {198 nosuspend switch (builtin.os.tag) {
199 .linux => {199 .linux => {
200 errdefer {200 errdefer {
201 while (self.available_eventfd_resume_nodes.pop()) |node| os.close(node.data.eventfd);201 while (self.available_eventfd_resume_nodes.pop()) |node| os.close(node.data.eventfd);
...@@ -371,7 +371,7 @@ pub const Loop = struct {...@@ -371,7 +371,7 @@ pub const Loop = struct {
371 }371 }
372372
373 fn deinitOsData(self: *Loop) void {373 fn deinitOsData(self: *Loop) void {
374 noasync switch (builtin.os.tag) {374 nosuspend switch (builtin.os.tag) {
375 .linux => {375 .linux => {
376 os.close(self.os_data.final_eventfd);376 os.close(self.os_data.final_eventfd);
377 while (self.available_eventfd_resume_nodes.pop()) |node| os.close(node.data.eventfd);377 while (self.available_eventfd_resume_nodes.pop()) |node| os.close(node.data.eventfd);
...@@ -663,7 +663,7 @@ pub const Loop = struct {...@@ -663,7 +663,7 @@ pub const Loop = struct {
663 }663 }
664664
665 pub fn finishOneEvent(self: *Loop) void {665 pub fn finishOneEvent(self: *Loop) void {
666 noasync {666 nosuspend {
667 const prev = @atomicRmw(usize, &self.pending_event_count, .Sub, 1, .SeqCst);667 const prev = @atomicRmw(usize, &self.pending_event_count, .Sub, 1, .SeqCst);
668 if (prev != 1) return;668 if (prev != 1) return;
669669
...@@ -1041,7 +1041,7 @@ pub const Loop = struct {...@@ -1041,7 +1041,7 @@ pub const Loop = struct {
1041 }1041 }
10421042
1043 fn posixFsRun(self: *Loop) void {1043 fn posixFsRun(self: *Loop) void {
1044 noasync while (true) {1044 nosuspend while (true) {
1045 self.fs_thread_wakeup.reset();1045 self.fs_thread_wakeup.reset();
1046 while (self.fs_queue.get()) |node| {1046 while (self.fs_queue.get()) |node| {
1047 switch (node.data.msg) {1047 switch (node.data.msg) {
lib/std/zig/system/macos.zig+9-4
...@@ -39,7 +39,7 @@ pub fn version_from_build(build: []const u8) !std.builtin.Version {...@@ -39,7 +39,7 @@ pub fn version_from_build(build: []const u8) !std.builtin.Version {
39 zend += 1;39 zend += 1;
40 }40 }
41 if (zend == yindex + 1) return error.InvalidVersion;41 if (zend == yindex + 1) return error.InvalidVersion;
42 const z = std.fmt.parseUnsigned(u16, build[yindex + 1..zend], 10) catch return error.InvalidVersion;42 const z = std.fmt.parseUnsigned(u16, build[yindex + 1 .. zend], 10) catch return error.InvalidVersion;
4343
44 result.patch = switch (result.minor) {44 result.patch = switch (result.minor) {
45 // TODO: compiler complains without explicit @as() coercion45 // TODO: compiler complains without explicit @as() coercion
...@@ -97,7 +97,9 @@ pub fn version_from_build(build: []const u8) !std.builtin.Version {...@@ -97,7 +97,9 @@ pub fn version_from_build(build: []const u8) !std.builtin.Version {
97 4 => @as(u32, switch (y) { // Tiger: 10.497 4 => @as(u32, switch (y) { // Tiger: 10.4
98 'A' => 0,98 'A' => 0,
99 'B' => 1,99 'B' => 1,
100 'C', 'E', => 2,100 'C',
101 'E',
102 => 2,
101 'F' => 3,103 'F' => 3,
102 'G' => @as(u32, block: {104 'G' => @as(u32, block: {
103 if (z >= 1454) break :block 5;105 if (z >= 1454) break :block 5;
...@@ -105,7 +107,10 @@ pub fn version_from_build(build: []const u8) !std.builtin.Version {...@@ -105,7 +107,10 @@ pub fn version_from_build(build: []const u8) !std.builtin.Version {
105 }),107 }),
106 'H' => 5,108 'H' => 5,
107 'I' => 6,109 'I' => 6,
108 'J', 'K', 'N', => 7,110 'J',
111 'K',
112 'N',
113 => 7,
109 'L' => 8,114 'L' => 8,
110 'P' => 9,115 'P' => 9,
111 'R' => 10,116 'R' => 10,
...@@ -438,7 +443,7 @@ test "version_from_build" {...@@ -438,7 +443,7 @@ test "version_from_build" {
438 for (known) |pair| {443 for (known) |pair| {
439 var buf: [32]u8 = undefined;444 var buf: [32]u8 = undefined;
440 const ver = try version_from_build(pair[0]);445 const ver = try version_from_build(pair[0]);
441 const sver = try std.fmt.bufPrint(buf[0..], "{}.{}.{}", .{ver.major, ver.minor, ver.patch});446 const sver = try std.fmt.bufPrint(buf[0..], "{}.{}.{}", .{ ver.major, ver.minor, ver.patch });
442 std.testing.expect(std.mem.eql(u8, sver, pair[1]));447 std.testing.expect(std.mem.eql(u8, sver, pair[1]));
443 }448 }
444}449}
test/stage1/behavior/async_fn.zig+5-5
...@@ -1093,7 +1093,7 @@ test "recursive call of await @asyncCall with struct return type" {...@@ -1093,7 +1093,7 @@ test "recursive call of await @asyncCall with struct return type" {
1093test "noasync function call" {1093test "noasync function call" {
1094 const S = struct {1094 const S = struct {
1095 fn doTheTest() void {1095 fn doTheTest() void {
1096 const result = noasync add(50, 100);1096 const result = nosuspend add(50, 100);
1097 expect(result == 150);1097 expect(result == 150);
1098 }1098 }
1099 fn add(a: i32, b: i32) i32 {1099 fn add(a: i32, b: i32) i32 {
...@@ -1517,7 +1517,7 @@ test "noasync await" {...@@ -1517,7 +1517,7 @@ test "noasync await" {
15171517
1518 fn doTheTest() void {1518 fn doTheTest() void {
1519 var frame = async foo(false);1519 var frame = async foo(false);
1520 expect(noasync await frame == 42);1520 expect(nosuspend await frame == 42);
1521 finished = true;1521 finished = true;
1522 }1522 }
15231523
...@@ -1544,8 +1544,8 @@ test "noasync on function calls" {...@@ -1544,8 +1544,8 @@ test "noasync on function calls" {
1544 return S0{};1544 return S0{};
1545 }1545 }
1546 };1546 };
1547 expectEqual(@as(i32, 42), noasync S1.c().b);1547 expectEqual(@as(i32, 42), nosuspend S1.c().b);
1548 expectEqual(@as(i32, 42), (try noasync S1.d()).b);1548 expectEqual(@as(i32, 42), (try nosuspend S1.d()).b);
1549}1549}
15501550
1551test "avoid forcing frame alignment resolution implicit cast to *c_void" {1551test "avoid forcing frame alignment resolution implicit cast to *c_void" {
...@@ -1561,5 +1561,5 @@ test "avoid forcing frame alignment resolution implicit cast to *c_void" {...@@ -1561,5 +1561,5 @@ test "avoid forcing frame alignment resolution implicit cast to *c_void" {
1561 };1561 };
1562 var frame = async S.foo();1562 var frame = async S.foo();
1563 resume @ptrCast(anyframe->bool, @alignCast(@alignOf(@Frame(S.foo)), S.x));1563 resume @ptrCast(anyframe->bool, @alignCast(@alignOf(@Frame(S.foo)), S.x));
1564 expect(noasync await frame);1564 expect(nosuspend await frame);
1565}1565}
test/stage1/behavior/cast.zig+1-1
...@@ -823,7 +823,7 @@ test "peer type resolve array pointer and unknown pointer" {...@@ -823,7 +823,7 @@ test "peer type resolve array pointer and unknown pointer" {
823823
824 comptime expect(@TypeOf(&array, const_ptr) == [*]const u8);824 comptime expect(@TypeOf(&array, const_ptr) == [*]const u8);
825 comptime expect(@TypeOf(const_ptr, &array) == [*]const u8);825 comptime expect(@TypeOf(const_ptr, &array) == [*]const u8);
826 826
827 comptime expect(@TypeOf(&const_array, const_ptr) == [*]const u8);827 comptime expect(@TypeOf(&const_array, const_ptr) == [*]const u8);
828 comptime expect(@TypeOf(const_ptr, &const_array) == [*]const u8);828 comptime expect(@TypeOf(const_ptr, &const_array) == [*]const u8);
829}829}
test/standalone/main_return_error/error_u8.zig+1-3
...@@ -1,6 +1,4 @@...@@ -1,6 +1,4 @@
1const Err = error {1const Err = error{Foo};
2 Foo
3};
42
5pub fn main() !u8 {3pub fn main() !u8 {
6 return Err.Foo;4 return Err.Foo;
test/standalone/main_return_error/error_u8_non_zero.zig+5-2
...@@ -1,6 +1,9 @@...@@ -1,6 +1,9 @@
1const Err = error { Foo };1const Err = error{Foo};
22
3fn foo() u8 { var x = @intCast(u8, 9); return x; }3fn foo() u8 {
4 var x = @intCast(u8, 9);
5 return x;
6}
47
5pub fn main() !u8 {8pub fn main() !u8 {
6 if (foo() == 7) return Err.Foo;9 if (foo() == 7) return Err.Foo;