| author | |
| committer | |
| log | ba43492c0e4b37924caf5956b4dbaf832b964b81 |
| tree | 37af3289400d9536f170c8bf439de7e2eaedbc4b |
| parent | 20c1696865fc859e4f02a1f7a3e2e4bf4177a2d8 |
| parent | 84a0a9688caea0f7cfe19bac07d5b5d46a06d470 |
| signature |
Remove syntax redundant with callconv70 files changed, 299 insertions(+), 429 deletions(-)
doc/docgen.zig-2| ... | @@ -800,7 +800,6 @@ fn tokenizeAndPrintRaw(docgen_tokenizer: *Tokenizer, out: var, source_token: Tok | ... | @@ -800,7 +800,6 @@ fn tokenizeAndPrintRaw(docgen_tokenizer: *Tokenizer, out: var, source_token: Tok |
| 800 | .Keyword_for, | 800 | .Keyword_for, |
| 801 | .Keyword_if, | 801 | .Keyword_if, |
| 802 | .Keyword_inline, | 802 | .Keyword_inline, |
| 803 | .Keyword_nakedcc, | ||
| 804 | .Keyword_noalias, | 803 | .Keyword_noalias, |
| 805 | .Keyword_noinline, | 804 | .Keyword_noinline, |
| 806 | .Keyword_nosuspend, | 805 | .Keyword_nosuspend, |
| ... | @@ -813,7 +812,6 @@ fn tokenizeAndPrintRaw(docgen_tokenizer: *Tokenizer, out: var, source_token: Tok | ... | @@ -813,7 +812,6 @@ fn tokenizeAndPrintRaw(docgen_tokenizer: *Tokenizer, out: var, source_token: Tok |
| 813 | .Keyword_return, | 812 | .Keyword_return, |
| 814 | .Keyword_linksection, | 813 | .Keyword_linksection, |
| 815 | .Keyword_callconv, | 814 | .Keyword_callconv, |
| 816 | .Keyword_stdcallcc, | ||
| 817 | .Keyword_struct, | 815 | .Keyword_struct, |
| 818 | .Keyword_suspend, | 816 | .Keyword_suspend, |
| 819 | .Keyword_switch, | 817 | .Keyword_switch, |
doc/langref.html.in+3-8| ... | @@ -6713,7 +6713,7 @@ const assert = std.debug.assert; | ... | @@ -6713,7 +6713,7 @@ const assert = std.debug.assert; |
| 6713 | test "async fn pointer in a struct field" { | 6713 | test "async fn pointer in a struct field" { |
| 6714 | var data: i32 = 1; | 6714 | var data: i32 = 1; |
| 6715 | const Foo = struct { | 6715 | const Foo = struct { |
| 6716 | bar: async fn (*i32) void, | 6716 | bar: fn (*i32) callconv(.Async) void, |
| 6717 | }; | 6717 | }; |
| 6718 | var foo = Foo{ .bar = func }; | 6718 | var foo = Foo{ .bar = func }; |
| 6719 | var bytes: [64]u8 align(@alignOf(@Frame(func))) = undefined; | 6719 | var bytes: [64]u8 align(@alignOf(@Frame(func))) = undefined; |
| ... | @@ -6723,7 +6723,7 @@ test "async fn pointer in a struct field" { | ... | @@ -6723,7 +6723,7 @@ test "async fn pointer in a struct field" { |
| 6723 | assert(data == 4); | 6723 | assert(data == 4); |
| 6724 | } | 6724 | } |
| 6725 | 6725 | ||
| 6726 | async fn func(y: *i32) void { | 6726 | fn func(y: *i32) void { |
| 6727 | defer y.* += 2; | 6727 | defer y.* += 2; |
| 6728 | y.* += 1; | 6728 | y.* += 1; |
| 6729 | suspend; | 6729 | suspend; |
| ... | @@ -10086,7 +10086,7 @@ TopLevelDecl | ... | @@ -10086,7 +10086,7 @@ TopLevelDecl |
| 10086 | / (KEYWORD_export / KEYWORD_extern STRINGLITERALSINGLE?)? KEYWORD_threadlocal? VarDecl | 10086 | / (KEYWORD_export / KEYWORD_extern STRINGLITERALSINGLE?)? KEYWORD_threadlocal? VarDecl |
| 10087 | / KEYWORD_usingnamespace Expr SEMICOLON | 10087 | / KEYWORD_usingnamespace Expr SEMICOLON |
| 10088 | 10088 | ||
| 10089 | FnProto <- FnCC? KEYWORD_fn IDENTIFIER? LPAREN ParamDeclList RPAREN ByteAlign? LinkSection? EXCLAMATIONMARK? (KEYWORD_var / TypeExpr) | 10089 | FnProto <- KEYWORD_fn IDENTIFIER? LPAREN ParamDeclList RPAREN ByteAlign? LinkSection? EXCLAMATIONMARK? (KEYWORD_var / TypeExpr) |
| 10090 | 10090 | ||
| 10091 | VarDecl <- (KEYWORD_const / KEYWORD_var) IDENTIFIER (COLON TypeExpr)? ByteAlign? LinkSection? (EQUAL Expr)? SEMICOLON | 10091 | VarDecl <- (KEYWORD_const / KEYWORD_var) IDENTIFIER (COLON TypeExpr)? ByteAlign? LinkSection? (EQUAL Expr)? SEMICOLON |
| 10092 | 10092 | ||
| ... | @@ -10253,11 +10253,6 @@ WhileContinueExpr <- COLON LPAREN AssignExpr RPAREN | ... | @@ -10253,11 +10253,6 @@ WhileContinueExpr <- COLON LPAREN AssignExpr RPAREN |
| 10253 | 10253 | ||
| 10254 | LinkSection <- KEYWORD_linksection LPAREN Expr RPAREN | 10254 | LinkSection <- KEYWORD_linksection LPAREN Expr RPAREN |
| 10255 | 10255 | ||
| 10256 | # Fn specific | ||
| 10257 | FnCC | ||
| 10258 | <- KEYWORD_extern | ||
| 10259 | / KEYWORD_async | ||
| 10260 | |||
| 10261 | ParamDecl <- (KEYWORD_noalias / KEYWORD_comptime)? (IDENTIFIER COLON)? ParamType | 10256 | ParamDecl <- (KEYWORD_noalias / KEYWORD_comptime)? (IDENTIFIER COLON)? ParamType |
| 10262 | 10257 | ||
| 10263 | ParamType | 10258 | ParamType |
lib/std/c.zig+1-1| ... | @@ -217,7 +217,7 @@ pub extern "c" fn utimes(path: [*:0]const u8, times: *[2]timeval) c_int; | ... | @@ -217,7 +217,7 @@ pub extern "c" fn utimes(path: [*:0]const u8, times: *[2]timeval) c_int; |
| 217 | pub extern "c" fn utimensat(dirfd: fd_t, pathname: [*:0]const u8, times: *[2]timespec, flags: u32) c_int; | 217 | pub extern "c" fn utimensat(dirfd: fd_t, pathname: [*:0]const u8, times: *[2]timespec, flags: u32) c_int; |
| 218 | pub extern "c" fn futimens(fd: fd_t, times: *const [2]timespec) c_int; | 218 | pub extern "c" fn futimens(fd: fd_t, times: *const [2]timespec) c_int; |
| 219 | 219 | ||
| 220 | pub extern "c" fn pthread_create(noalias newthread: *pthread_t, noalias attr: ?*const pthread_attr_t, start_routine: extern fn (?*c_void) ?*c_void, noalias arg: ?*c_void) c_int; | 220 | pub extern "c" fn pthread_create(noalias newthread: *pthread_t, noalias attr: ?*const pthread_attr_t, start_routine: fn (?*c_void) callconv(.C) ?*c_void, noalias arg: ?*c_void) c_int; |
| 221 | pub extern "c" fn pthread_attr_init(attr: *pthread_attr_t) c_int; | 221 | pub extern "c" fn pthread_attr_init(attr: *pthread_attr_t) c_int; |
| 222 | pub extern "c" fn pthread_attr_setstack(attr: *pthread_attr_t, stackaddr: *c_void, stacksize: usize) c_int; | 222 | pub extern "c" fn pthread_attr_setstack(attr: *pthread_attr_t, stackaddr: *c_void, stacksize: usize) c_int; |
| 223 | pub extern "c" fn pthread_attr_setguardsize(attr: *pthread_attr_t, guardsize: usize) c_int; | 223 | pub extern "c" fn pthread_attr_setguardsize(attr: *pthread_attr_t, guardsize: usize) c_int; |
lib/std/c/dragonfly.zig+1-1| ... | @@ -9,7 +9,7 @@ pub extern "c" fn getdents(fd: c_int, buf_ptr: [*]u8, nbytes: usize) usize; | ... | @@ -9,7 +9,7 @@ pub extern "c" fn getdents(fd: c_int, buf_ptr: [*]u8, nbytes: usize) usize; |
| 9 | pub extern "c" fn sigaltstack(ss: ?*stack_t, old_ss: ?*stack_t) c_int; | 9 | pub extern "c" fn sigaltstack(ss: ?*stack_t, old_ss: ?*stack_t) c_int; |
| 10 | pub extern "c" fn getrandom(buf_ptr: [*]u8, buf_len: usize, flags: c_uint) isize; | 10 | pub extern "c" fn getrandom(buf_ptr: [*]u8, buf_len: usize, flags: c_uint) isize; |
| 11 | 11 | ||
| 12 | pub const dl_iterate_phdr_callback = extern fn (info: *dl_phdr_info, size: usize, data: ?*c_void) c_int; | 12 | pub const dl_iterate_phdr_callback = fn (info: *dl_phdr_info, size: usize, data: ?*c_void) callconv(.C) c_int; |
| 13 | pub extern "c" fn dl_iterate_phdr(callback: dl_iterate_phdr_callback, data: ?*c_void) c_int; | 13 | pub extern "c" fn dl_iterate_phdr(callback: dl_iterate_phdr_callback, data: ?*c_void) c_int; |
| 14 | 14 | ||
| 15 | pub const pthread_mutex_t = extern struct { | 15 | pub const pthread_mutex_t = extern struct { |
lib/std/c/freebsd.zig+1-1| ... | @@ -24,7 +24,7 @@ pub extern "c" fn sendfile( | ... | @@ -24,7 +24,7 @@ pub extern "c" fn sendfile( |
| 24 | flags: u32, | 24 | flags: u32, |
| 25 | ) c_int; | 25 | ) c_int; |
| 26 | 26 | ||
| 27 | pub const dl_iterate_phdr_callback = extern fn (info: *dl_phdr_info, size: usize, data: ?*c_void) c_int; | 27 | pub const dl_iterate_phdr_callback = fn (info: *dl_phdr_info, size: usize, data: ?*c_void) callconv(.C) c_int; |
| 28 | pub extern "c" fn dl_iterate_phdr(callback: dl_iterate_phdr_callback, data: ?*c_void) c_int; | 28 | pub extern "c" fn dl_iterate_phdr(callback: dl_iterate_phdr_callback, data: ?*c_void) c_int; |
| 29 | 29 | ||
| 30 | pub const pthread_mutex_t = extern struct { | 30 | pub const pthread_mutex_t = extern struct { |
lib/std/c/linux.zig+1-1| ... | @@ -75,7 +75,7 @@ pub extern "c" fn inotify_add_watch(fd: fd_t, pathname: [*]const u8, mask: u32) | ... | @@ -75,7 +75,7 @@ pub extern "c" fn inotify_add_watch(fd: fd_t, pathname: [*]const u8, mask: u32) |
| 75 | /// See std.elf for constants for this | 75 | /// See std.elf for constants for this |
| 76 | pub extern "c" fn getauxval(__type: c_ulong) c_ulong; | 76 | pub extern "c" fn getauxval(__type: c_ulong) c_ulong; |
| 77 | 77 | ||
| 78 | pub const dl_iterate_phdr_callback = extern fn (info: *dl_phdr_info, size: usize, data: ?*c_void) c_int; | 78 | pub const dl_iterate_phdr_callback = fn (info: *dl_phdr_info, size: usize, data: ?*c_void) callconv(.C) c_int; |
| 79 | pub extern "c" fn dl_iterate_phdr(callback: dl_iterate_phdr_callback, data: ?*c_void) c_int; | 79 | pub extern "c" fn dl_iterate_phdr(callback: dl_iterate_phdr_callback, data: ?*c_void) c_int; |
| 80 | 80 | ||
| 81 | pub extern "c" fn sigaltstack(ss: ?*stack_t, old_ss: ?*stack_t) c_int; | 81 | pub extern "c" fn sigaltstack(ss: ?*stack_t, old_ss: ?*stack_t) c_int; |
lib/std/c/netbsd.zig+1-1| ... | @@ -6,7 +6,7 @@ usingnamespace std.c; | ... | @@ -6,7 +6,7 @@ usingnamespace std.c; |
| 6 | extern "c" fn __errno() *c_int; | 6 | extern "c" fn __errno() *c_int; |
| 7 | pub const _errno = __errno; | 7 | pub const _errno = __errno; |
| 8 | 8 | ||
| 9 | pub const dl_iterate_phdr_callback = extern fn (info: *dl_phdr_info, size: usize, data: ?*c_void) c_int; | 9 | pub const dl_iterate_phdr_callback = fn (info: *dl_phdr_info, size: usize, data: ?*c_void) callconv(.C) c_int; |
| 10 | pub extern "c" fn dl_iterate_phdr(callback: dl_iterate_phdr_callback, data: ?*c_void) c_int; | 10 | pub extern "c" fn dl_iterate_phdr(callback: dl_iterate_phdr_callback, data: ?*c_void) c_int; |
| 11 | 11 | ||
| 12 | pub extern "c" fn arc4random_buf(buf: [*]u8, len: usize) void; | 12 | pub extern "c" fn arc4random_buf(buf: [*]u8, len: usize) void; |
lib/std/event/channel.zig+4-7| ... | @@ -105,7 +105,7 @@ pub fn Channel(comptime T: type) type { | ... | @@ -105,7 +105,7 @@ pub fn Channel(comptime T: type) type { |
| 105 | 105 | ||
| 106 | /// await this function to get an item from the channel. If the buffer is empty, the frame will | 106 | /// await this function to get an item from the channel. If the buffer is empty, the frame will |
| 107 | /// complete when the next item is put in the channel. | 107 | /// complete when the next item is put in the channel. |
| 108 | pub async fn get(self: *SelfChannel) T { | 108 | pub fn get(self: *SelfChannel) callconv(.Async) T { |
| 109 | // TODO https://github.com/ziglang/zig/issues/2765 | 109 | // TODO https://github.com/ziglang/zig/issues/2765 |
| 110 | var result: T = undefined; | 110 | var result: T = undefined; |
| 111 | var my_tick_node = Loop.NextTickNode.init(@frame()); | 111 | var my_tick_node = Loop.NextTickNode.init(@frame()); |
| ... | @@ -305,8 +305,7 @@ test "std.event.Channel wraparound" { | ... | @@ -305,8 +305,7 @@ test "std.event.Channel wraparound" { |
| 305 | channel.put(7); | 305 | channel.put(7); |
| 306 | testing.expectEqual(@as(i32, 7), channel.get()); | 306 | testing.expectEqual(@as(i32, 7), channel.get()); |
| 307 | } | 307 | } |
| 308 | 308 | fn testChannelGetter(channel: *Channel(i32)) callconv(.Async) void { | |
| 309 | async fn testChannelGetter(channel: *Channel(i32)) void { | ||
| 310 | const value1 = channel.get(); | 309 | const value1 = channel.get(); |
| 311 | testing.expect(value1 == 1234); | 310 | testing.expect(value1 == 1234); |
| 312 | 311 | ||
| ... | @@ -321,12 +320,10 @@ async fn testChannelGetter(channel: *Channel(i32)) void { | ... | @@ -321,12 +320,10 @@ async fn testChannelGetter(channel: *Channel(i32)) void { |
| 321 | testing.expect(value4.? == 4444); | 320 | testing.expect(value4.? == 4444); |
| 322 | await last_put; | 321 | await last_put; |
| 323 | } | 322 | } |
| 324 | 323 | fn testChannelPutter(channel: *Channel(i32)) callconv(.Async) void { | |
| 325 | async fn testChannelPutter(channel: *Channel(i32)) void { | ||
| 326 | channel.put(1234); | 324 | channel.put(1234); |
| 327 | channel.put(4567); | 325 | channel.put(4567); |
| 328 | } | 326 | } |
| 329 | 327 | fn testPut(channel: *Channel(i32), value: i32) callconv(.Async) void { | |
| 330 | async fn testPut(channel: *Channel(i32), value: i32) void { | ||
| 331 | channel.put(value); | 328 | channel.put(value); |
| 332 | } | 329 | } |
lib/std/event/future.zig+2-2| ... | @@ -34,7 +34,7 @@ pub fn Future(comptime T: type) type { | ... | @@ -34,7 +34,7 @@ pub fn Future(comptime T: type) type { |
| 34 | /// Obtain the value. If it's not available, wait until it becomes | 34 | /// Obtain the value. If it's not available, wait until it becomes |
| 35 | /// available. | 35 | /// available. |
| 36 | /// Thread-safe. | 36 | /// Thread-safe. |
| 37 | pub async fn get(self: *Self) *T { | 37 | pub fn get(self: *Self) callconv(.Async) *T { |
| 38 | if (@atomicLoad(Available, &self.available, .SeqCst) == .Finished) { | 38 | if (@atomicLoad(Available, &self.available, .SeqCst) == .Finished) { |
| 39 | return &self.data; | 39 | return &self.data; |
| 40 | } | 40 | } |
| ... | @@ -59,7 +59,7 @@ pub fn Future(comptime T: type) type { | ... | @@ -59,7 +59,7 @@ pub fn Future(comptime T: type) type { |
| 59 | /// should start working on the data. | 59 | /// should start working on the data. |
| 60 | /// It's not required to call start() before resolve() but it can be useful since | 60 | /// It's not required to call start() before resolve() but it can be useful since |
| 61 | /// this method is thread-safe. | 61 | /// this method is thread-safe. |
| 62 | pub async fn start(self: *Self) ?*T { | 62 | pub fn start(self: *Self) callconv(.Async) ?*T { |
| 63 | const state = @cmpxchgStrong(Available, &self.available, .NotStarted, .Started, .SeqCst, .SeqCst) orelse return null; | 63 | const state = @cmpxchgStrong(Available, &self.available, .NotStarted, .Started, .SeqCst, .SeqCst) orelse return null; |
| 64 | switch (state) { | 64 | switch (state) { |
| 65 | .Started => { | 65 | .Started => { |
lib/std/event/group.zig+6-10| ... | @@ -84,7 +84,7 @@ pub fn Group(comptime ReturnType: type) type { | ... | @@ -84,7 +84,7 @@ pub fn Group(comptime ReturnType: type) type { |
| 84 | /// Wait for all the calls and promises of the group to complete. | 84 | /// Wait for all the calls and promises of the group to complete. |
| 85 | /// Thread-safe. | 85 | /// Thread-safe. |
| 86 | /// Safe to call any number of times. | 86 | /// Safe to call any number of times. |
| 87 | pub async fn wait(self: *Self) ReturnType { | 87 | pub fn wait(self: *Self) callconv(.Async) ReturnType { |
| 88 | const held = self.lock.acquire(); | 88 | const held = self.lock.acquire(); |
| 89 | defer held.release(); | 89 | defer held.release(); |
| 90 | 90 | ||
| ... | @@ -127,8 +127,7 @@ test "std.event.Group" { | ... | @@ -127,8 +127,7 @@ test "std.event.Group" { |
| 127 | 127 | ||
| 128 | const handle = async testGroup(std.heap.page_allocator); | 128 | const handle = async testGroup(std.heap.page_allocator); |
| 129 | } | 129 | } |
| 130 | 130 | fn testGroup(allocator: *Allocator) callconv(.Async) void { | |
| 131 | async fn testGroup(allocator: *Allocator) void { | ||
| 132 | var count: usize = 0; | 131 | var count: usize = 0; |
| 133 | var group = Group(void).init(allocator); | 132 | var group = Group(void).init(allocator); |
| 134 | var sleep_a_little_frame = async sleepALittle(&count); | 133 | var sleep_a_little_frame = async sleepALittle(&count); |
| ... | @@ -145,20 +144,17 @@ async fn testGroup(allocator: *Allocator) void { | ... | @@ -145,20 +144,17 @@ async fn testGroup(allocator: *Allocator) void { |
| 145 | another.add(&something_that_fails_frame) catch @panic("memory"); | 144 | another.add(&something_that_fails_frame) catch @panic("memory"); |
| 146 | testing.expectError(error.ItBroke, another.wait()); | 145 | testing.expectError(error.ItBroke, another.wait()); |
| 147 | } | 146 | } |
| 148 | 147 | fn sleepALittle(count: *usize) callconv(.Async) void { | |
| 149 | async fn sleepALittle(count: *usize) void { | ||
| 150 | std.time.sleep(1 * std.time.millisecond); | 148 | std.time.sleep(1 * std.time.millisecond); |
| 151 | _ = @atomicRmw(usize, count, .Add, 1, .SeqCst); | 149 | _ = @atomicRmw(usize, count, .Add, 1, .SeqCst); |
| 152 | } | 150 | } |
| 153 | 151 | fn increaseByTen(count: *usize) callconv(.Async) void { | |
| 154 | async fn increaseByTen(count: *usize) void { | ||
| 155 | var i: usize = 0; | 152 | var i: usize = 0; |
| 156 | while (i < 10) : (i += 1) { | 153 | while (i < 10) : (i += 1) { |
| 157 | _ = @atomicRmw(usize, count, .Add, 1, .SeqCst); | 154 | _ = @atomicRmw(usize, count, .Add, 1, .SeqCst); |
| 158 | } | 155 | } |
| 159 | } | 156 | } |
| 160 | 157 | fn doSomethingThatFails() callconv(.Async) anyerror!void {} | |
| 161 | async fn doSomethingThatFails() anyerror!void {} | 158 | fn somethingElse() callconv(.Async) anyerror!void { |
| 162 | async fn somethingElse() anyerror!void { | ||
| 163 | return error.ItBroke; | 159 | return error.ItBroke; |
| 164 | } | 160 | } |
lib/std/event/lock.zig+3-5| ... | @@ -89,7 +89,7 @@ pub const Lock = struct { | ... | @@ -89,7 +89,7 @@ pub const Lock = struct { |
| 89 | while (self.queue.get()) |node| resume node.data; | 89 | while (self.queue.get()) |node| resume node.data; |
| 90 | } | 90 | } |
| 91 | 91 | ||
| 92 | pub async fn acquire(self: *Lock) Held { | 92 | pub fn acquire(self: *Lock) callconv(.Async) Held { |
| 93 | var my_tick_node = Loop.NextTickNode.init(@frame()); | 93 | var my_tick_node = Loop.NextTickNode.init(@frame()); |
| 94 | 94 | ||
| 95 | errdefer _ = self.queue.remove(&my_tick_node); // TODO test canceling an acquire | 95 | errdefer _ = self.queue.remove(&my_tick_node); // TODO test canceling an acquire |
| ... | @@ -134,8 +134,7 @@ test "std.event.Lock" { | ... | @@ -134,8 +134,7 @@ test "std.event.Lock" { |
| 134 | const expected_result = [1]i32{3 * @intCast(i32, shared_test_data.len)} ** shared_test_data.len; | 134 | const expected_result = [1]i32{3 * @intCast(i32, shared_test_data.len)} ** shared_test_data.len; |
| 135 | testing.expectEqualSlices(i32, &expected_result, &shared_test_data); | 135 | testing.expectEqualSlices(i32, &expected_result, &shared_test_data); |
| 136 | } | 136 | } |
| 137 | 137 | fn testLock(lock: *Lock) callconv(.Async) void { | |
| 138 | async fn testLock(lock: *Lock) void { | ||
| 139 | var handle1 = async lockRunner(lock); | 138 | var handle1 = async lockRunner(lock); |
| 140 | var tick_node1 = Loop.NextTickNode{ | 139 | var tick_node1 = Loop.NextTickNode{ |
| 141 | .prev = undefined, | 140 | .prev = undefined, |
| ... | @@ -167,8 +166,7 @@ async fn testLock(lock: *Lock) void { | ... | @@ -167,8 +166,7 @@ async fn testLock(lock: *Lock) void { |
| 167 | 166 | ||
| 168 | var shared_test_data = [1]i32{0} ** 10; | 167 | var shared_test_data = [1]i32{0} ** 10; |
| 169 | var shared_test_index: usize = 0; | 168 | var shared_test_index: usize = 0; |
| 170 | 169 | fn lockRunner(lock: *Lock) callconv(.Async) void { | |
| 171 | async fn lockRunner(lock: *Lock) void { | ||
| 172 | suspend; // resumed by onNextTick | 170 | suspend; // resumed by onNextTick |
| 173 | 171 | ||
| 174 | var i: usize = 0; | 172 | var i: usize = 0; |
lib/std/event/locked.zig+1-1| ... | @@ -31,7 +31,7 @@ pub fn Locked(comptime T: type) type { | ... | @@ -31,7 +31,7 @@ pub fn Locked(comptime T: type) type { |
| 31 | self.lock.deinit(); | 31 | self.lock.deinit(); |
| 32 | } | 32 | } |
| 33 | 33 | ||
| 34 | pub async fn acquire(self: *Self) HeldLock { | 34 | pub fn acquire(self: *Self) callconv(.Async) HeldLock { |
| 35 | return HeldLock{ | 35 | return HeldLock{ |
| 36 | // TODO guaranteed allocation elision | 36 | // TODO guaranteed allocation elision |
| 37 | .held = self.lock.acquire(), | 37 | .held = self.lock.acquire(), |
lib/std/event/loop.zig+1-1| ... | @@ -503,7 +503,7 @@ pub const Loop = struct { | ... | @@ -503,7 +503,7 @@ pub const Loop = struct { |
| 503 | } | 503 | } |
| 504 | } | 504 | } |
| 505 | 505 | ||
| 506 | pub async fn bsdWaitKev(self: *Loop, ident: usize, filter: i16, fflags: u32) void { | 506 | pub fn bsdWaitKev(self: *Loop, ident: usize, filter: i16, fflags: u32) callconv(.Async) void { |
| 507 | var resume_node = ResumeNode.Basic{ | 507 | var resume_node = ResumeNode.Basic{ |
| 508 | .base = ResumeNode{ | 508 | .base = ResumeNode{ |
| 509 | .id = ResumeNode.Id.Basic, | 509 | .id = ResumeNode.Id.Basic, |
lib/std/event/rwlock.zig+5-8| ... | @@ -97,7 +97,7 @@ pub const RwLock = struct { | ... | @@ -97,7 +97,7 @@ pub const RwLock = struct { |
| 97 | while (self.reader_queue.get()) |node| resume node.data; | 97 | while (self.reader_queue.get()) |node| resume node.data; |
| 98 | } | 98 | } |
| 99 | 99 | ||
| 100 | pub async fn acquireRead(self: *RwLock) HeldRead { | 100 | pub fn acquireRead(self: *RwLock) callconv(.Async) HeldRead { |
| 101 | _ = @atomicRmw(usize, &self.reader_lock_count, .Add, 1, .SeqCst); | 101 | _ = @atomicRmw(usize, &self.reader_lock_count, .Add, 1, .SeqCst); |
| 102 | 102 | ||
| 103 | suspend { | 103 | suspend { |
| ... | @@ -130,7 +130,7 @@ pub const RwLock = struct { | ... | @@ -130,7 +130,7 @@ pub const RwLock = struct { |
| 130 | return HeldRead{ .lock = self }; | 130 | return HeldRead{ .lock = self }; |
| 131 | } | 131 | } |
| 132 | 132 | ||
| 133 | pub async fn acquireWrite(self: *RwLock) HeldWrite { | 133 | pub fn acquireWrite(self: *RwLock) callconv(.Async) HeldWrite { |
| 134 | suspend { | 134 | suspend { |
| 135 | var my_tick_node = Loop.NextTickNode{ | 135 | var my_tick_node = Loop.NextTickNode{ |
| 136 | .data = @frame(), | 136 | .data = @frame(), |
| ... | @@ -225,8 +225,7 @@ test "std.event.RwLock" { | ... | @@ -225,8 +225,7 @@ test "std.event.RwLock" { |
| 225 | const expected_result = [1]i32{shared_it_count * @intCast(i32, shared_test_data.len)} ** shared_test_data.len; | 225 | const expected_result = [1]i32{shared_it_count * @intCast(i32, shared_test_data.len)} ** shared_test_data.len; |
| 226 | testing.expectEqualSlices(i32, expected_result, shared_test_data); | 226 | testing.expectEqualSlices(i32, expected_result, shared_test_data); |
| 227 | } | 227 | } |
| 228 | 228 | fn testLock(allocator: *Allocator, lock: *RwLock) callconv(.Async) void { | |
| 229 | async fn testLock(allocator: *Allocator, lock: *RwLock) void { | ||
| 230 | var read_nodes: [100]Loop.NextTickNode = undefined; | 229 | var read_nodes: [100]Loop.NextTickNode = undefined; |
| 231 | for (read_nodes) |*read_node| { | 230 | for (read_nodes) |*read_node| { |
| 232 | const frame = allocator.create(@Frame(readRunner)) catch @panic("memory"); | 231 | const frame = allocator.create(@Frame(readRunner)) catch @panic("memory"); |
| ... | @@ -259,8 +258,7 @@ const shared_it_count = 10; | ... | @@ -259,8 +258,7 @@ const shared_it_count = 10; |
| 259 | var shared_test_data = [1]i32{0} ** 10; | 258 | var shared_test_data = [1]i32{0} ** 10; |
| 260 | var shared_test_index: usize = 0; | 259 | var shared_test_index: usize = 0; |
| 261 | var shared_count: usize = 0; | 260 | var shared_count: usize = 0; |
| 262 | 261 | fn writeRunner(lock: *RwLock) callconv(.Async) void { | |
| 263 | async fn writeRunner(lock: *RwLock) void { | ||
| 264 | suspend; // resumed by onNextTick | 262 | suspend; // resumed by onNextTick |
| 265 | 263 | ||
| 266 | var i: usize = 0; | 264 | var i: usize = 0; |
| ... | @@ -277,8 +275,7 @@ async fn writeRunner(lock: *RwLock) void { | ... | @@ -277,8 +275,7 @@ async fn writeRunner(lock: *RwLock) void { |
| 277 | shared_test_index = 0; | 275 | shared_test_index = 0; |
| 278 | } | 276 | } |
| 279 | } | 277 | } |
| 280 | 278 | fn readRunner(lock: *RwLock) callconv(.Async) void { | |
| 281 | async fn readRunner(lock: *RwLock) void { | ||
| 282 | suspend; // resumed by onNextTick | 279 | suspend; // resumed by onNextTick |
| 283 | std.time.sleep(1); | 280 | std.time.sleep(1); |
| 284 | 281 |
lib/std/event/rwlocked.zig+2-2| ... | @@ -40,14 +40,14 @@ pub fn RwLocked(comptime T: type) type { | ... | @@ -40,14 +40,14 @@ pub fn RwLocked(comptime T: type) type { |
| 40 | self.lock.deinit(); | 40 | self.lock.deinit(); |
| 41 | } | 41 | } |
| 42 | 42 | ||
| 43 | pub async fn acquireRead(self: *Self) HeldReadLock { | 43 | pub fn acquireRead(self: *Self) callconv(.Async) HeldReadLock { |
| 44 | return HeldReadLock{ | 44 | return HeldReadLock{ |
| 45 | .held = self.lock.acquireRead(), | 45 | .held = self.lock.acquireRead(), |
| 46 | .value = &self.locked_data, | 46 | .value = &self.locked_data, |
| 47 | }; | 47 | }; |
| 48 | } | 48 | } |
| 49 | 49 | ||
| 50 | pub async fn acquireWrite(self: *Self) HeldWriteLock { | 50 | pub fn acquireWrite(self: *Self) callconv(.Async) HeldWriteLock { |
| 51 | return HeldWriteLock{ | 51 | return HeldWriteLock{ |
| 52 | .held = self.lock.acquireWrite(), | 52 | .held = self.lock.acquireWrite(), |
| 53 | .value = &self.locked_data, | 53 | .value = &self.locked_data, |
lib/std/os/bits/darwin.zig+1-1| ... | @@ -125,7 +125,7 @@ pub const empty_sigset = sigset_t(0); | ... | @@ -125,7 +125,7 @@ pub const empty_sigset = sigset_t(0); |
| 125 | 125 | ||
| 126 | /// Renamed from `sigaction` to `Sigaction` to avoid conflict with function name. | 126 | /// Renamed from `sigaction` to `Sigaction` to avoid conflict with function name. |
| 127 | pub const Sigaction = extern struct { | 127 | pub const Sigaction = extern struct { |
| 128 | handler: extern fn (c_int) void, | 128 | handler: fn (c_int) callconv(.C) void, |
| 129 | sa_mask: sigset_t, | 129 | sa_mask: sigset_t, |
| 130 | sa_flags: c_int, | 130 | sa_flags: c_int, |
| 131 | }; | 131 | }; |
lib/std/os/bits/dragonfly.zig+6-6| ... | @@ -458,9 +458,9 @@ pub const S_IFSOCK = 49152; | ... | @@ -458,9 +458,9 @@ pub const S_IFSOCK = 49152; |
| 458 | pub const S_IFWHT = 57344; | 458 | pub const S_IFWHT = 57344; |
| 459 | pub const S_IFMT = 61440; | 459 | pub const S_IFMT = 61440; |
| 460 | 460 | ||
| 461 | pub const SIG_ERR = @intToPtr(extern fn (i32) void, maxInt(usize)); | 461 | pub const SIG_ERR = @intToPtr(fn (i32) callconv(.C) void, maxInt(usize)); |
| 462 | pub const SIG_DFL = @intToPtr(extern fn (i32) void, 0); | 462 | pub const SIG_DFL = @intToPtr(fn (i32) callconv(.C) void, 0); |
| 463 | pub const SIG_IGN = @intToPtr(extern fn (i32) void, 1); | 463 | pub const SIG_IGN = @intToPtr(fn (i32) callconv(.C) void, 1); |
| 464 | pub const BADSIG = SIG_ERR; | 464 | pub const BADSIG = SIG_ERR; |
| 465 | pub const SIG_BLOCK = 1; | 465 | pub const SIG_BLOCK = 1; |
| 466 | pub const SIG_UNBLOCK = 2; | 466 | pub const SIG_UNBLOCK = 2; |
| ... | @@ -519,13 +519,13 @@ pub const sigset_t = extern struct { | ... | @@ -519,13 +519,13 @@ pub const sigset_t = extern struct { |
| 519 | pub const sig_atomic_t = c_int; | 519 | pub const sig_atomic_t = c_int; |
| 520 | pub const Sigaction = extern struct { | 520 | pub const Sigaction = extern struct { |
| 521 | __sigaction_u: extern union { | 521 | __sigaction_u: extern union { |
| 522 | __sa_handler: ?extern fn (c_int) void, | 522 | __sa_handler: ?fn (c_int) callconv(.C) void, |
| 523 | __sa_sigaction: ?extern fn (c_int, [*c]siginfo_t, ?*c_void) void, | 523 | __sa_sigaction: ?fn (c_int, [*c]siginfo_t, ?*c_void) callconv(.C) void, |
| 524 | }, | 524 | }, |
| 525 | sa_flags: c_int, | 525 | sa_flags: c_int, |
| 526 | sa_mask: sigset_t, | 526 | sa_mask: sigset_t, |
| 527 | }; | 527 | }; |
| 528 | pub const sig_t = [*c]extern fn (c_int) void; | 528 | pub const sig_t = [*c]fn (c_int) callconv(.C) void; |
| 529 | 529 | ||
| 530 | pub const sigvec = extern struct { | 530 | pub const sigvec = extern struct { |
| 531 | sv_handler: [*c]__sighandler_t, | 531 | sv_handler: [*c]__sighandler_t, |
lib/std/os/bits/freebsd.zig+5-5| ... | @@ -725,16 +725,16 @@ pub const winsize = extern struct { | ... | @@ -725,16 +725,16 @@ pub const winsize = extern struct { |
| 725 | 725 | ||
| 726 | const NSIG = 32; | 726 | const NSIG = 32; |
| 727 | 727 | ||
| 728 | pub const SIG_ERR = @intToPtr(extern fn (i32) void, maxInt(usize)); | 728 | pub const SIG_ERR = @intToPtr(fn (i32) callconv(.C) void, maxInt(usize)); |
| 729 | pub const SIG_DFL = @intToPtr(extern fn (i32) void, 0); | 729 | pub const SIG_DFL = @intToPtr(fn (i32) callconv(.C) void, 0); |
| 730 | pub const SIG_IGN = @intToPtr(extern fn (i32) void, 1); | 730 | pub const SIG_IGN = @intToPtr(fn (i32) callconv(.C) void, 1); |
| 731 | 731 | ||
| 732 | /// Renamed from `sigaction` to `Sigaction` to avoid conflict with the syscall. | 732 | /// Renamed from `sigaction` to `Sigaction` to avoid conflict with the syscall. |
| 733 | pub const Sigaction = extern struct { | 733 | pub const Sigaction = extern struct { |
| 734 | /// signal handler | 734 | /// signal handler |
| 735 | __sigaction_u: extern union { | 735 | __sigaction_u: extern union { |
| 736 | __sa_handler: extern fn (i32) void, | 736 | __sa_handler: fn (i32) callconv(.C) void, |
| 737 | __sa_sigaction: extern fn (i32, *__siginfo, usize) void, | 737 | __sa_sigaction: fn (i32, *__siginfo, usize) callconv(.C) void, |
| 738 | }, | 738 | }, |
| 739 | 739 | ||
| 740 | /// see signal options | 740 | /// see signal options |
lib/std/os/bits/linux.zig+5-5| ... | @@ -813,15 +813,15 @@ pub const app_mask: sigset_t = [2]u32{ 0xfffffffc, 0x7fffffff } ++ [_]u32{0xffff | ... | @@ -813,15 +813,15 @@ pub const app_mask: sigset_t = [2]u32{ 0xfffffffc, 0x7fffffff } ++ [_]u32{0xffff |
| 813 | pub const k_sigaction = if (is_mips) | 813 | pub const k_sigaction = if (is_mips) |
| 814 | extern struct { | 814 | extern struct { |
| 815 | flags: usize, | 815 | flags: usize, |
| 816 | sigaction: ?extern fn (i32, *siginfo_t, ?*c_void) void, | 816 | sigaction: ?fn (i32, *siginfo_t, ?*c_void) callconv(.C) void, |
| 817 | mask: [4]u32, | 817 | mask: [4]u32, |
| 818 | restorer: extern fn () void, | 818 | restorer: fn () callconv(.C) void, |
| 819 | } | 819 | } |
| 820 | else | 820 | else |
| 821 | extern struct { | 821 | extern struct { |
| 822 | sigaction: ?extern fn (i32, *siginfo_t, ?*c_void) void, | 822 | sigaction: ?fn (i32, *siginfo_t, ?*c_void) callconv(.C) void, |
| 823 | flags: usize, | 823 | flags: usize, |
| 824 | restorer: extern fn () void, | 824 | restorer: fn () callconv(.C) void, |
| 825 | mask: [2]u32, | 825 | mask: [2]u32, |
| 826 | }; | 826 | }; |
| 827 | 827 | ||
| ... | @@ -831,7 +831,7 @@ pub const Sigaction = extern struct { | ... | @@ -831,7 +831,7 @@ pub const Sigaction = extern struct { |
| 831 | sigaction: ?sigaction_fn, | 831 | sigaction: ?sigaction_fn, |
| 832 | mask: sigset_t, | 832 | mask: sigset_t, |
| 833 | flags: u32, | 833 | flags: u32, |
| 834 | restorer: ?extern fn () void = null, | 834 | restorer: ?fn () callconv(.C) void = null, |
| 835 | }; | 835 | }; |
| 836 | 836 | ||
| 837 | pub const SIG_ERR = @intToPtr(?Sigaction.sigaction_fn, maxInt(usize)); | 837 | pub const SIG_ERR = @intToPtr(?Sigaction.sigaction_fn, maxInt(usize)); |
lib/std/os/linux.zig+2-2| ... | @@ -599,7 +599,7 @@ pub fn flock(fd: fd_t, operation: i32) usize { | ... | @@ -599,7 +599,7 @@ pub fn flock(fd: fd_t, operation: i32) usize { |
| 599 | var vdso_clock_gettime = @ptrCast(?*const c_void, init_vdso_clock_gettime); | 599 | var vdso_clock_gettime = @ptrCast(?*const c_void, init_vdso_clock_gettime); |
| 600 | 600 | ||
| 601 | // We must follow the C calling convention when we call into the VDSO | 601 | // We must follow the C calling convention when we call into the VDSO |
| 602 | const vdso_clock_gettime_ty = extern fn (i32, *timespec) usize; | 602 | const vdso_clock_gettime_ty = fn (i32, *timespec) callconv(.C) usize; |
| 603 | 603 | ||
| 604 | pub fn clock_gettime(clk_id: i32, tp: *timespec) usize { | 604 | pub fn clock_gettime(clk_id: i32, tp: *timespec) usize { |
| 605 | if (@hasDecl(@This(), "VDSO_CGT_SYM")) { | 605 | if (@hasDecl(@This(), "VDSO_CGT_SYM")) { |
| ... | @@ -791,7 +791,7 @@ pub fn sigaction(sig: u6, noalias act: *const Sigaction, noalias oact: ?*Sigacti | ... | @@ -791,7 +791,7 @@ pub fn sigaction(sig: u6, noalias act: *const Sigaction, noalias oact: ?*Sigacti |
| 791 | .sigaction = act.sigaction, | 791 | .sigaction = act.sigaction, |
| 792 | .flags = act.flags | SA_RESTORER, | 792 | .flags = act.flags | SA_RESTORER, |
| 793 | .mask = undefined, | 793 | .mask = undefined, |
| 794 | .restorer = @ptrCast(extern fn () void, restorer_fn), | 794 | .restorer = @ptrCast(fn () callconv(.C) void, restorer_fn), |
| 795 | }; | 795 | }; |
| 796 | var ksa_old: k_sigaction = undefined; | 796 | var ksa_old: k_sigaction = undefined; |
| 797 | const ksa_mask_size = @sizeOf(@TypeOf(ksa_old.mask)); | 797 | const ksa_mask_size = @sizeOf(@TypeOf(ksa_old.mask)); |
lib/std/os/linux/arm-eabi.zig+1-1| ... | @@ -86,7 +86,7 @@ pub fn syscall6( | ... | @@ -86,7 +86,7 @@ pub fn syscall6( |
| 86 | } | 86 | } |
| 87 | 87 | ||
| 88 | /// This matches the libc clone function. | 88 | /// This matches the libc clone function. |
| 89 | pub extern fn clone(func: extern fn (arg: usize) u8, stack: usize, flags: u32, arg: usize, ptid: *i32, tls: usize, ctid: *i32) usize; | 89 | pub extern fn clone(func: fn (arg: usize) callconv(.C) u8, stack: usize, flags: u32, arg: usize, ptid: *i32, tls: usize, ctid: *i32) usize; |
| 90 | 90 | ||
| 91 | pub fn restore() callconv(.Naked) void { | 91 | pub fn restore() callconv(.Naked) void { |
| 92 | return asm volatile ("svc #0" | 92 | return asm volatile ("svc #0" |
lib/std/os/linux/arm64.zig+1-1| ... | @@ -86,7 +86,7 @@ pub fn syscall6( | ... | @@ -86,7 +86,7 @@ pub fn syscall6( |
| 86 | } | 86 | } |
| 87 | 87 | ||
| 88 | /// This matches the libc clone function. | 88 | /// This matches the libc clone function. |
| 89 | pub extern fn clone(func: extern fn (arg: usize) u8, stack: usize, flags: u32, arg: usize, ptid: *i32, tls: usize, ctid: *i32) usize; | 89 | pub extern fn clone(func: fn (arg: usize) callconv(.C) u8, stack: usize, flags: u32, arg: usize, ptid: *i32, tls: usize, ctid: *i32) usize; |
| 90 | 90 | ||
| 91 | pub const restore = restore_rt; | 91 | pub const restore = restore_rt; |
| 92 | 92 |
lib/std/os/linux/i386.zig+1-1| ... | @@ -106,7 +106,7 @@ pub fn socketcall(call: usize, args: [*]usize) usize { | ... | @@ -106,7 +106,7 @@ pub fn socketcall(call: usize, args: [*]usize) usize { |
| 106 | } | 106 | } |
| 107 | 107 | ||
| 108 | /// This matches the libc clone function. | 108 | /// This matches the libc clone function. |
| 109 | pub extern fn clone(func: extern fn (arg: usize) u8, stack: usize, flags: u32, arg: usize, ptid: *i32, tls: usize, ctid: *i32) usize; | 109 | pub extern fn clone(func: fn (arg: usize) callconv(.C) u8, stack: usize, flags: u32, arg: usize, ptid: *i32, tls: usize, ctid: *i32) usize; |
| 110 | 110 | ||
| 111 | pub fn restore() callconv(.Naked) void { | 111 | pub fn restore() callconv(.Naked) void { |
| 112 | return asm volatile ("int $0x80" | 112 | return asm volatile ("int $0x80" |
lib/std/os/linux/mips.zig+1-1| ... | @@ -142,7 +142,7 @@ pub fn syscall6( | ... | @@ -142,7 +142,7 @@ pub fn syscall6( |
| 142 | } | 142 | } |
| 143 | 143 | ||
| 144 | /// This matches the libc clone function. | 144 | /// This matches the libc clone function. |
| 145 | pub extern fn clone(func: extern fn (arg: usize) u8, stack: usize, flags: u32, arg: usize, ptid: *i32, tls: usize, ctid: *i32) usize; | 145 | pub extern fn clone(func: fn (arg: usize) callconv(.C) u8, stack: usize, flags: u32, arg: usize, ptid: *i32, tls: usize, ctid: *i32) usize; |
| 146 | 146 | ||
| 147 | pub fn restore() callconv(.Naked) void { | 147 | pub fn restore() callconv(.Naked) void { |
| 148 | return asm volatile ("syscall" | 148 | return asm volatile ("syscall" |
lib/std/os/linux/riscv64.zig+1-1| ... | @@ -85,7 +85,7 @@ pub fn syscall6( | ... | @@ -85,7 +85,7 @@ pub fn syscall6( |
| 85 | ); | 85 | ); |
| 86 | } | 86 | } |
| 87 | 87 | ||
| 88 | pub extern fn clone(func: extern fn (arg: usize) u8, stack: usize, flags: u32, arg: usize, ptid: *i32, tls: usize, ctid: *i32) usize; | 88 | pub extern fn clone(func: fn (arg: usize) callconv(.C) u8, stack: usize, flags: u32, arg: usize, ptid: *i32, tls: usize, ctid: *i32) usize; |
| 89 | 89 | ||
| 90 | pub const restore = restore_rt; | 90 | pub const restore = restore_rt; |
| 91 | 91 |
lib/std/os/linux/x86_64.zig+1-1| ... | @@ -86,7 +86,7 @@ pub fn syscall6( | ... | @@ -86,7 +86,7 @@ pub fn syscall6( |
| 86 | } | 86 | } |
| 87 | 87 | ||
| 88 | /// This matches the libc clone function. | 88 | /// This matches the libc clone function. |
| 89 | pub extern fn clone(func: extern fn (arg: usize) u8, stack: usize, flags: usize, arg: usize, ptid: *i32, tls: usize, ctid: *i32) usize; | 89 | pub extern fn clone(func: fn (arg: usize) callconv(.C) u8, stack: usize, flags: usize, arg: usize, ptid: *i32, tls: usize, ctid: *i32) usize; |
| 90 | 90 | ||
| 91 | pub const restore = restore_rt; | 91 | pub const restore = restore_rt; |
| 92 | 92 |
lib/std/os/uefi/protocols/absolute_pointer_protocol.zig+2-2| ... | @@ -5,8 +5,8 @@ const Status = uefi.Status; | ... | @@ -5,8 +5,8 @@ const Status = uefi.Status; |
| 5 | 5 | ||
| 6 | /// Protocol for touchscreens | 6 | /// Protocol for touchscreens |
| 7 | pub const AbsolutePointerProtocol = extern struct { | 7 | pub const AbsolutePointerProtocol = extern struct { |
| 8 | _reset: extern fn (*const AbsolutePointerProtocol, bool) Status, | 8 | _reset: fn (*const AbsolutePointerProtocol, bool) callconv(.C) Status, |
| 9 | _get_state: extern fn (*const AbsolutePointerProtocol, *AbsolutePointerState) Status, | 9 | _get_state: fn (*const AbsolutePointerProtocol, *AbsolutePointerState) callconv(.C) Status, |
| 10 | wait_for_input: Event, | 10 | wait_for_input: Event, |
| 11 | mode: *AbsolutePointerMode, | 11 | mode: *AbsolutePointerMode, |
| 12 | 12 |
lib/std/os/uefi/protocols/edid_override_protocol.zig+1-1| ... | @@ -5,7 +5,7 @@ const Status = uefi.Status; | ... | @@ -5,7 +5,7 @@ const Status = uefi.Status; |
| 5 | 5 | ||
| 6 | /// Override EDID information | 6 | /// Override EDID information |
| 7 | pub const EdidOverrideProtocol = extern struct { | 7 | pub const EdidOverrideProtocol = extern struct { |
| 8 | _get_edid: extern fn (*const EdidOverrideProtocol, Handle, *u32, *usize, *?[*]u8) Status, | 8 | _get_edid: fn (*const EdidOverrideProtocol, Handle, *u32, *usize, *?[*]u8) callconv(.C) Status, |
| 9 | 9 | ||
| 10 | /// Returns policy information and potentially a replacement EDID for the specified video output device. | 10 | /// Returns policy information and potentially a replacement EDID for the specified video output device. |
| 11 | /// attributes must be align(4) | 11 | /// attributes must be align(4) |
lib/std/os/uefi/protocols/file_protocol.zig+10-10| ... | @@ -5,16 +5,16 @@ const Status = uefi.Status; | ... | @@ -5,16 +5,16 @@ const Status = uefi.Status; |
| 5 | 5 | ||
| 6 | pub const FileProtocol = extern struct { | 6 | pub const FileProtocol = extern struct { |
| 7 | revision: u64, | 7 | revision: u64, |
| 8 | _open: extern fn (*const FileProtocol, **const FileProtocol, [*:0]const u16, u64, u64) Status, | 8 | _open: fn (*const FileProtocol, **const FileProtocol, [*:0]const u16, u64, u64) callconv(.C) Status, |
| 9 | _close: extern fn (*const FileProtocol) Status, | 9 | _close: fn (*const FileProtocol) callconv(.C) Status, |
| 10 | _delete: extern fn (*const FileProtocol) Status, | 10 | _delete: fn (*const FileProtocol) callconv(.C) Status, |
| 11 | _read: extern fn (*const FileProtocol, *usize, [*]u8) Status, | 11 | _read: fn (*const FileProtocol, *usize, [*]u8) callconv(.C) Status, |
| 12 | _write: extern fn (*const FileProtocol, *usize, [*]const u8) Status, | 12 | _write: fn (*const FileProtocol, *usize, [*]const u8) callconv(.C) Status, |
| 13 | _get_position: extern fn (*const FileProtocol, *u64) Status, | 13 | _get_position: fn (*const FileProtocol, *u64) callconv(.C) Status, |
| 14 | _set_position: extern fn (*const FileProtocol, *const u64) Status, | 14 | _set_position: fn (*const FileProtocol, *const u64) callconv(.C) Status, |
| 15 | _get_info: extern fn (*const FileProtocol, *align(8) const Guid, *const usize, [*]u8) Status, | 15 | _get_info: fn (*const FileProtocol, *align(8) const Guid, *const usize, [*]u8) callconv(.C) Status, |
| 16 | _set_info: extern fn (*const FileProtocol, *align(8) const Guid, usize, [*]const u8) Status, | 16 | _set_info: fn (*const FileProtocol, *align(8) const Guid, usize, [*]const u8) callconv(.C) Status, |
| 17 | _flush: extern fn (*const FileProtocol) Status, | 17 | _flush: fn (*const FileProtocol) callconv(.C) Status, |
| 18 | 18 | ||
| 19 | pub fn open(self: *const FileProtocol, new_handle: **const FileProtocol, file_name: [*:0]const u16, open_mode: u64, attributes: u64) Status { | 19 | pub fn open(self: *const FileProtocol, new_handle: **const FileProtocol, file_name: [*:0]const u16, open_mode: u64, attributes: u64) Status { |
| 20 | return self._open(self, new_handle, file_name, open_mode, attributes); | 20 | return self._open(self, new_handle, file_name, open_mode, attributes); |
lib/std/os/uefi/protocols/graphics_output_protocol.zig+3-3| ... | @@ -4,9 +4,9 @@ const Status = uefi.Status; | ... | @@ -4,9 +4,9 @@ const Status = uefi.Status; |
| 4 | 4 | ||
| 5 | /// Graphics output | 5 | /// Graphics output |
| 6 | pub const GraphicsOutputProtocol = extern struct { | 6 | pub const GraphicsOutputProtocol = extern struct { |
| 7 | _query_mode: extern fn (*const GraphicsOutputProtocol, u32, *usize, **GraphicsOutputModeInformation) Status, | 7 | _query_mode: fn (*const GraphicsOutputProtocol, u32, *usize, **GraphicsOutputModeInformation) callconv(.C) Status, |
| 8 | _set_mode: extern fn (*const GraphicsOutputProtocol, u32) Status, | 8 | _set_mode: fn (*const GraphicsOutputProtocol, u32) callconv(.C) Status, |
| 9 | _blt: extern fn (*const GraphicsOutputProtocol, ?[*]GraphicsOutputBltPixel, GraphicsOutputBltOperation, usize, usize, usize, usize, usize, usize, usize) Status, | 9 | _blt: fn (*const GraphicsOutputProtocol, ?[*]GraphicsOutputBltPixel, GraphicsOutputBltOperation, usize, usize, usize, usize, usize, usize, usize) callconv(.C) Status, |
| 10 | mode: *GraphicsOutputProtocolMode, | 10 | mode: *GraphicsOutputProtocolMode, |
| 11 | 11 | ||
| 12 | /// Returns information for an available graphics mode that the graphics device and the set of active video output devices supports. | 12 | /// Returns information for an available graphics mode that the graphics device and the set of active video output devices supports. |
lib/std/os/uefi/protocols/hii_database_protocol.zig+4-4| ... | @@ -6,10 +6,10 @@ const hii = uefi.protocols.hii; | ... | @@ -6,10 +6,10 @@ const hii = uefi.protocols.hii; |
| 6 | /// Database manager for HII-related data structures. | 6 | /// Database manager for HII-related data structures. |
| 7 | pub const HIIDatabaseProtocol = extern struct { | 7 | pub const HIIDatabaseProtocol = extern struct { |
| 8 | _new_package_list: Status, // TODO | 8 | _new_package_list: Status, // TODO |
| 9 | _remove_package_list: extern fn (*const HIIDatabaseProtocol, hii.HIIHandle) Status, | 9 | _remove_package_list: fn (*const HIIDatabaseProtocol, hii.HIIHandle) callconv(.C) Status, |
| 10 | _update_package_list: extern fn (*const HIIDatabaseProtocol, hii.HIIHandle, *const hii.HIIPackageList) Status, | 10 | _update_package_list: fn (*const HIIDatabaseProtocol, hii.HIIHandle, *const hii.HIIPackageList) callconv(.C) Status, |
| 11 | _list_package_lists: extern fn (*const HIIDatabaseProtocol, u8, ?*const Guid, *usize, [*]hii.HIIHandle) Status, | 11 | _list_package_lists: fn (*const HIIDatabaseProtocol, u8, ?*const Guid, *usize, [*]hii.HIIHandle) callconv(.C) Status, |
| 12 | _export_package_lists: extern fn (*const HIIDatabaseProtocol, ?hii.HIIHandle, *usize, *hii.HIIPackageList) Status, | 12 | _export_package_lists: fn (*const HIIDatabaseProtocol, ?hii.HIIHandle, *usize, *hii.HIIPackageList) callconv(.C) Status, |
| 13 | _register_package_notify: Status, // TODO | 13 | _register_package_notify: Status, // TODO |
| 14 | _unregister_package_notify: Status, // TODO | 14 | _unregister_package_notify: Status, // TODO |
| 15 | _find_keyboard_layouts: Status, // TODO | 15 | _find_keyboard_layouts: Status, // TODO |
lib/std/os/uefi/protocols/hii_popup_protocol.zig+1-1| ... | @@ -6,7 +6,7 @@ const hii = uefi.protocols.hii; | ... | @@ -6,7 +6,7 @@ const hii = uefi.protocols.hii; |
| 6 | /// Display a popup window | 6 | /// Display a popup window |
| 7 | pub const HIIPopupProtocol = extern struct { | 7 | pub const HIIPopupProtocol = extern struct { |
| 8 | revision: u64, | 8 | revision: u64, |
| 9 | _create_popup: extern fn (*const HIIPopupProtocol, HIIPopupStyle, HIIPopupType, hii.HIIHandle, u16, ?*HIIPopupSelection) Status, | 9 | _create_popup: fn (*const HIIPopupProtocol, HIIPopupStyle, HIIPopupType, hii.HIIHandle, u16, ?*HIIPopupSelection) callconv(.C) Status, |
| 10 | 10 | ||
| 11 | /// Displays a popup window. | 11 | /// Displays a popup window. |
| 12 | pub fn createPopup(self: *const HIIPopupProtocol, style: HIIPopupStyle, popup_type: HIIPopupType, handle: hii.HIIHandle, msg: u16, user_selection: ?*HIIPopupSelection) Status { | 12 | pub fn createPopup(self: *const HIIPopupProtocol, style: HIIPopupStyle, popup_type: HIIPopupType, handle: hii.HIIHandle, msg: u16, user_selection: ?*HIIPopupSelection) Status { |
lib/std/os/uefi/protocols/ip6_config_protocol.zig+4-4| ... | @@ -4,10 +4,10 @@ const Event = uefi.Event; | ... | @@ -4,10 +4,10 @@ const Event = uefi.Event; |
| 4 | const Status = uefi.Status; | 4 | const Status = uefi.Status; |
| 5 | 5 | ||
| 6 | pub const Ip6ConfigProtocol = extern struct { | 6 | pub const Ip6ConfigProtocol = extern struct { |
| 7 | _set_data: extern fn (*const Ip6ConfigProtocol, Ip6ConfigDataType, usize, *const c_void) Status, | 7 | _set_data: fn (*const Ip6ConfigProtocol, Ip6ConfigDataType, usize, *const c_void) callconv(.C) Status, |
| 8 | _get_data: extern fn (*const Ip6ConfigProtocol, Ip6ConfigDataType, *usize, ?*const c_void) Status, | 8 | _get_data: fn (*const Ip6ConfigProtocol, Ip6ConfigDataType, *usize, ?*const c_void) callconv(.C) Status, |
| 9 | _register_data_notify: extern fn (*const Ip6ConfigProtocol, Ip6ConfigDataType, Event) Status, | 9 | _register_data_notify: fn (*const Ip6ConfigProtocol, Ip6ConfigDataType, Event) callconv(.C) Status, |
| 10 | _unregister_data_notify: extern fn (*const Ip6ConfigProtocol, Ip6ConfigDataType, Event) Status, | 10 | _unregister_data_notify: fn (*const Ip6ConfigProtocol, Ip6ConfigDataType, Event) callconv(.C) Status, |
| 11 | 11 | ||
| 12 | pub fn setData(self: *const Ip6ConfigProtocol, data_type: Ip6ConfigDataType, data_size: usize, data: *const c_void) Status { | 12 | pub fn setData(self: *const Ip6ConfigProtocol, data_type: Ip6ConfigDataType, data_size: usize, data: *const c_void) Status { |
| 13 | return self._set_data(self, data_type, data_size, data); | 13 | return self._set_data(self, data_type, data_size, data); |
lib/std/os/uefi/protocols/ip6_protocol.zig+9-9| ... | @@ -7,15 +7,15 @@ const ManagedNetworkConfigData = uefi.protocols.ManagedNetworkConfigData; | ... | @@ -7,15 +7,15 @@ const ManagedNetworkConfigData = uefi.protocols.ManagedNetworkConfigData; |
| 7 | const SimpleNetworkMode = uefi.protocols.SimpleNetworkMode; | 7 | const SimpleNetworkMode = uefi.protocols.SimpleNetworkMode; |
| 8 | 8 | ||
| 9 | pub const Ip6Protocol = extern struct { | 9 | pub const Ip6Protocol = extern struct { |
| 10 | _get_mode_data: extern fn (*const Ip6Protocol, ?*Ip6ModeData, ?*ManagedNetworkConfigData, ?*SimpleNetworkMode) Status, | 10 | _get_mode_data: fn (*const Ip6Protocol, ?*Ip6ModeData, ?*ManagedNetworkConfigData, ?*SimpleNetworkMode) callconv(.C) Status, |
| 11 | _configure: extern fn (*const Ip6Protocol, ?*const Ip6ConfigData) Status, | 11 | _configure: fn (*const Ip6Protocol, ?*const Ip6ConfigData) callconv(.C) Status, |
| 12 | _groups: extern fn (*const Ip6Protocol, bool, ?*const Ip6Address) Status, | 12 | _groups: fn (*const Ip6Protocol, bool, ?*const Ip6Address) callconv(.C) Status, |
| 13 | _routes: extern fn (*const Ip6Protocol, bool, ?*const Ip6Address, u8, ?*const Ip6Address) Status, | 13 | _routes: fn (*const Ip6Protocol, bool, ?*const Ip6Address, u8, ?*const Ip6Address) callconv(.C) Status, |
| 14 | _neighbors: extern fn (*const Ip6Protocol, bool, *const Ip6Address, ?*const MacAddress, u32, bool) Status, | 14 | _neighbors: fn (*const Ip6Protocol, bool, *const Ip6Address, ?*const MacAddress, u32, bool) callconv(.C) Status, |
| 15 | _transmit: extern fn (*const Ip6Protocol, *Ip6CompletionToken) Status, | 15 | _transmit: fn (*const Ip6Protocol, *Ip6CompletionToken) callconv(.C) Status, |
| 16 | _receive: extern fn (*const Ip6Protocol, *Ip6CompletionToken) Status, | 16 | _receive: fn (*const Ip6Protocol, *Ip6CompletionToken) callconv(.C) Status, |
| 17 | _cancel: extern fn (*const Ip6Protocol, ?*Ip6CompletionToken) Status, | 17 | _cancel: fn (*const Ip6Protocol, ?*Ip6CompletionToken) callconv(.C) Status, |
| 18 | _poll: extern fn (*const Ip6Protocol) Status, | 18 | _poll: fn (*const Ip6Protocol) callconv(.C) Status, |
| 19 | 19 | ||
| 20 | /// Gets the current operational settings for this instance of the EFI IPv6 Protocol driver. | 20 | /// Gets the current operational settings for this instance of the EFI IPv6 Protocol driver. |
| 21 | pub fn getModeData(self: *const Ip6Protocol, ip6_mode_data: ?*Ip6ModeData, mnp_config_data: ?*ManagedNetworkConfigData, snp_mode_data: ?*SimpleNetworkMode) Status { | 21 | pub fn getModeData(self: *const Ip6Protocol, ip6_mode_data: ?*Ip6ModeData, mnp_config_data: ?*ManagedNetworkConfigData, snp_mode_data: ?*SimpleNetworkMode) Status { |
lib/std/os/uefi/protocols/ip6_service_binding_protocol.zig+2-2| ... | @@ -4,8 +4,8 @@ const Guid = uefi.Guid; | ... | @@ -4,8 +4,8 @@ const Guid = uefi.Guid; |
| 4 | const Status = uefi.Status; | 4 | const Status = uefi.Status; |
| 5 | 5 | ||
| 6 | pub const Ip6ServiceBindingProtocol = extern struct { | 6 | pub const Ip6ServiceBindingProtocol = extern struct { |
| 7 | _create_child: extern fn (*const Ip6ServiceBindingProtocol, *?Handle) Status, | 7 | _create_child: fn (*const Ip6ServiceBindingProtocol, *?Handle) callconv(.C) Status, |
| 8 | _destroy_child: extern fn (*const Ip6ServiceBindingProtocol, Handle) Status, | 8 | _destroy_child: fn (*const Ip6ServiceBindingProtocol, Handle) callconv(.C) Status, |
| 9 | 9 | ||
| 10 | pub fn createChild(self: *const Ip6ServiceBindingProtocol, handle: *?Handle) Status { | 10 | pub fn createChild(self: *const Ip6ServiceBindingProtocol, handle: *?Handle) Status { |
| 11 | return self._create_child(self, handle); | 11 | return self._create_child(self, handle); |
lib/std/os/uefi/protocols/loaded_image_protocol.zig+1-1| ... | @@ -19,7 +19,7 @@ pub const LoadedImageProtocol = extern struct { | ... | @@ -19,7 +19,7 @@ pub const LoadedImageProtocol = extern struct { |
| 19 | image_size: u64, | 19 | image_size: u64, |
| 20 | image_code_type: MemoryType, | 20 | image_code_type: MemoryType, |
| 21 | image_data_type: MemoryType, | 21 | image_data_type: MemoryType, |
| 22 | _unload: extern fn (*const LoadedImageProtocol, Handle) Status, | 22 | _unload: fn (*const LoadedImageProtocol, Handle) callconv(.C) Status, |
| 23 | 23 | ||
| 24 | /// Unloads an image from memory. | 24 | /// Unloads an image from memory. |
| 25 | pub fn unload(self: *const LoadedImageProtocol, handle: Handle) Status { | 25 | pub fn unload(self: *const LoadedImageProtocol, handle: Handle) Status { |
lib/std/os/uefi/protocols/managed_network_protocol.zig+8-8| ... | @@ -7,14 +7,14 @@ const SimpleNetworkMode = uefi.protocols.SimpleNetworkMode; | ... | @@ -7,14 +7,14 @@ const SimpleNetworkMode = uefi.protocols.SimpleNetworkMode; |
| 7 | const MacAddress = uefi.protocols.MacAddress; | 7 | const MacAddress = uefi.protocols.MacAddress; |
| 8 | 8 | ||
| 9 | pub const ManagedNetworkProtocol = extern struct { | 9 | pub const ManagedNetworkProtocol = extern struct { |
| 10 | _get_mode_data: extern fn (*const ManagedNetworkProtocol, ?*ManagedNetworkConfigData, ?*SimpleNetworkMode) Status, | 10 | _get_mode_data: fn (*const ManagedNetworkProtocol, ?*ManagedNetworkConfigData, ?*SimpleNetworkMode) callconv(.C) Status, |
| 11 | _configure: extern fn (*const ManagedNetworkProtocol, ?*const ManagedNetworkConfigData) Status, | 11 | _configure: fn (*const ManagedNetworkProtocol, ?*const ManagedNetworkConfigData) callconv(.C) Status, |
| 12 | _mcast_ip_to_mac: extern fn (*const ManagedNetworkProtocol, bool, *const c_void, *MacAddress) Status, | 12 | _mcast_ip_to_mac: fn (*const ManagedNetworkProtocol, bool, *const c_void, *MacAddress) callconv(.C) Status, |
| 13 | _groups: extern fn (*const ManagedNetworkProtocol, bool, ?*const MacAddress) Status, | 13 | _groups: fn (*const ManagedNetworkProtocol, bool, ?*const MacAddress) callconv(.C) Status, |
| 14 | _transmit: extern fn (*const ManagedNetworkProtocol, *const ManagedNetworkCompletionToken) Status, | 14 | _transmit: fn (*const ManagedNetworkProtocol, *const ManagedNetworkCompletionToken) callconv(.C) Status, |
| 15 | _receive: extern fn (*const ManagedNetworkProtocol, *const ManagedNetworkCompletionToken) Status, | 15 | _receive: fn (*const ManagedNetworkProtocol, *const ManagedNetworkCompletionToken) callconv(.C) Status, |
| 16 | _cancel: extern fn (*const ManagedNetworkProtocol, ?*const ManagedNetworkCompletionToken) Status, | 16 | _cancel: fn (*const ManagedNetworkProtocol, ?*const ManagedNetworkCompletionToken) callconv(.C) Status, |
| 17 | _poll: extern fn (*const ManagedNetworkProtocol) usize, | 17 | _poll: fn (*const ManagedNetworkProtocol) callconv(.C) usize, |
| 18 | 18 | ||
| 19 | /// Returns the operational parameters for the current MNP child driver. | 19 | /// Returns the operational parameters for the current MNP child driver. |
| 20 | /// May also support returning the underlying SNP driver mode data. | 20 | /// May also support returning the underlying SNP driver mode data. |
lib/std/os/uefi/protocols/managed_network_service_binding_protocol.zig+2-2| ... | @@ -4,8 +4,8 @@ const Guid = uefi.Guid; | ... | @@ -4,8 +4,8 @@ const Guid = uefi.Guid; |
| 4 | const Status = uefi.Status; | 4 | const Status = uefi.Status; |
| 5 | 5 | ||
| 6 | pub const ManagedNetworkServiceBindingProtocol = extern struct { | 6 | pub const ManagedNetworkServiceBindingProtocol = extern struct { |
| 7 | _create_child: extern fn (*const ManagedNetworkServiceBindingProtocol, *?Handle) Status, | 7 | _create_child: fn (*const ManagedNetworkServiceBindingProtocol, *?Handle) callconv(.C) Status, |
| 8 | _destroy_child: extern fn (*const ManagedNetworkServiceBindingProtocol, Handle) Status, | 8 | _destroy_child: fn (*const ManagedNetworkServiceBindingProtocol, Handle) callconv(.C) Status, |
| 9 | 9 | ||
| 10 | pub fn createChild(self: *const ManagedNetworkServiceBindingProtocol, handle: *?Handle) Status { | 10 | pub fn createChild(self: *const ManagedNetworkServiceBindingProtocol, handle: *?Handle) Status { |
| 11 | return self._create_child(self, handle); | 11 | return self._create_child(self, handle); |
lib/std/os/uefi/protocols/rng_protocol.zig+2-2| ... | @@ -4,8 +4,8 @@ const Status = uefi.Status; | ... | @@ -4,8 +4,8 @@ const Status = uefi.Status; |
| 4 | 4 | ||
| 5 | /// Random Number Generator protocol | 5 | /// Random Number Generator protocol |
| 6 | pub const RNGProtocol = extern struct { | 6 | pub const RNGProtocol = extern struct { |
| 7 | _get_info: extern fn (*const RNGProtocol, *usize, [*]align(8) Guid) Status, | 7 | _get_info: fn (*const RNGProtocol, *usize, [*]align(8) Guid) callconv(.C) Status, |
| 8 | _get_rng: extern fn (*const RNGProtocol, ?*align(8) const Guid, usize, [*]u8) Status, | 8 | _get_rng: fn (*const RNGProtocol, ?*align(8) const Guid, usize, [*]u8) callconv(.C) Status, |
| 9 | 9 | ||
| 10 | /// Returns information about the random number generation implementation. | 10 | /// Returns information about the random number generation implementation. |
| 11 | pub fn getInfo(self: *const RNGProtocol, list_size: *usize, list: [*]align(8) Guid) Status { | 11 | pub fn getInfo(self: *const RNGProtocol, list_size: *usize, list: [*]align(8) Guid) Status { |
lib/std/os/uefi/protocols/simple_file_system_protocol.zig+1-1| ... | @@ -5,7 +5,7 @@ const Status = uefi.Status; | ... | @@ -5,7 +5,7 @@ const Status = uefi.Status; |
| 5 | 5 | ||
| 6 | pub const SimpleFileSystemProtocol = extern struct { | 6 | pub const SimpleFileSystemProtocol = extern struct { |
| 7 | revision: u64, | 7 | revision: u64, |
| 8 | _open_volume: extern fn (*const SimpleFileSystemProtocol, **const FileProtocol) Status, | 8 | _open_volume: fn (*const SimpleFileSystemProtocol, **const FileProtocol) callconv(.C) Status, |
| 9 | 9 | ||
| 10 | pub fn openVolume(self: *const SimpleFileSystemProtocol, root: **const FileProtocol) Status { | 10 | pub fn openVolume(self: *const SimpleFileSystemProtocol, root: **const FileProtocol) Status { |
| 11 | return self._open_volume(self, root); | 11 | return self._open_volume(self, root); |
lib/std/os/uefi/protocols/simple_network_protocol.zig+13-13| ... | @@ -5,19 +5,19 @@ const Status = uefi.Status; | ... | @@ -5,19 +5,19 @@ const Status = uefi.Status; |
| 5 | 5 | ||
| 6 | pub const SimpleNetworkProtocol = extern struct { | 6 | pub const SimpleNetworkProtocol = extern struct { |
| 7 | revision: u64, | 7 | revision: u64, |
| 8 | _start: extern fn (*const SimpleNetworkProtocol) Status, | 8 | _start: fn (*const SimpleNetworkProtocol) callconv(.C) Status, |
| 9 | _stop: extern fn (*const SimpleNetworkProtocol) Status, | 9 | _stop: fn (*const SimpleNetworkProtocol) callconv(.C) Status, |
| 10 | _initialize: extern fn (*const SimpleNetworkProtocol, usize, usize) Status, | 10 | _initialize: fn (*const SimpleNetworkProtocol, usize, usize) callconv(.C) Status, |
| 11 | _reset: extern fn (*const SimpleNetworkProtocol, bool) Status, | 11 | _reset: fn (*const SimpleNetworkProtocol, bool) callconv(.C) Status, |
| 12 | _shutdown: extern fn (*const SimpleNetworkProtocol) Status, | 12 | _shutdown: fn (*const SimpleNetworkProtocol) callconv(.C) Status, |
| 13 | _receive_filters: extern fn (*const SimpleNetworkProtocol, SimpleNetworkReceiveFilter, SimpleNetworkReceiveFilter, bool, usize, ?[*]const MacAddress) Status, | 13 | _receive_filters: fn (*const SimpleNetworkProtocol, SimpleNetworkReceiveFilter, SimpleNetworkReceiveFilter, bool, usize, ?[*]const MacAddress) callconv(.C) Status, |
| 14 | _station_address: extern fn (*const SimpleNetworkProtocol, bool, ?*const MacAddress) Status, | 14 | _station_address: fn (*const SimpleNetworkProtocol, bool, ?*const MacAddress) callconv(.C) Status, |
| 15 | _statistics: extern fn (*const SimpleNetworkProtocol, bool, ?*usize, ?*NetworkStatistics) Status, | 15 | _statistics: fn (*const SimpleNetworkProtocol, bool, ?*usize, ?*NetworkStatistics) callconv(.C) Status, |
| 16 | _mcast_ip_to_mac: extern fn (*const SimpleNetworkProtocol, bool, *const c_void, *MacAddress) Status, | 16 | _mcast_ip_to_mac: fn (*const SimpleNetworkProtocol, bool, *const c_void, *MacAddress) callconv(.C) Status, |
| 17 | _nvdata: extern fn (*const SimpleNetworkProtocol, bool, usize, usize, [*]u8) Status, | 17 | _nvdata: fn (*const SimpleNetworkProtocol, bool, usize, usize, [*]u8) callconv(.C) Status, |
| 18 | _get_status: extern fn (*const SimpleNetworkProtocol, *SimpleNetworkInterruptStatus, ?*?[*]u8) Status, | 18 | _get_status: fn (*const SimpleNetworkProtocol, *SimpleNetworkInterruptStatus, ?*?[*]u8) callconv(.C) Status, |
| 19 | _transmit: extern fn (*const SimpleNetworkProtocol, usize, usize, [*]const u8, ?*const MacAddress, ?*const MacAddress, ?*const u16) Status, | 19 | _transmit: fn (*const SimpleNetworkProtocol, usize, usize, [*]const u8, ?*const MacAddress, ?*const MacAddress, ?*const u16) callconv(.C) Status, |
| 20 | _receive: extern fn (*const SimpleNetworkProtocol, ?*usize, *usize, [*]u8, ?*MacAddress, ?*MacAddress, ?*u16) Status, | 20 | _receive: fn (*const SimpleNetworkProtocol, ?*usize, *usize, [*]u8, ?*MacAddress, ?*MacAddress, ?*u16) callconv(.C) Status, |
| 21 | wait_for_packet: Event, | 21 | wait_for_packet: Event, |
| 22 | mode: *SimpleNetworkMode, | 22 | mode: *SimpleNetworkMode, |
| 23 | 23 |
lib/std/os/uefi/protocols/simple_pointer_protocol.zig+2-2| ... | @@ -5,8 +5,8 @@ const Status = uefi.Status; | ... | @@ -5,8 +5,8 @@ const Status = uefi.Status; |
| 5 | 5 | ||
| 6 | /// Protocol for mice | 6 | /// Protocol for mice |
| 7 | pub const SimplePointerProtocol = struct { | 7 | pub const SimplePointerProtocol = struct { |
| 8 | _reset: extern fn (*const SimplePointerProtocol, bool) Status, | 8 | _reset: fn (*const SimplePointerProtocol, bool) callconv(.C) Status, |
| 9 | _get_state: extern fn (*const SimplePointerProtocol, *SimplePointerState) Status, | 9 | _get_state: fn (*const SimplePointerProtocol, *SimplePointerState) callconv(.C) Status, |
| 10 | wait_for_input: Event, | 10 | wait_for_input: Event, |
| 11 | mode: *SimplePointerMode, | 11 | mode: *SimplePointerMode, |
| 12 | 12 |
lib/std/os/uefi/protocols/simple_text_input_ex_protocol.zig+6-6| ... | @@ -5,12 +5,12 @@ const Status = uefi.Status; | ... | @@ -5,12 +5,12 @@ const Status = uefi.Status; |
| 5 | 5 | ||
| 6 | /// Character input devices, e.g. Keyboard | 6 | /// Character input devices, e.g. Keyboard |
| 7 | pub const SimpleTextInputExProtocol = extern struct { | 7 | pub const SimpleTextInputExProtocol = extern struct { |
| 8 | _reset: extern fn (*const SimpleTextInputExProtocol, bool) Status, | 8 | _reset: fn (*const SimpleTextInputExProtocol, bool) callconv(.C) Status, |
| 9 | _read_key_stroke_ex: extern fn (*const SimpleTextInputExProtocol, *KeyData) Status, | 9 | _read_key_stroke_ex: fn (*const SimpleTextInputExProtocol, *KeyData) callconv(.C) Status, |
| 10 | wait_for_key_ex: Event, | 10 | wait_for_key_ex: Event, |
| 11 | _set_state: extern fn (*const SimpleTextInputExProtocol, *const u8) Status, | 11 | _set_state: fn (*const SimpleTextInputExProtocol, *const u8) callconv(.C) Status, |
| 12 | _register_key_notify: extern fn (*const SimpleTextInputExProtocol, *const KeyData, extern fn (*const KeyData) usize, **c_void) Status, | 12 | _register_key_notify: fn (*const SimpleTextInputExProtocol, *const KeyData, fn (*const KeyData) callconv(.C) usize, **c_void) callconv(.C) Status, |
| 13 | _unregister_key_notify: extern fn (*const SimpleTextInputExProtocol, *const c_void) Status, | 13 | _unregister_key_notify: fn (*const SimpleTextInputExProtocol, *const c_void) callconv(.C) Status, |
| 14 | 14 | ||
| 15 | /// Resets the input device hardware. | 15 | /// Resets the input device hardware. |
| 16 | pub fn reset(self: *const SimpleTextInputExProtocol, verify: bool) Status { | 16 | pub fn reset(self: *const SimpleTextInputExProtocol, verify: bool) Status { |
| ... | @@ -28,7 +28,7 @@ pub const SimpleTextInputExProtocol = extern struct { | ... | @@ -28,7 +28,7 @@ pub const SimpleTextInputExProtocol = extern struct { |
| 28 | } | 28 | } |
| 29 | 29 | ||
| 30 | /// Register a notification function for a particular keystroke for the input device. | 30 | /// Register a notification function for a particular keystroke for the input device. |
| 31 | pub fn registerKeyNotify(self: *const SimpleTextInputExProtocol, key_data: *const KeyData, notify: extern fn (*const KeyData) usize, handle: **c_void) Status { | 31 | pub fn registerKeyNotify(self: *const SimpleTextInputExProtocol, key_data: *const KeyData, notify: fn (*const KeyData) callconv(.C) usize, handle: **c_void) Status { |
| 32 | return self._register_key_notify(self, key_data, notify, handle); | 32 | return self._register_key_notify(self, key_data, notify, handle); |
| 33 | } | 33 | } |
| 34 | 34 |
lib/std/os/uefi/protocols/simple_text_input_protocol.zig+2-2| ... | @@ -6,8 +6,8 @@ const Status = uefi.Status; | ... | @@ -6,8 +6,8 @@ const Status = uefi.Status; |
| 6 | 6 | ||
| 7 | /// Character input devices, e.g. Keyboard | 7 | /// Character input devices, e.g. Keyboard |
| 8 | pub const SimpleTextInputProtocol = extern struct { | 8 | pub const SimpleTextInputProtocol = extern struct { |
| 9 | _reset: extern fn (*const SimpleTextInputProtocol, bool) usize, | 9 | _reset: fn (*const SimpleTextInputProtocol, bool) callconv(.C) usize, |
| 10 | _read_key_stroke: extern fn (*const SimpleTextInputProtocol, *InputKey) Status, | 10 | _read_key_stroke: fn (*const SimpleTextInputProtocol, *InputKey) callconv(.C) Status, |
| 11 | wait_for_key: Event, | 11 | wait_for_key: Event, |
| 12 | 12 | ||
| 13 | /// Resets the input device hardware. | 13 | /// Resets the input device hardware. |
lib/std/os/uefi/protocols/simple_text_output_protocol.zig+9-9| ... | @@ -4,15 +4,15 @@ const Status = uefi.Status; | ... | @@ -4,15 +4,15 @@ const Status = uefi.Status; |
| 4 | 4 | ||
| 5 | /// Character output devices | 5 | /// Character output devices |
| 6 | pub const SimpleTextOutputProtocol = extern struct { | 6 | pub const SimpleTextOutputProtocol = extern struct { |
| 7 | _reset: extern fn (*const SimpleTextOutputProtocol, bool) Status, | 7 | _reset: fn (*const SimpleTextOutputProtocol, bool) callconv(.C) Status, |
| 8 | _output_string: extern fn (*const SimpleTextOutputProtocol, [*:0]const u16) Status, | 8 | _output_string: fn (*const SimpleTextOutputProtocol, [*:0]const u16) callconv(.C) Status, |
| 9 | _test_string: extern fn (*const SimpleTextOutputProtocol, [*:0]const u16) Status, | 9 | _test_string: fn (*const SimpleTextOutputProtocol, [*:0]const u16) callconv(.C) Status, |
| 10 | _query_mode: extern fn (*const SimpleTextOutputProtocol, usize, *usize, *usize) Status, | 10 | _query_mode: fn (*const SimpleTextOutputProtocol, usize, *usize, *usize) callconv(.C) Status, |
| 11 | _set_mode: extern fn (*const SimpleTextOutputProtocol, usize) Status, | 11 | _set_mode: fn (*const SimpleTextOutputProtocol, usize) callconv(.C) Status, |
| 12 | _set_attribute: extern fn (*const SimpleTextOutputProtocol, usize) Status, | 12 | _set_attribute: fn (*const SimpleTextOutputProtocol, usize) callconv(.C) Status, |
| 13 | _clear_screen: extern fn (*const SimpleTextOutputProtocol) Status, | 13 | _clear_screen: fn (*const SimpleTextOutputProtocol) callconv(.C) Status, |
| 14 | _set_cursor_position: extern fn (*const SimpleTextOutputProtocol, usize, usize) Status, | 14 | _set_cursor_position: fn (*const SimpleTextOutputProtocol, usize, usize) callconv(.C) Status, |
| 15 | _enable_cursor: extern fn (*const SimpleTextOutputProtocol, bool) Status, | 15 | _enable_cursor: fn (*const SimpleTextOutputProtocol, bool) callconv(.C) Status, |
| 16 | mode: *SimpleTextOutputMode, | 16 | mode: *SimpleTextOutputMode, |
| 17 | 17 | ||
| 18 | /// Resets the text output device hardware. | 18 | /// Resets the text output device hardware. |
lib/std/os/uefi/protocols/udp6_protocol.zig+7-7| ... | @@ -9,13 +9,13 @@ const ManagedNetworkConfigData = uefi.protocols.ManagedNetworkConfigData; | ... | @@ -9,13 +9,13 @@ const ManagedNetworkConfigData = uefi.protocols.ManagedNetworkConfigData; |
| 9 | const SimpleNetworkMode = uefi.protocols.SimpleNetworkMode; | 9 | const SimpleNetworkMode = uefi.protocols.SimpleNetworkMode; |
| 10 | 10 | ||
| 11 | pub const Udp6Protocol = extern struct { | 11 | pub const Udp6Protocol = extern struct { |
| 12 | _get_mode_data: extern fn (*const Udp6Protocol, ?*Udp6ConfigData, ?*Ip6ModeData, ?*ManagedNetworkConfigData, ?*SimpleNetworkMode) Status, | 12 | _get_mode_data: fn (*const Udp6Protocol, ?*Udp6ConfigData, ?*Ip6ModeData, ?*ManagedNetworkConfigData, ?*SimpleNetworkMode) callconv(.C) Status, |
| 13 | _configure: extern fn (*const Udp6Protocol, ?*const Udp6ConfigData) Status, | 13 | _configure: fn (*const Udp6Protocol, ?*const Udp6ConfigData) callconv(.C) Status, |
| 14 | _groups: extern fn (*const Udp6Protocol, bool, ?*const Ip6Address) Status, | 14 | _groups: fn (*const Udp6Protocol, bool, ?*const Ip6Address) callconv(.C) Status, |
| 15 | _transmit: extern fn (*const Udp6Protocol, *Udp6CompletionToken) Status, | 15 | _transmit: fn (*const Udp6Protocol, *Udp6CompletionToken) callconv(.C) Status, |
| 16 | _receive: extern fn (*const Udp6Protocol, *Udp6CompletionToken) Status, | 16 | _receive: fn (*const Udp6Protocol, *Udp6CompletionToken) callconv(.C) Status, |
| 17 | _cancel: extern fn (*const Udp6Protocol, ?*Udp6CompletionToken) Status, | 17 | _cancel: fn (*const Udp6Protocol, ?*Udp6CompletionToken) callconv(.C) Status, |
| 18 | _poll: extern fn (*const Udp6Protocol) Status, | 18 | _poll: fn (*const Udp6Protocol) callconv(.C) Status, |
| 19 | 19 | ||
| 20 | pub fn getModeData(self: *const Udp6Protocol, udp6_config_data: ?*Udp6ConfigData, ip6_mode_data: ?*Ip6ModeData, mnp_config_data: ?*ManagedNetworkConfigData, snp_mode_data: ?*SimpleNetworkMode) Status { | 20 | pub fn getModeData(self: *const Udp6Protocol, udp6_config_data: ?*Udp6ConfigData, ip6_mode_data: ?*Ip6ModeData, mnp_config_data: ?*ManagedNetworkConfigData, snp_mode_data: ?*SimpleNetworkMode) Status { |
| 21 | return self._get_mode_data(self, udp6_config_data, ip6_mode_data, mnp_config_data, snp_mode_data); | 21 | return self._get_mode_data(self, udp6_config_data, ip6_mode_data, mnp_config_data, snp_mode_data); |
lib/std/os/uefi/protocols/udp6_service_binding_protocol.zig+2-2| ... | @@ -4,8 +4,8 @@ const Guid = uefi.Guid; | ... | @@ -4,8 +4,8 @@ const Guid = uefi.Guid; |
| 4 | const Status = uefi.Status; | 4 | const Status = uefi.Status; |
| 5 | 5 | ||
| 6 | pub const Udp6ServiceBindingProtocol = extern struct { | 6 | pub const Udp6ServiceBindingProtocol = extern struct { |
| 7 | _create_child: extern fn (*const Udp6ServiceBindingProtocol, *?Handle) Status, | 7 | _create_child: fn (*const Udp6ServiceBindingProtocol, *?Handle) callconv(.C) Status, |
| 8 | _destroy_child: extern fn (*const Udp6ServiceBindingProtocol, Handle) Status, | 8 | _destroy_child: fn (*const Udp6ServiceBindingProtocol, Handle) callconv(.C) Status, |
| 9 | 9 | ||
| 10 | pub fn createChild(self: *const Udp6ServiceBindingProtocol, handle: *?Handle) Status { | 10 | pub fn createChild(self: *const Udp6ServiceBindingProtocol, handle: *?Handle) Status { |
| 11 | return self._create_child(self, handle); | 11 | return self._create_child(self, handle); |
lib/std/os/uefi/tables/boot_services.zig+32-32| ... | @@ -21,117 +21,117 @@ pub const BootServices = extern struct { | ... | @@ -21,117 +21,117 @@ pub const BootServices = extern struct { |
| 21 | hdr: TableHeader, | 21 | hdr: TableHeader, |
| 22 | 22 | ||
| 23 | /// Raises a task's priority level and returns its previous level. | 23 | /// Raises a task's priority level and returns its previous level. |
| 24 | raiseTpl: extern fn (usize) usize, | 24 | raiseTpl: fn (usize) callconv(.C) usize, |
| 25 | 25 | ||
| 26 | /// Restores a task's priority level to its previous value. | 26 | /// Restores a task's priority level to its previous value. |
| 27 | restoreTpl: extern fn (usize) void, | 27 | restoreTpl: fn (usize) callconv(.C) void, |
| 28 | 28 | ||
| 29 | /// Allocates memory pages from the system. | 29 | /// Allocates memory pages from the system. |
| 30 | allocatePages: extern fn (AllocateType, MemoryType, usize, *[*]align(4096) u8) Status, | 30 | allocatePages: fn (AllocateType, MemoryType, usize, *[*]align(4096) u8) callconv(.C) Status, |
| 31 | 31 | ||
| 32 | /// Frees memory pages. | 32 | /// Frees memory pages. |
| 33 | freePages: extern fn ([*]align(4096) u8, usize) Status, | 33 | freePages: fn ([*]align(4096) u8, usize) callconv(.C) Status, |
| 34 | 34 | ||
| 35 | /// Returns the current memory map. | 35 | /// Returns the current memory map. |
| 36 | getMemoryMap: extern fn (*usize, [*]MemoryDescriptor, *usize, *usize, *u32) Status, | 36 | getMemoryMap: fn (*usize, [*]MemoryDescriptor, *usize, *usize, *u32) callconv(.C) Status, |
| 37 | 37 | ||
| 38 | /// Allocates pool memory. | 38 | /// Allocates pool memory. |
| 39 | allocatePool: extern fn (MemoryType, usize, *[*]align(8) u8) Status, | 39 | allocatePool: fn (MemoryType, usize, *[*]align(8) u8) callconv(.C) Status, |
| 40 | 40 | ||
| 41 | /// Returns pool memory to the system. | 41 | /// Returns pool memory to the system. |
| 42 | freePool: extern fn ([*]align(8) u8) Status, | 42 | freePool: fn ([*]align(8) u8) callconv(.C) Status, |
| 43 | 43 | ||
| 44 | /// Creates an event. | 44 | /// Creates an event. |
| 45 | createEvent: extern fn (u32, usize, ?extern fn (Event, ?*c_void) void, ?*const c_void, *Event) Status, | 45 | createEvent: fn (u32, usize, ?fn (Event, ?*c_void) callconv(.C) void, ?*const c_void, *Event) callconv(.C) Status, |
| 46 | 46 | ||
| 47 | /// Sets the type of timer and the trigger time for a timer event. | 47 | /// Sets the type of timer and the trigger time for a timer event. |
| 48 | setTimer: extern fn (Event, TimerDelay, u64) Status, | 48 | setTimer: fn (Event, TimerDelay, u64) callconv(.C) Status, |
| 49 | 49 | ||
| 50 | /// Stops execution until an event is signaled. | 50 | /// Stops execution until an event is signaled. |
| 51 | waitForEvent: extern fn (usize, [*]const Event, *usize) Status, | 51 | waitForEvent: fn (usize, [*]const Event, *usize) callconv(.C) Status, |
| 52 | 52 | ||
| 53 | /// Signals an event. | 53 | /// Signals an event. |
| 54 | signalEvent: extern fn (Event) Status, | 54 | signalEvent: fn (Event) callconv(.C) Status, |
| 55 | 55 | ||
| 56 | /// Closes an event. | 56 | /// Closes an event. |
| 57 | closeEvent: extern fn (Event) Status, | 57 | closeEvent: fn (Event) callconv(.C) Status, |
| 58 | 58 | ||
| 59 | /// Checks whether an event is in the signaled state. | 59 | /// Checks whether an event is in the signaled state. |
| 60 | checkEvent: extern fn (Event) Status, | 60 | checkEvent: fn (Event) callconv(.C) Status, |
| 61 | 61 | ||
| 62 | installProtocolInterface: Status, // TODO | 62 | installProtocolInterface: Status, // TODO |
| 63 | reinstallProtocolInterface: Status, // TODO | 63 | reinstallProtocolInterface: Status, // TODO |
| 64 | uninstallProtocolInterface: Status, // TODO | 64 | uninstallProtocolInterface: Status, // TODO |
| 65 | 65 | ||
| 66 | /// Queries a handle to determine if it supports a specified protocol. | 66 | /// Queries a handle to determine if it supports a specified protocol. |
| 67 | handleProtocol: extern fn (Handle, *align(8) const Guid, *?*c_void) Status, | 67 | handleProtocol: fn (Handle, *align(8) const Guid, *?*c_void) callconv(.C) Status, |
| 68 | 68 | ||
| 69 | reserved: *c_void, | 69 | reserved: *c_void, |
| 70 | 70 | ||
| 71 | registerProtocolNotify: Status, // TODO | 71 | registerProtocolNotify: Status, // TODO |
| 72 | 72 | ||
| 73 | /// Returns an array of handles that support a specified protocol. | 73 | /// Returns an array of handles that support a specified protocol. |
| 74 | locateHandle: extern fn (LocateSearchType, ?*align(8) const Guid, ?*const c_void, *usize, [*]Handle) Status, | 74 | locateHandle: fn (LocateSearchType, ?*align(8) const Guid, ?*const c_void, *usize, [*]Handle) callconv(.C) Status, |
| 75 | 75 | ||
| 76 | locateDevicePath: Status, // TODO | 76 | locateDevicePath: Status, // TODO |
| 77 | installConfigurationTable: Status, // TODO | 77 | installConfigurationTable: Status, // TODO |
| 78 | 78 | ||
| 79 | /// Loads an EFI image into memory. | 79 | /// Loads an EFI image into memory. |
| 80 | loadImage: extern fn (bool, Handle, ?*const DevicePathProtocol, ?[*]const u8, usize, *?Handle) Status, | 80 | loadImage: fn (bool, Handle, ?*const DevicePathProtocol, ?[*]const u8, usize, *?Handle) callconv(.C) Status, |
| 81 | 81 | ||
| 82 | /// Transfers control to a loaded image's entry point. | 82 | /// Transfers control to a loaded image's entry point. |
| 83 | startImage: extern fn (Handle, ?*usize, ?*[*]u16) Status, | 83 | startImage: fn (Handle, ?*usize, ?*[*]u16) callconv(.C) Status, |
| 84 | 84 | ||
| 85 | /// Terminates a loaded EFI image and returns control to boot services. | 85 | /// Terminates a loaded EFI image and returns control to boot services. |
| 86 | exit: extern fn (Handle, Status, usize, ?*const c_void) Status, | 86 | exit: fn (Handle, Status, usize, ?*const c_void) callconv(.C) Status, |
| 87 | 87 | ||
| 88 | /// Unloads an image. | 88 | /// Unloads an image. |
| 89 | unloadImage: extern fn (Handle) Status, | 89 | unloadImage: fn (Handle) callconv(.C) Status, |
| 90 | 90 | ||
| 91 | /// Terminates all boot services. | 91 | /// Terminates all boot services. |
| 92 | exitBootServices: extern fn (Handle, usize) Status, | 92 | exitBootServices: fn (Handle, usize) callconv(.C) Status, |
| 93 | 93 | ||
| 94 | /// Returns a monotonically increasing count for the platform. | 94 | /// Returns a monotonically increasing count for the platform. |
| 95 | getNextMonotonicCount: extern fn (*u64) Status, | 95 | getNextMonotonicCount: fn (*u64) callconv(.C) Status, |
| 96 | 96 | ||
| 97 | /// Induces a fine-grained stall. | 97 | /// Induces a fine-grained stall. |
| 98 | stall: extern fn (usize) Status, | 98 | stall: fn (usize) callconv(.C) Status, |
| 99 | 99 | ||
| 100 | /// Sets the system's watchdog timer. | 100 | /// Sets the system's watchdog timer. |
| 101 | setWatchdogTimer: extern fn (usize, u64, usize, ?[*]const u16) Status, | 101 | setWatchdogTimer: fn (usize, u64, usize, ?[*]const u16) callconv(.C) Status, |
| 102 | 102 | ||
| 103 | connectController: Status, // TODO | 103 | connectController: Status, // TODO |
| 104 | disconnectController: Status, // TODO | 104 | disconnectController: Status, // TODO |
| 105 | 105 | ||
| 106 | /// Queries a handle to determine if it supports a specified protocol. | 106 | /// Queries a handle to determine if it supports a specified protocol. |
| 107 | openProtocol: extern fn (Handle, *align(8) const Guid, *?*c_void, ?Handle, ?Handle, OpenProtocolAttributes) Status, | 107 | openProtocol: fn (Handle, *align(8) const Guid, *?*c_void, ?Handle, ?Handle, OpenProtocolAttributes) callconv(.C) Status, |
| 108 | 108 | ||
| 109 | /// Closes a protocol on a handle that was opened using openProtocol(). | 109 | /// Closes a protocol on a handle that was opened using openProtocol(). |
| 110 | closeProtocol: extern fn (Handle, *align(8) const Guid, Handle, ?Handle) Status, | 110 | closeProtocol: fn (Handle, *align(8) const Guid, Handle, ?Handle) callconv(.C) Status, |
| 111 | 111 | ||
| 112 | /// Retrieves the list of agents that currently have a protocol interface opened. | 112 | /// Retrieves the list of agents that currently have a protocol interface opened. |
| 113 | openProtocolInformation: extern fn (Handle, *align(8) const Guid, *[*]ProtocolInformationEntry, *usize) Status, | 113 | openProtocolInformation: fn (Handle, *align(8) const Guid, *[*]ProtocolInformationEntry, *usize) callconv(.C) Status, |
| 114 | 114 | ||
| 115 | /// Retrieves the list of protocol interface GUIDs that are installed on a handle in a buffer allocated from pool. | 115 | /// Retrieves the list of protocol interface GUIDs that are installed on a handle in a buffer allocated from pool. |
| 116 | protocolsPerHandle: extern fn (Handle, *[*]*align(8) const Guid, *usize) Status, | 116 | protocolsPerHandle: fn (Handle, *[*]*align(8) const Guid, *usize) callconv(.C) Status, |
| 117 | 117 | ||
| 118 | /// Returns an array of handles that support the requested protocol in a buffer allocated from pool. | 118 | /// Returns an array of handles that support the requested protocol in a buffer allocated from pool. |
| 119 | locateHandleBuffer: extern fn (LocateSearchType, ?*align(8) const Guid, ?*const c_void, *usize, *[*]Handle) Status, | 119 | locateHandleBuffer: fn (LocateSearchType, ?*align(8) const Guid, ?*const c_void, *usize, *[*]Handle) callconv(.C) Status, |
| 120 | 120 | ||
| 121 | /// Returns the first protocol instance that matches the given protocol. | 121 | /// Returns the first protocol instance that matches the given protocol. |
| 122 | locateProtocol: extern fn (*align(8) const Guid, ?*const c_void, *?*c_void) Status, | 122 | locateProtocol: fn (*align(8) const Guid, ?*const c_void, *?*c_void) callconv(.C) Status, |
| 123 | 123 | ||
| 124 | installMultipleProtocolInterfaces: Status, // TODO | 124 | installMultipleProtocolInterfaces: Status, // TODO |
| 125 | uninstallMultipleProtocolInterfaces: Status, // TODO | 125 | uninstallMultipleProtocolInterfaces: Status, // TODO |
| 126 | 126 | ||
| 127 | /// Computes and returns a 32-bit CRC for a data buffer. | 127 | /// Computes and returns a 32-bit CRC for a data buffer. |
| 128 | calculateCrc32: extern fn ([*]const u8, usize, *u32) Status, | 128 | calculateCrc32: fn ([*]const u8, usize, *u32) callconv(.C) Status, |
| 129 | 129 | ||
| 130 | /// Copies the contents of one buffer to another buffer | 130 | /// Copies the contents of one buffer to another buffer |
| 131 | copyMem: extern fn ([*]u8, [*]const u8, usize) void, | 131 | copyMem: fn ([*]u8, [*]const u8, usize) callconv(.C) void, |
| 132 | 132 | ||
| 133 | /// Fills a buffer with a specified value | 133 | /// Fills a buffer with a specified value |
| 134 | setMem: extern fn ([*]u8, usize, u8) void, | 134 | setMem: fn ([*]u8, usize, u8) callconv(.C) void, |
| 135 | 135 | ||
| 136 | createEventEx: Status, // TODO | 136 | createEventEx: Status, // TODO |
| 137 | 137 |
lib/std/os/uefi/tables/runtime_services.zig+5-5| ... | @@ -17,7 +17,7 @@ pub const RuntimeServices = extern struct { | ... | @@ -17,7 +17,7 @@ pub const RuntimeServices = extern struct { |
| 17 | hdr: TableHeader, | 17 | hdr: TableHeader, |
| 18 | 18 | ||
| 19 | /// Returns the current time and date information, and the time-keeping capabilities of the hardware platform. | 19 | /// Returns the current time and date information, and the time-keeping capabilities of the hardware platform. |
| 20 | getTime: extern fn (*uefi.Time, ?*TimeCapabilities) Status, | 20 | getTime: fn (*uefi.Time, ?*TimeCapabilities) callconv(.C) Status, |
| 21 | 21 | ||
| 22 | setTime: Status, // TODO | 22 | setTime: Status, // TODO |
| 23 | getWakeupTime: Status, // TODO | 23 | getWakeupTime: Status, // TODO |
| ... | @@ -26,18 +26,18 @@ pub const RuntimeServices = extern struct { | ... | @@ -26,18 +26,18 @@ pub const RuntimeServices = extern struct { |
| 26 | convertPointer: Status, // TODO | 26 | convertPointer: Status, // TODO |
| 27 | 27 | ||
| 28 | /// Returns the value of a variable. | 28 | /// Returns the value of a variable. |
| 29 | getVariable: extern fn ([*:0]const u16, *align(8) const Guid, ?*u32, *usize, ?*c_void) Status, | 29 | getVariable: fn ([*:0]const u16, *align(8) const Guid, ?*u32, *usize, ?*c_void) callconv(.C) Status, |
| 30 | 30 | ||
| 31 | /// Enumerates the current variable names. | 31 | /// Enumerates the current variable names. |
| 32 | getNextVariableName: extern fn (*usize, [*:0]u16, *align(8) Guid) Status, | 32 | getNextVariableName: fn (*usize, [*:0]u16, *align(8) Guid) callconv(.C) Status, |
| 33 | 33 | ||
| 34 | /// Sets the value of a variable. | 34 | /// Sets the value of a variable. |
| 35 | setVariable: extern fn ([*:0]const u16, *align(8) const Guid, u32, usize, *c_void) Status, | 35 | setVariable: fn ([*:0]const u16, *align(8) const Guid, u32, usize, *c_void) callconv(.C) Status, |
| 36 | 36 | ||
| 37 | getNextHighMonotonicCount: Status, // TODO | 37 | getNextHighMonotonicCount: Status, // TODO |
| 38 | 38 | ||
| 39 | /// Resets the entire platform. | 39 | /// Resets the entire platform. |
| 40 | resetSystem: extern fn (ResetType, Status, usize, ?*const c_void) noreturn, | 40 | resetSystem: fn (ResetType, Status, usize, ?*const c_void) callconv(.C) noreturn, |
| 41 | 41 | ||
| 42 | updateCapsule: Status, // TODO | 42 | updateCapsule: Status, // TODO |
| 43 | queryCapsuleCapabilities: Status, // TODO | 43 | queryCapsuleCapabilities: Status, // TODO |
lib/std/os/windows/bits.zig+6-6| ... | @@ -627,7 +627,7 @@ pub const MEM_RESERVE_PLACEHOLDERS = 0x2; | ... | @@ -627,7 +627,7 @@ pub const MEM_RESERVE_PLACEHOLDERS = 0x2; |
| 627 | pub const MEM_DECOMMIT = 0x4000; | 627 | pub const MEM_DECOMMIT = 0x4000; |
| 628 | pub const MEM_RELEASE = 0x8000; | 628 | pub const MEM_RELEASE = 0x8000; |
| 629 | 629 | ||
| 630 | pub const PTHREAD_START_ROUTINE = extern fn (LPVOID) DWORD; | 630 | pub const PTHREAD_START_ROUTINE = fn (LPVOID) callconv(.C) DWORD; |
| 631 | pub const LPTHREAD_START_ROUTINE = PTHREAD_START_ROUTINE; | 631 | pub const LPTHREAD_START_ROUTINE = PTHREAD_START_ROUTINE; |
| 632 | 632 | ||
| 633 | pub const WIN32_FIND_DATAW = extern struct { | 633 | pub const WIN32_FIND_DATAW = extern struct { |
| ... | @@ -784,7 +784,7 @@ pub const IMAGE_TLS_DIRECTORY = extern struct { | ... | @@ -784,7 +784,7 @@ pub const IMAGE_TLS_DIRECTORY = extern struct { |
| 784 | pub const IMAGE_TLS_DIRECTORY64 = IMAGE_TLS_DIRECTORY; | 784 | pub const IMAGE_TLS_DIRECTORY64 = IMAGE_TLS_DIRECTORY; |
| 785 | pub const IMAGE_TLS_DIRECTORY32 = IMAGE_TLS_DIRECTORY; | 785 | pub const IMAGE_TLS_DIRECTORY32 = IMAGE_TLS_DIRECTORY; |
| 786 | 786 | ||
| 787 | pub const PIMAGE_TLS_CALLBACK = ?extern fn (PVOID, DWORD, PVOID) void; | 787 | pub const PIMAGE_TLS_CALLBACK = ?fn (PVOID, DWORD, PVOID) callconv(.C) void; |
| 788 | 788 | ||
| 789 | pub const PROV_RSA_FULL = 1; | 789 | pub const PROV_RSA_FULL = 1; |
| 790 | 790 | ||
| ... | @@ -810,7 +810,7 @@ pub const FILE_ACTION_MODIFIED = 0x00000003; | ... | @@ -810,7 +810,7 @@ pub const FILE_ACTION_MODIFIED = 0x00000003; |
| 810 | pub const FILE_ACTION_RENAMED_OLD_NAME = 0x00000004; | 810 | pub const FILE_ACTION_RENAMED_OLD_NAME = 0x00000004; |
| 811 | pub const FILE_ACTION_RENAMED_NEW_NAME = 0x00000005; | 811 | pub const FILE_ACTION_RENAMED_NEW_NAME = 0x00000005; |
| 812 | 812 | ||
| 813 | pub const LPOVERLAPPED_COMPLETION_ROUTINE = ?extern fn (DWORD, DWORD, *OVERLAPPED) void; | 813 | pub const LPOVERLAPPED_COMPLETION_ROUTINE = ?fn (DWORD, DWORD, *OVERLAPPED) callconv(.C) void; |
| 814 | 814 | ||
| 815 | pub const FILE_NOTIFY_CHANGE_CREATION = 64; | 815 | pub const FILE_NOTIFY_CHANGE_CREATION = 64; |
| 816 | pub const FILE_NOTIFY_CHANGE_SIZE = 8; | 816 | pub const FILE_NOTIFY_CHANGE_SIZE = 8; |
| ... | @@ -863,7 +863,7 @@ pub const RTL_CRITICAL_SECTION = extern struct { | ... | @@ -863,7 +863,7 @@ pub const RTL_CRITICAL_SECTION = extern struct { |
| 863 | pub const CRITICAL_SECTION = RTL_CRITICAL_SECTION; | 863 | pub const CRITICAL_SECTION = RTL_CRITICAL_SECTION; |
| 864 | pub const INIT_ONCE = RTL_RUN_ONCE; | 864 | pub const INIT_ONCE = RTL_RUN_ONCE; |
| 865 | pub const INIT_ONCE_STATIC_INIT = RTL_RUN_ONCE_INIT; | 865 | pub const INIT_ONCE_STATIC_INIT = RTL_RUN_ONCE_INIT; |
| 866 | pub const INIT_ONCE_FN = extern fn (InitOnce: *INIT_ONCE, Parameter: ?*c_void, Context: ?*c_void) BOOL; | 866 | pub const INIT_ONCE_FN = fn (InitOnce: *INIT_ONCE, Parameter: ?*c_void, Context: ?*c_void) callconv(.C) BOOL; |
| 867 | 867 | ||
| 868 | pub const RTL_RUN_ONCE = extern struct { | 868 | pub const RTL_RUN_ONCE = extern struct { |
| 869 | Ptr: ?*c_void, | 869 | Ptr: ?*c_void, |
| ... | @@ -1418,7 +1418,7 @@ pub const RTL_DRIVE_LETTER_CURDIR = extern struct { | ... | @@ -1418,7 +1418,7 @@ pub const RTL_DRIVE_LETTER_CURDIR = extern struct { |
| 1418 | DosPath: UNICODE_STRING, | 1418 | DosPath: UNICODE_STRING, |
| 1419 | }; | 1419 | }; |
| 1420 | 1420 | ||
| 1421 | pub const PPS_POST_PROCESS_INIT_ROUTINE = ?extern fn () void; | 1421 | pub const PPS_POST_PROCESS_INIT_ROUTINE = ?fn () callconv(.C) void; |
| 1422 | 1422 | ||
| 1423 | pub const FILE_BOTH_DIR_INFORMATION = extern struct { | 1423 | pub const FILE_BOTH_DIR_INFORMATION = extern struct { |
| 1424 | NextEntryOffset: ULONG, | 1424 | NextEntryOffset: ULONG, |
| ... | @@ -1438,7 +1438,7 @@ pub const FILE_BOTH_DIR_INFORMATION = extern struct { | ... | @@ -1438,7 +1438,7 @@ pub const FILE_BOTH_DIR_INFORMATION = extern struct { |
| 1438 | }; | 1438 | }; |
| 1439 | pub const FILE_BOTH_DIRECTORY_INFORMATION = FILE_BOTH_DIR_INFORMATION; | 1439 | pub const FILE_BOTH_DIRECTORY_INFORMATION = FILE_BOTH_DIR_INFORMATION; |
| 1440 | 1440 | ||
| 1441 | pub const IO_APC_ROUTINE = extern fn (PVOID, *IO_STATUS_BLOCK, ULONG) void; | 1441 | pub const IO_APC_ROUTINE = fn (PVOID, *IO_STATUS_BLOCK, ULONG) callconv(.C) void; |
| 1442 | 1442 | ||
| 1443 | pub const CURDIR = extern struct { | 1443 | pub const CURDIR = extern struct { |
| 1444 | DosPath: UNICODE_STRING, | 1444 | DosPath: UNICODE_STRING, |
lib/std/os/windows/ws2_32.zig+1-1| ... | @@ -106,7 +106,7 @@ pub const WSAOVERLAPPED = extern struct { | ... | @@ -106,7 +106,7 @@ pub const WSAOVERLAPPED = extern struct { |
| 106 | hEvent: ?WSAEVENT, | 106 | hEvent: ?WSAEVENT, |
| 107 | }; | 107 | }; |
| 108 | 108 | ||
| 109 | pub const WSAOVERLAPPED_COMPLETION_ROUTINE = extern fn (dwError: DWORD, cbTransferred: DWORD, lpOverlapped: *WSAOVERLAPPED, dwFlags: DWORD) void; | 109 | pub const WSAOVERLAPPED_COMPLETION_ROUTINE = fn (dwError: DWORD, cbTransferred: DWORD, lpOverlapped: *WSAOVERLAPPED, dwFlags: DWORD) callconv(.C) void; |
| 110 | 110 | ||
| 111 | pub const ADDRESS_FAMILY = u16; | 111 | pub const ADDRESS_FAMILY = u16; |
| 112 | 112 |
lib/std/special/test_runner.zig+1-1| ... | @@ -34,7 +34,7 @@ pub fn main() anyerror!void { | ... | @@ -34,7 +34,7 @@ pub fn main() anyerror!void { |
| 34 | std.heap.page_allocator.free(async_frame_buffer); | 34 | std.heap.page_allocator.free(async_frame_buffer); |
| 35 | async_frame_buffer = try std.heap.page_allocator.alignedAlloc(u8, std.Target.stack_align, size); | 35 | async_frame_buffer = try std.heap.page_allocator.alignedAlloc(u8, std.Target.stack_align, size); |
| 36 | } | 36 | } |
| 37 | const casted_fn = @ptrCast(async fn () anyerror!void, test_fn.func); | 37 | const casted_fn = @ptrCast(fn () callconv(.Async) anyerror!void, test_fn.func); |
| 38 | break :blk await @asyncCall(async_frame_buffer, {}, casted_fn); | 38 | break :blk await @asyncCall(async_frame_buffer, {}, casted_fn); |
| 39 | }, | 39 | }, |
| 40 | .blocking => { | 40 | .blocking => { |
lib/std/start.zig+1-2| ... | @@ -224,8 +224,7 @@ inline fn initEventLoopAndCallMain() u8 { | ... | @@ -224,8 +224,7 @@ inline fn initEventLoopAndCallMain() u8 { |
| 224 | // and we want fewer call frames in stack traces. | 224 | // and we want fewer call frames in stack traces. |
| 225 | return @call(.{ .modifier = .always_inline }, callMain, .{}); | 225 | return @call(.{ .modifier = .always_inline }, callMain, .{}); |
| 226 | } | 226 | } |
| 227 | 227 | fn callMainAsync(loop: *std.event.Loop) callconv(.Async) u8 { | |
| 228 | async fn callMainAsync(loop: *std.event.Loop) u8 { | ||
| 229 | // This prevents the event loop from terminating at least until main() has returned. | 228 | // This prevents the event loop from terminating at least until main() has returned. |
| 230 | loop.beginOneEvent(); | 229 | loop.beginOneEvent(); |
| 231 | defer loop.finishOneEvent(); | 230 | defer loop.finishOneEvent(); |
lib/std/zig/ast.zig+2-2| ... | @@ -875,12 +875,13 @@ pub const Node = struct { | ... | @@ -875,12 +875,13 @@ pub const Node = struct { |
| 875 | return_type: ReturnType, | 875 | return_type: ReturnType, |
| 876 | var_args_token: ?TokenIndex, | 876 | var_args_token: ?TokenIndex, |
| 877 | extern_export_inline_token: ?TokenIndex, | 877 | extern_export_inline_token: ?TokenIndex, |
| 878 | cc_token: ?TokenIndex, | ||
| 879 | body_node: ?*Node, | 878 | body_node: ?*Node, |
| 880 | lib_name: ?*Node, // populated if this is an extern declaration | 879 | lib_name: ?*Node, // populated if this is an extern declaration |
| 881 | align_expr: ?*Node, // populated if align(A) is present | 880 | align_expr: ?*Node, // populated if align(A) is present |
| 882 | section_expr: ?*Node, // populated if linksection(A) is present | 881 | section_expr: ?*Node, // populated if linksection(A) is present |
| 883 | callconv_expr: ?*Node, // populated if callconv(A) is present | 882 | callconv_expr: ?*Node, // populated if callconv(A) is present |
| 883 | is_extern_prototype: bool = false, // TODO: Remove once extern fn rewriting is | ||
| 884 | is_async: bool = false, // TODO: remove once async fn rewriting is | ||
| 884 | 885 | ||
| 885 | pub const ParamList = SegmentedList(*Node, 2); | 886 | pub const ParamList = SegmentedList(*Node, 2); |
| 886 | 887 | ||
| ... | @@ -929,7 +930,6 @@ pub const Node = struct { | ... | @@ -929,7 +930,6 @@ pub const Node = struct { |
| 929 | if (self.visib_token) |visib_token| return visib_token; | 930 | if (self.visib_token) |visib_token| return visib_token; |
| 930 | if (self.extern_export_inline_token) |extern_export_inline_token| return extern_export_inline_token; | 931 | if (self.extern_export_inline_token) |extern_export_inline_token| return extern_export_inline_token; |
| 931 | assert(self.lib_name == null); | 932 | assert(self.lib_name == null); |
| 932 | if (self.cc_token) |cc_token| return cc_token; | ||
| 933 | return self.fn_token; | 933 | return self.fn_token; |
| 934 | } | 934 | } |
| 935 | 935 |
lib/std/zig/parse.zig+20-39| ... | @@ -335,20 +335,25 @@ fn parseTopLevelDecl(arena: *Allocator, it: *TokenIterator, tree: *Tree) !?*Node | ... | @@ -335,20 +335,25 @@ fn parseTopLevelDecl(arena: *Allocator, it: *TokenIterator, tree: *Tree) !?*Node |
| 335 | return use_node; | 335 | return use_node; |
| 336 | } | 336 | } |
| 337 | 337 | ||
| 338 | /// FnProto <- FnCC? KEYWORD_fn IDENTIFIER? LPAREN ParamDeclList RPAREN ByteAlign? LinkSection? EXCLAMATIONMARK? (KEYWORD_var / TypeExpr) | 338 | /// FnProto <- KEYWORD_fn IDENTIFIER? LPAREN ParamDeclList RPAREN ByteAlign? LinkSection? EXCLAMATIONMARK? (KEYWORD_var / TypeExpr) |
| 339 | fn parseFnProto(arena: *Allocator, it: *TokenIterator, tree: *Tree) !?*Node { | 339 | fn parseFnProto(arena: *Allocator, it: *TokenIterator, tree: *Tree) !?*Node { |
| 340 | const cc = parseFnCC(arena, it, tree); | 340 | // TODO: Remove once extern/async fn rewriting is |
| 341 | const fn_token = eatToken(it, .Keyword_fn) orelse { | 341 | var is_async = false; |
| 342 | if (cc) |fnCC| { | 342 | var is_extern = false; |
| 343 | if (fnCC == .Extern) { | 343 | const cc_token: ?usize = blk: { |
| 344 | putBackToken(it, fnCC.Extern); // 'extern' is also used in ContainerDecl | 344 | if (eatToken(it, .Keyword_extern)) |token| { |
| 345 | } else { | 345 | is_extern = true; |
| 346 | try tree.errors.push(.{ | 346 | break :blk token; |
| 347 | .ExpectedToken = .{ .token = it.index, .expected_id = .Keyword_fn }, | 347 | } |
| 348 | }); | 348 | if (eatToken(it, .Keyword_async)) |token| { |
| 349 | return error.ParseError; | 349 | is_async = true; |
| 350 | } | 350 | break :blk token; |
| 351 | } | 351 | } |
| 352 | break :blk null; | ||
| 353 | }; | ||
| 354 | const fn_token = eatToken(it, .Keyword_fn) orelse { | ||
| 355 | if (cc_token) |token| | ||
| 356 | putBackToken(it, token); | ||
| 352 | return null; | 357 | return null; |
| 353 | }; | 358 | }; |
| 354 | const name_token = eatToken(it, .Identifier); | 359 | const name_token = eatToken(it, .Identifier); |
| ... | @@ -389,21 +394,15 @@ fn parseFnProto(arena: *Allocator, it: *TokenIterator, tree: *Tree) !?*Node { | ... | @@ -389,21 +394,15 @@ fn parseFnProto(arena: *Allocator, it: *TokenIterator, tree: *Tree) !?*Node { |
| 389 | .return_type = return_type, | 394 | .return_type = return_type, |
| 390 | .var_args_token = var_args_token, | 395 | .var_args_token = var_args_token, |
| 391 | .extern_export_inline_token = null, | 396 | .extern_export_inline_token = null, |
| 392 | .cc_token = null, | ||
| 393 | .body_node = null, | 397 | .body_node = null, |
| 394 | .lib_name = null, | 398 | .lib_name = null, |
| 395 | .align_expr = align_expr, | 399 | .align_expr = align_expr, |
| 396 | .section_expr = section_expr, | 400 | .section_expr = section_expr, |
| 397 | .callconv_expr = callconv_expr, | 401 | .callconv_expr = callconv_expr, |
| 402 | .is_extern_prototype = is_extern, | ||
| 403 | .is_async = is_async, | ||
| 398 | }; | 404 | }; |
| 399 | 405 | ||
| 400 | if (cc) |kind| { | ||
| 401 | switch (kind) { | ||
| 402 | .CC => |token| fn_proto_node.cc_token = token, | ||
| 403 | .Extern => |token| fn_proto_node.extern_export_inline_token = token, | ||
| 404 | } | ||
| 405 | } | ||
| 406 | |||
| 407 | return &fn_proto_node.base; | 406 | return &fn_proto_node.base; |
| 408 | } | 407 | } |
| 409 | 408 | ||
| ... | @@ -1197,6 +1196,7 @@ fn parseSuffixExpr(arena: *Allocator, it: *TokenIterator, tree: *Tree) !?*Node { | ... | @@ -1197,6 +1196,7 @@ fn parseSuffixExpr(arena: *Allocator, it: *TokenIterator, tree: *Tree) !?*Node { |
| 1197 | if (maybe_async) |async_token| { | 1196 | if (maybe_async) |async_token| { |
| 1198 | const token_fn = eatToken(it, .Keyword_fn); | 1197 | const token_fn = eatToken(it, .Keyword_fn); |
| 1199 | if (token_fn != null) { | 1198 | if (token_fn != null) { |
| 1199 | // TODO: remove this hack when async fn rewriting is | ||
| 1200 | // HACK: If we see the keyword `fn`, then we assume that | 1200 | // HACK: If we see the keyword `fn`, then we assume that |
| 1201 | // we are parsing an async fn proto, and not a call. | 1201 | // we are parsing an async fn proto, and not a call. |
| 1202 | // We therefore put back all tokens consumed by the async | 1202 | // We therefore put back all tokens consumed by the async |
| ... | @@ -1205,7 +1205,6 @@ fn parseSuffixExpr(arena: *Allocator, it: *TokenIterator, tree: *Tree) !?*Node { | ... | @@ -1205,7 +1205,6 @@ fn parseSuffixExpr(arena: *Allocator, it: *TokenIterator, tree: *Tree) !?*Node { |
| 1205 | putBackToken(it, async_token); | 1205 | putBackToken(it, async_token); |
| 1206 | return parsePrimaryTypeExpr(arena, it, tree); | 1206 | return parsePrimaryTypeExpr(arena, it, tree); |
| 1207 | } | 1207 | } |
| 1208 | // TODO: Implement hack for parsing `async fn ...` in ast_parse_suffix_expr | ||
| 1209 | var res = try expectNode(arena, it, tree, parsePrimaryTypeExpr, .{ | 1208 | var res = try expectNode(arena, it, tree, parsePrimaryTypeExpr, .{ |
| 1210 | .ExpectedPrimaryTypeExpr = .{ .token = it.index }, | 1209 | .ExpectedPrimaryTypeExpr = .{ .token = it.index }, |
| 1211 | }); | 1210 | }); |
| ... | @@ -1778,24 +1777,6 @@ fn parseCallconv(arena: *Allocator, it: *TokenIterator, tree: *Tree) !?*Node { | ... | @@ -1778,24 +1777,6 @@ fn parseCallconv(arena: *Allocator, it: *TokenIterator, tree: *Tree) !?*Node { |
| 1778 | return expr_node; | 1777 | return expr_node; |
| 1779 | } | 1778 | } |
| 1780 | 1779 | ||
| 1781 | /// FnCC | ||
| 1782 | /// <- KEYWORD_nakedcc | ||
| 1783 | /// / KEYWORD_stdcallcc | ||
| 1784 | /// / KEYWORD_extern | ||
| 1785 | /// / KEYWORD_async | ||
| 1786 | fn parseFnCC(arena: *Allocator, it: *TokenIterator, tree: *Tree) ?FnCC { | ||
| 1787 | if (eatToken(it, .Keyword_nakedcc)) |token| return FnCC{ .CC = token }; | ||
| 1788 | if (eatToken(it, .Keyword_stdcallcc)) |token| return FnCC{ .CC = token }; | ||
| 1789 | if (eatToken(it, .Keyword_extern)) |token| return FnCC{ .Extern = token }; | ||
| 1790 | if (eatToken(it, .Keyword_async)) |token| return FnCC{ .CC = token }; | ||
| 1791 | return null; | ||
| 1792 | } | ||
| 1793 | |||
| 1794 | const FnCC = union(enum) { | ||
| 1795 | CC: TokenIndex, | ||
| 1796 | Extern: TokenIndex, | ||
| 1797 | }; | ||
| 1798 | |||
| 1799 | /// ParamDecl <- (KEYWORD_noalias / KEYWORD_comptime)? (IDENTIFIER COLON)? ParamType | 1780 | /// ParamDecl <- (KEYWORD_noalias / KEYWORD_comptime)? (IDENTIFIER COLON)? ParamType |
| 1800 | fn parseParamDecl(arena: *Allocator, it: *TokenIterator, tree: *Tree) !?*Node { | 1781 | fn parseParamDecl(arena: *Allocator, it: *TokenIterator, tree: *Tree) !?*Node { |
| 1801 | const doc_comments = try parseDocComment(arena, it, tree); | 1782 | const doc_comments = try parseDocComment(arena, it, tree); |
lib/std/zig/parser_test.zig+25-34| ... | @@ -123,22 +123,6 @@ test "zig fmt: trailing comma in fn parameter list" { | ... | @@ -123,22 +123,6 @@ test "zig fmt: trailing comma in fn parameter list" { |
| 123 | ); | 123 | ); |
| 124 | } | 124 | } |
| 125 | 125 | ||
| 126 | // TODO: Remove nakedcc/stdcallcc once zig 0.6.0 is released. See https://github.com/ziglang/zig/pull/3977 | ||
| 127 | test "zig fmt: convert extern/nakedcc/stdcallcc into callconv(...)" { | ||
| 128 | try testTransform( | ||
| 129 | \\nakedcc fn foo1() void {} | ||
| 130 | \\stdcallcc fn foo2() void {} | ||
| 131 | \\extern fn foo3() void {} | ||
| 132 | \\extern "mylib" fn foo4() void {} | ||
| 133 | , | ||
| 134 | \\fn foo1() callconv(.Naked) void {} | ||
| 135 | \\fn foo2() callconv(.Stdcall) void {} | ||
| 136 | \\fn foo3() callconv(.C) void {} | ||
| 137 | \\fn foo4() callconv(.C) void {} | ||
| 138 | \\ | ||
| 139 | ); | ||
| 140 | } | ||
| 141 | |||
| 142 | test "zig fmt: comptime struct field" { | 126 | test "zig fmt: comptime struct field" { |
| 143 | try testCanonical( | 127 | try testCanonical( |
| 144 | \\const Foo = struct { | 128 | \\const Foo = struct { |
| ... | @@ -252,10 +236,10 @@ test "zig fmt: anon list literal syntax" { | ... | @@ -252,10 +236,10 @@ test "zig fmt: anon list literal syntax" { |
| 252 | test "zig fmt: async function" { | 236 | test "zig fmt: async function" { |
| 253 | try testCanonical( | 237 | try testCanonical( |
| 254 | \\pub const Server = struct { | 238 | \\pub const Server = struct { |
| 255 | \\ handleRequestFn: async fn (*Server, *const std.net.Address, File) void, | 239 | \\ handleRequestFn: fn (*Server, *const std.net.Address, File) callconv(.Async) void, |
| 256 | \\}; | 240 | \\}; |
| 257 | \\test "hi" { | 241 | \\test "hi" { |
| 258 | \\ var ptr = @ptrCast(async fn (i32) void, other); | 242 | \\ var ptr = @ptrCast(fn (i32) callconv(.Async) void, other); |
| 259 | \\} | 243 | \\} |
| 260 | \\ | 244 | \\ |
| 261 | ); | 245 | ); |
| ... | @@ -451,15 +435,6 @@ test "zig fmt: aligned struct field" { | ... | @@ -451,15 +435,6 @@ test "zig fmt: aligned struct field" { |
| 451 | ); | 435 | ); |
| 452 | } | 436 | } |
| 453 | 437 | ||
| 454 | test "zig fmt: preserve space between async fn definitions" { | ||
| 455 | try testCanonical( | ||
| 456 | \\async fn a() void {} | ||
| 457 | \\ | ||
| 458 | \\async fn b() void {} | ||
| 459 | \\ | ||
| 460 | ); | ||
| 461 | } | ||
| 462 | |||
| 463 | test "zig fmt: comment to disable/enable zig fmt first" { | 438 | test "zig fmt: comment to disable/enable zig fmt first" { |
| 464 | try testCanonical( | 439 | try testCanonical( |
| 465 | \\// Test trailing comma syntax | 440 | \\// Test trailing comma syntax |
| ... | @@ -1515,7 +1490,7 @@ test "zig fmt: line comments in struct initializer" { | ... | @@ -1515,7 +1490,7 @@ test "zig fmt: line comments in struct initializer" { |
| 1515 | 1490 | ||
| 1516 | test "zig fmt: first line comment in struct initializer" { | 1491 | test "zig fmt: first line comment in struct initializer" { |
| 1517 | try testCanonical( | 1492 | try testCanonical( |
| 1518 | \\pub async fn acquire(self: *Self) HeldLock { | 1493 | \\pub fn acquire(self: *Self) HeldLock { |
| 1519 | \\ return HeldLock{ | 1494 | \\ return HeldLock{ |
| 1520 | \\ // guaranteed allocation elision | 1495 | \\ // guaranteed allocation elision |
| 1521 | \\ .held = self.lock.acquire(), | 1496 | \\ .held = self.lock.acquire(), |
| ... | @@ -2477,8 +2452,7 @@ test "zig fmt: fn type" { | ... | @@ -2477,8 +2452,7 @@ test "zig fmt: fn type" { |
| 2477 | \\} | 2452 | \\} |
| 2478 | \\ | 2453 | \\ |
| 2479 | \\const a: fn (u8) u8 = undefined; | 2454 | \\const a: fn (u8) u8 = undefined; |
| 2480 | \\const b: extern fn (u8) u8 = undefined; | 2455 | \\const b: fn (u8) callconv(.Naked) u8 = undefined; |
| 2481 | \\const c: fn (u8) callconv(.Naked) u8 = undefined; | ||
| 2482 | \\const ap: fn (u8) u8 = a; | 2456 | \\const ap: fn (u8) u8 = a; |
| 2483 | \\ | 2457 | \\ |
| 2484 | ); | 2458 | ); |
| ... | @@ -2500,7 +2474,7 @@ test "zig fmt: inline asm" { | ... | @@ -2500,7 +2474,7 @@ test "zig fmt: inline asm" { |
| 2500 | 2474 | ||
| 2501 | test "zig fmt: async functions" { | 2475 | test "zig fmt: async functions" { |
| 2502 | try testCanonical( | 2476 | try testCanonical( |
| 2503 | \\async fn simpleAsyncFn() void { | 2477 | \\fn simpleAsyncFn() void { |
| 2504 | \\ const a = async a.b(); | 2478 | \\ const a = async a.b(); |
| 2505 | \\ x += 1; | 2479 | \\ x += 1; |
| 2506 | \\ suspend; | 2480 | \\ suspend; |
| ... | @@ -2940,6 +2914,26 @@ test "zig fmt: noasync to nosuspend" { | ... | @@ -2940,6 +2914,26 @@ test "zig fmt: noasync to nosuspend" { |
| 2940 | ); | 2914 | ); |
| 2941 | } | 2915 | } |
| 2942 | 2916 | ||
| 2917 | test "zig fmt: convert async fn into callconv(.Async)" { | ||
| 2918 | try testTransform( | ||
| 2919 | \\async fn foo() void {} | ||
| 2920 | , | ||
| 2921 | \\fn foo() callconv(.Async) void {} | ||
| 2922 | \\ | ||
| 2923 | ); | ||
| 2924 | } | ||
| 2925 | |||
| 2926 | test "zig fmt: convert extern fn proto into callconv(.C)" { | ||
| 2927 | try testTransform( | ||
| 2928 | \\extern fn foo0() void {} | ||
| 2929 | \\const foo1 = extern fn () void; | ||
| 2930 | , | ||
| 2931 | \\extern fn foo0() void {} | ||
| 2932 | \\const foo1 = fn () callconv(.C) void; | ||
| 2933 | \\ | ||
| 2934 | ); | ||
| 2935 | } | ||
| 2936 | |||
| 2943 | const std = @import("std"); | 2937 | const std = @import("std"); |
| 2944 | const mem = std.mem; | 2938 | const mem = std.mem; |
| 2945 | const warn = std.debug.warn; | 2939 | const warn = std.debug.warn; |
| ... | @@ -2986,7 +2980,6 @@ fn testParse(source: []const u8, allocator: *mem.Allocator, anything_changed: *b | ... | @@ -2986,7 +2980,6 @@ fn testParse(source: []const u8, allocator: *mem.Allocator, anything_changed: *b |
| 2986 | anything_changed.* = try std.zig.render(allocator, buffer.outStream(), tree); | 2980 | anything_changed.* = try std.zig.render(allocator, buffer.outStream(), tree); |
| 2987 | return buffer.toOwnedSlice(); | 2981 | return buffer.toOwnedSlice(); |
| 2988 | } | 2982 | } |
| 2989 | |||
| 2990 | fn testTransform(source: []const u8, expected_source: []const u8) !void { | 2983 | fn testTransform(source: []const u8, expected_source: []const u8) !void { |
| 2991 | const needed_alloc_count = x: { | 2984 | const needed_alloc_count = x: { |
| 2992 | // Try it once with unlimited memory, make sure it works | 2985 | // Try it once with unlimited memory, make sure it works |
| ... | @@ -3034,11 +3027,9 @@ fn testTransform(source: []const u8, expected_source: []const u8) !void { | ... | @@ -3034,11 +3027,9 @@ fn testTransform(source: []const u8, expected_source: []const u8) !void { |
| 3034 | } | 3027 | } |
| 3035 | } | 3028 | } |
| 3036 | } | 3029 | } |
| 3037 | |||
| 3038 | fn testCanonical(source: []const u8) !void { | 3030 | fn testCanonical(source: []const u8) !void { |
| 3039 | return testTransform(source, source); | 3031 | return testTransform(source, source); |
| 3040 | } | 3032 | } |
| 3041 | |||
| 3042 | fn testError(source: []const u8) !void { | 3033 | fn testError(source: []const u8) !void { |
| 3043 | const tree = try std.zig.parse(std.testing.allocator, source); | 3034 | const tree = try std.zig.parse(std.testing.allocator, source); |
| 3044 | defer tree.deinit(); | 3035 | defer tree.deinit(); |
lib/std/zig/render.zig+6-23| ... | @@ -1413,32 +1413,15 @@ fn renderExpression( | ... | @@ -1413,32 +1413,15 @@ fn renderExpression( |
| 1413 | try renderToken(tree, stream, visib_token_index, indent, start_col, Space.Space); // pub | 1413 | try renderToken(tree, stream, visib_token_index, indent, start_col, Space.Space); // pub |
| 1414 | } | 1414 | } |
| 1415 | 1415 | ||
| 1416 | // Some extra machinery is needed to rewrite the old-style cc | ||
| 1417 | // notation to the new callconv one | ||
| 1418 | var cc_rewrite_str: ?[*:0]const u8 = null; | ||
| 1419 | if (fn_proto.extern_export_inline_token) |extern_export_inline_token| { | 1416 | if (fn_proto.extern_export_inline_token) |extern_export_inline_token| { |
| 1420 | const tok = tree.tokens.at(extern_export_inline_token); | 1417 | if (!fn_proto.is_extern_prototype) |
| 1421 | if (tok.id != .Keyword_extern or fn_proto.body_node == null) { | 1418 | try renderToken(tree, stream, extern_export_inline_token, indent, start_col, Space.Space); // extern/export/inline |
| 1422 | try renderToken(tree, stream, extern_export_inline_token, indent, start_col, Space.Space); // extern/export | ||
| 1423 | } else { | ||
| 1424 | cc_rewrite_str = ".C"; | ||
| 1425 | fn_proto.lib_name = null; | ||
| 1426 | } | ||
| 1427 | } | 1419 | } |
| 1428 | 1420 | ||
| 1429 | if (fn_proto.lib_name) |lib_name| { | 1421 | if (fn_proto.lib_name) |lib_name| { |
| 1430 | try renderExpression(allocator, stream, tree, indent, start_col, lib_name, Space.Space); | 1422 | try renderExpression(allocator, stream, tree, indent, start_col, lib_name, Space.Space); |
| 1431 | } | 1423 | } |
| 1432 | 1424 | ||
| 1433 | if (fn_proto.cc_token) |cc_token| { | ||
| 1434 | var str = tree.tokenSlicePtr(tree.tokens.at(cc_token)); | ||
| 1435 | if (mem.eql(u8, str, "stdcallcc")) { | ||
| 1436 | cc_rewrite_str = ".Stdcall"; | ||
| 1437 | } else if (mem.eql(u8, str, "nakedcc")) { | ||
| 1438 | cc_rewrite_str = ".Naked"; | ||
| 1439 | } else try renderToken(tree, stream, cc_token, indent, start_col, Space.Space); // stdcallcc | ||
| 1440 | } | ||
| 1441 | |||
| 1442 | const lparen = if (fn_proto.name_token) |name_token| blk: { | 1425 | const lparen = if (fn_proto.name_token) |name_token| blk: { |
| 1443 | try renderToken(tree, stream, fn_proto.fn_token, indent, start_col, Space.Space); // fn | 1426 | try renderToken(tree, stream, fn_proto.fn_token, indent, start_col, Space.Space); // fn |
| 1444 | try renderToken(tree, stream, name_token, indent, start_col, Space.None); // name | 1427 | try renderToken(tree, stream, name_token, indent, start_col, Space.None); // name |
| ... | @@ -1528,10 +1511,10 @@ fn renderExpression( | ... | @@ -1528,10 +1511,10 @@ fn renderExpression( |
| 1528 | try renderToken(tree, stream, callconv_lparen, indent, start_col, Space.None); // ( | 1511 | try renderToken(tree, stream, callconv_lparen, indent, start_col, Space.None); // ( |
| 1529 | try renderExpression(allocator, stream, tree, indent, start_col, callconv_expr, Space.None); | 1512 | try renderExpression(allocator, stream, tree, indent, start_col, callconv_expr, Space.None); |
| 1530 | try renderToken(tree, stream, callconv_rparen, indent, start_col, Space.Space); // ) | 1513 | try renderToken(tree, stream, callconv_rparen, indent, start_col, Space.Space); // ) |
| 1531 | } else if (cc_rewrite_str) |str| { | 1514 | } else if (fn_proto.is_extern_prototype) { |
| 1532 | try stream.writeAll("callconv("); | 1515 | try stream.writeAll("callconv(.C) "); |
| 1533 | try stream.writeAll(mem.spanZ(str)); | 1516 | } else if (fn_proto.is_async) { |
| 1534 | try stream.writeAll(") "); | 1517 | try stream.writeAll("callconv(.Async) "); |
| 1535 | } | 1518 | } |
| 1536 | 1519 | ||
| 1537 | switch (fn_proto.return_type) { | 1520 | switch (fn_proto.return_type) { |
lib/std/zig/tokenizer.zig-6| ... | @@ -47,7 +47,6 @@ pub const Token = struct { | ... | @@ -47,7 +47,6 @@ pub const Token = struct { |
| 47 | Keyword.init("for", .Keyword_for), | 47 | Keyword.init("for", .Keyword_for), |
| 48 | Keyword.init("if", .Keyword_if), | 48 | Keyword.init("if", .Keyword_if), |
| 49 | Keyword.init("inline", .Keyword_inline), | 49 | Keyword.init("inline", .Keyword_inline), |
| 50 | Keyword.init("nakedcc", .Keyword_nakedcc), | ||
| 51 | Keyword.init("noalias", .Keyword_noalias), | 50 | Keyword.init("noalias", .Keyword_noalias), |
| 52 | Keyword.init("noasync", .Keyword_nosuspend), // TODO: remove this | 51 | Keyword.init("noasync", .Keyword_nosuspend), // TODO: remove this |
| 53 | Keyword.init("noinline", .Keyword_noinline), | 52 | Keyword.init("noinline", .Keyword_noinline), |
| ... | @@ -60,7 +59,6 @@ pub const Token = struct { | ... | @@ -60,7 +59,6 @@ pub const Token = struct { |
| 60 | Keyword.init("resume", .Keyword_resume), | 59 | Keyword.init("resume", .Keyword_resume), |
| 61 | Keyword.init("return", .Keyword_return), | 60 | Keyword.init("return", .Keyword_return), |
| 62 | Keyword.init("linksection", .Keyword_linksection), | 61 | Keyword.init("linksection", .Keyword_linksection), |
| 63 | Keyword.init("stdcallcc", .Keyword_stdcallcc), | ||
| 64 | Keyword.init("struct", .Keyword_struct), | 62 | Keyword.init("struct", .Keyword_struct), |
| 65 | Keyword.init("suspend", .Keyword_suspend), | 63 | Keyword.init("suspend", .Keyword_suspend), |
| 66 | Keyword.init("switch", .Keyword_switch), | 64 | Keyword.init("switch", .Keyword_switch), |
| ... | @@ -181,7 +179,6 @@ pub const Token = struct { | ... | @@ -181,7 +179,6 @@ pub const Token = struct { |
| 181 | Keyword_for, | 179 | Keyword_for, |
| 182 | Keyword_if, | 180 | Keyword_if, |
| 183 | Keyword_inline, | 181 | Keyword_inline, |
| 184 | Keyword_nakedcc, | ||
| 185 | Keyword_noalias, | 182 | Keyword_noalias, |
| 186 | Keyword_noinline, | 183 | Keyword_noinline, |
| 187 | Keyword_nosuspend, | 184 | Keyword_nosuspend, |
| ... | @@ -194,7 +191,6 @@ pub const Token = struct { | ... | @@ -194,7 +191,6 @@ pub const Token = struct { |
| 194 | Keyword_resume, | 191 | Keyword_resume, |
| 195 | Keyword_return, | 192 | Keyword_return, |
| 196 | Keyword_linksection, | 193 | Keyword_linksection, |
| 197 | Keyword_stdcallcc, | ||
| 198 | Keyword_struct, | 194 | Keyword_struct, |
| 199 | Keyword_suspend, | 195 | Keyword_suspend, |
| 200 | Keyword_switch, | 196 | Keyword_switch, |
| ... | @@ -306,7 +302,6 @@ pub const Token = struct { | ... | @@ -306,7 +302,6 @@ pub const Token = struct { |
| 306 | .Keyword_for => "for", | 302 | .Keyword_for => "for", |
| 307 | .Keyword_if => "if", | 303 | .Keyword_if => "if", |
| 308 | .Keyword_inline => "inline", | 304 | .Keyword_inline => "inline", |
| 309 | .Keyword_nakedcc => "nakedcc", | ||
| 310 | .Keyword_noalias => "noalias", | 305 | .Keyword_noalias => "noalias", |
| 311 | .Keyword_noinline => "noinline", | 306 | .Keyword_noinline => "noinline", |
| 312 | .Keyword_nosuspend => "nosuspend", | 307 | .Keyword_nosuspend => "nosuspend", |
| ... | @@ -318,7 +313,6 @@ pub const Token = struct { | ... | @@ -318,7 +313,6 @@ pub const Token = struct { |
| 318 | .Keyword_resume => "resume", | 313 | .Keyword_resume => "resume", |
| 319 | .Keyword_return => "return", | 314 | .Keyword_return => "return", |
| 320 | .Keyword_linksection => "linksection", | 315 | .Keyword_linksection => "linksection", |
| 321 | .Keyword_stdcallcc => "stdcallcc", | ||
| 322 | .Keyword_struct => "struct", | 316 | .Keyword_struct => "struct", |
| 323 | .Keyword_suspend => "suspend", | 317 | .Keyword_suspend => "suspend", |
| 324 | .Keyword_switch => "switch", | 318 | .Keyword_switch => "switch", |
src-self-hosted/clang.zig+1-1| ... | @@ -781,7 +781,7 @@ pub extern fn ZigClangSourceManager_getCharacterData(self: ?*const struct_ZigCla | ... | @@ -781,7 +781,7 @@ pub extern fn ZigClangSourceManager_getCharacterData(self: ?*const struct_ZigCla |
| 781 | pub extern fn ZigClangASTContext_getPointerType(self: ?*const struct_ZigClangASTContext, T: struct_ZigClangQualType) struct_ZigClangQualType; | 781 | pub extern fn ZigClangASTContext_getPointerType(self: ?*const struct_ZigClangASTContext, T: struct_ZigClangQualType) struct_ZigClangQualType; |
| 782 | pub extern fn ZigClangASTUnit_getASTContext(self: ?*struct_ZigClangASTUnit) ?*struct_ZigClangASTContext; | 782 | pub extern fn ZigClangASTUnit_getASTContext(self: ?*struct_ZigClangASTUnit) ?*struct_ZigClangASTContext; |
| 783 | pub extern fn ZigClangASTUnit_getSourceManager(self: *struct_ZigClangASTUnit) *struct_ZigClangSourceManager; | 783 | pub extern fn ZigClangASTUnit_getSourceManager(self: *struct_ZigClangASTUnit) *struct_ZigClangSourceManager; |
| 784 | pub extern fn ZigClangASTUnit_visitLocalTopLevelDecls(self: *struct_ZigClangASTUnit, context: ?*c_void, Fn: ?extern fn (?*c_void, *const struct_ZigClangDecl) bool) bool; | 784 | pub extern fn ZigClangASTUnit_visitLocalTopLevelDecls(self: *struct_ZigClangASTUnit, context: ?*c_void, Fn: ?fn (?*c_void, *const struct_ZigClangDecl) callconv(.C) bool) bool; |
| 785 | pub extern fn ZigClangRecordType_getDecl(record_ty: ?*const struct_ZigClangRecordType) *const struct_ZigClangRecordDecl; | 785 | pub extern fn ZigClangRecordType_getDecl(record_ty: ?*const struct_ZigClangRecordType) *const struct_ZigClangRecordDecl; |
| 786 | pub extern fn ZigClangTagDecl_isThisDeclarationADefinition(self: *const ZigClangTagDecl) bool; | 786 | pub extern fn ZigClangTagDecl_isThisDeclarationADefinition(self: *const ZigClangTagDecl) bool; |
| 787 | pub extern fn ZigClangEnumType_getDecl(record_ty: ?*const struct_ZigClangEnumType) *const struct_ZigClangEnumDecl; | 787 | pub extern fn ZigClangEnumType_getDecl(record_ty: ?*const struct_ZigClangEnumType) *const struct_ZigClangEnumDecl; |
src-self-hosted/main.zig+2-3| ... | @@ -41,7 +41,7 @@ const usage = | ... | @@ -41,7 +41,7 @@ const usage = |
| 41 | 41 | ||
| 42 | const Command = struct { | 42 | const Command = struct { |
| 43 | name: []const u8, | 43 | name: []const u8, |
| 44 | exec: async fn (*Allocator, []const []const u8) anyerror!void, | 44 | exec: fn (*Allocator, []const []const u8) callconv(.Async) anyerror!void, |
| 45 | }; | 45 | }; |
| 46 | 46 | ||
| 47 | pub fn main() !void { | 47 | pub fn main() !void { |
| ... | @@ -713,8 +713,7 @@ const FmtError = error{ | ... | @@ -713,8 +713,7 @@ const FmtError = error{ |
| 713 | FileBusy, | 713 | FileBusy, |
| 714 | CurrentWorkingDirectoryUnlinked, | 714 | CurrentWorkingDirectoryUnlinked, |
| 715 | } || fs.File.OpenError; | 715 | } || fs.File.OpenError; |
| 716 | 716 | fn fmtPath(fmt: *Fmt, file_path_ref: []const u8, check_mode: bool) callconv(.Async) FmtError!void { | |
| 717 | async fn fmtPath(fmt: *Fmt, file_path_ref: []const u8, check_mode: bool) FmtError!void { | ||
| 718 | const stderr_file = io.getStdErr(); | 717 | const stderr_file = io.getStdErr(); |
| 719 | const stderr = stderr_file.outStream(); | 718 | const stderr = stderr_file.outStream(); |
| 720 | 719 |
src-self-hosted/translate_c.zig-3| ... | @@ -4121,7 +4121,6 @@ fn transCreateNodeMacroFn(c: *Context, name: []const u8, ref: *ast.Node, proto_a | ... | @@ -4121,7 +4121,6 @@ fn transCreateNodeMacroFn(c: *Context, name: []const u8, ref: *ast.Node, proto_a |
| 4121 | .return_type = proto_alias.return_type, | 4121 | .return_type = proto_alias.return_type, |
| 4122 | .var_args_token = null, | 4122 | .var_args_token = null, |
| 4123 | .extern_export_inline_token = inline_tok, | 4123 | .extern_export_inline_token = inline_tok, |
| 4124 | .cc_token = null, | ||
| 4125 | .body_node = null, | 4124 | .body_node = null, |
| 4126 | .lib_name = null, | 4125 | .lib_name = null, |
| 4127 | .align_expr = null, | 4126 | .align_expr = null, |
| ... | @@ -4780,7 +4779,6 @@ fn finishTransFnProto( | ... | @@ -4780,7 +4779,6 @@ fn finishTransFnProto( |
| 4780 | .return_type = .{ .Explicit = return_type_node }, | 4779 | .return_type = .{ .Explicit = return_type_node }, |
| 4781 | .var_args_token = null, // TODO this field is broken in the AST data model | 4780 | .var_args_token = null, // TODO this field is broken in the AST data model |
| 4782 | .extern_export_inline_token = extern_export_inline_tok, | 4781 | .extern_export_inline_token = extern_export_inline_tok, |
| 4783 | .cc_token = null, | ||
| 4784 | .body_node = null, | 4782 | .body_node = null, |
| 4785 | .lib_name = null, | 4783 | .lib_name = null, |
| 4786 | .align_expr = align_expr, | 4784 | .align_expr = align_expr, |
| ... | @@ -5146,7 +5144,6 @@ fn transMacroFnDefine(c: *Context, it: *CTokenList.Iterator, source: []const u8, | ... | @@ -5146,7 +5144,6 @@ fn transMacroFnDefine(c: *Context, it: *CTokenList.Iterator, source: []const u8, |
| 5146 | .return_type = .{ .Explicit = &type_of.base }, | 5144 | .return_type = .{ .Explicit = &type_of.base }, |
| 5147 | .doc_comments = null, | 5145 | .doc_comments = null, |
| 5148 | .var_args_token = null, | 5146 | .var_args_token = null, |
| 5149 | .cc_token = null, | ||
| 5150 | .body_node = null, | 5147 | .body_node = null, |
| 5151 | .lib_name = null, | 5148 | .lib_name = null, |
| 5152 | .align_expr = null, | 5149 | .align_expr = null, |
src/all_types.hpp-1| ... | @@ -718,7 +718,6 @@ struct AstNodeFnProto { | ... | @@ -718,7 +718,6 @@ struct AstNodeFnProto { |
| 718 | Buf doc_comments; | 718 | Buf doc_comments; |
| 719 | 719 | ||
| 720 | FnInline fn_inline; | 720 | FnInline fn_inline; |
| 721 | bool is_async; | ||
| 722 | 721 | ||
| 723 | VisibMod visib_mod; | 722 | VisibMod visib_mod; |
| 724 | bool auto_err_set; | 723 | bool auto_err_set; |
src/analyze.cpp-2| ... | @@ -1528,8 +1528,6 @@ ZigType *get_generic_fn_type(CodeGen *g, FnTypeId *fn_type_id) { | ... | @@ -1528,8 +1528,6 @@ ZigType *get_generic_fn_type(CodeGen *g, FnTypeId *fn_type_id) { |
| 1528 | } | 1528 | } |
| 1529 | 1529 | ||
| 1530 | CallingConvention cc_from_fn_proto(AstNodeFnProto *fn_proto) { | 1530 | CallingConvention cc_from_fn_proto(AstNodeFnProto *fn_proto) { |
| 1531 | if (fn_proto->is_async) | ||
| 1532 | return CallingConventionAsync; | ||
| 1533 | // Compatible with the C ABI | 1531 | // Compatible with the C ABI |
| 1534 | if (fn_proto->is_extern || fn_proto->is_export) | 1532 | if (fn_proto->is_extern || fn_proto->is_export) |
| 1535 | return CallingConventionC; | 1533 | return CallingConventionC; |
src/parser.cpp+5-53| ... | @@ -93,7 +93,6 @@ static AstNode *ast_parse_field_init(ParseContext *pc); | ... | @@ -93,7 +93,6 @@ static AstNode *ast_parse_field_init(ParseContext *pc); |
| 93 | static AstNode *ast_parse_while_continue_expr(ParseContext *pc); | 93 | static AstNode *ast_parse_while_continue_expr(ParseContext *pc); |
| 94 | static AstNode *ast_parse_link_section(ParseContext *pc); | 94 | static AstNode *ast_parse_link_section(ParseContext *pc); |
| 95 | static AstNode *ast_parse_callconv(ParseContext *pc); | 95 | static AstNode *ast_parse_callconv(ParseContext *pc); |
| 96 | static Optional<AstNodeFnProto> ast_parse_fn_cc(ParseContext *pc); | ||
| 97 | static AstNode *ast_parse_param_decl(ParseContext *pc); | 96 | static AstNode *ast_parse_param_decl(ParseContext *pc); |
| 98 | static AstNode *ast_parse_param_type(ParseContext *pc); | 97 | static AstNode *ast_parse_param_type(ParseContext *pc); |
| 99 | static AstNode *ast_parse_if_prefix(ParseContext *pc); | 98 | static AstNode *ast_parse_if_prefix(ParseContext *pc); |
| ... | @@ -707,7 +706,6 @@ static AstNode *ast_parse_top_level_decl(ParseContext *pc, VisibMod visib_mod, B | ... | @@ -707,7 +706,6 @@ static AstNode *ast_parse_top_level_decl(ParseContext *pc, VisibMod visib_mod, B |
| 707 | fn_proto->column = first->start_column; | 706 | fn_proto->column = first->start_column; |
| 708 | fn_proto->data.fn_proto.visib_mod = visib_mod; | 707 | fn_proto->data.fn_proto.visib_mod = visib_mod; |
| 709 | fn_proto->data.fn_proto.doc_comments = *doc_comments; | 708 | fn_proto->data.fn_proto.doc_comments = *doc_comments; |
| 710 | // ast_parse_fn_cc may set it | ||
| 711 | if (!fn_proto->data.fn_proto.is_extern) | 709 | if (!fn_proto->data.fn_proto.is_extern) |
| 712 | fn_proto->data.fn_proto.is_extern = first->id == TokenIdKeywordExtern; | 710 | fn_proto->data.fn_proto.is_extern = first->id == TokenIdKeywordExtern; |
| 713 | fn_proto->data.fn_proto.is_export = first->id == TokenIdKeywordExport; | 711 | fn_proto->data.fn_proto.is_export = first->id == TokenIdKeywordExport; |
| ... | @@ -788,29 +786,11 @@ static AstNode *ast_parse_top_level_decl(ParseContext *pc, VisibMod visib_mod, B | ... | @@ -788,29 +786,11 @@ static AstNode *ast_parse_top_level_decl(ParseContext *pc, VisibMod visib_mod, B |
| 788 | return nullptr; | 786 | return nullptr; |
| 789 | } | 787 | } |
| 790 | 788 | ||
| 791 | // FnProto <- FnCC? KEYWORD_fn IDENTIFIER? LPAREN ParamDeclList RPAREN ByteAlign? LinkSection? EXCLAMATIONMARK? (KEYWORD_var / TypeExpr) | 789 | // FnProto <- KEYWORD_fn IDENTIFIER? LPAREN ParamDeclList RPAREN ByteAlign? LinkSection? EXCLAMATIONMARK? (KEYWORD_var / TypeExpr) |
| 792 | static AstNode *ast_parse_fn_proto(ParseContext *pc) { | 790 | static AstNode *ast_parse_fn_proto(ParseContext *pc) { |
| 793 | Token *first = peek_token(pc); | 791 | Token *first = eat_token_if(pc, TokenIdKeywordFn); |
| 794 | AstNodeFnProto fn_cc; | 792 | if (first == nullptr) { |
| 795 | Token *fn; | 793 | return nullptr; |
| 796 | if (ast_parse_fn_cc(pc).unwrap(&fn_cc)) { | ||
| 797 | // The extern keyword for fn CC is also used for container decls. | ||
| 798 | // We therefore put it back, as allow container decl to consume it | ||
| 799 | // later. | ||
| 800 | if (fn_cc.is_extern) { | ||
| 801 | fn = eat_token_if(pc, TokenIdKeywordFn); | ||
| 802 | if (fn == nullptr) { | ||
| 803 | put_back_token(pc); | ||
| 804 | return nullptr; | ||
| 805 | } | ||
| 806 | } else { | ||
| 807 | fn = expect_token(pc, TokenIdKeywordFn); | ||
| 808 | } | ||
| 809 | } else { | ||
| 810 | fn_cc = {}; | ||
| 811 | fn = eat_token_if(pc, TokenIdKeywordFn); | ||
| 812 | if (fn == nullptr) | ||
| 813 | return nullptr; | ||
| 814 | } | 794 | } |
| 815 | 795 | ||
| 816 | Token *identifier = eat_token_if(pc, TokenIdSymbol); | 796 | Token *identifier = eat_token_if(pc, TokenIdSymbol); |
| ... | @@ -830,7 +810,7 @@ static AstNode *ast_parse_fn_proto(ParseContext *pc) { | ... | @@ -830,7 +810,7 @@ static AstNode *ast_parse_fn_proto(ParseContext *pc) { |
| 830 | } | 810 | } |
| 831 | 811 | ||
| 832 | AstNode *res = ast_create_node(pc, NodeTypeFnProto, first); | 812 | AstNode *res = ast_create_node(pc, NodeTypeFnProto, first); |
| 833 | res->data.fn_proto = fn_cc; | 813 | res->data.fn_proto = {}; |
| 834 | res->data.fn_proto.name = token_buf(identifier); | 814 | res->data.fn_proto.name = token_buf(identifier); |
| 835 | res->data.fn_proto.params = params; | 815 | res->data.fn_proto.params = params; |
| 836 | res->data.fn_proto.align_expr = align_expr; | 816 | res->data.fn_proto.align_expr = align_expr; |
| ... | @@ -1524,17 +1504,6 @@ static AstNode *ast_parse_error_union_expr(ParseContext *pc) { | ... | @@ -1524,17 +1504,6 @@ static AstNode *ast_parse_error_union_expr(ParseContext *pc) { |
| 1524 | static AstNode *ast_parse_suffix_expr(ParseContext *pc) { | 1504 | static AstNode *ast_parse_suffix_expr(ParseContext *pc) { |
| 1525 | Token *async_token = eat_token_if(pc, TokenIdKeywordAsync); | 1505 | Token *async_token = eat_token_if(pc, TokenIdKeywordAsync); |
| 1526 | if (async_token) { | 1506 | if (async_token) { |
| 1527 | if (eat_token_if(pc, TokenIdKeywordFn) != nullptr) { | ||
| 1528 | // HACK: If we see the keyword `fn`, then we assume that | ||
| 1529 | // we are parsing an async fn proto, and not a call. | ||
| 1530 | // We therefore put back all tokens consumed by the async | ||
| 1531 | // prefix... | ||
| 1532 | put_back_token(pc); | ||
| 1533 | put_back_token(pc); | ||
| 1534 | |||
| 1535 | return ast_parse_primary_type_expr(pc); | ||
| 1536 | } | ||
| 1537 | |||
| 1538 | AstNode *child = ast_expect(pc, ast_parse_primary_type_expr); | 1507 | AstNode *child = ast_expect(pc, ast_parse_primary_type_expr); |
| 1539 | while (true) { | 1508 | while (true) { |
| 1540 | AstNode *suffix = ast_parse_suffix_op(pc); | 1509 | AstNode *suffix = ast_parse_suffix_op(pc); |
| ... | @@ -2187,23 +2156,6 @@ static AstNode *ast_parse_callconv(ParseContext *pc) { | ... | @@ -2187,23 +2156,6 @@ static AstNode *ast_parse_callconv(ParseContext *pc) { |
| 2187 | return res; | 2156 | return res; |
| 2188 | } | 2157 | } |
| 2189 | 2158 | ||
| 2190 | // FnCC | ||
| 2191 | // <- KEYWORD_extern | ||
| 2192 | // / KEYWORD_async | ||
| 2193 | static Optional<AstNodeFnProto> ast_parse_fn_cc(ParseContext *pc) { | ||
| 2194 | AstNodeFnProto res = {}; | ||
| 2195 | if (eat_token_if(pc, TokenIdKeywordAsync) != nullptr) { | ||
| 2196 | res.is_async = true; | ||
| 2197 | return Optional<AstNodeFnProto>::some(res); | ||
| 2198 | } | ||
| 2199 | if (eat_token_if(pc, TokenIdKeywordExtern) != nullptr) { | ||
| 2200 | res.is_extern = true; | ||
| 2201 | return Optional<AstNodeFnProto>::some(res); | ||
| 2202 | } | ||
| 2203 | |||
| 2204 | return Optional<AstNodeFnProto>::none(); | ||
| 2205 | } | ||
| 2206 | |||
| 2207 | // ParamDecl <- (KEYWORD_noalias / KEYWORD_comptime)? (IDENTIFIER COLON)? ParamType | 2159 | // ParamDecl <- (KEYWORD_noalias / KEYWORD_comptime)? (IDENTIFIER COLON)? ParamType |
| 2208 | static AstNode *ast_parse_param_decl(ParseContext *pc) { | 2160 | static AstNode *ast_parse_param_decl(ParseContext *pc) { |
| 2209 | Buf doc_comments = BUF_INIT; | 2161 | Buf doc_comments = BUF_INIT; |
test/compile_errors.zig+11-11| ... | @@ -802,7 +802,7 @@ pub fn addCases(cases: *tests.CompileErrorContext) void { | ... | @@ -802,7 +802,7 @@ pub fn addCases(cases: *tests.CompileErrorContext) void { |
| 802 | }); | 802 | }); |
| 803 | 803 | ||
| 804 | cases.add("exported async function", | 804 | cases.add("exported async function", |
| 805 | \\export async fn foo() void {} | 805 | \\export fn foo() callconv(.Async) void {} |
| 806 | , &[_][]const u8{ | 806 | , &[_][]const u8{ |
| 807 | "tmp.zig:1:1: error: exported function cannot be async", | 807 | "tmp.zig:1:1: error: exported function cannot be async", |
| 808 | }); | 808 | }); |
| ... | @@ -1281,11 +1281,11 @@ pub fn addCases(cases: *tests.CompileErrorContext) void { | ... | @@ -1281,11 +1281,11 @@ pub fn addCases(cases: *tests.CompileErrorContext) void { |
| 1281 | 1281 | ||
| 1282 | cases.add("bad alignment in @asyncCall", | 1282 | cases.add("bad alignment in @asyncCall", |
| 1283 | \\export fn entry() void { | 1283 | \\export fn entry() void { |
| 1284 | \\ var ptr: async fn () void = func; | 1284 | \\ var ptr: fn () callconv(.Async) void = func; |
| 1285 | \\ var bytes: [64]u8 = undefined; | 1285 | \\ var bytes: [64]u8 = undefined; |
| 1286 | \\ _ = @asyncCall(&bytes, {}, ptr); | 1286 | \\ _ = @asyncCall(&bytes, {}, ptr); |
| 1287 | \\} | 1287 | \\} |
| 1288 | \\async fn func() void {} | 1288 | \\fn func() callconv(.Async) void {} |
| 1289 | , &[_][]const u8{ | 1289 | , &[_][]const u8{ |
| 1290 | "tmp.zig:4:21: error: expected type '[]align(16) u8', found '*[64]u8'", | 1290 | "tmp.zig:4:21: error: expected type '[]align(16) u8', found '*[64]u8'", |
| 1291 | }); | 1291 | }); |
| ... | @@ -1431,7 +1431,7 @@ pub fn addCases(cases: *tests.CompileErrorContext) void { | ... | @@ -1431,7 +1431,7 @@ pub fn addCases(cases: *tests.CompileErrorContext) void { |
| 1431 | \\export fn entry() void { | 1431 | \\export fn entry() void { |
| 1432 | \\ _ = async amain(); | 1432 | \\ _ = async amain(); |
| 1433 | \\} | 1433 | \\} |
| 1434 | \\async fn amain() void { | 1434 | \\fn amain() callconv(.Async) void { |
| 1435 | \\ other(); | 1435 | \\ other(); |
| 1436 | \\} | 1436 | \\} |
| 1437 | \\fn other() void { | 1437 | \\fn other() void { |
| ... | @@ -1447,7 +1447,7 @@ pub fn addCases(cases: *tests.CompileErrorContext) void { | ... | @@ -1447,7 +1447,7 @@ pub fn addCases(cases: *tests.CompileErrorContext) void { |
| 1447 | \\export fn entry() void { | 1447 | \\export fn entry() void { |
| 1448 | \\ _ = async amain(); | 1448 | \\ _ = async amain(); |
| 1449 | \\} | 1449 | \\} |
| 1450 | \\async fn amain() void { | 1450 | \\fn amain() callconv(.Async) void { |
| 1451 | \\ var x: [@sizeOf(@Frame(amain))]u8 = undefined; | 1451 | \\ var x: [@sizeOf(@Frame(amain))]u8 = undefined; |
| 1452 | \\} | 1452 | \\} |
| 1453 | , &[_][]const u8{ | 1453 | , &[_][]const u8{ |
| ... | @@ -1474,7 +1474,7 @@ pub fn addCases(cases: *tests.CompileErrorContext) void { | ... | @@ -1474,7 +1474,7 @@ pub fn addCases(cases: *tests.CompileErrorContext) void { |
| 1474 | \\ var ptr = afunc; | 1474 | \\ var ptr = afunc; |
| 1475 | \\ _ = ptr(); | 1475 | \\ _ = ptr(); |
| 1476 | \\} | 1476 | \\} |
| 1477 | \\async fn afunc() void {} | 1477 | \\fn afunc() callconv(.Async) void {} |
| 1478 | , &[_][]const u8{ | 1478 | , &[_][]const u8{ |
| 1479 | "tmp.zig:6:12: error: function is not comptime-known; @asyncCall required", | 1479 | "tmp.zig:6:12: error: function is not comptime-known; @asyncCall required", |
| 1480 | }); | 1480 | }); |
| ... | @@ -1485,7 +1485,7 @@ pub fn addCases(cases: *tests.CompileErrorContext) void { | ... | @@ -1485,7 +1485,7 @@ pub fn addCases(cases: *tests.CompileErrorContext) void { |
| 1485 | \\ _ = async ptr(); | 1485 | \\ _ = async ptr(); |
| 1486 | \\} | 1486 | \\} |
| 1487 | \\ | 1487 | \\ |
| 1488 | \\async fn afunc() void { } | 1488 | \\fn afunc() callconv(.Async) void { } |
| 1489 | , &[_][]const u8{ | 1489 | , &[_][]const u8{ |
| 1490 | "tmp.zig:3:15: error: function is not comptime-known; @asyncCall required", | 1490 | "tmp.zig:3:15: error: function is not comptime-known; @asyncCall required", |
| 1491 | }); | 1491 | }); |
| ... | @@ -3074,7 +3074,7 @@ pub fn addCases(cases: *tests.CompileErrorContext) void { | ... | @@ -3074,7 +3074,7 @@ pub fn addCases(cases: *tests.CompileErrorContext) void { |
| 3074 | \\export fn entry() void { | 3074 | \\export fn entry() void { |
| 3075 | \\ _ = async foo(); | 3075 | \\ _ = async foo(); |
| 3076 | \\} | 3076 | \\} |
| 3077 | \\async fn foo() void { | 3077 | \\fn foo() void { |
| 3078 | \\ suspend { | 3078 | \\ suspend { |
| 3079 | \\ suspend { | 3079 | \\ suspend { |
| 3080 | \\ } | 3080 | \\ } |
| ... | @@ -3122,7 +3122,7 @@ pub fn addCases(cases: *tests.CompileErrorContext) void { | ... | @@ -3122,7 +3122,7 @@ pub fn addCases(cases: *tests.CompileErrorContext) void { |
| 3122 | \\export fn entry() void { | 3122 | \\export fn entry() void { |
| 3123 | \\ _ = async amain(); | 3123 | \\ _ = async amain(); |
| 3124 | \\} | 3124 | \\} |
| 3125 | \\async fn amain() void { | 3125 | \\fn amain() callconv(.Async) void { |
| 3126 | \\ return error.ShouldBeCompileError; | 3126 | \\ return error.ShouldBeCompileError; |
| 3127 | \\} | 3127 | \\} |
| 3128 | , &[_][]const u8{ | 3128 | , &[_][]const u8{ |
| ... | @@ -3592,7 +3592,7 @@ pub fn addCases(cases: *tests.CompileErrorContext) void { | ... | @@ -3592,7 +3592,7 @@ pub fn addCases(cases: *tests.CompileErrorContext) void { |
| 3592 | }); | 3592 | }); |
| 3593 | 3593 | ||
| 3594 | cases.add("attempt to use 0 bit type in extern fn", | 3594 | cases.add("attempt to use 0 bit type in extern fn", |
| 3595 | \\extern fn foo(ptr: extern fn(*void) void) void; | 3595 | \\extern fn foo(ptr: fn(*void) callconv(.C) void) void; |
| 3596 | \\ | 3596 | \\ |
| 3597 | \\export fn entry() void { | 3597 | \\export fn entry() void { |
| 3598 | \\ foo(bar); | 3598 | \\ foo(bar); |
| ... | @@ -3603,7 +3603,7 @@ pub fn addCases(cases: *tests.CompileErrorContext) void { | ... | @@ -3603,7 +3603,7 @@ pub fn addCases(cases: *tests.CompileErrorContext) void { |
| 3603 | \\ bar(&{}); | 3603 | \\ bar(&{}); |
| 3604 | \\} | 3604 | \\} |
| 3605 | , &[_][]const u8{ | 3605 | , &[_][]const u8{ |
| 3606 | "tmp.zig:1:30: error: parameter of type '*void' has 0 bits; not allowed in function with calling convention 'C'", | 3606 | "tmp.zig:1:23: error: parameter of type '*void' has 0 bits; not allowed in function with calling convention 'C'", |
| 3607 | "tmp.zig:7:11: error: parameter of type '*void' has 0 bits; not allowed in function with calling convention 'C'", | 3607 | "tmp.zig:7:11: error: parameter of type '*void' has 0 bits; not allowed in function with calling convention 'C'", |
| 3608 | }); | 3608 | }); |
| 3609 | 3609 |
test/runtime_safety.zig+4-4| ... | @@ -282,7 +282,7 @@ pub fn addCases(cases: *tests.CompareOutputContext) void { | ... | @@ -282,7 +282,7 @@ pub fn addCases(cases: *tests.CompareOutputContext) void { |
| 282 | \\ var ptr = other; | 282 | \\ var ptr = other; |
| 283 | \\ var frame = @asyncCall(&bytes, {}, ptr); | 283 | \\ var frame = @asyncCall(&bytes, {}, ptr); |
| 284 | \\} | 284 | \\} |
| 285 | \\async fn other() void { | 285 | \\fn other() callconv(.Async) void { |
| 286 | \\ suspend; | 286 | \\ suspend; |
| 287 | \\} | 287 | \\} |
| 288 | ); | 288 | ); |
| ... | @@ -874,16 +874,16 @@ pub fn addCases(cases: *tests.CompareOutputContext) void { | ... | @@ -874,16 +874,16 @@ pub fn addCases(cases: *tests.CompareOutputContext) void { |
| 874 | \\ return &failing_frame; | 874 | \\ return &failing_frame; |
| 875 | \\} | 875 | \\} |
| 876 | \\ | 876 | \\ |
| 877 | \\async fn failing() anyerror!void { | 877 | \\fn failing() anyerror!void { |
| 878 | \\ suspend; | 878 | \\ suspend; |
| 879 | \\ return second(); | 879 | \\ return second(); |
| 880 | \\} | 880 | \\} |
| 881 | \\ | 881 | \\ |
| 882 | \\async fn second() anyerror!void { | 882 | \\fn second() callconv(.Async) anyerror!void { |
| 883 | \\ return error.Fail; | 883 | \\ return error.Fail; |
| 884 | \\} | 884 | \\} |
| 885 | \\ | 885 | \\ |
| 886 | \\async fn printTrace(p: anyframe->anyerror!void) void { | 886 | \\fn printTrace(p: anyframe->anyerror!void) void { |
| 887 | \\ (await p) catch unreachable; | 887 | \\ (await p) catch unreachable; |
| 888 | \\} | 888 | \\} |
| 889 | ); | 889 | ); |
test/stack_traces.zig+1-1| ... | @@ -282,7 +282,7 @@ pub fn addCases(cases: *tests.StackTracesContext) void { | ... | @@ -282,7 +282,7 @@ pub fn addCases(cases: *tests.StackTracesContext) void { |
| 282 | \\source.zig:10:8: [address] in main (test) | 282 | \\source.zig:10:8: [address] in main (test) |
| 283 | \\ foo(); | 283 | \\ foo(); |
| 284 | \\ ^ | 284 | \\ ^ |
| 285 | \\start.zig:250:29: [address] in std.start.posixCallMainAndExit (test) | 285 | \\start.zig:249:29: [address] in std.start.posixCallMainAndExit (test) |
| 286 | \\ return root.main(); | 286 | \\ return root.main(); |
| 287 | \\ ^ | 287 | \\ ^ |
| 288 | \\start.zig:123:5: [address] in std.start._start (test) | 288 | \\start.zig:123:5: [address] in std.start._start (test) |
test/stage1/behavior/async_fn.zig+25-29| ... | @@ -112,12 +112,12 @@ test "@frameSize" { | ... | @@ -112,12 +112,12 @@ test "@frameSize" { |
| 112 | const S = struct { | 112 | const S = struct { |
| 113 | fn doTheTest() void { | 113 | fn doTheTest() void { |
| 114 | { | 114 | { |
| 115 | var ptr = @ptrCast(async fn (i32) void, other); | 115 | var ptr = @ptrCast(fn (i32) callconv(.Async) void, other); |
| 116 | const size = @frameSize(ptr); | 116 | const size = @frameSize(ptr); |
| 117 | expect(size == @sizeOf(@Frame(other))); | 117 | expect(size == @sizeOf(@Frame(other))); |
| 118 | } | 118 | } |
| 119 | { | 119 | { |
| 120 | var ptr = @ptrCast(async fn () void, first); | 120 | var ptr = @ptrCast(fn () callconv(.Async) void, first); |
| 121 | const size = @frameSize(ptr); | 121 | const size = @frameSize(ptr); |
| 122 | expect(size == @sizeOf(@Frame(first))); | 122 | expect(size == @sizeOf(@Frame(first))); |
| 123 | } | 123 | } |
| ... | @@ -184,7 +184,7 @@ test "coroutine suspend with block" { | ... | @@ -184,7 +184,7 @@ test "coroutine suspend with block" { |
| 184 | 184 | ||
| 185 | var a_promise: anyframe = undefined; | 185 | var a_promise: anyframe = undefined; |
| 186 | var global_result = false; | 186 | var global_result = false; |
| 187 | async fn testSuspendBlock() void { | 187 | fn testSuspendBlock() callconv(.Async) void { |
| 188 | suspend { | 188 | suspend { |
| 189 | comptime expect(@TypeOf(@frame()) == *@Frame(testSuspendBlock)); | 189 | comptime expect(@TypeOf(@frame()) == *@Frame(testSuspendBlock)); |
| 190 | a_promise = @frame(); | 190 | a_promise = @frame(); |
| ... | @@ -209,14 +209,14 @@ test "coroutine await" { | ... | @@ -209,14 +209,14 @@ test "coroutine await" { |
| 209 | expect(await_final_result == 1234); | 209 | expect(await_final_result == 1234); |
| 210 | expect(std.mem.eql(u8, &await_points, "abcdefghi")); | 210 | expect(std.mem.eql(u8, &await_points, "abcdefghi")); |
| 211 | } | 211 | } |
| 212 | async fn await_amain() void { | 212 | fn await_amain() callconv(.Async) void { |
| 213 | await_seq('b'); | 213 | await_seq('b'); |
| 214 | var p = async await_another(); | 214 | var p = async await_another(); |
| 215 | await_seq('e'); | 215 | await_seq('e'); |
| 216 | await_final_result = await p; | 216 | await_final_result = await p; |
| 217 | await_seq('h'); | 217 | await_seq('h'); |
| 218 | } | 218 | } |
| 219 | async fn await_another() i32 { | 219 | fn await_another() callconv(.Async) i32 { |
| 220 | await_seq('c'); | 220 | await_seq('c'); |
| 221 | suspend { | 221 | suspend { |
| 222 | await_seq('d'); | 222 | await_seq('d'); |
| ... | @@ -243,14 +243,14 @@ test "coroutine await early return" { | ... | @@ -243,14 +243,14 @@ test "coroutine await early return" { |
| 243 | expect(early_final_result == 1234); | 243 | expect(early_final_result == 1234); |
| 244 | expect(std.mem.eql(u8, &early_points, "abcdef")); | 244 | expect(std.mem.eql(u8, &early_points, "abcdef")); |
| 245 | } | 245 | } |
| 246 | async fn early_amain() void { | 246 | fn early_amain() callconv(.Async) void { |
| 247 | early_seq('b'); | 247 | early_seq('b'); |
| 248 | var p = async early_another(); | 248 | var p = async early_another(); |
| 249 | early_seq('d'); | 249 | early_seq('d'); |
| 250 | early_final_result = await p; | 250 | early_final_result = await p; |
| 251 | early_seq('e'); | 251 | early_seq('e'); |
| 252 | } | 252 | } |
| 253 | async fn early_another() i32 { | 253 | fn early_another() callconv(.Async) i32 { |
| 254 | early_seq('c'); | 254 | early_seq('c'); |
| 255 | return 1234; | 255 | return 1234; |
| 256 | } | 256 | } |
| ... | @@ -266,7 +266,7 @@ fn early_seq(c: u8) void { | ... | @@ -266,7 +266,7 @@ fn early_seq(c: u8) void { |
| 266 | test "async function with dot syntax" { | 266 | test "async function with dot syntax" { |
| 267 | const S = struct { | 267 | const S = struct { |
| 268 | var y: i32 = 1; | 268 | var y: i32 = 1; |
| 269 | async fn foo() void { | 269 | fn foo() callconv(.Async) void { |
| 270 | y += 1; | 270 | y += 1; |
| 271 | suspend; | 271 | suspend; |
| 272 | } | 272 | } |
| ... | @@ -278,7 +278,7 @@ test "async function with dot syntax" { | ... | @@ -278,7 +278,7 @@ test "async function with dot syntax" { |
| 278 | test "async fn pointer in a struct field" { | 278 | test "async fn pointer in a struct field" { |
| 279 | var data: i32 = 1; | 279 | var data: i32 = 1; |
| 280 | const Foo = struct { | 280 | const Foo = struct { |
| 281 | bar: async fn (*i32) void, | 281 | bar: fn (*i32) callconv(.Async) void, |
| 282 | }; | 282 | }; |
| 283 | var foo = Foo{ .bar = simpleAsyncFn2 }; | 283 | var foo = Foo{ .bar = simpleAsyncFn2 }; |
| 284 | var bytes: [64]u8 align(16) = undefined; | 284 | var bytes: [64]u8 align(16) = undefined; |
| ... | @@ -294,8 +294,7 @@ test "async fn pointer in a struct field" { | ... | @@ -294,8 +294,7 @@ test "async fn pointer in a struct field" { |
| 294 | fn doTheAwait(f: anyframe->void) void { | 294 | fn doTheAwait(f: anyframe->void) void { |
| 295 | await f; | 295 | await f; |
| 296 | } | 296 | } |
| 297 | 297 | fn simpleAsyncFn2(y: *i32) callconv(.Async) void { | |
| 298 | async fn simpleAsyncFn2(y: *i32) void { | ||
| 299 | defer y.* += 2; | 298 | defer y.* += 2; |
| 300 | y.* += 1; | 299 | y.* += 1; |
| 301 | suspend; | 300 | suspend; |
| ... | @@ -303,11 +302,10 @@ async fn simpleAsyncFn2(y: *i32) void { | ... | @@ -303,11 +302,10 @@ async fn simpleAsyncFn2(y: *i32) void { |
| 303 | 302 | ||
| 304 | test "@asyncCall with return type" { | 303 | test "@asyncCall with return type" { |
| 305 | const Foo = struct { | 304 | const Foo = struct { |
| 306 | bar: async fn () i32, | 305 | bar: fn () callconv(.Async) i32, |
| 307 | 306 | ||
| 308 | var global_frame: anyframe = undefined; | 307 | var global_frame: anyframe = undefined; |
| 309 | 308 | fn middle() callconv(.Async) i32 { | |
| 310 | async fn middle() i32 { | ||
| 311 | return afunc(); | 309 | return afunc(); |
| 312 | } | 310 | } |
| 313 | 311 | ||
| ... | @@ -338,8 +336,7 @@ test "async fn with inferred error set" { | ... | @@ -338,8 +336,7 @@ test "async fn with inferred error set" { |
| 338 | resume global_frame; | 336 | resume global_frame; |
| 339 | std.testing.expectError(error.Fail, result); | 337 | std.testing.expectError(error.Fail, result); |
| 340 | } | 338 | } |
| 341 | 339 | fn middle() callconv(.Async) !void { | |
| 342 | async fn middle() !void { | ||
| 343 | var f = async middle2(); | 340 | var f = async middle2(); |
| 344 | return await f; | 341 | return await f; |
| 345 | } | 342 | } |
| ... | @@ -376,11 +373,11 @@ fn nonFailing() (anyframe->anyerror!void) { | ... | @@ -376,11 +373,11 @@ fn nonFailing() (anyframe->anyerror!void) { |
| 376 | Static.frame = async suspendThenFail(); | 373 | Static.frame = async suspendThenFail(); |
| 377 | return &Static.frame; | 374 | return &Static.frame; |
| 378 | } | 375 | } |
| 379 | async fn suspendThenFail() anyerror!void { | 376 | fn suspendThenFail() callconv(.Async) anyerror!void { |
| 380 | suspend; | 377 | suspend; |
| 381 | return error.Fail; | 378 | return error.Fail; |
| 382 | } | 379 | } |
| 383 | async fn printTrace(p: anyframe->(anyerror!void)) void { | 380 | fn printTrace(p: anyframe->(anyerror!void)) callconv(.Async) void { |
| 384 | (await p) catch |e| { | 381 | (await p) catch |e| { |
| 385 | std.testing.expect(e == error.Fail); | 382 | std.testing.expect(e == error.Fail); |
| 386 | if (@errorReturnTrace()) |trace| { | 383 | if (@errorReturnTrace()) |trace| { |
| ... | @@ -397,7 +394,7 @@ test "break from suspend" { | ... | @@ -397,7 +394,7 @@ test "break from suspend" { |
| 397 | const p = async testBreakFromSuspend(&my_result); | 394 | const p = async testBreakFromSuspend(&my_result); |
| 398 | std.testing.expect(my_result == 2); | 395 | std.testing.expect(my_result == 2); |
| 399 | } | 396 | } |
| 400 | async fn testBreakFromSuspend(my_result: *i32) void { | 397 | fn testBreakFromSuspend(my_result: *i32) callconv(.Async) void { |
| 401 | suspend { | 398 | suspend { |
| 402 | resume @frame(); | 399 | resume @frame(); |
| 403 | } | 400 | } |
| ... | @@ -826,7 +823,7 @@ test "cast fn to async fn when it is inferred to be async" { | ... | @@ -826,7 +823,7 @@ test "cast fn to async fn when it is inferred to be async" { |
| 826 | var ok = false; | 823 | var ok = false; |
| 827 | 824 | ||
| 828 | fn doTheTest() void { | 825 | fn doTheTest() void { |
| 829 | var ptr: async fn () i32 = undefined; | 826 | var ptr: fn () callconv(.Async) i32 = undefined; |
| 830 | ptr = func; | 827 | ptr = func; |
| 831 | var buf: [100]u8 align(16) = undefined; | 828 | var buf: [100]u8 align(16) = undefined; |
| 832 | var result: i32 = undefined; | 829 | var result: i32 = undefined; |
| ... | @@ -854,7 +851,7 @@ test "cast fn to async fn when it is inferred to be async, awaited directly" { | ... | @@ -854,7 +851,7 @@ test "cast fn to async fn when it is inferred to be async, awaited directly" { |
| 854 | var ok = false; | 851 | var ok = false; |
| 855 | 852 | ||
| 856 | fn doTheTest() void { | 853 | fn doTheTest() void { |
| 857 | var ptr: async fn () i32 = undefined; | 854 | var ptr: fn () callconv(.Async) i32 = undefined; |
| 858 | ptr = func; | 855 | ptr = func; |
| 859 | var buf: [100]u8 align(16) = undefined; | 856 | var buf: [100]u8 align(16) = undefined; |
| 860 | var result: i32 = undefined; | 857 | var result: i32 = undefined; |
| ... | @@ -958,8 +955,7 @@ test "@asyncCall with comptime-known function, but not awaited directly" { | ... | @@ -958,8 +955,7 @@ test "@asyncCall with comptime-known function, but not awaited directly" { |
| 958 | resume global_frame; | 955 | resume global_frame; |
| 959 | std.testing.expectError(error.Fail, result); | 956 | std.testing.expectError(error.Fail, result); |
| 960 | } | 957 | } |
| 961 | 958 | fn middle() callconv(.Async) !void { | |
| 962 | async fn middle() !void { | ||
| 963 | var f = async middle2(); | 959 | var f = async middle2(); |
| 964 | return await f; | 960 | return await f; |
| 965 | } | 961 | } |
| ... | @@ -993,7 +989,7 @@ test "@asyncCall with actual frame instead of byte buffer" { | ... | @@ -993,7 +989,7 @@ test "@asyncCall with actual frame instead of byte buffer" { |
| 993 | 989 | ||
| 994 | test "@asyncCall using the result location inside the frame" { | 990 | test "@asyncCall using the result location inside the frame" { |
| 995 | const S = struct { | 991 | const S = struct { |
| 996 | async fn simple2(y: *i32) i32 { | 992 | fn simple2(y: *i32) callconv(.Async) i32 { |
| 997 | defer y.* += 2; | 993 | defer y.* += 2; |
| 998 | y.* += 1; | 994 | y.* += 1; |
| 999 | suspend; | 995 | suspend; |
| ... | @@ -1005,7 +1001,7 @@ test "@asyncCall using the result location inside the frame" { | ... | @@ -1005,7 +1001,7 @@ test "@asyncCall using the result location inside the frame" { |
| 1005 | }; | 1001 | }; |
| 1006 | var data: i32 = 1; | 1002 | var data: i32 = 1; |
| 1007 | const Foo = struct { | 1003 | const Foo = struct { |
| 1008 | bar: async fn (*i32) i32, | 1004 | bar: fn (*i32) callconv(.Async) i32, |
| 1009 | }; | 1005 | }; |
| 1010 | var foo = Foo{ .bar = S.simple2 }; | 1006 | var foo = Foo{ .bar = S.simple2 }; |
| 1011 | var bytes: [64]u8 align(16) = undefined; | 1007 | var bytes: [64]u8 align(16) = undefined; |
| ... | @@ -1115,7 +1111,7 @@ test "await used in expression and awaiting fn with no suspend but async calling | ... | @@ -1115,7 +1111,7 @@ test "await used in expression and awaiting fn with no suspend but async calling |
| 1115 | const sum = (await f1) + (await f2); | 1111 | const sum = (await f1) + (await f2); |
| 1116 | expect(sum == 10); | 1112 | expect(sum == 10); |
| 1117 | } | 1113 | } |
| 1118 | async fn add(a: i32, b: i32) i32 { | 1114 | fn add(a: i32, b: i32) callconv(.Async) i32 { |
| 1119 | return a + b; | 1115 | return a + b; |
| 1120 | } | 1116 | } |
| 1121 | }; | 1117 | }; |
| ... | @@ -1130,7 +1126,7 @@ test "await used in expression after a fn call" { | ... | @@ -1130,7 +1126,7 @@ test "await used in expression after a fn call" { |
| 1130 | sum = foo() + await f1; | 1126 | sum = foo() + await f1; |
| 1131 | expect(sum == 8); | 1127 | expect(sum == 8); |
| 1132 | } | 1128 | } |
| 1133 | async fn add(a: i32, b: i32) i32 { | 1129 | fn add(a: i32, b: i32) callconv(.Async) i32 { |
| 1134 | return a + b; | 1130 | return a + b; |
| 1135 | } | 1131 | } |
| 1136 | fn foo() i32 { | 1132 | fn foo() i32 { |
| ... | @@ -1147,7 +1143,7 @@ test "async fn call used in expression after a fn call" { | ... | @@ -1147,7 +1143,7 @@ test "async fn call used in expression after a fn call" { |
| 1147 | sum = foo() + add(3, 4); | 1143 | sum = foo() + add(3, 4); |
| 1148 | expect(sum == 8); | 1144 | expect(sum == 8); |
| 1149 | } | 1145 | } |
| 1150 | async fn add(a: i32, b: i32) i32 { | 1146 | fn add(a: i32, b: i32) callconv(.Async) i32 { |
| 1151 | return a + b; | 1147 | return a + b; |
| 1152 | } | 1148 | } |
| 1153 | fn foo() i32 { | 1149 | fn foo() i32 { |
| ... | @@ -1403,7 +1399,7 @@ test "async function call resolves target fn frame, runtime func" { | ... | @@ -1403,7 +1399,7 @@ test "async function call resolves target fn frame, runtime func" { |
| 1403 | fn foo() anyerror!void { | 1399 | fn foo() anyerror!void { |
| 1404 | const stack_size = 1000; | 1400 | const stack_size = 1000; |
| 1405 | var stack_frame: [stack_size]u8 align(std.Target.stack_align) = undefined; | 1401 | var stack_frame: [stack_size]u8 align(std.Target.stack_align) = undefined; |
| 1406 | var func: async fn () anyerror!void = bar; | 1402 | var func: fn () callconv(.Async) anyerror!void = bar; |
| 1407 | return await @asyncCall(&stack_frame, {}, func); | 1403 | return await @asyncCall(&stack_frame, {}, func); |
| 1408 | } | 1404 | } |
| 1409 | 1405 |
test/stage1/behavior/await_struct.zig+2-2| ... | @@ -18,14 +18,14 @@ test "coroutine await struct" { | ... | @@ -18,14 +18,14 @@ test "coroutine await struct" { |
| 18 | expect(await_final_result.x == 1234); | 18 | expect(await_final_result.x == 1234); |
| 19 | expect(std.mem.eql(u8, &await_points, "abcdefghi")); | 19 | expect(std.mem.eql(u8, &await_points, "abcdefghi")); |
| 20 | } | 20 | } |
| 21 | async fn await_amain() void { | 21 | fn await_amain() callconv(.Async) void { |
| 22 | await_seq('b'); | 22 | await_seq('b'); |
| 23 | var p = async await_another(); | 23 | var p = async await_another(); |
| 24 | await_seq('e'); | 24 | await_seq('e'); |
| 25 | await_final_result = await p; | 25 | await_final_result = await p; |
| 26 | await_seq('h'); | 26 | await_seq('h'); |
| 27 | } | 27 | } |
| 28 | async fn await_another() Foo { | 28 | fn await_another() callconv(.Async) Foo { |
| 29 | await_seq('c'); | 29 | await_seq('c'); |
| 30 | suspend { | 30 | suspend { |
| 31 | await_seq('d'); | 31 | await_seq('d'); |
test/stage1/behavior/cast.zig+1-1| ... | @@ -762,7 +762,7 @@ test "variable initialization uses result locations properly with regards to the | ... | @@ -762,7 +762,7 @@ test "variable initialization uses result locations properly with regards to the |
| 762 | 762 | ||
| 763 | test "cast between [*c]T and ?[*:0]T on fn parameter" { | 763 | test "cast between [*c]T and ?[*:0]T on fn parameter" { |
| 764 | const S = struct { | 764 | const S = struct { |
| 765 | const Handler = ?extern fn ([*c]const u8) void; | 765 | const Handler = ?fn ([*c]const u8) callconv(.C) void; |
| 766 | fn addCallback(handler: Handler) void {} | 766 | fn addCallback(handler: Handler) void {} |
| 767 | 767 | ||
| 768 | fn myCallback(cstr: ?[*:0]const u8) callconv(.C) void {} | 768 | fn myCallback(cstr: ?[*:0]const u8) callconv(.C) void {} |