authorgravatar for me@tadeo.caTadeo Kondrak <me@tadeo.ca> 2020-05-04 09:49:27-06:00
committergravatar for me@tadeo.caTadeo Kondrak <me@tadeo.ca> 2020-05-05 09:38:02-06:00
log6745a6f6f6f2b8d4473f00bed03a6cf1af117890
tree37ae8d09b48070877421d18aa79d6a49600210f1
parentd0e996405bff4352c78c570b4944b369d642d058
signature Commit is signed but in an unrecognized format.

zig fmt


56 files changed, 222 insertions(+), 240 deletions(-)

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;
217pub extern "c" fn utimensat(dirfd: fd_t, pathname: [*:0]const u8, times: *[2]timespec, flags: u32) c_int;217pub extern "c" fn utimensat(dirfd: fd_t, pathname: [*:0]const u8, times: *[2]timespec, flags: u32) c_int;
218pub extern "c" fn futimens(fd: fd_t, times: *const [2]timespec) c_int;218pub extern "c" fn futimens(fd: fd_t, times: *const [2]timespec) c_int;
219219
220pub 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;220pub 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;
221pub extern "c" fn pthread_attr_init(attr: *pthread_attr_t) c_int;221pub extern "c" fn pthread_attr_init(attr: *pthread_attr_t) c_int;
222pub extern "c" fn pthread_attr_setstack(attr: *pthread_attr_t, stackaddr: *c_void, stacksize: usize) c_int;222pub extern "c" fn pthread_attr_setstack(attr: *pthread_attr_t, stackaddr: *c_void, stacksize: usize) c_int;
223pub extern "c" fn pthread_attr_setguardsize(attr: *pthread_attr_t, guardsize: usize) c_int;223pub 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;
9pub extern "c" fn sigaltstack(ss: ?*stack_t, old_ss: ?*stack_t) c_int;9pub extern "c" fn sigaltstack(ss: ?*stack_t, old_ss: ?*stack_t) c_int;
10pub extern "c" fn getrandom(buf_ptr: [*]u8, buf_len: usize, flags: c_uint) isize;10pub extern "c" fn getrandom(buf_ptr: [*]u8, buf_len: usize, flags: c_uint) isize;
1111
12pub const dl_iterate_phdr_callback = extern fn (info: *dl_phdr_info, size: usize, data: ?*c_void) c_int;12pub const dl_iterate_phdr_callback = fn (info: *dl_phdr_info, size: usize, data: ?*c_void) callconv(.C) c_int;
13pub extern "c" fn dl_iterate_phdr(callback: dl_iterate_phdr_callback, data: ?*c_void) c_int;13pub extern "c" fn dl_iterate_phdr(callback: dl_iterate_phdr_callback, data: ?*c_void) c_int;
1414
15pub const pthread_mutex_t = extern struct {15pub 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;
2626
27pub const dl_iterate_phdr_callback = extern fn (info: *dl_phdr_info, size: usize, data: ?*c_void) c_int;27pub const dl_iterate_phdr_callback = fn (info: *dl_phdr_info, size: usize, data: ?*c_void) callconv(.C) c_int;
28pub extern "c" fn dl_iterate_phdr(callback: dl_iterate_phdr_callback, data: ?*c_void) c_int;28pub extern "c" fn dl_iterate_phdr(callback: dl_iterate_phdr_callback, data: ?*c_void) c_int;
2929
30pub const pthread_mutex_t = extern struct {30pub 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 this75/// See std.elf for constants for this
76pub extern "c" fn getauxval(__type: c_ulong) c_ulong;76pub extern "c" fn getauxval(__type: c_ulong) c_ulong;
7777
78pub const dl_iterate_phdr_callback = extern fn (info: *dl_phdr_info, size: usize, data: ?*c_void) c_int;78pub const dl_iterate_phdr_callback = fn (info: *dl_phdr_info, size: usize, data: ?*c_void) callconv(.C) c_int;
79pub extern "c" fn dl_iterate_phdr(callback: dl_iterate_phdr_callback, data: ?*c_void) c_int;79pub extern "c" fn dl_iterate_phdr(callback: dl_iterate_phdr_callback, data: ?*c_void) c_int;
8080
81pub extern "c" fn sigaltstack(ss: ?*stack_t, old_ss: ?*stack_t) c_int;81pub 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;
6extern "c" fn __errno() *c_int;6extern "c" fn __errno() *c_int;
7pub const _errno = __errno;7pub const _errno = __errno;
88
9pub const dl_iterate_phdr_callback = extern fn (info: *dl_phdr_info, size: usize, data: ?*c_void) c_int;9pub const dl_iterate_phdr_callback = fn (info: *dl_phdr_info, size: usize, data: ?*c_void) callconv(.C) c_int;
10pub extern "c" fn dl_iterate_phdr(callback: dl_iterate_phdr_callback, data: ?*c_void) c_int;10pub extern "c" fn dl_iterate_phdr(callback: dl_iterate_phdr_callback, data: ?*c_void) c_int;
1111
12pub extern "c" fn arc4random_buf(buf: [*]u8, len: usize) void;12pub 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 {
105105
106 /// await this function to get an item from the channel. If the buffer is empty, the frame will106 /// 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/2765109 // 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}
308308fn testChannelGetter(channel: *Channel(i32)) callconv(.Async) void {
309async 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);
312311
...@@ -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}
324323fn testChannelPutter(channel: *Channel(i32)) callconv(.Async) void {
325async fn testChannelPutter(channel: *Channel(i32)) void {
326 channel.put(1234);324 channel.put(1234);
327 channel.put(4567);325 channel.put(4567);
328}326}
329327fn testPut(channel: *Channel(i32), value: i32) callconv(.Async) void {
330async 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 becomes34 /// 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 since60 /// 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();
9090
...@@ -127,8 +127,7 @@ test "std.event.Group" {...@@ -127,8 +127,7 @@ test "std.event.Group" {
127127
128 const handle = async testGroup(std.heap.page_allocator);128 const handle = async testGroup(std.heap.page_allocator);
129}129}
130130fn testGroup(allocator: *Allocator) callconv(.Async) void {
131async 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}
148147fn sleepALittle(count: *usize) callconv(.Async) void {
149async 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}
153151fn increaseByTen(count: *usize) callconv(.Async) void {
154async 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}
160157fn doSomethingThatFails() callconv(.Async) anyerror!void {}
161async fn doSomethingThatFails() anyerror!void {}158fn somethingElse() callconv(.Async) anyerror!void {
162async 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 }
9191
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());
9494
95 errdefer _ = self.queue.remove(&my_tick_node); // TODO test canceling an acquire95 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}
137137fn testLock(lock: *Lock) callconv(.Async) void {
138async 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 {
167166
168var shared_test_data = [1]i32{0} ** 10;167var shared_test_data = [1]i32{0} ** 10;
169var shared_test_index: usize = 0;168var shared_test_index: usize = 0;
170169fn lockRunner(lock: *Lock) callconv(.Async) void {
171async fn lockRunner(lock: *Lock) void {
172 suspend; // resumed by onNextTick170 suspend; // resumed by onNextTick
173171
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 }
3333
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 elision36 // 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 }
505505
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 }
9999
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);
102102
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 }
132132
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}
228228fn testLock(allocator: *Allocator, lock: *RwLock) callconv(.Async) void {
229async 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;
259var shared_test_data = [1]i32{0} ** 10;258var shared_test_data = [1]i32{0} ** 10;
260var shared_test_index: usize = 0;259var shared_test_index: usize = 0;
261var shared_count: usize = 0;260var shared_count: usize = 0;
262261fn writeRunner(lock: *RwLock) callconv(.Async) void {
263async fn writeRunner(lock: *RwLock) void {
264 suspend; // resumed by onNextTick262 suspend; // resumed by onNextTick
265263
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}
280278fn readRunner(lock: *RwLock) callconv(.Async) void {
281async fn readRunner(lock: *RwLock) void {
282 suspend; // resumed by onNextTick279 suspend; // resumed by onNextTick
283 std.time.sleep(1);280 std.time.sleep(1);
284281
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 }
4242
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 }
4949
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);
125125
126/// Renamed from `sigaction` to `Sigaction` to avoid conflict with function name.126/// Renamed from `sigaction` to `Sigaction` to avoid conflict with function name.
127pub const Sigaction = extern struct {127pub 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;
458pub const S_IFWHT = 57344;458pub const S_IFWHT = 57344;
459pub const S_IFMT = 61440;459pub const S_IFMT = 61440;
460460
461pub const SIG_ERR = @intToPtr(extern fn (i32) void, maxInt(usize));461pub const SIG_ERR = @intToPtr(fn (i32) callconv(.C) void, maxInt(usize));
462pub const SIG_DFL = @intToPtr(extern fn (i32) void, 0);462pub const SIG_DFL = @intToPtr(fn (i32) callconv(.C) void, 0);
463pub const SIG_IGN = @intToPtr(extern fn (i32) void, 1);463pub const SIG_IGN = @intToPtr(fn (i32) callconv(.C) void, 1);
464pub const BADSIG = SIG_ERR;464pub const BADSIG = SIG_ERR;
465pub const SIG_BLOCK = 1;465pub const SIG_BLOCK = 1;
466pub const SIG_UNBLOCK = 2;466pub const SIG_UNBLOCK = 2;
...@@ -519,13 +519,13 @@ pub const sigset_t = extern struct {...@@ -519,13 +519,13 @@ pub const sigset_t = extern struct {
519pub const sig_atomic_t = c_int;519pub const sig_atomic_t = c_int;
520pub const Sigaction = extern struct {520pub 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};
528pub const sig_t = [*c]extern fn (c_int) void;528pub const sig_t = [*c]fn (c_int) callconv(.C) void;
529529
530pub const sigvec = extern struct {530pub 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 {
725725
726const NSIG = 32;726const NSIG = 32;
727727
728pub const SIG_ERR = @intToPtr(extern fn (i32) void, maxInt(usize));728pub const SIG_ERR = @intToPtr(fn (i32) callconv(.C) void, maxInt(usize));
729pub const SIG_DFL = @intToPtr(extern fn (i32) void, 0);729pub const SIG_DFL = @intToPtr(fn (i32) callconv(.C) void, 0);
730pub const SIG_IGN = @intToPtr(extern fn (i32) void, 1);730pub const SIG_IGN = @intToPtr(fn (i32) callconv(.C) void, 1);
731731
732/// Renamed from `sigaction` to `Sigaction` to avoid conflict with the syscall.732/// Renamed from `sigaction` to `Sigaction` to avoid conflict with the syscall.
733pub const Sigaction = extern struct {733pub const Sigaction = extern struct {
734 /// signal handler734 /// 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 },
739739
740 /// see signal options740 /// 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
813pub const k_sigaction = if (is_mips)813pub 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 }
820else820else
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 };
827827
...@@ -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};
836836
837pub const SIG_ERR = @intToPtr(?Sigaction.sigaction_fn, maxInt(usize));837pub 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 {
599var vdso_clock_gettime = @ptrCast(?*const c_void, init_vdso_clock_gettime);599var vdso_clock_gettime = @ptrCast(?*const c_void, init_vdso_clock_gettime);
600600
601// We must follow the C calling convention when we call into the VDSO601// We must follow the C calling convention when we call into the VDSO
602const vdso_clock_gettime_ty = extern fn (i32, *timespec) usize;602const vdso_clock_gettime_ty = fn (i32, *timespec) callconv(.C) usize;
603603
604pub fn clock_gettime(clk_id: i32, tp: *timespec) usize {604pub 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}
8787
88/// This matches the libc clone function.88/// This matches the libc clone function.
89pub extern fn clone(func: extern fn (arg: usize) u8, stack: usize, flags: u32, arg: usize, ptid: *i32, tls: usize, ctid: *i32) usize;89pub extern fn clone(func: fn (arg: usize) callconv(.C) u8, stack: usize, flags: u32, arg: usize, ptid: *i32, tls: usize, ctid: *i32) usize;
9090
91pub fn restore() callconv(.Naked) void {91pub 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}
8787
88/// This matches the libc clone function.88/// This matches the libc clone function.
89pub extern fn clone(func: extern fn (arg: usize) u8, stack: usize, flags: u32, arg: usize, ptid: *i32, tls: usize, ctid: *i32) usize;89pub extern fn clone(func: fn (arg: usize) callconv(.C) u8, stack: usize, flags: u32, arg: usize, ptid: *i32, tls: usize, ctid: *i32) usize;
9090
91pub const restore = restore_rt;91pub const restore = restore_rt;
9292
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}
107107
108/// This matches the libc clone function.108/// This matches the libc clone function.
109pub extern fn clone(func: extern fn (arg: usize) u8, stack: usize, flags: u32, arg: usize, ptid: *i32, tls: usize, ctid: *i32) usize;109pub extern fn clone(func: fn (arg: usize) callconv(.C) u8, stack: usize, flags: u32, arg: usize, ptid: *i32, tls: usize, ctid: *i32) usize;
110110
111pub fn restore() callconv(.Naked) void {111pub 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}
143143
144/// This matches the libc clone function.144/// This matches the libc clone function.
145pub extern fn clone(func: extern fn (arg: usize) u8, stack: usize, flags: u32, arg: usize, ptid: *i32, tls: usize, ctid: *i32) usize;145pub extern fn clone(func: fn (arg: usize) callconv(.C) u8, stack: usize, flags: u32, arg: usize, ptid: *i32, tls: usize, ctid: *i32) usize;
146146
147pub fn restore() callconv(.Naked) void {147pub 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}
8787
88pub extern fn clone(func: extern fn (arg: usize) u8, stack: usize, flags: u32, arg: usize, ptid: *i32, tls: usize, ctid: *i32) usize;88pub extern fn clone(func: fn (arg: usize) callconv(.C) u8, stack: usize, flags: u32, arg: usize, ptid: *i32, tls: usize, ctid: *i32) usize;
8989
90pub const restore = restore_rt;90pub const restore = restore_rt;
9191
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}
8787
88/// This matches the libc clone function.88/// This matches the libc clone function.
89pub extern fn clone(func: extern fn (arg: usize) u8, stack: usize, flags: usize, arg: usize, ptid: *i32, tls: usize, ctid: *i32) usize;89pub extern fn clone(func: fn (arg: usize) callconv(.C) u8, stack: usize, flags: usize, arg: usize, ptid: *i32, tls: usize, ctid: *i32) usize;
9090
91pub const restore = restore_rt;91pub const restore = restore_rt;
9292
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;
55
6/// Protocol for touchscreens6/// Protocol for touchscreens
7pub const AbsolutePointerProtocol = extern struct {7pub 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,
1212
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;
55
6/// Override EDID information6/// Override EDID information
7pub const EdidOverrideProtocol = extern struct {7pub 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,
99
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;
55
6pub const FileProtocol = extern struct {6pub 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,
1818
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;
44
5/// Graphics output5/// Graphics output
6pub const GraphicsOutputProtocol = extern struct {6pub 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,
1111
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.
7pub const HIIDatabaseProtocol = extern struct {7pub const HIIDatabaseProtocol = extern struct {
8 _new_package_list: Status, // TODO8 _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, // TODO13 _register_package_notify: Status, // TODO
14 _unregister_package_notify: Status, // TODO14 _unregister_package_notify: Status, // TODO
15 _find_keyboard_layouts: Status, // TODO15 _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 window6/// Display a popup window
7pub const HIIPopupProtocol = extern struct {7pub 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,
1010
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;
4const Status = uefi.Status;4const Status = uefi.Status;
55
6pub const Ip6ConfigProtocol = extern struct {6pub 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,
1111
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;
7const SimpleNetworkMode = uefi.protocols.SimpleNetworkMode;7const SimpleNetworkMode = uefi.protocols.SimpleNetworkMode;
88
9pub const Ip6Protocol = extern struct {9pub 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,
1919
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;
4const Status = uefi.Status;4const Status = uefi.Status;
55
6pub const Ip6ServiceBindingProtocol = extern struct {6pub 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,
99
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,
2323
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;
7const MacAddress = uefi.protocols.MacAddress;7const MacAddress = uefi.protocols.MacAddress;
88
9pub const ManagedNetworkProtocol = extern struct {9pub 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,
1818
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;
4const Status = uefi.Status;4const Status = uefi.Status;
55
6pub const ManagedNetworkServiceBindingProtocol = extern struct {6pub 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,
99
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;
44
5/// Random Number Generator protocol5/// Random Number Generator protocol
6pub const RNGProtocol = extern struct {6pub 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,
99
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;
55
6pub const SimpleFileSystemProtocol = extern struct {6pub 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,
99
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;
55
6pub const SimpleNetworkProtocol = extern struct {6pub 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,
2323
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;
55
6/// Protocol for mice6/// Protocol for mice
7pub const SimplePointerProtocol = struct {7pub 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,
1212
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;
55
6/// Character input devices, e.g. Keyboard6/// Character input devices, e.g. Keyboard
7pub const SimpleTextInputExProtocol = extern struct {7pub 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,
1414
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 }
2929
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 }
3434
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;
66
7/// Character input devices, e.g. Keyboard7/// Character input devices, e.g. Keyboard
8pub const SimpleTextInputProtocol = extern struct {8pub 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,
1212
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;
44
5/// Character output devices5/// Character output devices
6pub const SimpleTextOutputProtocol = extern struct {6pub 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,
1717
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;
9const SimpleNetworkMode = uefi.protocols.SimpleNetworkMode;9const SimpleNetworkMode = uefi.protocols.SimpleNetworkMode;
1010
11pub const Udp6Protocol = extern struct {11pub 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,
1919
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;
4const Status = uefi.Status;4const Status = uefi.Status;
55
6pub const Udp6ServiceBindingProtocol = extern struct {6pub 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,
99
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,
2222
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,
2525
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,
2828
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,
3131
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,
3434
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,
3737
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,
4040
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,
4343
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,
4646
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,
4949
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,
5252
53 /// Signals an event.53 /// Signals an event.
54 signalEvent: extern fn (Event) Status,54 signalEvent: fn (Event) callconv(.C) Status,
5555
56 /// Closes an event.56 /// Closes an event.
57 closeEvent: extern fn (Event) Status,57 closeEvent: fn (Event) callconv(.C) Status,
5858
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,
6161
62 installProtocolInterface: Status, // TODO62 installProtocolInterface: Status, // TODO
63 reinstallProtocolInterface: Status, // TODO63 reinstallProtocolInterface: Status, // TODO
64 uninstallProtocolInterface: Status, // TODO64 uninstallProtocolInterface: Status, // TODO
6565
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,
6868
69 reserved: *c_void,69 reserved: *c_void,
7070
71 registerProtocolNotify: Status, // TODO71 registerProtocolNotify: Status, // TODO
7272
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,
7575
76 locateDevicePath: Status, // TODO76 locateDevicePath: Status, // TODO
77 installConfigurationTable: Status, // TODO77 installConfigurationTable: Status, // TODO
7878
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,
8181
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,
8484
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,
8787
88 /// Unloads an image.88 /// Unloads an image.
89 unloadImage: extern fn (Handle) Status,89 unloadImage: fn (Handle) callconv(.C) Status,
9090
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,
9393
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,
9696
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,
9999
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,
102102
103 connectController: Status, // TODO103 connectController: Status, // TODO
104 disconnectController: Status, // TODO104 disconnectController: Status, // TODO
105105
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,
108108
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,
111111
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,
114114
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,
117117
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,
120120
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,
123123
124 installMultipleProtocolInterfaces: Status, // TODO124 installMultipleProtocolInterfaces: Status, // TODO
125 uninstallMultipleProtocolInterfaces: Status, // TODO125 uninstallMultipleProtocolInterfaces: Status, // TODO
126126
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,
129129
130 /// Copies the contents of one buffer to another buffer130 /// 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,
132132
133 /// Fills a buffer with a specified value133 /// Fills a buffer with a specified value
134 setMem: extern fn ([*]u8, usize, u8) void,134 setMem: fn ([*]u8, usize, u8) callconv(.C) void,
135135
136 createEventEx: Status, // TODO136 createEventEx: Status, // TODO
137137
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,
1818
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,
2121
22 setTime: Status, // TODO22 setTime: Status, // TODO
23 getWakeupTime: Status, // TODO23 getWakeupTime: Status, // TODO
...@@ -26,18 +26,18 @@ pub const RuntimeServices = extern struct {...@@ -26,18 +26,18 @@ pub const RuntimeServices = extern struct {
26 convertPointer: Status, // TODO26 convertPointer: Status, // TODO
2727
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,
3030
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,
3333
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,
3636
37 getNextHighMonotonicCount: Status, // TODO37 getNextHighMonotonicCount: Status, // TODO
3838
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,
4141
42 updateCapsule: Status, // TODO42 updateCapsule: Status, // TODO
43 queryCapsuleCapabilities: Status, // TODO43 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;
627pub const MEM_DECOMMIT = 0x4000;627pub const MEM_DECOMMIT = 0x4000;
628pub const MEM_RELEASE = 0x8000;628pub const MEM_RELEASE = 0x8000;
629629
630pub const PTHREAD_START_ROUTINE = extern fn (LPVOID) DWORD;630pub const PTHREAD_START_ROUTINE = fn (LPVOID) callconv(.C) DWORD;
631pub const LPTHREAD_START_ROUTINE = PTHREAD_START_ROUTINE;631pub const LPTHREAD_START_ROUTINE = PTHREAD_START_ROUTINE;
632632
633pub const WIN32_FIND_DATAW = extern struct {633pub 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 {
784pub const IMAGE_TLS_DIRECTORY64 = IMAGE_TLS_DIRECTORY;784pub const IMAGE_TLS_DIRECTORY64 = IMAGE_TLS_DIRECTORY;
785pub const IMAGE_TLS_DIRECTORY32 = IMAGE_TLS_DIRECTORY;785pub const IMAGE_TLS_DIRECTORY32 = IMAGE_TLS_DIRECTORY;
786786
787pub const PIMAGE_TLS_CALLBACK = ?extern fn (PVOID, DWORD, PVOID) void;787pub const PIMAGE_TLS_CALLBACK = ?fn (PVOID, DWORD, PVOID) callconv(.C) void;
788788
789pub const PROV_RSA_FULL = 1;789pub const PROV_RSA_FULL = 1;
790790
...@@ -810,7 +810,7 @@ pub const FILE_ACTION_MODIFIED = 0x00000003;...@@ -810,7 +810,7 @@ pub const FILE_ACTION_MODIFIED = 0x00000003;
810pub const FILE_ACTION_RENAMED_OLD_NAME = 0x00000004;810pub const FILE_ACTION_RENAMED_OLD_NAME = 0x00000004;
811pub const FILE_ACTION_RENAMED_NEW_NAME = 0x00000005;811pub const FILE_ACTION_RENAMED_NEW_NAME = 0x00000005;
812812
813pub const LPOVERLAPPED_COMPLETION_ROUTINE = ?extern fn (DWORD, DWORD, *OVERLAPPED) void;813pub const LPOVERLAPPED_COMPLETION_ROUTINE = ?fn (DWORD, DWORD, *OVERLAPPED) callconv(.C) void;
814814
815pub const FILE_NOTIFY_CHANGE_CREATION = 64;815pub const FILE_NOTIFY_CHANGE_CREATION = 64;
816pub const FILE_NOTIFY_CHANGE_SIZE = 8;816pub 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 {
863pub const CRITICAL_SECTION = RTL_CRITICAL_SECTION;863pub const CRITICAL_SECTION = RTL_CRITICAL_SECTION;
864pub const INIT_ONCE = RTL_RUN_ONCE;864pub const INIT_ONCE = RTL_RUN_ONCE;
865pub const INIT_ONCE_STATIC_INIT = RTL_RUN_ONCE_INIT;865pub const INIT_ONCE_STATIC_INIT = RTL_RUN_ONCE_INIT;
866pub const INIT_ONCE_FN = extern fn (InitOnce: *INIT_ONCE, Parameter: ?*c_void, Context: ?*c_void) BOOL;866pub const INIT_ONCE_FN = fn (InitOnce: *INIT_ONCE, Parameter: ?*c_void, Context: ?*c_void) callconv(.C) BOOL;
867867
868pub const RTL_RUN_ONCE = extern struct {868pub 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};
14201420
1421pub const PPS_POST_PROCESS_INIT_ROUTINE = ?extern fn () void;1421pub const PPS_POST_PROCESS_INIT_ROUTINE = ?fn () callconv(.C) void;
14221422
1423pub const FILE_BOTH_DIR_INFORMATION = extern struct {1423pub 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};
1439pub const FILE_BOTH_DIRECTORY_INFORMATION = FILE_BOTH_DIR_INFORMATION;1439pub const FILE_BOTH_DIRECTORY_INFORMATION = FILE_BOTH_DIR_INFORMATION;
14401440
1441pub const IO_APC_ROUTINE = extern fn (PVOID, *IO_STATUS_BLOCK, ULONG) void;1441pub const IO_APC_ROUTINE = fn (PVOID, *IO_STATUS_BLOCK, ULONG) callconv(.C) void;
14421442
1443pub const CURDIR = extern struct {1443pub 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};
108108
109pub const WSAOVERLAPPED_COMPLETION_ROUTINE = extern fn (dwError: DWORD, cbTransferred: DWORD, lpOverlapped: *WSAOVERLAPPED, dwFlags: DWORD) void;109pub const WSAOVERLAPPED_COMPLETION_ROUTINE = fn (dwError: DWORD, cbTransferred: DWORD, lpOverlapped: *WSAOVERLAPPED, dwFlags: DWORD) callconv(.C) void;
110110
111pub const ADDRESS_FAMILY = u16;111pub const ADDRESS_FAMILY = u16;
112112
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}
227227fn callMainAsync(loop: *std.event.Loop) callconv(.Async) u8 {
228async 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();
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
781pub extern fn ZigClangASTContext_getPointerType(self: ?*const struct_ZigClangASTContext, T: struct_ZigClangQualType) struct_ZigClangQualType;781pub extern fn ZigClangASTContext_getPointerType(self: ?*const struct_ZigClangASTContext, T: struct_ZigClangQualType) struct_ZigClangQualType;
782pub extern fn ZigClangASTUnit_getASTContext(self: ?*struct_ZigClangASTUnit) ?*struct_ZigClangASTContext;782pub extern fn ZigClangASTUnit_getASTContext(self: ?*struct_ZigClangASTUnit) ?*struct_ZigClangASTContext;
783pub extern fn ZigClangASTUnit_getSourceManager(self: *struct_ZigClangASTUnit) *struct_ZigClangSourceManager;783pub extern fn ZigClangASTUnit_getSourceManager(self: *struct_ZigClangASTUnit) *struct_ZigClangSourceManager;
784pub extern fn ZigClangASTUnit_visitLocalTopLevelDecls(self: *struct_ZigClangASTUnit, context: ?*c_void, Fn: ?extern fn (?*c_void, *const struct_ZigClangDecl) bool) bool;784pub extern fn ZigClangASTUnit_visitLocalTopLevelDecls(self: *struct_ZigClangASTUnit, context: ?*c_void, Fn: ?fn (?*c_void, *const struct_ZigClangDecl) callconv(.C) bool) bool;
785pub extern fn ZigClangRecordType_getDecl(record_ty: ?*const struct_ZigClangRecordType) *const struct_ZigClangRecordDecl;785pub extern fn ZigClangRecordType_getDecl(record_ty: ?*const struct_ZigClangRecordType) *const struct_ZigClangRecordDecl;
786pub extern fn ZigClangTagDecl_isThisDeclarationADefinition(self: *const ZigClangTagDecl) bool;786pub extern fn ZigClangTagDecl_isThisDeclarationADefinition(self: *const ZigClangTagDecl) bool;
787pub extern fn ZigClangEnumType_getDecl(record_ty: ?*const struct_ZigClangEnumType) *const struct_ZigClangEnumDecl;787pub 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 =
4141
42const Command = struct {42const 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};
4646
47pub fn main() !void {47pub 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;
716716fn fmtPath(fmt: *Fmt, file_path_ref: []const u8, check_mode: bool) callconv(.Async) FmtError!void {
717async 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();
720719
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" {
184184
185var a_promise: anyframe = undefined;185var a_promise: anyframe = undefined;
186var global_result = false;186var global_result = false;
187async fn testSuspendBlock() void {187fn 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}
212async fn await_amain() void {212fn 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}
219async fn await_another() i32 {219fn 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}
246async fn early_amain() void {246fn 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}
253async fn early_another() i32 {253fn 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 {
266test "async function with dot syntax" {266test "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" {
278test "async fn pointer in a struct field" {278test "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" {
294fn doTheAwait(f: anyframe->void) void {294fn doTheAwait(f: anyframe->void) void {
295 await f;295 await f;
296}296}
297297fn simpleAsyncFn2(y: *i32) callconv(.Async) void {
298async 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 {
303302
304test "@asyncCall with return type" {303test "@asyncCall with return type" {
305 const Foo = struct {304 const Foo = struct {
306 bar: async fn () i32,305 bar: fn () callconv(.Async) i32,
307306
308 var global_frame: anyframe = undefined;307 var global_frame: anyframe = undefined;
309308 fn middle() callconv(.Async) i32 {
310 async fn middle() i32 {
311 return afunc();309 return afunc();
312 }310 }
313311
...@@ -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 }
341339 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}
379async fn suspendThenFail() anyerror!void {376fn suspendThenFail() callconv(.Async) anyerror!void {
380 suspend;377 suspend;
381 return error.Fail;378 return error.Fail;
382}379}
383async fn printTrace(p: anyframe->(anyerror!void)) void {380fn 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}
400async fn testBreakFromSuspend(my_result: *i32) void {397fn 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;
827824
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;
855852
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 }
961958 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" {
993989
994test "@asyncCall using the result location inside the frame" {990test "@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 }
14091405
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}
21async fn await_amain() void {21fn 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}
28async fn await_another() Foo {28fn 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
762762
763test "cast between [*c]T and ?[*:0]T on fn parameter" {763test "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 {}
767767
768 fn myCallback(cstr: ?[*:0]const u8) callconv(.C) void {}768 fn myCallback(cstr: ?[*:0]const u8) callconv(.C) void {}