authorgravatar for andrew@ziglang.orgAndrew Kelley <andrew@ziglang.org> 2022-12-06 20:35:50-07:00
committergravatar for andrew@ziglang.orgAndrew Kelley <andrew@ziglang.org> 2022-12-06 20:38:54-07:00
log50eb7983cde6e07d2613a6f3ab164ca055d9306f
treebe9361a684543867bf3fd1711e64c7974660d074
parentc8aba15c222e5bb8cf5d2d48678761197f564351

remove most conditional compilation based on stage1

There are still a few occurrences of "stage1" in the standard library and self-hosted compiler source, however, these instances need a bit more careful inspection to ensure no breakage.

88 files changed, 365 insertions(+), 573 deletions(-)

lib/std/atomic/Atomic.zig+2-2
...@@ -214,8 +214,8 @@ pub fn Atomic(comptime T: type) type {...@@ -214,8 +214,8 @@ pub fn Atomic(comptime T: type) type {
214 inline fn bitRmw(self: *Self, comptime op: BitRmwOp, bit: Bit, comptime ordering: Ordering) u1 {214 inline fn bitRmw(self: *Self, comptime op: BitRmwOp, bit: Bit, comptime ordering: Ordering) u1 {
215 // x86 supports dedicated bitwise instructions215 // x86 supports dedicated bitwise instructions
216 if (comptime builtin.target.cpu.arch.isX86() and @sizeOf(T) >= 2 and @sizeOf(T) <= 8) {216 if (comptime builtin.target.cpu.arch.isX86() and @sizeOf(T) >= 2 and @sizeOf(T) <= 8) {
217 // TODO: stage2 currently doesn't like the inline asm this function emits.217 // TODO: this causes std lib test failures when enabled
218 if (builtin.zig_backend == .stage1) {218 if (false) {
219 return x86BitRmw(self, op, bit, ordering);219 return x86BitRmw(self, op, bit, ordering);
220 }220 }
221 }221 }
lib/std/base64.zig+1-1
...@@ -9,7 +9,7 @@ pub const Error = error{...@@ -9,7 +9,7 @@ pub const Error = error{
9 NoSpaceLeft,9 NoSpaceLeft,
10};10};
1111
12const decoderWithIgnoreProto = std.meta.FnPtr(fn (ignore: []const u8) Base64DecoderWithIgnore);12const decoderWithIgnoreProto = *const fn (ignore: []const u8) Base64DecoderWithIgnore;
1313
14/// Base64 codecs14/// Base64 codecs
15pub const Codecs = struct {15pub const Codecs = struct {
lib/std/build.zig+2-3
...@@ -3293,8 +3293,7 @@ pub const LibExeObjStep = struct {...@@ -3293,8 +3293,7 @@ pub const LibExeObjStep = struct {
3293 while (try it.next()) |entry| {3293 while (try it.next()) |entry| {
3294 // The compiler can put these files into the same directory, but we don't3294 // The compiler can put these files into the same directory, but we don't
3295 // want to copy them over.3295 // want to copy them over.
3296 if (mem.eql(u8, entry.name, "stage1.id") or3296 if (mem.eql(u8, entry.name, "llvm-ar.id") or
3297 mem.eql(u8, entry.name, "llvm-ar.id") or
3298 mem.eql(u8, entry.name, "libs.txt") or3297 mem.eql(u8, entry.name, "libs.txt") or
3299 mem.eql(u8, entry.name, "builtin.zig") or3298 mem.eql(u8, entry.name, "builtin.zig") or
3300 mem.eql(u8, entry.name, "zld.id") or3299 mem.eql(u8, entry.name, "zld.id") or
...@@ -3607,7 +3606,7 @@ pub const Step = struct {...@@ -3607,7 +3606,7 @@ pub const Step = struct {
3607 loop_flag: bool,3606 loop_flag: bool,
3608 done_flag: bool,3607 done_flag: bool,
36093608
3610 const MakeFn = std.meta.FnPtr(fn (self: *Step) anyerror!void);3609 const MakeFn = *const fn (self: *Step) anyerror!void;
36113610
3612 pub const Id = enum {3611 pub const Id = enum {
3613 top_level,3612 top_level,
lib/std/build/WriteFileStep.zig+3-3
...@@ -62,9 +62,9 @@ fn make(step: *Step) !void {...@@ -62,9 +62,9 @@ fn make(step: *Step) !void {
62 // If, for example, a hard-coded path was used as the location to put WriteFileStep62 // If, for example, a hard-coded path was used as the location to put WriteFileStep
63 // files, then two WriteFileSteps executing in parallel might clobber each other.63 // files, then two WriteFileSteps executing in parallel might clobber each other.
6464
65 // TODO port the cache system from stage1 to zig std lib. Until then we use blake2b65 // TODO port the cache system from the compiler to zig std lib. Until then
66 // directly and construct the path, and no "cache hit" detection happens; the files66 // we use blake2b directly and construct the path, and no "cache hit"
67 // are always written.67 // detection happens; the files are always written.
68 var hash = std.crypto.hash.blake2.Blake2b384.init(.{});68 var hash = std.crypto.hash.blake2.Blake2b384.init(.{});
6969
70 // Random bytes to make WriteFileStep unique. Refresh this with70 // Random bytes to make WriteFileStep unique. Refresh this with
lib/std/builtin.zig+6-5
...@@ -698,8 +698,9 @@ pub const CompilerBackend = enum(u64) {...@@ -698,8 +698,9 @@ pub const CompilerBackend = enum(u64) {
698 /// in which case this value is appropriate. Be cool and make sure your698 /// in which case this value is appropriate. Be cool and make sure your
699 /// code supports `other` Zig compilers!699 /// code supports `other` Zig compilers!
700 other = 0,700 other = 0,
701 /// The original Zig compiler created in 2015 by Andrew Kelley.701 /// The original Zig compiler created in 2015 by Andrew Kelley. Implemented
702 /// Implemented in C++. Uses LLVM.702 /// in C++. Used LLVM. Deleted from the ZSF ziglang/zig codebase on
703 /// December 6th, 2022.
703 stage1 = 1,704 stage1 = 1,
704 /// The reference implementation self-hosted compiler of Zig, using the705 /// The reference implementation self-hosted compiler of Zig, using the
705 /// LLVM backend.706 /// LLVM backend.
...@@ -738,7 +739,7 @@ pub const CompilerBackend = enum(u64) {...@@ -738,7 +739,7 @@ pub const CompilerBackend = enum(u64) {
738/// therefore must be kept in sync with the compiler implementation.739/// therefore must be kept in sync with the compiler implementation.
739pub const TestFn = struct {740pub const TestFn = struct {
740 name: []const u8,741 name: []const u8,
741 func: std.meta.FnPtr(fn () anyerror!void),742 func: *const fn () anyerror!void,
742 async_frame_size: ?usize,743 async_frame_size: ?usize,
743};744};
744745
...@@ -760,8 +761,8 @@ else...@@ -760,8 +761,8 @@ else
760pub fn default_panic(msg: []const u8, error_return_trace: ?*StackTrace, ret_addr: ?usize) noreturn {761pub fn default_panic(msg: []const u8, error_return_trace: ?*StackTrace, ret_addr: ?usize) noreturn {
761 @setCold(true);762 @setCold(true);
762763
763 // Until self-hosted catches up with stage1 language features, we have a simpler764 // For backends that cannot handle the language features depended on by the
764 // default panic function:765 // default panic handler, we have a simpler panic handler:
765 if (builtin.zig_backend == .stage2_c or766 if (builtin.zig_backend == .stage2_c or
766 builtin.zig_backend == .stage2_wasm or767 builtin.zig_backend == .stage2_wasm or
767 builtin.zig_backend == .stage2_arm or768 builtin.zig_backend == .stage2_arm or
lib/std/c.zig+13-8
...@@ -241,8 +241,12 @@ pub extern "c" fn utimes(path: [*:0]const u8, times: *[2]c.timeval) c_int;...@@ -241,8 +241,12 @@ pub extern "c" fn utimes(path: [*:0]const u8, times: *[2]c.timeval) c_int;
241pub extern "c" fn utimensat(dirfd: c.fd_t, pathname: [*:0]const u8, times: *[2]c.timespec, flags: u32) c_int;241pub extern "c" fn utimensat(dirfd: c.fd_t, pathname: [*:0]const u8, times: *[2]c.timespec, flags: u32) c_int;
242pub extern "c" fn futimens(fd: c.fd_t, times: *const [2]c.timespec) c_int;242pub extern "c" fn futimens(fd: c.fd_t, times: *const [2]c.timespec) c_int;
243243
244const PThreadStartFn = std.meta.FnPtr(fn (?*anyopaque) callconv(.C) ?*anyopaque);244pub extern "c" fn pthread_create(
245pub extern "c" fn pthread_create(noalias newthread: *pthread_t, noalias attr: ?*const c.pthread_attr_t, start_routine: PThreadStartFn, noalias arg: ?*anyopaque) c.E;245 noalias newthread: *pthread_t,
246 noalias attr: ?*const c.pthread_attr_t,
247 start_routine: *const fn (?*anyopaque) callconv(.C) ?*anyopaque,
248 noalias arg: ?*anyopaque,
249) c.E;
246pub extern "c" fn pthread_attr_init(attr: *c.pthread_attr_t) c.E;250pub extern "c" fn pthread_attr_init(attr: *c.pthread_attr_t) c.E;
247pub extern "c" fn pthread_attr_setstack(attr: *c.pthread_attr_t, stackaddr: *anyopaque, stacksize: usize) c.E;251pub extern "c" fn pthread_attr_setstack(attr: *c.pthread_attr_t, stackaddr: *anyopaque, stacksize: usize) c.E;
248pub extern "c" fn pthread_attr_setstacksize(attr: *c.pthread_attr_t, stacksize: usize) c.E;252pub extern "c" fn pthread_attr_setstacksize(attr: *c.pthread_attr_t, stacksize: usize) c.E;
...@@ -251,14 +255,15 @@ pub extern "c" fn pthread_attr_destroy(attr: *c.pthread_attr_t) c.E;...@@ -251,14 +255,15 @@ pub extern "c" fn pthread_attr_destroy(attr: *c.pthread_attr_t) c.E;
251pub extern "c" fn pthread_self() pthread_t;255pub extern "c" fn pthread_self() pthread_t;
252pub extern "c" fn pthread_join(thread: pthread_t, arg_return: ?*?*anyopaque) c.E;256pub extern "c" fn pthread_join(thread: pthread_t, arg_return: ?*?*anyopaque) c.E;
253pub extern "c" fn pthread_detach(thread: pthread_t) c.E;257pub extern "c" fn pthread_detach(thread: pthread_t) c.E;
254const PThreadForkFn = std.meta.FnPtr(fn () callconv(.C) void);
255pub extern "c" fn pthread_atfork(258pub extern "c" fn pthread_atfork(
256 prepare: ?PThreadForkFn,259 prepare: ?*const fn () callconv(.C) void,
257 parent: ?PThreadForkFn,260 parent: ?*const fn () callconv(.C) void,
258 child: ?PThreadForkFn,261 child: ?*const fn () callconv(.C) void,
259) c_int;262) c_int;
260const PThreadKeyCreateFn = std.meta.FnPtr(fn (value: *anyopaque) callconv(.C) void);263pub extern "c" fn pthread_key_create(
261pub extern "c" fn pthread_key_create(key: *c.pthread_key_t, destructor: ?PThreadKeyCreateFn) c.E;264 key: *c.pthread_key_t,
265 destructor: ?*const fn (value: *anyopaque) callconv(.C) void,
266) c.E;
262pub extern "c" fn pthread_key_delete(key: c.pthread_key_t) c.E;267pub extern "c" fn pthread_key_delete(key: c.pthread_key_t) c.E;
263pub extern "c" fn pthread_getspecific(key: c.pthread_key_t) ?*anyopaque;268pub extern "c" fn pthread_getspecific(key: c.pthread_key_t) ?*anyopaque;
264pub extern "c" fn pthread_setspecific(key: c.pthread_key_t, value: ?*anyopaque) c_int;269pub extern "c" fn pthread_setspecific(key: c.pthread_key_t, value: ?*anyopaque) c_int;
lib/std/c/darwin.zig+2-2
...@@ -918,8 +918,8 @@ pub const siginfo_t = extern struct {...@@ -918,8 +918,8 @@ pub const siginfo_t = extern struct {
918918
919/// Renamed from `sigaction` to `Sigaction` to avoid conflict with function name.919/// Renamed from `sigaction` to `Sigaction` to avoid conflict with function name.
920pub const Sigaction = extern struct {920pub const Sigaction = extern struct {
921 pub const handler_fn = std.meta.FnPtr(fn (c_int) align(1) callconv(.C) void);921 pub const handler_fn = *const fn (c_int) align(1) callconv(.C) void;
922 pub const sigaction_fn = std.meta.FnPtr(fn (c_int, *const siginfo_t, ?*const anyopaque) callconv(.C) void);922 pub const sigaction_fn = *const fn (c_int, *const siginfo_t, ?*const anyopaque) callconv(.C) void;
923923
924 handler: extern union {924 handler: extern union {
925 handler: ?handler_fn,925 handler: ?handler_fn,
lib/std/c/dragonfly.zig+3-3
...@@ -13,7 +13,7 @@ pub extern "c" fn sigaltstack(ss: ?*stack_t, old_ss: ?*stack_t) c_int;...@@ -13,7 +13,7 @@ pub extern "c" fn sigaltstack(ss: ?*stack_t, old_ss: ?*stack_t) c_int;
13pub extern "c" fn getrandom(buf_ptr: [*]u8, buf_len: usize, flags: c_uint) isize;13pub extern "c" fn getrandom(buf_ptr: [*]u8, buf_len: usize, flags: c_uint) isize;
14pub extern "c" fn pipe2(fds: *[2]fd_t, flags: u32) c_int;14pub extern "c" fn pipe2(fds: *[2]fd_t, flags: u32) c_int;
1515
16pub const dl_iterate_phdr_callback = std.meta.FnPtr(fn (info: *dl_phdr_info, size: usize, data: ?*anyopaque) callconv(.C) c_int);16pub const dl_iterate_phdr_callback = *const fn (info: *dl_phdr_info, size: usize, data: ?*anyopaque) callconv(.C) c_int;
17pub extern "c" fn dl_iterate_phdr(callback: dl_iterate_phdr_callback, data: ?*anyopaque) c_int;17pub extern "c" fn dl_iterate_phdr(callback: dl_iterate_phdr_callback, data: ?*anyopaque) c_int;
1818
19pub extern "c" fn lwp_gettid() c_int;19pub extern "c" fn lwp_gettid() c_int;
...@@ -681,8 +681,8 @@ pub const empty_sigset = sigset_t{ .__bits = [_]c_uint{0} ** _SIG_WORDS };...@@ -681,8 +681,8 @@ pub const empty_sigset = sigset_t{ .__bits = [_]c_uint{0} ** _SIG_WORDS };
681pub const sig_atomic_t = c_int;681pub const sig_atomic_t = c_int;
682682
683pub const Sigaction = extern struct {683pub const Sigaction = extern struct {
684 pub const handler_fn = std.meta.FnPtr(fn (c_int) align(1) callconv(.C) void);684 pub const handler_fn = *const fn (c_int) align(1) callconv(.C) void;
685 pub const sigaction_fn = std.meta.FnPtr(fn (c_int, *const siginfo_t, ?*const anyopaque) callconv(.C) void);685 pub const sigaction_fn = *const fn (c_int, *const siginfo_t, ?*const anyopaque) callconv(.C) void;
686686
687 /// signal handler687 /// signal handler
688 handler: extern union {688 handler: extern union {
lib/std/c/freebsd.zig+3-3
...@@ -37,7 +37,7 @@ pub extern "c" fn sendfile(...@@ -37,7 +37,7 @@ pub extern "c" fn sendfile(
37 flags: u32,37 flags: u32,
38) c_int;38) c_int;
3939
40pub const dl_iterate_phdr_callback = std.meta.FnPtr(fn (info: *dl_phdr_info, size: usize, data: ?*anyopaque) callconv(.C) c_int);40pub const dl_iterate_phdr_callback = *const fn (info: *dl_phdr_info, size: usize, data: ?*anyopaque) callconv(.C) c_int;
41pub extern "c" fn dl_iterate_phdr(callback: dl_iterate_phdr_callback, data: ?*anyopaque) c_int;41pub extern "c" fn dl_iterate_phdr(callback: dl_iterate_phdr_callback, data: ?*anyopaque) c_int;
4242
43pub const pthread_mutex_t = extern struct {43pub const pthread_mutex_t = extern struct {
...@@ -1197,8 +1197,8 @@ const NSIG = 32;...@@ -1197,8 +1197,8 @@ const NSIG = 32;
11971197
1198/// Renamed from `sigaction` to `Sigaction` to avoid conflict with the syscall.1198/// Renamed from `sigaction` to `Sigaction` to avoid conflict with the syscall.
1199pub const Sigaction = extern struct {1199pub const Sigaction = extern struct {
1200 pub const handler_fn = std.meta.FnPtr(fn (c_int) align(1) callconv(.C) void);1200 pub const handler_fn = *const fn (c_int) align(1) callconv(.C) void;
1201 pub const sigaction_fn = std.meta.FnPtr(fn (c_int, *const siginfo_t, ?*const anyopaque) callconv(.C) void);1201 pub const sigaction_fn = *const fn (c_int, *const siginfo_t, ?*const anyopaque) callconv(.C) void;
12021202
1203 /// signal handler1203 /// signal handler
1204 handler: extern union {1204 handler: extern union {
lib/std/c/haiku.zig+1-1
...@@ -742,7 +742,7 @@ const NSIG = 32;...@@ -742,7 +742,7 @@ const NSIG = 32;
742742
743/// Renamed from `sigaction` to `Sigaction` to avoid conflict with the syscall.743/// Renamed from `sigaction` to `Sigaction` to avoid conflict with the syscall.
744pub const Sigaction = extern struct {744pub const Sigaction = extern struct {
745 pub const handler_fn = std.meta.FnPtr(fn (i32) align(1) callconv(.C) void);745 pub const handler_fn = *const fn (i32) align(1) callconv(.C) void;
746746
747 /// signal handler747 /// signal handler
748 __sigaction_u: extern union {748 __sigaction_u: extern union {
lib/std/c/linux.zig+1-1
...@@ -263,7 +263,7 @@ pub extern "c" fn inotify_rm_watch(fd: fd_t, wd: c_int) c_int;...@@ -263,7 +263,7 @@ pub extern "c" fn inotify_rm_watch(fd: fd_t, wd: c_int) c_int;
263/// See std.elf for constants for this263/// See std.elf for constants for this
264pub extern "c" fn getauxval(__type: c_ulong) c_ulong;264pub extern "c" fn getauxval(__type: c_ulong) c_ulong;
265265
266pub const dl_iterate_phdr_callback = std.meta.FnPtr(fn (info: *dl_phdr_info, size: usize, data: ?*anyopaque) callconv(.C) c_int);266pub const dl_iterate_phdr_callback = *const fn (info: *dl_phdr_info, size: usize, data: ?*anyopaque) callconv(.C) c_int;
267267
268pub extern "c" fn dl_iterate_phdr(callback: dl_iterate_phdr_callback, data: ?*anyopaque) c_int;268pub extern "c" fn dl_iterate_phdr(callback: dl_iterate_phdr_callback, data: ?*anyopaque) c_int;
269269
lib/std/c/netbsd.zig+3-3
...@@ -9,7 +9,7 @@ const rusage = std.c.rusage;...@@ -9,7 +9,7 @@ const rusage = std.c.rusage;
9extern "c" fn __errno() *c_int;9extern "c" fn __errno() *c_int;
10pub const _errno = __errno;10pub const _errno = __errno;
1111
12pub const dl_iterate_phdr_callback = std.meta.FnPtr(fn (info: *dl_phdr_info, size: usize, data: ?*anyopaque) callconv(.C) c_int);12pub const dl_iterate_phdr_callback = *const fn (info: *dl_phdr_info, size: usize, data: ?*anyopaque) callconv(.C) c_int;
13pub extern "c" fn dl_iterate_phdr(callback: dl_iterate_phdr_callback, data: ?*anyopaque) c_int;13pub extern "c" fn dl_iterate_phdr(callback: dl_iterate_phdr_callback, data: ?*anyopaque) c_int;
1414
15pub extern "c" fn _lwp_self() lwpid_t;15pub extern "c" fn _lwp_self() lwpid_t;
...@@ -971,8 +971,8 @@ pub const SIG = struct {...@@ -971,8 +971,8 @@ pub const SIG = struct {
971971
972/// Renamed from `sigaction` to `Sigaction` to avoid conflict with the syscall.972/// Renamed from `sigaction` to `Sigaction` to avoid conflict with the syscall.
973pub const Sigaction = extern struct {973pub const Sigaction = extern struct {
974 pub const handler_fn = std.meta.FnPtr(fn (c_int) align(1) callconv(.C) void);974 pub const handler_fn = *const fn (c_int) align(1) callconv(.C) void;
975 pub const sigaction_fn = std.meta.FnPtr(fn (c_int, *const siginfo_t, ?*const anyopaque) callconv(.C) void);975 pub const sigaction_fn = *const fn (c_int, *const siginfo_t, ?*const anyopaque) callconv(.C) void;
976976
977 /// signal handler977 /// signal handler
978 handler: extern union {978 handler: extern union {
lib/std/c/openbsd.zig+3-3
...@@ -7,7 +7,7 @@ const iovec_const = std.os.iovec_const;...@@ -7,7 +7,7 @@ const iovec_const = std.os.iovec_const;
7extern "c" fn __errno() *c_int;7extern "c" fn __errno() *c_int;
8pub const _errno = __errno;8pub const _errno = __errno;
99
10pub const dl_iterate_phdr_callback = std.meta.FnPtr(fn (info: *dl_phdr_info, size: usize, data: ?*anyopaque) callconv(.C) c_int);10pub const dl_iterate_phdr_callback = *const fn (info: *dl_phdr_info, size: usize, data: ?*anyopaque) callconv(.C) c_int;
11pub extern "c" fn dl_iterate_phdr(callback: dl_iterate_phdr_callback, data: ?*anyopaque) c_int;11pub extern "c" fn dl_iterate_phdr(callback: dl_iterate_phdr_callback, data: ?*anyopaque) c_int;
1212
13pub extern "c" fn arc4random_buf(buf: [*]u8, len: usize) void;13pub extern "c" fn arc4random_buf(buf: [*]u8, len: usize) void;
...@@ -1026,8 +1026,8 @@ pub const SIG = struct {...@@ -1026,8 +1026,8 @@ pub const SIG = struct {
10261026
1027/// Renamed from `sigaction` to `Sigaction` to avoid conflict with the syscall.1027/// Renamed from `sigaction` to `Sigaction` to avoid conflict with the syscall.
1028pub const Sigaction = extern struct {1028pub const Sigaction = extern struct {
1029 pub const handler_fn = std.meta.FnPtr(fn (c_int) align(1) callconv(.C) void);1029 pub const handler_fn = *const fn (c_int) align(1) callconv(.C) void;
1030 pub const sigaction_fn = std.meta.FnPtr(fn (c_int, *const siginfo_t, ?*const anyopaque) callconv(.C) void);1030 pub const sigaction_fn = *const fn (c_int, *const siginfo_t, ?*const anyopaque) callconv(.C) void;
10311031
1032 /// signal handler1032 /// signal handler
1033 handler: extern union {1033 handler: extern union {
lib/std/c/solaris.zig+3-3
...@@ -8,7 +8,7 @@ const timezone = std.c.timezone;...@@ -8,7 +8,7 @@ const timezone = std.c.timezone;
8extern "c" fn ___errno() *c_int;8extern "c" fn ___errno() *c_int;
9pub const _errno = ___errno;9pub const _errno = ___errno;
1010
11pub const dl_iterate_phdr_callback = std.meta.FnPtr(fn (info: *dl_phdr_info, size: usize, data: ?*anyopaque) callconv(.C) c_int);11pub const dl_iterate_phdr_callback = *const fn (info: *dl_phdr_info, size: usize, data: ?*anyopaque) callconv(.C) c_int;
12pub extern "c" fn dl_iterate_phdr(callback: dl_iterate_phdr_callback, data: ?*anyopaque) c_int;12pub extern "c" fn dl_iterate_phdr(callback: dl_iterate_phdr_callback, data: ?*anyopaque) c_int;
1313
14pub extern "c" fn getdents(fd: c_int, buf_ptr: [*]u8, nbytes: usize) usize;14pub extern "c" fn getdents(fd: c_int, buf_ptr: [*]u8, nbytes: usize) usize;
...@@ -952,8 +952,8 @@ pub const SIG = struct {...@@ -952,8 +952,8 @@ pub const SIG = struct {
952952
953/// Renamed from `sigaction` to `Sigaction` to avoid conflict with the syscall.953/// Renamed from `sigaction` to `Sigaction` to avoid conflict with the syscall.
954pub const Sigaction = extern struct {954pub const Sigaction = extern struct {
955 pub const handler_fn = std.meta.FnPtr(fn (c_int) align(1) callconv(.C) void);955 pub const handler_fn = *const fn (c_int) align(1) callconv(.C) void;
956 pub const sigaction_fn = std.meta.FnPtr(fn (c_int, *const siginfo_t, ?*const anyopaque) callconv(.C) void);956 pub const sigaction_fn = *const fn (c_int, *const siginfo_t, ?*const anyopaque) callconv(.C) void;
957957
958 /// signal options958 /// signal options
959 flags: c_uint,959 flags: c_uint,
lib/std/compress/deflate/compressor.zig+1-1
...@@ -254,7 +254,7 @@ pub fn Compressor(comptime WriterType: anytype) type {...@@ -254,7 +254,7 @@ pub fn Compressor(comptime WriterType: anytype) type {
254254
255 // Inner writer wrapped in a HuffmanBitWriter255 // Inner writer wrapped in a HuffmanBitWriter
256 hm_bw: hm_bw.HuffmanBitWriter(WriterType) = undefined,256 hm_bw: hm_bw.HuffmanBitWriter(WriterType) = undefined,
257 bulk_hasher: std.meta.FnPtr(fn ([]u8, []u32) u32),257 bulk_hasher: *const fn ([]u8, []u32) u32,
258258
259 sync: bool, // requesting flush259 sync: bool, // requesting flush
260 best_speed_enc: *fast.DeflateFast, // Encoder for best_speed260 best_speed_enc: *fast.DeflateFast, // Encoder for best_speed
lib/std/compress/deflate/compressor_test.zig+2-1
...@@ -133,7 +133,8 @@ fn testToFromWithLevelAndLimit(level: deflate.Compression, input: []const u8, li...@@ -133,7 +133,8 @@ fn testToFromWithLevelAndLimit(level: deflate.Compression, input: []const u8, li
133 try expect(read == input.len);133 try expect(read == input.len);
134 try expect(mem.eql(u8, input, decompressed));134 try expect(mem.eql(u8, input, decompressed));
135135
136 if (builtin.zig_backend == .stage1) {136 if (false) {
137 // TODO: this test has regressed
137 try testSync(level, input);138 try testSync(level, input);
138 }139 }
139}140}
lib/std/compress/deflate/decompressor.zig+1-7
...@@ -334,7 +334,7 @@ pub fn Decompressor(comptime ReaderType: type) type {...@@ -334,7 +334,7 @@ pub fn Decompressor(comptime ReaderType: type) type {
334334
335 // Next step in the decompression,335 // Next step in the decompression,
336 // and decompression state.336 // and decompression state.
337 step: std.meta.FnPtr(fn (*Self) Error!void),337 step: *const fn (*Self) Error!void,
338 step_state: DecompressorState,338 step_state: DecompressorState,
339 final: bool,339 final: bool,
340 err: ?Error,340 err: ?Error,
...@@ -479,12 +479,6 @@ pub fn Decompressor(comptime ReaderType: type) type {...@@ -479,12 +479,6 @@ pub fn Decompressor(comptime ReaderType: type) type {
479 }479 }
480480
481 pub fn close(self: *Self) ?Error {481 pub fn close(self: *Self) ?Error {
482 if (@import("builtin").zig_backend == .stage1) {
483 if (self.err == Error.EndOfStreamWithNoError) {
484 return null;
485 }
486 return self.err;
487 }
488 if (self.err == @as(?Error, error.EndOfStreamWithNoError)) {482 if (self.err == @as(?Error, error.EndOfStreamWithNoError)) {
489 return null;483 return null;
490 }484 }
lib/std/dwarf.zig+1-1
...@@ -638,7 +638,7 @@ fn parseFormValue(allocator: mem.Allocator, in_stream: anytype, form_id: u64, en...@@ -638,7 +638,7 @@ fn parseFormValue(allocator: mem.Allocator, in_stream: anytype, form_id: u64, en
638 FORM.line_strp => FormValue{ .LineStrPtr = try readAddress(in_stream, endian, is_64) },638 FORM.line_strp => FormValue{ .LineStrPtr = try readAddress(in_stream, endian, is_64) },
639 FORM.indirect => {639 FORM.indirect => {
640 const child_form_id = try nosuspend leb.readULEB128(u64, in_stream);640 const child_form_id = try nosuspend leb.readULEB128(u64, in_stream);
641 if (builtin.zig_backend != .stage1) {641 if (true) {
642 return parseFormValue(allocator, in_stream, child_form_id, endian, is_64);642 return parseFormValue(allocator, in_stream, child_form_id, endian, is_64);
643 }643 }
644 const F = @TypeOf(async parseFormValue(allocator, in_stream, child_form_id, endian, is_64));644 const F = @TypeOf(async parseFormValue(allocator, in_stream, child_form_id, endian, is_64));
lib/std/event/batch.zig+1-1
...@@ -109,7 +109,7 @@ pub fn Batch(...@@ -109,7 +109,7 @@ pub fn Batch(
109}109}
110110
111test "std.event.Batch" {111test "std.event.Batch" {
112 if (@import("builtin").zig_backend != .stage1) return error.SkipZigTest;112 if (true) return error.SkipZigTest;
113 var count: usize = 0;113 var count: usize = 0;
114 var batch = Batch(void, 2, .auto_async).init();114 var batch = Batch(void, 2, .auto_async).init();
115 batch.add(&async sleepALittle(&count));115 batch.add(&async sleepALittle(&count));
lib/std/fmt.zig+1-39
...@@ -2209,7 +2209,7 @@ test "pointer" {...@@ -2209,7 +2209,7 @@ test "pointer" {
2209 try expectFmt("pointer: i32@deadbeef\n", "pointer: {}\n", .{value});2209 try expectFmt("pointer: i32@deadbeef\n", "pointer: {}\n", .{value});
2210 try expectFmt("pointer: i32@deadbeef\n", "pointer: {*}\n", .{value});2210 try expectFmt("pointer: i32@deadbeef\n", "pointer: {*}\n", .{value});
2211 }2211 }
2212 const FnPtr = if (builtin.zig_backend == .stage1) fn () void else *align(1) const fn () void;2212 const FnPtr = *align(1) const fn () void;
2213 {2213 {
2214 const value = @intToPtr(FnPtr, 0xdeadbeef);2214 const value = @intToPtr(FnPtr, 0xdeadbeef);
2215 try expectFmt("pointer: fn() void@deadbeef\n", "pointer: {}\n", .{value});2215 try expectFmt("pointer: fn() void@deadbeef\n", "pointer: {}\n", .{value});
...@@ -2266,10 +2266,6 @@ test "struct" {...@@ -2266,10 +2266,6 @@ test "struct" {
2266}2266}
22672267
2268test "enum" {2268test "enum" {
2269 if (builtin.zig_backend == .stage1) {
2270 // stage1 starts the typename with 'std' which might also be desireable for stage2
2271 return error.SkipZigTest;
2272 }
2273 const Enum = enum {2269 const Enum = enum {
2274 One,2270 One,
2275 Two,2271 Two,
...@@ -2285,10 +2281,6 @@ test "enum" {...@@ -2285,10 +2281,6 @@ test "enum" {
2285}2281}
22862282
2287test "non-exhaustive enum" {2283test "non-exhaustive enum" {
2288 if (builtin.zig_backend == .stage1) {
2289 // stage1 fails to return fully qualified namespaces.
2290 return error.SkipZigTest;
2291 }
2292 const Enum = enum(u16) {2284 const Enum = enum(u16) {
2293 One = 0x000f,2285 One = 0x000f,
2294 Two = 0xbeef,2286 Two = 0xbeef,
...@@ -2462,10 +2454,6 @@ test "custom" {...@@ -2462,10 +2454,6 @@ test "custom" {
2462}2454}
24632455
2464test "struct" {2456test "struct" {
2465 if (builtin.zig_backend == .stage1) {
2466 // stage1 fails to return fully qualified namespaces.
2467 return error.SkipZigTest;
2468 }
2469 const S = struct {2457 const S = struct {
2470 a: u32,2458 a: u32,
2471 b: anyerror,2459 b: anyerror,
...@@ -2484,10 +2472,6 @@ test "struct" {...@@ -2484,10 +2472,6 @@ test "struct" {
2484}2472}
24852473
2486test "union" {2474test "union" {
2487 if (builtin.zig_backend == .stage1) {
2488 // stage1 fails to return fully qualified namespaces.
2489 return error.SkipZigTest;
2490 }
2491 const TU = union(enum) {2475 const TU = union(enum) {
2492 float: f32,2476 float: f32,
2493 int: u32,2477 int: u32,
...@@ -2518,10 +2502,6 @@ test "union" {...@@ -2518,10 +2502,6 @@ test "union" {
2518}2502}
25192503
2520test "enum" {2504test "enum" {
2521 if (builtin.zig_backend == .stage1) {
2522 // stage1 fails to return fully qualified namespaces.
2523 return error.SkipZigTest;
2524 }
2525 const E = enum {2505 const E = enum {
2526 One,2506 One,
2527 Two,2507 Two,
...@@ -2534,10 +2514,6 @@ test "enum" {...@@ -2534,10 +2514,6 @@ test "enum" {
2534}2514}
25352515
2536test "struct.self-referential" {2516test "struct.self-referential" {
2537 if (builtin.zig_backend == .stage1) {
2538 // stage1 fails to return fully qualified namespaces.
2539 return error.SkipZigTest;
2540 }
2541 const S = struct {2517 const S = struct {
2542 const SelfType = @This();2518 const SelfType = @This();
2543 a: ?*SelfType,2519 a: ?*SelfType,
...@@ -2552,10 +2528,6 @@ test "struct.self-referential" {...@@ -2552,10 +2528,6 @@ test "struct.self-referential" {
2552}2528}
25532529
2554test "struct.zero-size" {2530test "struct.zero-size" {
2555 if (builtin.zig_backend == .stage1) {
2556 // stage1 fails to return fully qualified namespaces.
2557 return error.SkipZigTest;
2558 }
2559 const A = struct {2531 const A = struct {
2560 fn foo() void {}2532 fn foo() void {}
2561 };2533 };
...@@ -2633,10 +2605,6 @@ test "formatFloatValue with comptime_float" {...@@ -2633,10 +2605,6 @@ test "formatFloatValue with comptime_float" {
2633}2605}
26342606
2635test "formatType max_depth" {2607test "formatType max_depth" {
2636 if (builtin.zig_backend == .stage1) {
2637 // stage1 fails to return fully qualified namespaces.
2638 return error.SkipZigTest;
2639 }
2640 const Vec2 = struct {2608 const Vec2 = struct {
2641 const SelfType = @This();2609 const SelfType = @This();
2642 x: f32,2610 x: f32,
...@@ -2724,12 +2692,6 @@ test "vector" {...@@ -2724,12 +2692,6 @@ test "vector" {
2724 return error.SkipZigTest;2692 return error.SkipZigTest;
2725 }2693 }
27262694
2727 if (builtin.zig_backend == .stage1) {
2728 // Regressed in LLVM 14:
2729 // https://github.com/llvm/llvm-project/issues/55522
2730 return error.SkipZigTest;
2731 }
2732
2733 const vbool: @Vector(4, bool) = [_]bool{ true, false, true, false };2695 const vbool: @Vector(4, bool) = [_]bool{ true, false, true, false };
2734 const vi64: @Vector(4, i64) = [_]i64{ -2, -1, 0, 1 };2696 const vi64: @Vector(4, i64) = [_]i64{ -2, -1, 0, 1 };
2735 const vu64: @Vector(4, u64) = [_]u64{ 1000, 2000, 3000, 4000 };2697 const vu64: @Vector(4, u64) = [_]u64{ 1000, 2000, 3000, 4000 };
lib/std/fmt/parse_float.zig+1-3
...@@ -70,9 +70,7 @@ test "fmt.parseFloat" {...@@ -70,9 +70,7 @@ test "fmt.parseFloat" {
70}70}
7171
72test "fmt.parseFloat nan and inf" {72test "fmt.parseFloat nan and inf" {
73 if ((builtin.zig_backend == .stage1 or builtin.zig_backend == .stage2_llvm) and73 if (builtin.zig_backend == .stage2_llvm and builtin.cpu.arch == .aarch64) {
74 builtin.cpu.arch == .aarch64)
75 {
76 // https://github.com/ziglang/zig/issues/1202774 // https://github.com/ziglang/zig/issues/12027
77 return error.SkipZigTest;75 return error.SkipZigTest;
78 }76 }
lib/std/json.zig+1-4
...@@ -2373,10 +2373,7 @@ pub fn stringifyAlloc(allocator: std.mem.Allocator, value: anytype, options: Str...@@ -2373,10 +2373,7 @@ pub fn stringifyAlloc(allocator: std.mem.Allocator, value: anytype, options: Str
2373}2373}
23742374
2375test {2375test {
2376 if (builtin.zig_backend != .stage1) {2376 _ = @import("json/test.zig");
2377 // https://github.com/ziglang/zig/issues/8442
2378 _ = @import("json/test.zig");
2379 }
2380 _ = @import("json/write_stream.zig");2377 _ = @import("json/write_stream.zig");
2381}2378}
23822379
lib/std/leb128.zig+2-6
...@@ -347,9 +347,7 @@ fn test_write_leb128(value: anytype) !void {...@@ -347,9 +347,7 @@ fn test_write_leb128(value: anytype) !void {
347}347}
348348
349test "serialize unsigned LEB128" {349test "serialize unsigned LEB128" {
350 if ((builtin.zig_backend == .stage1 or builtin.zig_backend == .stage2_llvm) and350 if (builtin.zig_backend == .stage2_llvm and builtin.cpu.arch == .riscv64) {
351 builtin.cpu.arch == .riscv64)
352 {
353 // https://github.com/ziglang/zig/issues/12031351 // https://github.com/ziglang/zig/issues/12031
354 return error.SkipZigTest;352 return error.SkipZigTest;
355 }353 }
...@@ -368,9 +366,7 @@ test "serialize unsigned LEB128" {...@@ -368,9 +366,7 @@ test "serialize unsigned LEB128" {
368}366}
369367
370test "serialize signed LEB128" {368test "serialize signed LEB128" {
371 if ((builtin.zig_backend == .stage1 or builtin.zig_backend == .stage2_llvm) and369 if (builtin.zig_backend == .stage2_llvm and builtin.cpu.arch == .riscv64) {
372 builtin.cpu.arch == .riscv64)
373 {
374 // https://github.com/ziglang/zig/issues/12031370 // https://github.com/ziglang/zig/issues/12031
375 return error.SkipZigTest;371 return error.SkipZigTest;
376 }372 }
lib/std/math.zig+5-13
...@@ -528,9 +528,7 @@ pub fn shl(comptime T: type, a: T, shift_amt: anytype) T {...@@ -528,9 +528,7 @@ pub fn shl(comptime T: type, a: T, shift_amt: anytype) T {
528}528}
529529
530test "shl" {530test "shl" {
531 if ((builtin.zig_backend == .stage1 or builtin.zig_backend == .stage2_llvm) and531 if (builtin.zig_backend == .stage2_llvm and builtin.cpu.arch == .aarch64) {
532 builtin.cpu.arch == .aarch64)
533 {
534 // https://github.com/ziglang/zig/issues/12012532 // https://github.com/ziglang/zig/issues/12012
535 return error.SkipZigTest;533 return error.SkipZigTest;
536 }534 }
...@@ -574,9 +572,7 @@ pub fn shr(comptime T: type, a: T, shift_amt: anytype) T {...@@ -574,9 +572,7 @@ pub fn shr(comptime T: type, a: T, shift_amt: anytype) T {
574}572}
575573
576test "shr" {574test "shr" {
577 if ((builtin.zig_backend == .stage1 or builtin.zig_backend == .stage2_llvm) and575 if (builtin.zig_backend == .stage2_llvm and builtin.cpu.arch == .aarch64) {
578 builtin.cpu.arch == .aarch64)
579 {
580 // https://github.com/ziglang/zig/issues/12012576 // https://github.com/ziglang/zig/issues/12012
581 return error.SkipZigTest;577 return error.SkipZigTest;
582 }578 }
...@@ -621,9 +617,7 @@ pub fn rotr(comptime T: type, x: T, r: anytype) T {...@@ -621,9 +617,7 @@ pub fn rotr(comptime T: type, x: T, r: anytype) T {
621}617}
622618
623test "rotr" {619test "rotr" {
624 if ((builtin.zig_backend == .stage1 or builtin.zig_backend == .stage2_llvm) and620 if (builtin.zig_backend == .stage2_llvm and builtin.cpu.arch == .aarch64) {
625 builtin.cpu.arch == .aarch64)
626 {
627 // https://github.com/ziglang/zig/issues/12012621 // https://github.com/ziglang/zig/issues/12012
628 return error.SkipZigTest;622 return error.SkipZigTest;
629 }623 }
...@@ -667,9 +661,7 @@ pub fn rotl(comptime T: type, x: T, r: anytype) T {...@@ -667,9 +661,7 @@ pub fn rotl(comptime T: type, x: T, r: anytype) T {
667}661}
668662
669test "rotl" {663test "rotl" {
670 if ((builtin.zig_backend == .stage1 or builtin.zig_backend == .stage2_llvm) and664 if (builtin.zig_backend == .stage2_llvm and builtin.cpu.arch == .aarch64) {
671 builtin.cpu.arch == .aarch64)
672 {
673 // https://github.com/ziglang/zig/issues/12012665 // https://github.com/ziglang/zig/issues/12012
674 return error.SkipZigTest;666 return error.SkipZigTest;
675 }667 }
...@@ -1695,7 +1687,7 @@ fn testSign() !void {...@@ -1695,7 +1687,7 @@ fn testSign() !void {
1695}1687}
16961688
1697test "sign" {1689test "sign" {
1698 if (builtin.zig_backend == .stage1 or builtin.zig_backend == .stage2_llvm) {1690 if (builtin.zig_backend == .stage2_llvm) {
1699 // https://github.com/ziglang/zig/issues/120121691 // https://github.com/ziglang/zig/issues/12012
1700 return error.SkipZigTest;1692 return error.SkipZigTest;
1701 }1693 }
lib/std/mem.zig+1-7
...@@ -322,7 +322,7 @@ pub fn zeroes(comptime T: type) T {...@@ -322,7 +322,7 @@ pub fn zeroes(comptime T: type) T {
322}322}
323323
324test "zeroes" {324test "zeroes" {
325 if (builtin.zig_backend == .stage1 or builtin.zig_backend == .stage2_llvm) {325 if (builtin.zig_backend == .stage2_llvm) {
326 // Regressed in LLVM 14:326 // Regressed in LLVM 14:
327 // https://github.com/llvm/llvm-project/issues/55522327 // https://github.com/llvm/llvm-project/issues/55522
328 return error.SkipZigTest;328 return error.SkipZigTest;
...@@ -3187,8 +3187,6 @@ pub fn asBytes(ptr: anytype) AsBytesReturnType(@TypeOf(ptr)) {...@@ -3187,8 +3187,6 @@ pub fn asBytes(ptr: anytype) AsBytesReturnType(@TypeOf(ptr)) {
3187}3187}
31883188
3189test "asBytes" {3189test "asBytes" {
3190 if (builtin.zig_backend == .stage1) return error.SkipZigTest;
3191
3192 const deadbeef = @as(u32, 0xDEADBEEF);3190 const deadbeef = @as(u32, 0xDEADBEEF);
3193 const deadbeef_bytes = switch (native_endian) {3191 const deadbeef_bytes = switch (native_endian) {
3194 .Big => "\xDE\xAD\xBE\xEF",3192 .Big => "\xDE\xAD\xBE\xEF",
...@@ -3282,8 +3280,6 @@ pub fn bytesAsValue(comptime T: type, bytes: anytype) BytesAsValueReturnType(T,...@@ -3282,8 +3280,6 @@ pub fn bytesAsValue(comptime T: type, bytes: anytype) BytesAsValueReturnType(T,
3282}3280}
32833281
3284test "bytesAsValue" {3282test "bytesAsValue" {
3285 if (builtin.zig_backend == .stage1) return error.SkipZigTest;
3286
3287 const deadbeef = @as(u32, 0xDEADBEEF);3283 const deadbeef = @as(u32, 0xDEADBEEF);
3288 const deadbeef_bytes = switch (native_endian) {3284 const deadbeef_bytes = switch (native_endian) {
3289 .Big => "\xDE\xAD\xBE\xEF",3285 .Big => "\xDE\xAD\xBE\xEF",
...@@ -3485,8 +3481,6 @@ test "sliceAsBytes with sentinel slice" {...@@ -3485,8 +3481,6 @@ test "sliceAsBytes with sentinel slice" {
3485}3481}
34863482
3487test "sliceAsBytes packed struct at runtime and comptime" {3483test "sliceAsBytes packed struct at runtime and comptime" {
3488 if (builtin.zig_backend == .stage1) return error.SkipZigTest;
3489
3490 const Foo = packed struct {3484 const Foo = packed struct {
3491 a: u4,3485 a: u4,
3492 b: u4,3486 b: u4,
lib/std/mem/Allocator.zig+3-3
...@@ -20,7 +20,7 @@ pub const VTable = struct {...@@ -20,7 +20,7 @@ pub const VTable = struct {
20 /// `ret_addr` is optionally provided as the first return address of the20 /// `ret_addr` is optionally provided as the first return address of the
21 /// allocation call stack. If the value is `0` it means no return address21 /// allocation call stack. If the value is `0` it means no return address
22 /// has been provided.22 /// has been provided.
23 alloc: std.meta.FnPtr(fn (ctx: *anyopaque, len: usize, ptr_align: u8, ret_addr: usize) ?[*]u8),23 alloc: *const fn (ctx: *anyopaque, len: usize, ptr_align: u8, ret_addr: usize) ?[*]u8,
2424
25 /// Attempt to expand or shrink memory in place. `buf.len` must equal the25 /// Attempt to expand or shrink memory in place. `buf.len` must equal the
26 /// length requested from the most recent successful call to `alloc` or26 /// length requested from the most recent successful call to `alloc` or
...@@ -37,7 +37,7 @@ pub const VTable = struct {...@@ -37,7 +37,7 @@ pub const VTable = struct {
37 /// `ret_addr` is optionally provided as the first return address of the37 /// `ret_addr` is optionally provided as the first return address of the
38 /// allocation call stack. If the value is `0` it means no return address38 /// allocation call stack. If the value is `0` it means no return address
39 /// has been provided.39 /// has been provided.
40 resize: std.meta.FnPtr(fn (ctx: *anyopaque, buf: []u8, buf_align: u8, new_len: usize, ret_addr: usize) bool),40 resize: *const fn (ctx: *anyopaque, buf: []u8, buf_align: u8, new_len: usize, ret_addr: usize) bool,
4141
42 /// Free and invalidate a buffer.42 /// Free and invalidate a buffer.
43 ///43 ///
...@@ -50,7 +50,7 @@ pub const VTable = struct {...@@ -50,7 +50,7 @@ pub const VTable = struct {
50 /// `ret_addr` is optionally provided as the first return address of the50 /// `ret_addr` is optionally provided as the first return address of the
51 /// allocation call stack. If the value is `0` it means no return address51 /// allocation call stack. If the value is `0` it means no return address
52 /// has been provided.52 /// has been provided.
53 free: std.meta.FnPtr(fn (ctx: *anyopaque, buf: []u8, buf_align: u8, ret_addr: usize) void),53 free: *const fn (ctx: *anyopaque, buf: []u8, buf_align: u8, ret_addr: usize) void,
54};54};
5555
56pub fn noResize(56pub fn noResize(
lib/std/meta.zig+2-34
...@@ -361,11 +361,7 @@ pub fn assumeSentinel(p: anytype, comptime sentinel_val: Elem(@TypeOf(p))) Senti...@@ -361,11 +361,7 @@ pub fn assumeSentinel(p: anytype, comptime sentinel_val: Elem(@TypeOf(p))) Senti
361 const ReturnType = Sentinel(T, sentinel_val);361 const ReturnType = Sentinel(T, sentinel_val);
362 switch (@typeInfo(T)) {362 switch (@typeInfo(T)) {
363 .Pointer => |info| switch (info.size) {363 .Pointer => |info| switch (info.size) {
364 .Slice => if (@import("builtin").zig_backend == .stage1)364 .Slice, .Many, .One => return @ptrCast(ReturnType, p),
365 return @bitCast(ReturnType, p)
366 else
367 return @ptrCast(ReturnType, p),
368 .Many, .One => return @ptrCast(ReturnType, p),
369 .C => {},365 .C => {},
370 },366 },
371 .Optional => |info| switch (@typeInfo(info.child)) {367 .Optional => |info| switch (@typeInfo(info.child)) {
...@@ -658,8 +654,6 @@ pub fn FieldEnum(comptime T: type) type {...@@ -658,8 +654,6 @@ pub fn FieldEnum(comptime T: type) type {
658 const field_infos = fields(T);654 const field_infos = fields(T);
659655
660 if (field_infos.len == 0) {656 if (field_infos.len == 0) {
661 // TODO simplify when stage1 is removed
662 if (@import("builtin").zig_backend == .stage1) @compileError("stage1 doesn't allow empty enums");
663 return @Type(.{657 return @Type(.{
664 .Enum = .{658 .Enum = .{
665 .layout = .Auto,659 .layout = .Auto,
...@@ -742,9 +736,7 @@ fn expectEqualEnum(expected: anytype, actual: @TypeOf(expected)) !void {...@@ -742,9 +736,7 @@ fn expectEqualEnum(expected: anytype, actual: @TypeOf(expected)) !void {
742}736}
743737
744test "std.meta.FieldEnum" {738test "std.meta.FieldEnum" {
745 if (comptime @import("builtin").zig_backend != .stage1) {739 try expectEqualEnum(enum {}, FieldEnum(struct {}));
746 try expectEqualEnum(enum {}, FieldEnum(struct {}));
747 }
748 try expectEqualEnum(enum { a }, FieldEnum(struct { a: u8 }));740 try expectEqualEnum(enum { a }, FieldEnum(struct { a: u8 }));
749 try expectEqualEnum(enum { a, b, c }, FieldEnum(struct { a: u8, b: void, c: f32 }));741 try expectEqualEnum(enum { a, b, c }, FieldEnum(struct { a: u8, b: void, c: f32 }));
750 try expectEqualEnum(enum { a, b, c }, FieldEnum(union { a: u8, b: void, c: f32 }));742 try expectEqualEnum(enum { a, b, c }, FieldEnum(union { a: u8, b: void, c: f32 }));
...@@ -1239,27 +1231,3 @@ test "isError" {...@@ -1239,27 +1231,3 @@ test "isError" {
1239 try std.testing.expect(isError(math.absInt(@as(i8, -128))));1231 try std.testing.expect(isError(math.absInt(@as(i8, -128))));
1240 try std.testing.expect(!isError(math.absInt(@as(i8, -127))));1232 try std.testing.expect(!isError(math.absInt(@as(i8, -127))));
1241}1233}
1242
1243/// This function returns a function pointer for a given function signature.
1244/// It's a helper to make code compatible to both stage1 and stage2.
1245///
1246/// **WARNING:** This function is deprecated and will be removed together with stage1.
1247pub fn FnPtr(comptime Fn: type) type {
1248 return if (@import("builtin").zig_backend != .stage1)
1249 *const Fn
1250 else
1251 Fn;
1252}
1253
1254test "FnPtr" {
1255 var func: FnPtr(fn () i64) = undefined;
1256
1257 // verify that we can perform runtime exchange
1258 // and not have a function body in stage2:
1259
1260 func = std.time.timestamp;
1261 _ = func();
1262
1263 func = std.time.milliTimestamp;
1264 _ = func();
1265}
lib/std/multi_array_list.zig+3-4
...@@ -90,13 +90,12 @@ pub fn MultiArrayList(comptime S: type) type {...@@ -90,13 +90,12 @@ pub fn MultiArrayList(comptime S: type) type {
90 };90 };
91 }91 }
92 const Sort = struct {92 const Sort = struct {
93 fn lessThan(trash: *i32, lhs: Data, rhs: Data) bool {93 fn lessThan(context: void, lhs: Data, rhs: Data) bool {
94 _ = trash;94 _ = context;
95 return lhs.alignment > rhs.alignment;95 return lhs.alignment > rhs.alignment;
96 }96 }
97 };97 };
98 var trash: i32 = undefined; // workaround for stage1 compiler bug98 std.sort.sort(Data, &data, {}, Sort.lessThan);
99 std.sort.sort(Data, &data, &trash, Sort.lessThan);
100 var sizes_bytes: [fields.len]usize = undefined;99 var sizes_bytes: [fields.len]usize = undefined;
101 var field_indexes: [fields.len]usize = undefined;100 var field_indexes: [fields.len]usize = undefined;
102 for (data) |elem, i| {101 for (data) |elem, i| {
lib/std/os.zig+1-1
...@@ -5360,7 +5360,7 @@ pub fn toPosixPath(file_path: []const u8) ![MAX_PATH_BYTES - 1:0]u8 {...@@ -5360,7 +5360,7 @@ pub fn toPosixPath(file_path: []const u8) ![MAX_PATH_BYTES - 1:0]u8 {
5360/// if this happens the fix is to add the error code to the corresponding5360/// if this happens the fix is to add the error code to the corresponding
5361/// switch expression, possibly introduce a new error in the error set, and5361/// switch expression, possibly introduce a new error in the error set, and
5362/// send a patch to Zig.5362/// send a patch to Zig.
5363pub const unexpected_error_tracing = (builtin.zig_backend == .stage1 or builtin.zig_backend == .stage2_llvm) and builtin.mode == .Debug;5363pub const unexpected_error_tracing = builtin.zig_backend == .stage2_llvm and builtin.mode == .Debug;
53645364
5365pub const UnexpectedError = error{5365pub const UnexpectedError = error{
5366 /// The Operating System returned an undocumented error code.5366 /// The Operating System returned an undocumented error code.
lib/std/os/linux.zig+15-34
...@@ -936,16 +936,10 @@ pub fn flock(fd: fd_t, operation: i32) usize {...@@ -936,16 +936,10 @@ pub fn flock(fd: fd_t, operation: i32) usize {
936 return syscall2(.flock, @bitCast(usize, @as(isize, fd)), @bitCast(usize, @as(isize, operation)));936 return syscall2(.flock, @bitCast(usize, @as(isize, fd)), @bitCast(usize, @as(isize, operation)));
937}937}
938938
939var vdso_clock_gettime = if (builtin.zig_backend == .stage1)939var vdso_clock_gettime = @ptrCast(?*const anyopaque, &init_vdso_clock_gettime);
940 @ptrCast(?*const anyopaque, init_vdso_clock_gettime)
941else
942 @ptrCast(?*const anyopaque, &init_vdso_clock_gettime);
943940
944// We must follow the C calling convention when we call into the VDSO941// We must follow the C calling convention when we call into the VDSO
945const vdso_clock_gettime_ty = if (builtin.zig_backend == .stage1)942const vdso_clock_gettime_ty = *align(1) const fn (i32, *timespec) callconv(.C) usize;
946 fn (i32, *timespec) callconv(.C) usize
947else
948 *align(1) const fn (i32, *timespec) callconv(.C) usize;
949943
950pub fn clock_gettime(clk_id: i32, tp: *timespec) usize {944pub fn clock_gettime(clk_id: i32, tp: *timespec) usize {
951 if (@hasDecl(VDSO, "CGT_SYM")) {945 if (@hasDecl(VDSO, "CGT_SYM")) {
...@@ -1151,8 +1145,8 @@ pub fn sigaction(sig: u6, noalias act: ?*const Sigaction, noalias oact: ?*Sigact...@@ -1151,8 +1145,8 @@ pub fn sigaction(sig: u6, noalias act: ?*const Sigaction, noalias oact: ?*Sigact
1151 const mask_size = @sizeOf(@TypeOf(ksa.mask));1145 const mask_size = @sizeOf(@TypeOf(ksa.mask));
11521146
1153 if (act) |new| {1147 if (act) |new| {
1154 const restore_rt_ptr = if (builtin.zig_backend == .stage1) restore_rt else &restore_rt;1148 const restore_rt_ptr = &restore_rt;
1155 const restore_ptr = if (builtin.zig_backend == .stage1) restore else &restore;1149 const restore_ptr = &restore;
1156 const restorer_fn = if ((new.flags & SA.SIGINFO) != 0) restore_rt_ptr else restore_ptr;1150 const restorer_fn = if ((new.flags & SA.SIGINFO) != 0) restore_rt_ptr else restore_ptr;
1157 ksa = k_sigaction{1151 ksa = k_sigaction{
1158 .handler = new.handler.handler,1152 .handler = new.handler.handler,
...@@ -3145,8 +3139,8 @@ pub const all_mask: sigset_t = [_]u32{0xffffffff} ** @typeInfo(sigset_t).Array.l...@@ -3145,8 +3139,8 @@ pub const all_mask: sigset_t = [_]u32{0xffffffff} ** @typeInfo(sigset_t).Array.l
3145pub const app_mask: sigset_t = [2]u32{ 0xfffffffc, 0x7fffffff } ++ [_]u32{0xffffffff} ** 30;3139pub const app_mask: sigset_t = [2]u32{ 0xfffffffc, 0x7fffffff } ++ [_]u32{0xffffffff} ** 30;
31463140
3147const k_sigaction_funcs = struct {3141const k_sigaction_funcs = struct {
3148 const handler = ?std.meta.FnPtr(fn (c_int) align(1) callconv(.C) void);3142 const handler = ?*const fn (c_int) align(1) callconv(.C) void;
3149 const restorer = std.meta.FnPtr(fn () callconv(.C) void);3143 const restorer = *const fn () callconv(.C) void;
3150};3144};
31513145
3152pub const k_sigaction = switch (native_arch) {3146pub const k_sigaction = switch (native_arch) {
...@@ -3172,8 +3166,8 @@ pub const k_sigaction = switch (native_arch) {...@@ -3172,8 +3166,8 @@ pub const k_sigaction = switch (native_arch) {
31723166
3173/// Renamed from `sigaction` to `Sigaction` to avoid conflict with the syscall.3167/// Renamed from `sigaction` to `Sigaction` to avoid conflict with the syscall.
3174pub const Sigaction = extern struct {3168pub const Sigaction = extern struct {
3175 pub const handler_fn = std.meta.FnPtr(fn (c_int) align(1) callconv(.C) void);3169 pub const handler_fn = *const fn (c_int) align(1) callconv(.C) void;
3176 pub const sigaction_fn = std.meta.FnPtr(fn (c_int, *const siginfo_t, ?*const anyopaque) callconv(.C) void);3170 pub const sigaction_fn = *const fn (c_int, *const siginfo_t, ?*const anyopaque) callconv(.C) void;
31773171
3178 handler: extern union {3172 handler: extern union {
3179 handler: ?handler_fn,3173 handler: ?handler_fn,
...@@ -3181,7 +3175,7 @@ pub const Sigaction = extern struct {...@@ -3181,7 +3175,7 @@ pub const Sigaction = extern struct {
3181 },3175 },
3182 mask: sigset_t,3176 mask: sigset_t,
3183 flags: c_uint,3177 flags: c_uint,
3184 restorer: ?std.meta.FnPtr(fn () callconv(.C) void) = null,3178 restorer: ?*const fn () callconv(.C) void = null,
3185};3179};
31863180
3187pub const empty_sigset = [_]u32{0} ** @typeInfo(sigset_t).Array.len;3181pub const empty_sigset = [_]u32{0} ** @typeInfo(sigset_t).Array.len;
...@@ -3314,25 +3308,12 @@ pub const epoll_data = extern union {...@@ -3314,25 +3308,12 @@ pub const epoll_data = extern union {
3314 u64: u64,3308 u64: u64,
3315};3309};
33163310
3317pub const epoll_event = switch (builtin.zig_backend) {3311pub const epoll_event = extern struct {
3318 // stage1 crashes with the align(4) field so we have this workaround3312 events: u32,
3319 .stage1 => switch (native_arch) {3313 data: epoll_data align(switch (native_arch) {
3320 .x86_64 => packed struct {3314 .x86_64 => 4,
3321 events: u32,3315 else => @alignOf(epoll_data),
3322 data: epoll_data,3316 }),
3323 },
3324 else => extern struct {
3325 events: u32,
3326 data: epoll_data,
3327 },
3328 },
3329 else => extern struct {
3330 events: u32,
3331 data: epoll_data align(switch (native_arch) {
3332 .x86_64 => 4,
3333 else => @alignOf(epoll_data),
3334 }),
3335 },
3336};3317};
33373318
3338pub const VFS_CAP_REVISION_MASK = 0xFF000000;3319pub const VFS_CAP_REVISION_MASK = 0xFF000000;
lib/std/os/linux/arm-eabi.zig+1-1
...@@ -98,7 +98,7 @@ pub fn syscall6(...@@ -98,7 +98,7 @@ pub fn syscall6(
98 );98 );
99}99}
100100
101const CloneFn = std.meta.FnPtr(fn (arg: usize) callconv(.C) u8);101const CloneFn = *const fn (arg: usize) callconv(.C) u8;
102102
103/// This matches the libc clone function.103/// This matches the libc clone function.
104pub extern fn clone(func: CloneFn, stack: usize, flags: u32, arg: usize, ptid: *i32, tls: usize, ctid: *i32) usize;104pub extern fn clone(func: CloneFn, stack: usize, flags: u32, arg: usize, ptid: *i32, tls: usize, ctid: *i32) usize;
lib/std/os/linux/arm64.zig+1-1
...@@ -98,7 +98,7 @@ pub fn syscall6(...@@ -98,7 +98,7 @@ pub fn syscall6(
98 );98 );
99}99}
100100
101const CloneFn = std.meta.FnPtr(fn (arg: usize) callconv(.C) u8);101const CloneFn = *const fn (arg: usize) callconv(.C) u8;
102102
103/// This matches the libc clone function.103/// This matches the libc clone function.
104pub extern fn clone(func: CloneFn, stack: usize, flags: u32, arg: usize, ptid: *i32, tls: usize, ctid: *i32) usize;104pub extern fn clone(func: CloneFn, stack: usize, flags: u32, arg: usize, ptid: *i32, tls: usize, ctid: *i32) usize;
lib/std/os/linux/mips.zig+1-1
...@@ -190,7 +190,7 @@ pub fn syscall7(...@@ -190,7 +190,7 @@ pub fn syscall7(
190 );190 );
191}191}
192192
193const CloneFn = std.meta.FnPtr(fn (arg: usize) callconv(.C) u8);193const CloneFn = *const fn (arg: usize) callconv(.C) u8;
194194
195/// This matches the libc clone function.195/// This matches the libc clone function.
196pub extern fn clone(func: CloneFn, stack: usize, flags: u32, arg: usize, ptid: *i32, tls: usize, ctid: *i32) usize;196pub extern fn clone(func: CloneFn, stack: usize, flags: u32, arg: usize, ptid: *i32, tls: usize, ctid: *i32) usize;
lib/std/os/linux/powerpc.zig+1-1
...@@ -126,7 +126,7 @@ pub fn syscall6(...@@ -126,7 +126,7 @@ pub fn syscall6(
126 );126 );
127}127}
128128
129const CloneFn = std.meta.FnPtr(fn (arg: usize) callconv(.C) u8);129const CloneFn = *const fn (arg: usize) callconv(.C) u8;
130130
131/// This matches the libc clone function.131/// This matches the libc clone function.
132pub extern fn clone(func: CloneFn, stack: usize, flags: usize, arg: usize, ptid: *i32, tls: usize, ctid: *i32) usize;132pub extern fn clone(func: CloneFn, stack: usize, flags: usize, arg: usize, ptid: *i32, tls: usize, ctid: *i32) usize;
lib/std/os/linux/powerpc64.zig+1-1
...@@ -126,7 +126,7 @@ pub fn syscall6(...@@ -126,7 +126,7 @@ pub fn syscall6(
126 );126 );
127}127}
128128
129const CloneFn = std.meta.FnPtr(fn (arg: usize) callconv(.C) u8);129const CloneFn = *const fn (arg: usize) callconv(.C) u8;
130130
131/// This matches the libc clone function.131/// This matches the libc clone function.
132pub extern fn clone(func: CloneFn, stack: usize, flags: usize, arg: usize, ptid: *i32, tls: usize, ctid: *i32) usize;132pub extern fn clone(func: CloneFn, stack: usize, flags: usize, arg: usize, ptid: *i32, tls: usize, ctid: *i32) usize;
lib/std/os/linux/riscv64.zig+1-1
...@@ -95,7 +95,7 @@ pub fn syscall6(...@@ -95,7 +95,7 @@ pub fn syscall6(
95 );95 );
96}96}
9797
98const CloneFn = std.meta.FnPtr(fn (arg: usize) callconv(.C) u8);98const CloneFn = *const fn (arg: usize) callconv(.C) u8;
9999
100pub extern fn clone(func: CloneFn, stack: usize, flags: u32, arg: usize, ptid: *i32, tls: usize, ctid: *i32) usize;100pub extern fn clone(func: CloneFn, stack: usize, flags: u32, arg: usize, ptid: *i32, tls: usize, ctid: *i32) usize;
101101
lib/std/os/linux/sparc64.zig+1-1
...@@ -178,7 +178,7 @@ pub fn syscall6(...@@ -178,7 +178,7 @@ pub fn syscall6(
178 );178 );
179}179}
180180
181const CloneFn = std.meta.FnPtr(fn (arg: usize) callconv(.C) u8);181const CloneFn = *const fn (arg: usize) callconv(.C) u8;
182182
183/// This matches the libc clone function.183/// This matches the libc clone function.
184pub extern fn clone(func: CloneFn, stack: usize, flags: usize, arg: usize, ptid: *i32, tls: usize, ctid: *i32) usize;184pub extern fn clone(func: CloneFn, stack: usize, flags: usize, arg: usize, ptid: *i32, tls: usize, ctid: *i32) usize;
lib/std/os/linux/x86.zig+1-1
...@@ -118,7 +118,7 @@ pub fn socketcall(call: usize, args: [*]usize) usize {...@@ -118,7 +118,7 @@ pub fn socketcall(call: usize, args: [*]usize) usize {
118 );118 );
119}119}
120120
121const CloneFn = std.meta.FnPtr(fn (arg: usize) callconv(.C) u8);121const CloneFn = *const fn (arg: usize) callconv(.C) u8;
122122
123/// This matches the libc clone function.123/// This matches the libc clone function.
124pub extern fn clone(func: CloneFn, stack: usize, flags: u32, arg: usize, ptid: *i32, tls: usize, ctid: *i32) usize;124pub extern fn clone(func: CloneFn, stack: usize, flags: u32, arg: usize, ptid: *i32, tls: usize, ctid: *i32) usize;
lib/std/os/linux/x86_64.zig+1-1
...@@ -100,7 +100,7 @@ pub fn syscall6(...@@ -100,7 +100,7 @@ pub fn syscall6(
100 );100 );
101}101}
102102
103const CloneFn = std.meta.FnPtr(fn (arg: usize) callconv(.C) u8);103const CloneFn = *const fn (arg: usize) callconv(.C) u8;
104104
105/// This matches the libc clone function.105/// This matches the libc clone function.
106pub extern fn clone(func: CloneFn, stack: usize, flags: usize, arg: usize, ptid: *i32, tls: usize, ctid: *i32) usize;106pub extern fn clone(func: CloneFn, stack: usize, flags: usize, arg: usize, ptid: *i32, tls: usize, ctid: *i32) usize;
lib/std/os/test.zig+2-4
...@@ -785,10 +785,8 @@ test "sigaction" {...@@ -785,10 +785,8 @@ test "sigaction" {
785 }785 }
786 };786 };
787787
788 const actual_handler = if (builtin.zig_backend == .stage1) S.handler else &S.handler;
789
790 var sa = os.Sigaction{788 var sa = os.Sigaction{
791 .handler = .{ .sigaction = actual_handler },789 .handler = .{ .sigaction = &S.handler },
792 .mask = os.empty_sigset,790 .mask = os.empty_sigset,
793 .flags = os.SA.SIGINFO | os.SA.RESETHAND,791 .flags = os.SA.SIGINFO | os.SA.RESETHAND,
794 };792 };
...@@ -799,7 +797,7 @@ test "sigaction" {...@@ -799,7 +797,7 @@ test "sigaction" {
799797
800 // Check that we can read it back correctly.798 // Check that we can read it back correctly.
801 try os.sigaction(os.SIG.USR1, null, &old_sa);799 try os.sigaction(os.SIG.USR1, null, &old_sa);
802 try testing.expectEqual(actual_handler, old_sa.handler.sigaction.?);800 try testing.expectEqual(&S.handler, old_sa.handler.sigaction.?);
803 try testing.expect((old_sa.flags & os.SA.SIGINFO) != 0);801 try testing.expect((old_sa.flags & os.SA.SIGINFO) != 0);
804802
805 // Invoke the handler.803 // Invoke the handler.
lib/std/os/uefi/protocols/absolute_pointer_protocol.zig+2-2
...@@ -6,8 +6,8 @@ const Status = uefi.Status;...@@ -6,8 +6,8 @@ const Status = uefi.Status;
66
7/// Protocol for touchscreens7/// Protocol for touchscreens
8pub const AbsolutePointerProtocol = extern struct {8pub const AbsolutePointerProtocol = extern struct {
9 _reset: std.meta.FnPtr(fn (*const AbsolutePointerProtocol, bool) callconv(.C) Status),9 _reset: *const fn (*const AbsolutePointerProtocol, bool) callconv(.C) Status,
10 _get_state: std.meta.FnPtr(fn (*const AbsolutePointerProtocol, *AbsolutePointerState) callconv(.C) Status),10 _get_state: *const fn (*const AbsolutePointerProtocol, *AbsolutePointerState) callconv(.C) Status,
11 wait_for_input: Event,11 wait_for_input: Event,
12 mode: *AbsolutePointerMode,12 mode: *AbsolutePointerMode,
1313
lib/std/os/uefi/protocols/block_io_protocol.zig+4-4
...@@ -44,10 +44,10 @@ pub const BlockIoProtocol = extern struct {...@@ -44,10 +44,10 @@ pub const BlockIoProtocol = extern struct {
44 revision: u64,44 revision: u64,
45 media: *EfiBlockMedia,45 media: *EfiBlockMedia,
4646
47 _reset: std.meta.FnPtr(fn (*BlockIoProtocol, extended_verification: bool) callconv(.C) Status),47 _reset: *const fn (*BlockIoProtocol, extended_verification: bool) callconv(.C) Status,
48 _read_blocks: std.meta.FnPtr(fn (*BlockIoProtocol, media_id: u32, lba: u64, buffer_size: usize, buf: [*]u8) callconv(.C) Status),48 _read_blocks: *const fn (*BlockIoProtocol, media_id: u32, lba: u64, buffer_size: usize, buf: [*]u8) callconv(.C) Status,
49 _write_blocks: std.meta.FnPtr(fn (*BlockIoProtocol, media_id: u32, lba: u64, buffer_size: usize, buf: [*]u8) callconv(.C) Status),49 _write_blocks: *const fn (*BlockIoProtocol, media_id: u32, lba: u64, buffer_size: usize, buf: [*]u8) callconv(.C) Status,
50 _flush_blocks: std.meta.FnPtr(fn (*BlockIoProtocol) callconv(.C) Status),50 _flush_blocks: *const fn (*BlockIoProtocol) callconv(.C) Status,
5151
52 /// Resets the block device hardware.52 /// Resets the block device hardware.
53 pub fn reset(self: *Self, extended_verification: bool) Status {53 pub fn reset(self: *Self, extended_verification: bool) Status {
lib/std/os/uefi/protocols/edid_override_protocol.zig+1-1
...@@ -6,7 +6,7 @@ const Status = uefi.Status;...@@ -6,7 +6,7 @@ const Status = uefi.Status;
66
7/// Override EDID information7/// Override EDID information
8pub const EdidOverrideProtocol = extern struct {8pub const EdidOverrideProtocol = extern struct {
9 _get_edid: std.meta.FnPtr(fn (*const EdidOverrideProtocol, Handle, *EdidOverrideProtocolAttributes, *usize, *?[*]u8) callconv(.C) Status),9 _get_edid: *const fn (*const EdidOverrideProtocol, Handle, *EdidOverrideProtocolAttributes, *usize, *?[*]u8) callconv(.C) Status,
1010
11 /// Returns policy information and potentially a replacement EDID for the specified video output device.11 /// Returns policy information and potentially a replacement EDID for the specified video output device.
12 pub fn getEdid(12 pub fn getEdid(
lib/std/os/uefi/protocols/file_protocol.zig+10-10
...@@ -7,16 +7,16 @@ const Status = uefi.Status;...@@ -7,16 +7,16 @@ const Status = uefi.Status;
77
8pub const FileProtocol = extern struct {8pub const FileProtocol = extern struct {
9 revision: u64,9 revision: u64,
10 _open: std.meta.FnPtr(fn (*const FileProtocol, **const FileProtocol, [*:0]const u16, u64, u64) callconv(.C) Status),10 _open: *const fn (*const FileProtocol, **const FileProtocol, [*:0]const u16, u64, u64) callconv(.C) Status,
11 _close: std.meta.FnPtr(fn (*const FileProtocol) callconv(.C) Status),11 _close: *const fn (*const FileProtocol) callconv(.C) Status,
12 _delete: std.meta.FnPtr(fn (*const FileProtocol) callconv(.C) Status),12 _delete: *const fn (*const FileProtocol) callconv(.C) Status,
13 _read: std.meta.FnPtr(fn (*const FileProtocol, *usize, [*]u8) callconv(.C) Status),13 _read: *const fn (*const FileProtocol, *usize, [*]u8) callconv(.C) Status,
14 _write: std.meta.FnPtr(fn (*const FileProtocol, *usize, [*]const u8) callconv(.C) Status),14 _write: *const fn (*const FileProtocol, *usize, [*]const u8) callconv(.C) Status,
15 _get_position: std.meta.FnPtr(fn (*const FileProtocol, *u64) callconv(.C) Status),15 _get_position: *const fn (*const FileProtocol, *u64) callconv(.C) Status,
16 _set_position: std.meta.FnPtr(fn (*const FileProtocol, u64) callconv(.C) Status),16 _set_position: *const fn (*const FileProtocol, u64) callconv(.C) Status,
17 _get_info: std.meta.FnPtr(fn (*const FileProtocol, *align(8) const Guid, *const usize, [*]u8) callconv(.C) Status),17 _get_info: *const fn (*const FileProtocol, *align(8) const Guid, *const usize, [*]u8) callconv(.C) Status,
18 _set_info: std.meta.FnPtr(fn (*const FileProtocol, *align(8) const Guid, usize, [*]const u8) callconv(.C) Status),18 _set_info: *const fn (*const FileProtocol, *align(8) const Guid, usize, [*]const u8) callconv(.C) Status,
19 _flush: std.meta.FnPtr(fn (*const FileProtocol) callconv(.C) Status),19 _flush: *const fn (*const FileProtocol) callconv(.C) Status,
2020
21 pub const SeekError = error{SeekError};21 pub const SeekError = error{SeekError};
22 pub const GetSeekPosError = error{GetSeekPosError};22 pub const GetSeekPosError = error{GetSeekPosError};
lib/std/os/uefi/protocols/graphics_output_protocol.zig+3-3
...@@ -5,9 +5,9 @@ const Status = uefi.Status;...@@ -5,9 +5,9 @@ const Status = uefi.Status;
55
6/// Graphics output6/// Graphics output
7pub const GraphicsOutputProtocol = extern struct {7pub const GraphicsOutputProtocol = extern struct {
8 _query_mode: std.meta.FnPtr(fn (*const GraphicsOutputProtocol, u32, *usize, **GraphicsOutputModeInformation) callconv(.C) Status),8 _query_mode: *const fn (*const GraphicsOutputProtocol, u32, *usize, **GraphicsOutputModeInformation) callconv(.C) Status,
9 _set_mode: std.meta.FnPtr(fn (*const GraphicsOutputProtocol, u32) callconv(.C) Status),9 _set_mode: *const fn (*const GraphicsOutputProtocol, u32) callconv(.C) Status,
10 _blt: std.meta.FnPtr(fn (*const GraphicsOutputProtocol, ?[*]GraphicsOutputBltPixel, GraphicsOutputBltOperation, usize, usize, usize, usize, usize, usize, usize) callconv(.C) Status),10 _blt: *const fn (*const GraphicsOutputProtocol, ?[*]GraphicsOutputBltPixel, GraphicsOutputBltOperation, usize, usize, usize, usize, usize, usize, usize) callconv(.C) Status,
11 mode: *GraphicsOutputProtocolMode,11 mode: *GraphicsOutputProtocolMode,
1212
13 /// Returns information for an available graphics mode that the graphics device and the set of active video output devices supports.13 /// 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
...@@ -7,10 +7,10 @@ const hii = uefi.protocols.hii;...@@ -7,10 +7,10 @@ const hii = uefi.protocols.hii;
7/// Database manager for HII-related data structures.7/// Database manager for HII-related data structures.
8pub const HIIDatabaseProtocol = extern struct {8pub const HIIDatabaseProtocol = extern struct {
9 _new_package_list: Status, // TODO9 _new_package_list: Status, // TODO
10 _remove_package_list: std.meta.FnPtr(fn (*const HIIDatabaseProtocol, hii.HIIHandle) callconv(.C) Status),10 _remove_package_list: *const fn (*const HIIDatabaseProtocol, hii.HIIHandle) callconv(.C) Status,
11 _update_package_list: std.meta.FnPtr(fn (*const HIIDatabaseProtocol, hii.HIIHandle, *const hii.HIIPackageList) callconv(.C) Status),11 _update_package_list: *const fn (*const HIIDatabaseProtocol, hii.HIIHandle, *const hii.HIIPackageList) callconv(.C) Status,
12 _list_package_lists: std.meta.FnPtr(fn (*const HIIDatabaseProtocol, u8, ?*const Guid, *usize, [*]hii.HIIHandle) callconv(.C) Status),12 _list_package_lists: *const fn (*const HIIDatabaseProtocol, u8, ?*const Guid, *usize, [*]hii.HIIHandle) callconv(.C) Status,
13 _export_package_lists: std.meta.FnPtr(fn (*const HIIDatabaseProtocol, ?hii.HIIHandle, *usize, *hii.HIIPackageList) callconv(.C) Status),13 _export_package_lists: *const fn (*const HIIDatabaseProtocol, ?hii.HIIHandle, *usize, *hii.HIIPackageList) callconv(.C) Status,
14 _register_package_notify: Status, // TODO14 _register_package_notify: Status, // TODO
15 _unregister_package_notify: Status, // TODO15 _unregister_package_notify: Status, // TODO
16 _find_keyboard_layouts: Status, // TODO16 _find_keyboard_layouts: Status, // TODO
lib/std/os/uefi/protocols/hii_popup_protocol.zig+1-1
...@@ -7,7 +7,7 @@ const hii = uefi.protocols.hii;...@@ -7,7 +7,7 @@ const hii = uefi.protocols.hii;
7/// Display a popup window7/// Display a popup window
8pub const HIIPopupProtocol = extern struct {8pub const HIIPopupProtocol = extern struct {
9 revision: u64,9 revision: u64,
10 _create_popup: std.meta.FnPtr(fn (*const HIIPopupProtocol, HIIPopupStyle, HIIPopupType, hii.HIIHandle, u16, ?*HIIPopupSelection) callconv(.C) Status),10 _create_popup: *const fn (*const HIIPopupProtocol, HIIPopupStyle, HIIPopupType, hii.HIIHandle, u16, ?*HIIPopupSelection) callconv(.C) Status,
1111
12 /// Displays a popup window.12 /// Displays a popup window.
13 pub fn createPopup(self: *const HIIPopupProtocol, style: HIIPopupStyle, popup_type: HIIPopupType, handle: hii.HIIHandle, msg: u16, user_selection: ?*HIIPopupSelection) Status {13 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
...@@ -5,10 +5,10 @@ const Event = uefi.Event;...@@ -5,10 +5,10 @@ const Event = uefi.Event;
5const Status = uefi.Status;5const Status = uefi.Status;
66
7pub const Ip6ConfigProtocol = extern struct {7pub const Ip6ConfigProtocol = extern struct {
8 _set_data: std.meta.FnPtr(fn (*const Ip6ConfigProtocol, Ip6ConfigDataType, usize, *const anyopaque) callconv(.C) Status),8 _set_data: *const fn (*const Ip6ConfigProtocol, Ip6ConfigDataType, usize, *const anyopaque) callconv(.C) Status,
9 _get_data: std.meta.FnPtr(fn (*const Ip6ConfigProtocol, Ip6ConfigDataType, *usize, ?*const anyopaque) callconv(.C) Status),9 _get_data: *const fn (*const Ip6ConfigProtocol, Ip6ConfigDataType, *usize, ?*const anyopaque) callconv(.C) Status,
10 _register_data_notify: std.meta.FnPtr(fn (*const Ip6ConfigProtocol, Ip6ConfigDataType, Event) callconv(.C) Status),10 _register_data_notify: *const fn (*const Ip6ConfigProtocol, Ip6ConfigDataType, Event) callconv(.C) Status,
11 _unregister_data_notify: std.meta.FnPtr(fn (*const Ip6ConfigProtocol, Ip6ConfigDataType, Event) callconv(.C) Status),11 _unregister_data_notify: *const fn (*const Ip6ConfigProtocol, Ip6ConfigDataType, Event) callconv(.C) Status,
1212
13 pub fn setData(self: *const Ip6ConfigProtocol, data_type: Ip6ConfigDataType, data_size: usize, data: *const anyopaque) Status {13 pub fn setData(self: *const Ip6ConfigProtocol, data_type: Ip6ConfigDataType, data_size: usize, data: *const anyopaque) Status {
14 return self._set_data(self, data_type, data_size, data);14 return self._set_data(self, data_type, data_size, data);
lib/std/os/uefi/protocols/ip6_protocol.zig+9-9
...@@ -8,15 +8,15 @@ const ManagedNetworkConfigData = uefi.protocols.ManagedNetworkConfigData;...@@ -8,15 +8,15 @@ const ManagedNetworkConfigData = uefi.protocols.ManagedNetworkConfigData;
8const SimpleNetworkMode = uefi.protocols.SimpleNetworkMode;8const SimpleNetworkMode = uefi.protocols.SimpleNetworkMode;
99
10pub const Ip6Protocol = extern struct {10pub const Ip6Protocol = extern struct {
11 _get_mode_data: std.meta.FnPtr(fn (*const Ip6Protocol, ?*Ip6ModeData, ?*ManagedNetworkConfigData, ?*SimpleNetworkMode) callconv(.C) Status),11 _get_mode_data: *const fn (*const Ip6Protocol, ?*Ip6ModeData, ?*ManagedNetworkConfigData, ?*SimpleNetworkMode) callconv(.C) Status,
12 _configure: std.meta.FnPtr(fn (*const Ip6Protocol, ?*const Ip6ConfigData) callconv(.C) Status),12 _configure: *const fn (*const Ip6Protocol, ?*const Ip6ConfigData) callconv(.C) Status,
13 _groups: std.meta.FnPtr(fn (*const Ip6Protocol, bool, ?*const Ip6Address) callconv(.C) Status),13 _groups: *const fn (*const Ip6Protocol, bool, ?*const Ip6Address) callconv(.C) Status,
14 _routes: std.meta.FnPtr(fn (*const Ip6Protocol, bool, ?*const Ip6Address, u8, ?*const Ip6Address) callconv(.C) Status),14 _routes: *const fn (*const Ip6Protocol, bool, ?*const Ip6Address, u8, ?*const Ip6Address) callconv(.C) Status,
15 _neighbors: std.meta.FnPtr(fn (*const Ip6Protocol, bool, *const Ip6Address, ?*const MacAddress, u32, bool) callconv(.C) Status),15 _neighbors: *const fn (*const Ip6Protocol, bool, *const Ip6Address, ?*const MacAddress, u32, bool) callconv(.C) Status,
16 _transmit: std.meta.FnPtr(fn (*const Ip6Protocol, *Ip6CompletionToken) callconv(.C) Status),16 _transmit: *const fn (*const Ip6Protocol, *Ip6CompletionToken) callconv(.C) Status,
17 _receive: std.meta.FnPtr(fn (*const Ip6Protocol, *Ip6CompletionToken) callconv(.C) Status),17 _receive: *const fn (*const Ip6Protocol, *Ip6CompletionToken) callconv(.C) Status,
18 _cancel: std.meta.FnPtr(fn (*const Ip6Protocol, ?*Ip6CompletionToken) callconv(.C) Status),18 _cancel: *const fn (*const Ip6Protocol, ?*Ip6CompletionToken) callconv(.C) Status,
19 _poll: std.meta.FnPtr(fn (*const Ip6Protocol) callconv(.C) Status),19 _poll: *const fn (*const Ip6Protocol) callconv(.C) Status,
2020
21 /// Gets the current operational settings for this instance of the EFI IPv6 Protocol driver.21 /// Gets the current operational settings for this instance of the EFI IPv6 Protocol driver.
22 pub fn getModeData(self: *const Ip6Protocol, ip6_mode_data: ?*Ip6ModeData, mnp_config_data: ?*ManagedNetworkConfigData, snp_mode_data: ?*SimpleNetworkMode) Status {22 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
...@@ -5,8 +5,8 @@ const Guid = uefi.Guid;...@@ -5,8 +5,8 @@ const Guid = uefi.Guid;
5const Status = uefi.Status;5const Status = uefi.Status;
66
7pub const Ip6ServiceBindingProtocol = extern struct {7pub const Ip6ServiceBindingProtocol = extern struct {
8 _create_child: std.meta.FnPtr(fn (*const Ip6ServiceBindingProtocol, *?Handle) callconv(.C) Status),8 _create_child: *const fn (*const Ip6ServiceBindingProtocol, *?Handle) callconv(.C) Status,
9 _destroy_child: std.meta.FnPtr(fn (*const Ip6ServiceBindingProtocol, Handle) callconv(.C) Status),9 _destroy_child: *const fn (*const Ip6ServiceBindingProtocol, Handle) callconv(.C) Status,
1010
11 pub fn createChild(self: *const Ip6ServiceBindingProtocol, handle: *?Handle) Status {11 pub fn createChild(self: *const Ip6ServiceBindingProtocol, handle: *?Handle) Status {
12 return self._create_child(self, handle);12 return self._create_child(self, handle);
lib/std/os/uefi/protocols/loaded_image_protocol.zig+1-1
...@@ -20,7 +20,7 @@ pub const LoadedImageProtocol = extern struct {...@@ -20,7 +20,7 @@ pub const LoadedImageProtocol = extern struct {
20 image_size: u64,20 image_size: u64,
21 image_code_type: MemoryType,21 image_code_type: MemoryType,
22 image_data_type: MemoryType,22 image_data_type: MemoryType,
23 _unload: std.meta.FnPtr(fn (*const LoadedImageProtocol, Handle) callconv(.C) Status),23 _unload: *const fn (*const LoadedImageProtocol, Handle) callconv(.C) Status,
2424
25 /// Unloads an image from memory.25 /// Unloads an image from memory.
26 pub fn unload(self: *const LoadedImageProtocol, handle: Handle) Status {26 pub fn unload(self: *const LoadedImageProtocol, handle: Handle) Status {
lib/std/os/uefi/protocols/managed_network_protocol.zig+8-8
...@@ -8,14 +8,14 @@ const SimpleNetworkMode = uefi.protocols.SimpleNetworkMode;...@@ -8,14 +8,14 @@ const SimpleNetworkMode = uefi.protocols.SimpleNetworkMode;
8const MacAddress = uefi.protocols.MacAddress;8const MacAddress = uefi.protocols.MacAddress;
99
10pub const ManagedNetworkProtocol = extern struct {10pub const ManagedNetworkProtocol = extern struct {
11 _get_mode_data: std.meta.FnPtr(fn (*const ManagedNetworkProtocol, ?*ManagedNetworkConfigData, ?*SimpleNetworkMode) callconv(.C) Status),11 _get_mode_data: *const fn (*const ManagedNetworkProtocol, ?*ManagedNetworkConfigData, ?*SimpleNetworkMode) callconv(.C) Status,
12 _configure: std.meta.FnPtr(fn (*const ManagedNetworkProtocol, ?*const ManagedNetworkConfigData) callconv(.C) Status),12 _configure: *const fn (*const ManagedNetworkProtocol, ?*const ManagedNetworkConfigData) callconv(.C) Status,
13 _mcast_ip_to_mac: std.meta.FnPtr(fn (*const ManagedNetworkProtocol, bool, *const anyopaque, *MacAddress) callconv(.C) Status),13 _mcast_ip_to_mac: *const fn (*const ManagedNetworkProtocol, bool, *const anyopaque, *MacAddress) callconv(.C) Status,
14 _groups: std.meta.FnPtr(fn (*const ManagedNetworkProtocol, bool, ?*const MacAddress) callconv(.C) Status),14 _groups: *const fn (*const ManagedNetworkProtocol, bool, ?*const MacAddress) callconv(.C) Status,
15 _transmit: std.meta.FnPtr(fn (*const ManagedNetworkProtocol, *const ManagedNetworkCompletionToken) callconv(.C) Status),15 _transmit: *const fn (*const ManagedNetworkProtocol, *const ManagedNetworkCompletionToken) callconv(.C) Status,
16 _receive: std.meta.FnPtr(fn (*const ManagedNetworkProtocol, *const ManagedNetworkCompletionToken) callconv(.C) Status),16 _receive: *const fn (*const ManagedNetworkProtocol, *const ManagedNetworkCompletionToken) callconv(.C) Status,
17 _cancel: std.meta.FnPtr(fn (*const ManagedNetworkProtocol, ?*const ManagedNetworkCompletionToken) callconv(.C) Status),17 _cancel: *const fn (*const ManagedNetworkProtocol, ?*const ManagedNetworkCompletionToken) callconv(.C) Status,
18 _poll: std.meta.FnPtr(fn (*const ManagedNetworkProtocol) callconv(.C) Status),18 _poll: *const fn (*const ManagedNetworkProtocol) callconv(.C) Status,
1919
20 /// Returns the operational parameters for the current MNP child driver.20 /// Returns the operational parameters for the current MNP child driver.
21 /// May also support returning the underlying SNP driver mode data.21 /// May also support returning the underlying SNP driver mode data.
lib/std/os/uefi/protocols/managed_network_service_binding_protocol.zig+2-2
...@@ -5,8 +5,8 @@ const Guid = uefi.Guid;...@@ -5,8 +5,8 @@ const Guid = uefi.Guid;
5const Status = uefi.Status;5const Status = uefi.Status;
66
7pub const ManagedNetworkServiceBindingProtocol = extern struct {7pub const ManagedNetworkServiceBindingProtocol = extern struct {
8 _create_child: std.meta.FnPtr(fn (*const ManagedNetworkServiceBindingProtocol, *?Handle) callconv(.C) Status),8 _create_child: *const fn (*const ManagedNetworkServiceBindingProtocol, *?Handle) callconv(.C) Status,
9 _destroy_child: std.meta.FnPtr(fn (*const ManagedNetworkServiceBindingProtocol, Handle) callconv(.C) Status),9 _destroy_child: *const fn (*const ManagedNetworkServiceBindingProtocol, Handle) callconv(.C) Status,
1010
11 pub fn createChild(self: *const ManagedNetworkServiceBindingProtocol, handle: *?Handle) Status {11 pub fn createChild(self: *const ManagedNetworkServiceBindingProtocol, handle: *?Handle) Status {
12 return self._create_child(self, handle);12 return self._create_child(self, handle);
lib/std/os/uefi/protocols/rng_protocol.zig+2-2
...@@ -5,8 +5,8 @@ const Status = uefi.Status;...@@ -5,8 +5,8 @@ const Status = uefi.Status;
55
6/// Random Number Generator protocol6/// Random Number Generator protocol
7pub const RNGProtocol = extern struct {7pub const RNGProtocol = extern struct {
8 _get_info: std.meta.FnPtr(fn (*const RNGProtocol, *usize, [*]align(8) Guid) callconv(.C) Status),8 _get_info: *const fn (*const RNGProtocol, *usize, [*]align(8) Guid) callconv(.C) Status,
9 _get_rng: std.meta.FnPtr(fn (*const RNGProtocol, ?*align(8) const Guid, usize, [*]u8) callconv(.C) Status),9 _get_rng: *const fn (*const RNGProtocol, ?*align(8) const Guid, usize, [*]u8) callconv(.C) Status,
1010
11 /// Returns information about the random number generation implementation.11 /// Returns information about the random number generation implementation.
12 pub fn getInfo(self: *const RNGProtocol, list_size: *usize, list: [*]align(8) Guid) Status {12 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
...@@ -6,7 +6,7 @@ const Status = uefi.Status;...@@ -6,7 +6,7 @@ const Status = uefi.Status;
66
7pub const SimpleFileSystemProtocol = extern struct {7pub const SimpleFileSystemProtocol = extern struct {
8 revision: u64,8 revision: u64,
9 _open_volume: std.meta.FnPtr(fn (*const SimpleFileSystemProtocol, **const FileProtocol) callconv(.C) Status),9 _open_volume: *const fn (*const SimpleFileSystemProtocol, **const FileProtocol) callconv(.C) Status,
1010
11 pub fn openVolume(self: *const SimpleFileSystemProtocol, root: **const FileProtocol) Status {11 pub fn openVolume(self: *const SimpleFileSystemProtocol, root: **const FileProtocol) Status {
12 return self._open_volume(self, root);12 return self._open_volume(self, root);
lib/std/os/uefi/protocols/simple_network_protocol.zig+13-13
...@@ -6,19 +6,19 @@ const Status = uefi.Status;...@@ -6,19 +6,19 @@ const Status = uefi.Status;
66
7pub const SimpleNetworkProtocol = extern struct {7pub const SimpleNetworkProtocol = extern struct {
8 revision: u64,8 revision: u64,
9 _start: std.meta.FnPtr(fn (*const SimpleNetworkProtocol) callconv(.C) Status),9 _start: *const fn (*const SimpleNetworkProtocol) callconv(.C) Status,
10 _stop: std.meta.FnPtr(fn (*const SimpleNetworkProtocol) callconv(.C) Status),10 _stop: *const fn (*const SimpleNetworkProtocol) callconv(.C) Status,
11 _initialize: std.meta.FnPtr(fn (*const SimpleNetworkProtocol, usize, usize) callconv(.C) Status),11 _initialize: *const fn (*const SimpleNetworkProtocol, usize, usize) callconv(.C) Status,
12 _reset: std.meta.FnPtr(fn (*const SimpleNetworkProtocol, bool) callconv(.C) Status),12 _reset: *const fn (*const SimpleNetworkProtocol, bool) callconv(.C) Status,
13 _shutdown: std.meta.FnPtr(fn (*const SimpleNetworkProtocol) callconv(.C) Status),13 _shutdown: *const fn (*const SimpleNetworkProtocol) callconv(.C) Status,
14 _receive_filters: std.meta.FnPtr(fn (*const SimpleNetworkProtocol, SimpleNetworkReceiveFilter, SimpleNetworkReceiveFilter, bool, usize, ?[*]const MacAddress) callconv(.C) Status),14 _receive_filters: *const fn (*const SimpleNetworkProtocol, SimpleNetworkReceiveFilter, SimpleNetworkReceiveFilter, bool, usize, ?[*]const MacAddress) callconv(.C) Status,
15 _station_address: std.meta.FnPtr(fn (*const SimpleNetworkProtocol, bool, ?*const MacAddress) callconv(.C) Status),15 _station_address: *const fn (*const SimpleNetworkProtocol, bool, ?*const MacAddress) callconv(.C) Status,
16 _statistics: std.meta.FnPtr(fn (*const SimpleNetworkProtocol, bool, ?*usize, ?*NetworkStatistics) callconv(.C) Status),16 _statistics: *const fn (*const SimpleNetworkProtocol, bool, ?*usize, ?*NetworkStatistics) callconv(.C) Status,
17 _mcast_ip_to_mac: std.meta.FnPtr(fn (*const SimpleNetworkProtocol, bool, *const anyopaque, *MacAddress) callconv(.C) Status),17 _mcast_ip_to_mac: *const fn (*const SimpleNetworkProtocol, bool, *const anyopaque, *MacAddress) callconv(.C) Status,
18 _nvdata: std.meta.FnPtr(fn (*const SimpleNetworkProtocol, bool, usize, usize, [*]u8) callconv(.C) Status),18 _nvdata: *const fn (*const SimpleNetworkProtocol, bool, usize, usize, [*]u8) callconv(.C) Status,
19 _get_status: std.meta.FnPtr(fn (*const SimpleNetworkProtocol, *SimpleNetworkInterruptStatus, ?*?[*]u8) callconv(.C) Status),19 _get_status: *const fn (*const SimpleNetworkProtocol, *SimpleNetworkInterruptStatus, ?*?[*]u8) callconv(.C) Status,
20 _transmit: std.meta.FnPtr(fn (*const SimpleNetworkProtocol, usize, usize, [*]const u8, ?*const MacAddress, ?*const MacAddress, ?*const u16) callconv(.C) Status),20 _transmit: *const fn (*const SimpleNetworkProtocol, usize, usize, [*]const u8, ?*const MacAddress, ?*const MacAddress, ?*const u16) callconv(.C) Status,
21 _receive: std.meta.FnPtr(fn (*const SimpleNetworkProtocol, ?*usize, *usize, [*]u8, ?*MacAddress, ?*MacAddress, ?*u16) callconv(.C) Status),21 _receive: *const fn (*const SimpleNetworkProtocol, ?*usize, *usize, [*]u8, ?*MacAddress, ?*MacAddress, ?*u16) callconv(.C) Status,
22 wait_for_packet: Event,22 wait_for_packet: Event,
23 mode: *SimpleNetworkMode,23 mode: *SimpleNetworkMode,
2424
lib/std/os/uefi/protocols/simple_pointer_protocol.zig+2-2
...@@ -6,8 +6,8 @@ const Status = uefi.Status;...@@ -6,8 +6,8 @@ const Status = uefi.Status;
66
7/// Protocol for mice7/// Protocol for mice
8pub const SimplePointerProtocol = struct {8pub const SimplePointerProtocol = struct {
9 _reset: std.meta.FnPtr(fn (*const SimplePointerProtocol, bool) callconv(.C) Status),9 _reset: *const fn (*const SimplePointerProtocol, bool) callconv(.C) Status,
10 _get_state: std.meta.FnPtr(fn (*const SimplePointerProtocol, *SimplePointerState) callconv(.C) Status),10 _get_state: *const fn (*const SimplePointerProtocol, *SimplePointerState) callconv(.C) Status,
11 wait_for_input: Event,11 wait_for_input: Event,
12 mode: *SimplePointerMode,12 mode: *SimplePointerMode,
1313
lib/std/os/uefi/protocols/simple_text_input_ex_protocol.zig+6-6
...@@ -6,12 +6,12 @@ const Status = uefi.Status;...@@ -6,12 +6,12 @@ const Status = uefi.Status;
66
7/// Character input devices, e.g. Keyboard7/// Character input devices, e.g. Keyboard
8pub const SimpleTextInputExProtocol = extern struct {8pub const SimpleTextInputExProtocol = extern struct {
9 _reset: std.meta.FnPtr(fn (*const SimpleTextInputExProtocol, bool) callconv(.C) Status),9 _reset: *const fn (*const SimpleTextInputExProtocol, bool) callconv(.C) Status,
10 _read_key_stroke_ex: std.meta.FnPtr(fn (*const SimpleTextInputExProtocol, *KeyData) callconv(.C) Status),10 _read_key_stroke_ex: *const fn (*const SimpleTextInputExProtocol, *KeyData) callconv(.C) Status,
11 wait_for_key_ex: Event,11 wait_for_key_ex: Event,
12 _set_state: std.meta.FnPtr(fn (*const SimpleTextInputExProtocol, *const u8) callconv(.C) Status),12 _set_state: *const fn (*const SimpleTextInputExProtocol, *const u8) callconv(.C) Status,
13 _register_key_notify: std.meta.FnPtr(fn (*const SimpleTextInputExProtocol, *const KeyData, std.meta.FnPtr(fn (*const KeyData) callconv(.C) usize), **anyopaque) callconv(.C) Status),13 _register_key_notify: *const fn (*const SimpleTextInputExProtocol, *const KeyData, *const fn (*const KeyData) callconv(.C) usize, **anyopaque) callconv(.C) Status,
14 _unregister_key_notify: std.meta.FnPtr(fn (*const SimpleTextInputExProtocol, *const anyopaque) callconv(.C) Status),14 _unregister_key_notify: *const fn (*const SimpleTextInputExProtocol, *const anyopaque) callconv(.C) Status,
1515
16 /// Resets the input device hardware.16 /// Resets the input device hardware.
17 pub fn reset(self: *const SimpleTextInputExProtocol, verify: bool) Status {17 pub fn reset(self: *const SimpleTextInputExProtocol, verify: bool) Status {
...@@ -29,7 +29,7 @@ pub const SimpleTextInputExProtocol = extern struct {...@@ -29,7 +29,7 @@ pub const SimpleTextInputExProtocol = extern struct {
29 }29 }
3030
31 /// Register a notification function for a particular keystroke for the input device.31 /// Register a notification function for a particular keystroke for the input device.
32 pub fn registerKeyNotify(self: *const SimpleTextInputExProtocol, key_data: *const KeyData, notify: std.meta.FnPtr(fn (*const KeyData) callconv(.C) usize), handle: **anyopaque) Status {32 pub fn registerKeyNotify(self: *const SimpleTextInputExProtocol, key_data: *const KeyData, notify: *const fn (*const KeyData) callconv(.C) usize, handle: **anyopaque) Status {
33 return self._register_key_notify(self, key_data, notify, handle);33 return self._register_key_notify(self, key_data, notify, handle);
34 }34 }
3535
lib/std/os/uefi/protocols/simple_text_input_protocol.zig+2-2
...@@ -7,8 +7,8 @@ const Status = uefi.Status;...@@ -7,8 +7,8 @@ const Status = uefi.Status;
77
8/// Character input devices, e.g. Keyboard8/// Character input devices, e.g. Keyboard
9pub const SimpleTextInputProtocol = extern struct {9pub const SimpleTextInputProtocol = extern struct {
10 _reset: std.meta.FnPtr(fn (*const SimpleTextInputProtocol, bool) callconv(.C) Status),10 _reset: *const fn (*const SimpleTextInputProtocol, bool) callconv(.C) Status,
11 _read_key_stroke: std.meta.FnPtr(fn (*const SimpleTextInputProtocol, *InputKey) callconv(.C) Status),11 _read_key_stroke: *const fn (*const SimpleTextInputProtocol, *InputKey) callconv(.C) Status,
12 wait_for_key: Event,12 wait_for_key: Event,
1313
14 /// Resets the input device hardware.14 /// Resets the input device hardware.
lib/std/os/uefi/protocols/simple_text_output_protocol.zig+9-9
...@@ -5,15 +5,15 @@ const Status = uefi.Status;...@@ -5,15 +5,15 @@ const Status = uefi.Status;
55
6/// Character output devices6/// Character output devices
7pub const SimpleTextOutputProtocol = extern struct {7pub const SimpleTextOutputProtocol = extern struct {
8 _reset: std.meta.FnPtr(fn (*const SimpleTextOutputProtocol, bool) callconv(.C) Status),8 _reset: *const fn (*const SimpleTextOutputProtocol, bool) callconv(.C) Status,
9 _output_string: std.meta.FnPtr(fn (*const SimpleTextOutputProtocol, [*:0]const u16) callconv(.C) Status),9 _output_string: *const fn (*const SimpleTextOutputProtocol, [*:0]const u16) callconv(.C) Status,
10 _test_string: std.meta.FnPtr(fn (*const SimpleTextOutputProtocol, [*:0]const u16) callconv(.C) Status),10 _test_string: *const fn (*const SimpleTextOutputProtocol, [*:0]const u16) callconv(.C) Status,
11 _query_mode: std.meta.FnPtr(fn (*const SimpleTextOutputProtocol, usize, *usize, *usize) callconv(.C) Status),11 _query_mode: *const fn (*const SimpleTextOutputProtocol, usize, *usize, *usize) callconv(.C) Status,
12 _set_mode: std.meta.FnPtr(fn (*const SimpleTextOutputProtocol, usize) callconv(.C) Status),12 _set_mode: *const fn (*const SimpleTextOutputProtocol, usize) callconv(.C) Status,
13 _set_attribute: std.meta.FnPtr(fn (*const SimpleTextOutputProtocol, usize) callconv(.C) Status),13 _set_attribute: *const fn (*const SimpleTextOutputProtocol, usize) callconv(.C) Status,
14 _clear_screen: std.meta.FnPtr(fn (*const SimpleTextOutputProtocol) callconv(.C) Status),14 _clear_screen: *const fn (*const SimpleTextOutputProtocol) callconv(.C) Status,
15 _set_cursor_position: std.meta.FnPtr(fn (*const SimpleTextOutputProtocol, usize, usize) callconv(.C) Status),15 _set_cursor_position: *const fn (*const SimpleTextOutputProtocol, usize, usize) callconv(.C) Status,
16 _enable_cursor: std.meta.FnPtr(fn (*const SimpleTextOutputProtocol, bool) callconv(.C) Status),16 _enable_cursor: *const fn (*const SimpleTextOutputProtocol, bool) callconv(.C) Status,
17 mode: *SimpleTextOutputMode,17 mode: *SimpleTextOutputMode,
1818
19 /// Resets the text output device hardware.19 /// Resets the text output device hardware.
lib/std/os/uefi/protocols/udp6_protocol.zig+7-7
...@@ -10,13 +10,13 @@ const ManagedNetworkConfigData = uefi.protocols.ManagedNetworkConfigData;...@@ -10,13 +10,13 @@ const ManagedNetworkConfigData = uefi.protocols.ManagedNetworkConfigData;
10const SimpleNetworkMode = uefi.protocols.SimpleNetworkMode;10const SimpleNetworkMode = uefi.protocols.SimpleNetworkMode;
1111
12pub const Udp6Protocol = extern struct {12pub const Udp6Protocol = extern struct {
13 _get_mode_data: std.meta.FnPtr(fn (*const Udp6Protocol, ?*Udp6ConfigData, ?*Ip6ModeData, ?*ManagedNetworkConfigData, ?*SimpleNetworkMode) callconv(.C) Status),13 _get_mode_data: *const fn (*const Udp6Protocol, ?*Udp6ConfigData, ?*Ip6ModeData, ?*ManagedNetworkConfigData, ?*SimpleNetworkMode) callconv(.C) Status,
14 _configure: std.meta.FnPtr(fn (*const Udp6Protocol, ?*const Udp6ConfigData) callconv(.C) Status),14 _configure: *const fn (*const Udp6Protocol, ?*const Udp6ConfigData) callconv(.C) Status,
15 _groups: std.meta.FnPtr(fn (*const Udp6Protocol, bool, ?*const Ip6Address) callconv(.C) Status),15 _groups: *const fn (*const Udp6Protocol, bool, ?*const Ip6Address) callconv(.C) Status,
16 _transmit: std.meta.FnPtr(fn (*const Udp6Protocol, *Udp6CompletionToken) callconv(.C) Status),16 _transmit: *const fn (*const Udp6Protocol, *Udp6CompletionToken) callconv(.C) Status,
17 _receive: std.meta.FnPtr(fn (*const Udp6Protocol, *Udp6CompletionToken) callconv(.C) Status),17 _receive: *const fn (*const Udp6Protocol, *Udp6CompletionToken) callconv(.C) Status,
18 _cancel: std.meta.FnPtr(fn (*const Udp6Protocol, ?*Udp6CompletionToken) callconv(.C) Status),18 _cancel: *const fn (*const Udp6Protocol, ?*Udp6CompletionToken) callconv(.C) Status,
19 _poll: std.meta.FnPtr(fn (*const Udp6Protocol) callconv(.C) Status),19 _poll: *const fn (*const Udp6Protocol) callconv(.C) Status,
2020
21 pub fn getModeData(self: *const Udp6Protocol, udp6_config_data: ?*Udp6ConfigData, ip6_mode_data: ?*Ip6ModeData, mnp_config_data: ?*ManagedNetworkConfigData, snp_mode_data: ?*SimpleNetworkMode) Status {21 pub fn getModeData(self: *const Udp6Protocol, udp6_config_data: ?*Udp6ConfigData, ip6_mode_data: ?*Ip6ModeData, mnp_config_data: ?*ManagedNetworkConfigData, snp_mode_data: ?*SimpleNetworkMode) Status {
22 return self._get_mode_data(self, udp6_config_data, ip6_mode_data, mnp_config_data, snp_mode_data);22 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
...@@ -5,8 +5,8 @@ const Guid = uefi.Guid;...@@ -5,8 +5,8 @@ const Guid = uefi.Guid;
5const Status = uefi.Status;5const Status = uefi.Status;
66
7pub const Udp6ServiceBindingProtocol = extern struct {7pub const Udp6ServiceBindingProtocol = extern struct {
8 _create_child: std.meta.FnPtr(fn (*const Udp6ServiceBindingProtocol, *?Handle) callconv(.C) Status),8 _create_child: *const fn (*const Udp6ServiceBindingProtocol, *?Handle) callconv(.C) Status,
9 _destroy_child: std.meta.FnPtr(fn (*const Udp6ServiceBindingProtocol, Handle) callconv(.C) Status),9 _destroy_child: *const fn (*const Udp6ServiceBindingProtocol, Handle) callconv(.C) Status,
1010
11 pub fn createChild(self: *const Udp6ServiceBindingProtocol, handle: *?Handle) Status {11 pub fn createChild(self: *const Udp6ServiceBindingProtocol, handle: *?Handle) Status {
12 return self._create_child(self, handle);12 return self._create_child(self, handle);
lib/std/os/uefi/tables/boot_services.zig+44-44
...@@ -22,138 +22,138 @@ pub const BootServices = extern struct {...@@ -22,138 +22,138 @@ pub const BootServices = extern struct {
22 hdr: TableHeader,22 hdr: TableHeader,
2323
24 /// Raises a task's priority level and returns its previous level.24 /// Raises a task's priority level and returns its previous level.
25 raiseTpl: std.meta.FnPtr(fn (new_tpl: usize) callconv(.C) usize),25 raiseTpl: *const fn (new_tpl: usize) callconv(.C) usize,
2626
27 /// Restores a task's priority level to its previous value.27 /// Restores a task's priority level to its previous value.
28 restoreTpl: std.meta.FnPtr(fn (old_tpl: usize) callconv(.C) void),28 restoreTpl: *const fn (old_tpl: usize) callconv(.C) void,
2929
30 /// Allocates memory pages from the system.30 /// Allocates memory pages from the system.
31 allocatePages: std.meta.FnPtr(fn (alloc_type: AllocateType, mem_type: MemoryType, pages: usize, memory: *[*]align(4096) u8) callconv(.C) Status),31 allocatePages: *const fn (alloc_type: AllocateType, mem_type: MemoryType, pages: usize, memory: *[*]align(4096) u8) callconv(.C) Status,
3232
33 /// Frees memory pages.33 /// Frees memory pages.
34 freePages: std.meta.FnPtr(fn (memory: [*]align(4096) u8, pages: usize) callconv(.C) Status),34 freePages: *const fn (memory: [*]align(4096) u8, pages: usize) callconv(.C) Status,
3535
36 /// Returns the current memory map.36 /// Returns the current memory map.
37 getMemoryMap: std.meta.FnPtr(fn (mmap_size: *usize, mmap: ?[*]MemoryDescriptor, mapKey: *usize, descriptor_size: *usize, descriptor_version: *u32) callconv(.C) Status),37 getMemoryMap: *const fn (mmap_size: *usize, mmap: ?[*]MemoryDescriptor, mapKey: *usize, descriptor_size: *usize, descriptor_version: *u32) callconv(.C) Status,
3838
39 /// Allocates pool memory.39 /// Allocates pool memory.
40 allocatePool: std.meta.FnPtr(fn (pool_type: MemoryType, size: usize, buffer: *[*]align(8) u8) callconv(.C) Status),40 allocatePool: *const fn (pool_type: MemoryType, size: usize, buffer: *[*]align(8) u8) callconv(.C) Status,
4141
42 /// Returns pool memory to the system.42 /// Returns pool memory to the system.
43 freePool: std.meta.FnPtr(fn (buffer: [*]align(8) u8) callconv(.C) Status),43 freePool: *const fn (buffer: [*]align(8) u8) callconv(.C) Status,
4444
45 /// Creates an event.45 /// Creates an event.
46 createEvent: std.meta.FnPtr(fn (type: u32, notify_tpl: usize, notify_func: ?std.meta.FnPtr(fn (Event, ?*anyopaque) callconv(.C) void), notifyCtx: ?*const anyopaque, event: *Event) callconv(.C) Status),46 createEvent: *const fn (type: u32, notify_tpl: usize, notify_func: ?*const fn (Event, ?*anyopaque) callconv(.C) void, notifyCtx: ?*const anyopaque, event: *Event) callconv(.C) Status,
4747
48 /// Sets the type of timer and the trigger time for a timer event.48 /// Sets the type of timer and the trigger time for a timer event.
49 setTimer: std.meta.FnPtr(fn (event: Event, type: TimerDelay, triggerTime: u64) callconv(.C) Status),49 setTimer: *const fn (event: Event, type: TimerDelay, triggerTime: u64) callconv(.C) Status,
5050
51 /// Stops execution until an event is signaled.51 /// Stops execution until an event is signaled.
52 waitForEvent: std.meta.FnPtr(fn (event_len: usize, events: [*]const Event, index: *usize) callconv(.C) Status),52 waitForEvent: *const fn (event_len: usize, events: [*]const Event, index: *usize) callconv(.C) Status,
5353
54 /// Signals an event.54 /// Signals an event.
55 signalEvent: std.meta.FnPtr(fn (event: Event) callconv(.C) Status),55 signalEvent: *const fn (event: Event) callconv(.C) Status,
5656
57 /// Closes an event.57 /// Closes an event.
58 closeEvent: std.meta.FnPtr(fn (event: Event) callconv(.C) Status),58 closeEvent: *const fn (event: Event) callconv(.C) Status,
5959
60 /// Checks whether an event is in the signaled state.60 /// Checks whether an event is in the signaled state.
61 checkEvent: std.meta.FnPtr(fn (event: Event) callconv(.C) Status),61 checkEvent: *const fn (event: Event) callconv(.C) Status,
6262
63 /// Installs a protocol interface on a device handle. If the handle does not exist, it is created63 /// Installs a protocol interface on a device handle. If the handle does not exist, it is created
64 /// and added to the list of handles in the system. installMultipleProtocolInterfaces()64 /// and added to the list of handles in the system. installMultipleProtocolInterfaces()
65 /// performs more error checking than installProtocolInterface(), so its use is recommended over this.65 /// performs more error checking than installProtocolInterface(), so its use is recommended over this.
66 installProtocolInterface: std.meta.FnPtr(fn (handle: Handle, protocol: *align(8) const Guid, interface_type: EfiInterfaceType, interface: *anyopaque) callconv(.C) Status),66 installProtocolInterface: *const fn (handle: Handle, protocol: *align(8) const Guid, interface_type: EfiInterfaceType, interface: *anyopaque) callconv(.C) Status,
6767
68 /// Reinstalls a protocol interface on a device handle68 /// Reinstalls a protocol interface on a device handle
69 reinstallProtocolInterface: std.meta.FnPtr(fn (handle: Handle, protocol: *align(8) const Guid, old_interface: *anyopaque, new_interface: *anyopaque) callconv(.C) Status),69 reinstallProtocolInterface: *const fn (handle: Handle, protocol: *align(8) const Guid, old_interface: *anyopaque, new_interface: *anyopaque) callconv(.C) Status,
7070
71 /// Removes a protocol interface from a device handle. Usage of71 /// Removes a protocol interface from a device handle. Usage of
72 /// uninstallMultipleProtocolInterfaces is recommended over this.72 /// uninstallMultipleProtocolInterfaces is recommended over this.
73 uninstallProtocolInterface: std.meta.FnPtr(fn (handle: Handle, protocol: *align(8) const Guid, interface: *anyopaque) callconv(.C) Status),73 uninstallProtocolInterface: *const fn (handle: Handle, protocol: *align(8) const Guid, interface: *anyopaque) callconv(.C) Status,
7474
75 /// Queries a handle to determine if it supports a specified protocol.75 /// Queries a handle to determine if it supports a specified protocol.
76 handleProtocol: std.meta.FnPtr(fn (handle: Handle, protocol: *align(8) const Guid, interface: *?*anyopaque) callconv(.C) Status),76 handleProtocol: *const fn (handle: Handle, protocol: *align(8) const Guid, interface: *?*anyopaque) callconv(.C) Status,
7777
78 reserved: *anyopaque,78 reserved: *anyopaque,
7979
80 /// Creates an event that is to be signaled whenever an interface is installed for a specified protocol.80 /// Creates an event that is to be signaled whenever an interface is installed for a specified protocol.
81 registerProtocolNotify: std.meta.FnPtr(fn (protocol: *align(8) const Guid, event: Event, registration: **anyopaque) callconv(.C) Status),81 registerProtocolNotify: *const fn (protocol: *align(8) const Guid, event: Event, registration: **anyopaque) callconv(.C) Status,
8282
83 /// Returns an array of handles that support a specified protocol.83 /// Returns an array of handles that support a specified protocol.
84 locateHandle: std.meta.FnPtr(fn (search_type: LocateSearchType, protocol: ?*align(8) const Guid, search_key: ?*const anyopaque, bufferSize: *usize, buffer: [*]Handle) callconv(.C) Status),84 locateHandle: *const fn (search_type: LocateSearchType, protocol: ?*align(8) const Guid, search_key: ?*const anyopaque, bufferSize: *usize, buffer: [*]Handle) callconv(.C) Status,
8585
86 /// Locates the handle to a device on the device path that supports the specified protocol86 /// Locates the handle to a device on the device path that supports the specified protocol
87 locateDevicePath: std.meta.FnPtr(fn (protocols: *align(8) const Guid, device_path: **const DevicePathProtocol, device: *?Handle) callconv(.C) Status),87 locateDevicePath: *const fn (protocols: *align(8) const Guid, device_path: **const DevicePathProtocol, device: *?Handle) callconv(.C) Status,
8888
89 /// Adds, updates, or removes a configuration table entry from the EFI System Table.89 /// Adds, updates, or removes a configuration table entry from the EFI System Table.
90 installConfigurationTable: std.meta.FnPtr(fn (guid: *align(8) const Guid, table: ?*anyopaque) callconv(.C) Status),90 installConfigurationTable: *const fn (guid: *align(8) const Guid, table: ?*anyopaque) callconv(.C) Status,
9191
92 /// Loads an EFI image into memory.92 /// Loads an EFI image into memory.
93 loadImage: std.meta.FnPtr(fn (boot_policy: bool, parent_image_handle: Handle, device_path: ?*const DevicePathProtocol, source_buffer: ?[*]const u8, source_size: usize, imageHandle: *?Handle) callconv(.C) Status),93 loadImage: *const fn (boot_policy: bool, parent_image_handle: Handle, device_path: ?*const DevicePathProtocol, source_buffer: ?[*]const u8, source_size: usize, imageHandle: *?Handle) callconv(.C) Status,
9494
95 /// Transfers control to a loaded image's entry point.95 /// Transfers control to a loaded image's entry point.
96 startImage: std.meta.FnPtr(fn (image_handle: Handle, exit_data_size: ?*usize, exit_data: ?*[*]u16) callconv(.C) Status),96 startImage: *const fn (image_handle: Handle, exit_data_size: ?*usize, exit_data: ?*[*]u16) callconv(.C) Status,
9797
98 /// Terminates a loaded EFI image and returns control to boot services.98 /// Terminates a loaded EFI image and returns control to boot services.
99 exit: std.meta.FnPtr(fn (image_handle: Handle, exit_status: Status, exit_data_size: usize, exit_data: ?*const anyopaque) callconv(.C) Status),99 exit: *const fn (image_handle: Handle, exit_status: Status, exit_data_size: usize, exit_data: ?*const anyopaque) callconv(.C) Status,
100100
101 /// Unloads an image.101 /// Unloads an image.
102 unloadImage: std.meta.FnPtr(fn (image_handle: Handle) callconv(.C) Status),102 unloadImage: *const fn (image_handle: Handle) callconv(.C) Status,
103103
104 /// Terminates all boot services.104 /// Terminates all boot services.
105 exitBootServices: std.meta.FnPtr(fn (image_handle: Handle, map_key: usize) callconv(.C) Status),105 exitBootServices: *const fn (image_handle: Handle, map_key: usize) callconv(.C) Status,
106106
107 /// Returns a monotonically increasing count for the platform.107 /// Returns a monotonically increasing count for the platform.
108 getNextMonotonicCount: std.meta.FnPtr(fn (count: *u64) callconv(.C) Status),108 getNextMonotonicCount: *const fn (count: *u64) callconv(.C) Status,
109109
110 /// Induces a fine-grained stall.110 /// Induces a fine-grained stall.
111 stall: std.meta.FnPtr(fn (microseconds: usize) callconv(.C) Status),111 stall: *const fn (microseconds: usize) callconv(.C) Status,
112112
113 /// Sets the system's watchdog timer.113 /// Sets the system's watchdog timer.
114 setWatchdogTimer: std.meta.FnPtr(fn (timeout: usize, watchdogCode: u64, data_size: usize, watchdog_data: ?[*]const u16) callconv(.C) Status),114 setWatchdogTimer: *const fn (timeout: usize, watchdogCode: u64, data_size: usize, watchdog_data: ?[*]const u16) callconv(.C) Status,
115115
116 /// Connects one or more drives to a controller.116 /// Connects one or more drives to a controller.
117 connectController: std.meta.FnPtr(fn (controller_handle: Handle, driver_image_handle: ?Handle, remaining_device_path: ?*DevicePathProtocol, recursive: bool) callconv(.C) Status),117 connectController: *const fn (controller_handle: Handle, driver_image_handle: ?Handle, remaining_device_path: ?*DevicePathProtocol, recursive: bool) callconv(.C) Status,
118118
119 // Disconnects one or more drivers from a controller119 // Disconnects one or more drivers from a controller
120 disconnectController: std.meta.FnPtr(fn (controller_handle: Handle, driver_image_handle: ?Handle, child_handle: ?Handle) callconv(.C) Status),120 disconnectController: *const fn (controller_handle: Handle, driver_image_handle: ?Handle, child_handle: ?Handle) callconv(.C) Status,
121121
122 /// Queries a handle to determine if it supports a specified protocol.122 /// Queries a handle to determine if it supports a specified protocol.
123 openProtocol: std.meta.FnPtr(fn (handle: Handle, protocol: *align(8) const Guid, interface: *?*anyopaque, agent_handle: ?Handle, controller_handle: ?Handle, attributes: OpenProtocolAttributes) callconv(.C) Status),123 openProtocol: *const fn (handle: Handle, protocol: *align(8) const Guid, interface: *?*anyopaque, agent_handle: ?Handle, controller_handle: ?Handle, attributes: OpenProtocolAttributes) callconv(.C) Status,
124124
125 /// Closes a protocol on a handle that was opened using openProtocol().125 /// Closes a protocol on a handle that was opened using openProtocol().
126 closeProtocol: std.meta.FnPtr(fn (handle: Handle, protocol: *align(8) const Guid, agentHandle: Handle, controller_handle: ?Handle) callconv(.C) Status),126 closeProtocol: *const fn (handle: Handle, protocol: *align(8) const Guid, agentHandle: Handle, controller_handle: ?Handle) callconv(.C) Status,
127127
128 /// Retrieves the list of agents that currently have a protocol interface opened.128 /// Retrieves the list of agents that currently have a protocol interface opened.
129 openProtocolInformation: std.meta.FnPtr(fn (handle: Handle, protocol: *align(8) const Guid, entry_buffer: *[*]ProtocolInformationEntry, entry_count: *usize) callconv(.C) Status),129 openProtocolInformation: *const fn (handle: Handle, protocol: *align(8) const Guid, entry_buffer: *[*]ProtocolInformationEntry, entry_count: *usize) callconv(.C) Status,
130130
131 /// Retrieves the list of protocol interface GUIDs that are installed on a handle in a buffer allocated from pool.131 /// Retrieves the list of protocol interface GUIDs that are installed on a handle in a buffer allocated from pool.
132 protocolsPerHandle: std.meta.FnPtr(fn (handle: Handle, protocol_buffer: *[*]*align(8) const Guid, protocol_buffer_count: *usize) callconv(.C) Status),132 protocolsPerHandle: *const fn (handle: Handle, protocol_buffer: *[*]*align(8) const Guid, protocol_buffer_count: *usize) callconv(.C) Status,
133133
134 /// Returns an array of handles that support the requested protocol in a buffer allocated from pool.134 /// Returns an array of handles that support the requested protocol in a buffer allocated from pool.
135 locateHandleBuffer: std.meta.FnPtr(fn (search_type: LocateSearchType, protocol: ?*align(8) const Guid, search_key: ?*const anyopaque, num_handles: *usize, buffer: *[*]Handle) callconv(.C) Status),135 locateHandleBuffer: *const fn (search_type: LocateSearchType, protocol: ?*align(8) const Guid, search_key: ?*const anyopaque, num_handles: *usize, buffer: *[*]Handle) callconv(.C) Status,
136136
137 /// Returns the first protocol instance that matches the given protocol.137 /// Returns the first protocol instance that matches the given protocol.
138 locateProtocol: std.meta.FnPtr(fn (protocol: *align(8) const Guid, registration: ?*const anyopaque, interface: *?*anyopaque) callconv(.C) Status),138 locateProtocol: *const fn (protocol: *align(8) const Guid, registration: ?*const anyopaque, interface: *?*anyopaque) callconv(.C) Status,
139139
140 /// Installs one or more protocol interfaces into the boot services environment140 /// Installs one or more protocol interfaces into the boot services environment
141 installMultipleProtocolInterfaces: std.meta.FnPtr(fn (handle: *Handle, ...) callconv(.C) Status),141 installMultipleProtocolInterfaces: *const fn (handle: *Handle, ...) callconv(.C) Status,
142142
143 /// Removes one or more protocol interfaces into the boot services environment143 /// Removes one or more protocol interfaces into the boot services environment
144 uninstallMultipleProtocolInterfaces: std.meta.FnPtr(fn (handle: *Handle, ...) callconv(.C) Status),144 uninstallMultipleProtocolInterfaces: *const fn (handle: *Handle, ...) callconv(.C) Status,
145145
146 /// Computes and returns a 32-bit CRC for a data buffer.146 /// Computes and returns a 32-bit CRC for a data buffer.
147 calculateCrc32: std.meta.FnPtr(fn (data: [*]const u8, data_size: usize, *u32) callconv(.C) Status),147 calculateCrc32: *const fn (data: [*]const u8, data_size: usize, *u32) callconv(.C) Status,
148148
149 /// Copies the contents of one buffer to another buffer149 /// Copies the contents of one buffer to another buffer
150 copyMem: std.meta.FnPtr(fn (dest: [*]u8, src: [*]const u8, len: usize) callconv(.C) void),150 copyMem: *const fn (dest: [*]u8, src: [*]const u8, len: usize) callconv(.C) void,
151151
152 /// Fills a buffer with a specified value152 /// Fills a buffer with a specified value
153 setMem: std.meta.FnPtr(fn (buffer: [*]u8, size: usize, value: u8) callconv(.C) void),153 setMem: *const fn (buffer: [*]u8, size: usize, value: u8) callconv(.C) void,
154154
155 /// Creates an event in a group.155 /// Creates an event in a group.
156 createEventEx: std.meta.FnPtr(fn (type: u32, notify_tpl: usize, notify_func: EfiEventNotify, notify_ctx: *const anyopaque, event_group: *align(8) const Guid, event: *Event) callconv(.C) Status),156 createEventEx: *const fn (type: u32, notify_tpl: usize, notify_func: EfiEventNotify, notify_ctx: *const anyopaque, event_group: *align(8) const Guid, event: *Event) callconv(.C) Status,
157157
158 /// Opens a protocol with a structure as the loaded image for a UEFI application158 /// Opens a protocol with a structure as the loaded image for a UEFI application
159 pub fn openProtocolSt(self: *BootServices, comptime protocol: type, handle: Handle) !*protocol {159 pub fn openProtocolSt(self: *BootServices, comptime protocol: type, handle: Handle) !*protocol {
...@@ -191,7 +191,7 @@ pub const BootServices = extern struct {...@@ -191,7 +191,7 @@ pub const BootServices = extern struct {
191 pub const tpl_high_level: usize = 31;191 pub const tpl_high_level: usize = 31;
192};192};
193193
194pub const EfiEventNotify = std.meta.FnPtr(fn (event: Event, ctx: *anyopaque) callconv(.C) void);194pub const EfiEventNotify = *const fn (event: Event, ctx: *anyopaque) callconv(.C) void;
195195
196pub const TimerDelay = enum(u32) {196pub const TimerDelay = enum(u32) {
197 TimerCancel,197 TimerCancel,
lib/std/os/uefi/tables/runtime_services.zig+14-14
...@@ -19,50 +19,50 @@ pub const RuntimeServices = extern struct {...@@ -19,50 +19,50 @@ pub const RuntimeServices = extern struct {
19 hdr: TableHeader,19 hdr: TableHeader,
2020
21 /// Returns the current time and date information, and the time-keeping capabilities of the hardware platform.21 /// Returns the current time and date information, and the time-keeping capabilities of the hardware platform.
22 getTime: std.meta.FnPtr(fn (time: *uefi.Time, capabilities: ?*TimeCapabilities) callconv(.C) Status),22 getTime: *const fn (time: *uefi.Time, capabilities: ?*TimeCapabilities) callconv(.C) Status,
2323
24 /// Sets the current local time and date information24 /// Sets the current local time and date information
25 setTime: std.meta.FnPtr(fn (time: *uefi.Time) callconv(.C) Status),25 setTime: *const fn (time: *uefi.Time) callconv(.C) Status,
2626
27 /// Returns the current wakeup alarm clock setting27 /// Returns the current wakeup alarm clock setting
28 getWakeupTime: std.meta.FnPtr(fn (enabled: *bool, pending: *bool, time: *uefi.Time) callconv(.C) Status),28 getWakeupTime: *const fn (enabled: *bool, pending: *bool, time: *uefi.Time) callconv(.C) Status,
2929
30 /// Sets the system wakeup alarm clock time30 /// Sets the system wakeup alarm clock time
31 setWakeupTime: std.meta.FnPtr(fn (enable: *bool, time: ?*uefi.Time) callconv(.C) Status),31 setWakeupTime: *const fn (enable: *bool, time: ?*uefi.Time) callconv(.C) Status,
3232
33 /// Changes the runtime addressing mode of EFI firmware from physical to virtual.33 /// Changes the runtime addressing mode of EFI firmware from physical to virtual.
34 setVirtualAddressMap: std.meta.FnPtr(fn (mmap_size: usize, descriptor_size: usize, descriptor_version: u32, virtual_map: [*]MemoryDescriptor) callconv(.C) Status),34 setVirtualAddressMap: *const fn (mmap_size: usize, descriptor_size: usize, descriptor_version: u32, virtual_map: [*]MemoryDescriptor) callconv(.C) Status,
3535
36 /// Determines the new virtual address that is to be used on subsequent memory accesses.36 /// Determines the new virtual address that is to be used on subsequent memory accesses.
37 convertPointer: std.meta.FnPtr(fn (debug_disposition: usize, address: **anyopaque) callconv(.C) Status),37 convertPointer: *const fn (debug_disposition: usize, address: **anyopaque) callconv(.C) Status,
3838
39 /// Returns the value of a variable.39 /// Returns the value of a variable.
40 getVariable: std.meta.FnPtr(fn (var_name: [*:0]const u16, vendor_guid: *align(8) const Guid, attributes: ?*u32, data_size: *usize, data: ?*anyopaque) callconv(.C) Status),40 getVariable: *const fn (var_name: [*:0]const u16, vendor_guid: *align(8) const Guid, attributes: ?*u32, data_size: *usize, data: ?*anyopaque) callconv(.C) Status,
4141
42 /// Enumerates the current variable names.42 /// Enumerates the current variable names.
43 getNextVariableName: std.meta.FnPtr(fn (var_name_size: *usize, var_name: [*:0]u16, vendor_guid: *align(8) Guid) callconv(.C) Status),43 getNextVariableName: *const fn (var_name_size: *usize, var_name: [*:0]u16, vendor_guid: *align(8) Guid) callconv(.C) Status,
4444
45 /// Sets the value of a variable.45 /// Sets the value of a variable.
46 setVariable: std.meta.FnPtr(fn (var_name: [*:0]const u16, vendor_guid: *align(8) const Guid, attributes: u32, data_size: usize, data: *anyopaque) callconv(.C) Status),46 setVariable: *const fn (var_name: [*:0]const u16, vendor_guid: *align(8) const Guid, attributes: u32, data_size: usize, data: *anyopaque) callconv(.C) Status,
4747
48 /// Return the next high 32 bits of the platform's monotonic counter48 /// Return the next high 32 bits of the platform's monotonic counter
49 getNextHighMonotonicCount: std.meta.FnPtr(fn (high_count: *u32) callconv(.C) Status),49 getNextHighMonotonicCount: *const fn (high_count: *u32) callconv(.C) Status,
5050
51 /// Resets the entire platform.51 /// Resets the entire platform.
52 resetSystem: std.meta.FnPtr(fn (reset_type: ResetType, reset_status: Status, data_size: usize, reset_data: ?*const anyopaque) callconv(.C) noreturn),52 resetSystem: *const fn (reset_type: ResetType, reset_status: Status, data_size: usize, reset_data: ?*const anyopaque) callconv(.C) noreturn,
5353
54 /// Passes capsules to the firmware with both virtual and physical mapping.54 /// Passes capsules to the firmware with both virtual and physical mapping.
55 /// Depending on the intended consumption, the firmware may process the capsule immediately.55 /// Depending on the intended consumption, the firmware may process the capsule immediately.
56 /// If the payload should persist across a system reset, the reset value returned from56 /// If the payload should persist across a system reset, the reset value returned from
57 /// `queryCapsuleCapabilities` must be passed into resetSystem and will cause the capsule57 /// `queryCapsuleCapabilities` must be passed into resetSystem and will cause the capsule
58 /// to be processed by the firmware as part of the reset process.58 /// to be processed by the firmware as part of the reset process.
59 updateCapsule: std.meta.FnPtr(fn (capsule_header_array: **CapsuleHeader, capsule_count: usize, scatter_gather_list: EfiPhysicalAddress) callconv(.C) Status),59 updateCapsule: *const fn (capsule_header_array: **CapsuleHeader, capsule_count: usize, scatter_gather_list: EfiPhysicalAddress) callconv(.C) Status,
6060
61 /// Returns if the capsule can be supported via `updateCapsule`61 /// Returns if the capsule can be supported via `updateCapsule`
62 queryCapsuleCapabilities: std.meta.FnPtr(fn (capsule_header_array: **CapsuleHeader, capsule_count: usize, maximum_capsule_size: *usize, resetType: ResetType) callconv(.C) Status),62 queryCapsuleCapabilities: *const fn (capsule_header_array: **CapsuleHeader, capsule_count: usize, maximum_capsule_size: *usize, resetType: ResetType) callconv(.C) Status,
6363
64 /// Returns information about the EFI variables64 /// Returns information about the EFI variables
65 queryVariableInfo: std.meta.FnPtr(fn (attributes: *u32, maximum_variable_storage_size: *u64, remaining_variable_storage_size: *u64, maximum_variable_size: *u64) callconv(.C) Status),65 queryVariableInfo: *const fn (attributes: *u32, maximum_variable_storage_size: *u64, remaining_variable_storage_size: *u64, maximum_variable_size: *u64) callconv(.C) Status,
6666
67 pub const signature: u64 = 0x56524553544e5552;67 pub const signature: u64 = 0x56524553544e5552;
68};68};
lib/std/os/windows.zig+12-12
...@@ -2696,7 +2696,7 @@ pub const MEM_RESERVE_PLACEHOLDERS = 0x2;...@@ -2696,7 +2696,7 @@ pub const MEM_RESERVE_PLACEHOLDERS = 0x2;
2696pub const MEM_DECOMMIT = 0x4000;2696pub const MEM_DECOMMIT = 0x4000;
2697pub const MEM_RELEASE = 0x8000;2697pub const MEM_RELEASE = 0x8000;
26982698
2699pub const PTHREAD_START_ROUTINE = std.meta.FnPtr(fn (LPVOID) callconv(.C) DWORD);2699pub const PTHREAD_START_ROUTINE = *const fn (LPVOID) callconv(.C) DWORD;
2700pub const LPTHREAD_START_ROUTINE = PTHREAD_START_ROUTINE;2700pub const LPTHREAD_START_ROUTINE = PTHREAD_START_ROUTINE;
27012701
2702pub const WIN32_FIND_DATAW = extern struct {2702pub const WIN32_FIND_DATAW = extern struct {
...@@ -2869,7 +2869,7 @@ pub const IMAGE_TLS_DIRECTORY = extern struct {...@@ -2869,7 +2869,7 @@ pub const IMAGE_TLS_DIRECTORY = extern struct {
2869pub const IMAGE_TLS_DIRECTORY64 = IMAGE_TLS_DIRECTORY;2869pub const IMAGE_TLS_DIRECTORY64 = IMAGE_TLS_DIRECTORY;
2870pub const IMAGE_TLS_DIRECTORY32 = IMAGE_TLS_DIRECTORY;2870pub const IMAGE_TLS_DIRECTORY32 = IMAGE_TLS_DIRECTORY;
28712871
2872pub const PIMAGE_TLS_CALLBACK = ?std.meta.FnPtr(fn (PVOID, DWORD, PVOID) callconv(.C) void);2872pub const PIMAGE_TLS_CALLBACK = ?*const fn (PVOID, DWORD, PVOID) callconv(.C) void;
28732873
2874pub const PROV_RSA_FULL = 1;2874pub const PROV_RSA_FULL = 1;
28752875
...@@ -2922,14 +2922,14 @@ pub const RTL_QUERY_REGISTRY_TABLE = extern struct {...@@ -2922,14 +2922,14 @@ pub const RTL_QUERY_REGISTRY_TABLE = extern struct {
2922 DefaultLength: ULONG,2922 DefaultLength: ULONG,
2923};2923};
29242924
2925pub const RTL_QUERY_REGISTRY_ROUTINE = ?std.meta.FnPtr(fn (2925pub const RTL_QUERY_REGISTRY_ROUTINE = ?*const fn (
2926 PWSTR,2926 PWSTR,
2927 ULONG,2927 ULONG,
2928 ?*anyopaque,2928 ?*anyopaque,
2929 ULONG,2929 ULONG,
2930 ?*anyopaque,2930 ?*anyopaque,
2931 ?*anyopaque,2931 ?*anyopaque,
2932) callconv(WINAPI) NTSTATUS);2932) callconv(WINAPI) NTSTATUS;
29332933
2934/// Path is a full path2934/// Path is a full path
2935pub const RTL_REGISTRY_ABSOLUTE = 0;2935pub const RTL_REGISTRY_ABSOLUTE = 0;
...@@ -3026,7 +3026,7 @@ pub const FILE_ACTION_MODIFIED = 0x00000003;...@@ -3026,7 +3026,7 @@ pub const FILE_ACTION_MODIFIED = 0x00000003;
3026pub const FILE_ACTION_RENAMED_OLD_NAME = 0x00000004;3026pub const FILE_ACTION_RENAMED_OLD_NAME = 0x00000004;
3027pub const FILE_ACTION_RENAMED_NEW_NAME = 0x00000005;3027pub const FILE_ACTION_RENAMED_NEW_NAME = 0x00000005;
30283028
3029pub const LPOVERLAPPED_COMPLETION_ROUTINE = ?std.meta.FnPtr(fn (DWORD, DWORD, *OVERLAPPED) callconv(.C) void);3029pub const LPOVERLAPPED_COMPLETION_ROUTINE = ?*const fn (DWORD, DWORD, *OVERLAPPED) callconv(.C) void;
30303030
3031pub const FILE_NOTIFY_CHANGE_CREATION = 64;3031pub const FILE_NOTIFY_CHANGE_CREATION = 64;
3032pub const FILE_NOTIFY_CHANGE_SIZE = 8;3032pub const FILE_NOTIFY_CHANGE_SIZE = 8;
...@@ -3079,7 +3079,7 @@ pub const RTL_CRITICAL_SECTION = extern struct {...@@ -3079,7 +3079,7 @@ pub const RTL_CRITICAL_SECTION = extern struct {
3079pub const CRITICAL_SECTION = RTL_CRITICAL_SECTION;3079pub const CRITICAL_SECTION = RTL_CRITICAL_SECTION;
3080pub const INIT_ONCE = RTL_RUN_ONCE;3080pub const INIT_ONCE = RTL_RUN_ONCE;
3081pub const INIT_ONCE_STATIC_INIT = RTL_RUN_ONCE_INIT;3081pub const INIT_ONCE_STATIC_INIT = RTL_RUN_ONCE_INIT;
3082pub const INIT_ONCE_FN = std.meta.FnPtr(fn (InitOnce: *INIT_ONCE, Parameter: ?*anyopaque, Context: ?*anyopaque) callconv(.C) BOOL);3082pub const INIT_ONCE_FN = *const fn (InitOnce: *INIT_ONCE, Parameter: ?*anyopaque, Context: ?*anyopaque) callconv(.C) BOOL;
30833083
3084pub const RTL_RUN_ONCE = extern struct {3084pub const RTL_RUN_ONCE = extern struct {
3085 Ptr: ?*anyopaque,3085 Ptr: ?*anyopaque,
...@@ -3382,7 +3382,7 @@ pub const EXCEPTION_POINTERS = extern struct {...@@ -3382,7 +3382,7 @@ pub const EXCEPTION_POINTERS = extern struct {
3382 ContextRecord: *std.os.windows.CONTEXT,3382 ContextRecord: *std.os.windows.CONTEXT,
3383};3383};
33843384
3385pub const VECTORED_EXCEPTION_HANDLER = std.meta.FnPtr(fn (ExceptionInfo: *EXCEPTION_POINTERS) callconv(WINAPI) c_long);3385pub const VECTORED_EXCEPTION_HANDLER = *const fn (ExceptionInfo: *EXCEPTION_POINTERS) callconv(WINAPI) c_long;
33863386
3387pub const OBJECT_ATTRIBUTES = extern struct {3387pub const OBJECT_ATTRIBUTES = extern struct {
3388 Length: ULONG,3388 Length: ULONG,
...@@ -3658,7 +3658,7 @@ pub const RTL_DRIVE_LETTER_CURDIR = extern struct {...@@ -3658,7 +3658,7 @@ pub const RTL_DRIVE_LETTER_CURDIR = extern struct {
3658 DosPath: UNICODE_STRING,3658 DosPath: UNICODE_STRING,
3659};3659};
36603660
3661pub const PPS_POST_PROCESS_INIT_ROUTINE = ?std.meta.FnPtr(fn () callconv(.C) void);3661pub const PPS_POST_PROCESS_INIT_ROUTINE = ?*const fn () callconv(.C) void;
36623662
3663pub const FILE_BOTH_DIR_INFORMATION = extern struct {3663pub const FILE_BOTH_DIR_INFORMATION = extern struct {
3664 NextEntryOffset: ULONG,3664 NextEntryOffset: ULONG,
...@@ -3678,7 +3678,7 @@ pub const FILE_BOTH_DIR_INFORMATION = extern struct {...@@ -3678,7 +3678,7 @@ pub const FILE_BOTH_DIR_INFORMATION = extern struct {
3678};3678};
3679pub const FILE_BOTH_DIRECTORY_INFORMATION = FILE_BOTH_DIR_INFORMATION;3679pub const FILE_BOTH_DIRECTORY_INFORMATION = FILE_BOTH_DIR_INFORMATION;
36803680
3681pub const IO_APC_ROUTINE = std.meta.FnPtr(fn (PVOID, *IO_STATUS_BLOCK, ULONG) callconv(.C) void);3681pub const IO_APC_ROUTINE = *const fn (PVOID, *IO_STATUS_BLOCK, ULONG) callconv(.C) void;
36823682
3683pub const CURDIR = extern struct {3683pub const CURDIR = extern struct {
3684 DosPath: UNICODE_STRING,3684 DosPath: UNICODE_STRING,
...@@ -3750,8 +3750,8 @@ pub const ENUM_PAGE_FILE_INFORMATION = extern struct {...@@ -3750,8 +3750,8 @@ pub const ENUM_PAGE_FILE_INFORMATION = extern struct {
3750 PeakUsage: SIZE_T,3750 PeakUsage: SIZE_T,
3751};3751};
37523752
3753pub const PENUM_PAGE_FILE_CALLBACKW = ?std.meta.FnPtr(fn (?LPVOID, *ENUM_PAGE_FILE_INFORMATION, LPCWSTR) callconv(.C) BOOL);3753pub const PENUM_PAGE_FILE_CALLBACKW = ?*const fn (?LPVOID, *ENUM_PAGE_FILE_INFORMATION, LPCWSTR) callconv(.C) BOOL;
3754pub const PENUM_PAGE_FILE_CALLBACKA = ?std.meta.FnPtr(fn (?LPVOID, *ENUM_PAGE_FILE_INFORMATION, LPCSTR) callconv(.C) BOOL);3754pub const PENUM_PAGE_FILE_CALLBACKA = ?*const fn (?LPVOID, *ENUM_PAGE_FILE_INFORMATION, LPCSTR) callconv(.C) BOOL;
37553755
3756pub const PSAPI_WS_WATCH_INFORMATION_EX = extern struct {3756pub const PSAPI_WS_WATCH_INFORMATION_EX = extern struct {
3757 BasicInfo: PSAPI_WS_WATCH_INFORMATION,3757 BasicInfo: PSAPI_WS_WATCH_INFORMATION,
...@@ -3851,7 +3851,7 @@ pub const CTRL_CLOSE_EVENT: DWORD = 2;...@@ -3851,7 +3851,7 @@ pub const CTRL_CLOSE_EVENT: DWORD = 2;
3851pub const CTRL_LOGOFF_EVENT: DWORD = 5;3851pub const CTRL_LOGOFF_EVENT: DWORD = 5;
3852pub const CTRL_SHUTDOWN_EVENT: DWORD = 6;3852pub const CTRL_SHUTDOWN_EVENT: DWORD = 6;
38533853
3854pub const HANDLER_ROUTINE = std.meta.FnPtr(fn (dwCtrlType: DWORD) callconv(WINAPI) BOOL);3854pub const HANDLER_ROUTINE = *const fn (dwCtrlType: DWORD) callconv(WINAPI) BOOL;
38553855
3856/// Processor feature enumeration.3856/// Processor feature enumeration.
3857pub const PF = enum(DWORD) {3857pub const PF = enum(DWORD) {
lib/std/os/windows/user32.zig+13-13
...@@ -39,7 +39,7 @@ fn selectSymbol(comptime function_static: anytype, function_dynamic: @TypeOf(fun...@@ -39,7 +39,7 @@ fn selectSymbol(comptime function_static: anytype, function_dynamic: @TypeOf(fun
3939
40// === Messages ===40// === Messages ===
4141
42pub const WNDPROC = std.meta.FnPtr(fn (hwnd: HWND, uMsg: UINT, wParam: WPARAM, lParam: LPARAM) callconv(WINAPI) LRESULT);42pub const WNDPROC = *const fn (hwnd: HWND, uMsg: UINT, wParam: WPARAM, lParam: LPARAM) callconv(WINAPI) LRESULT;
4343
44pub const MSG = extern struct {44pub const MSG = extern struct {
45 hWnd: ?HWND,45 hWnd: ?HWND,
...@@ -1056,7 +1056,7 @@ pub fn getMessageA(lpMsg: *MSG, hWnd: ?HWND, wMsgFilterMin: u32, wMsgFilterMax:...@@ -1056,7 +1056,7 @@ pub fn getMessageA(lpMsg: *MSG, hWnd: ?HWND, wMsgFilterMin: u32, wMsgFilterMax:
1056}1056}
10571057
1058pub extern "user32" fn GetMessageW(lpMsg: *MSG, hWnd: ?HWND, wMsgFilterMin: UINT, wMsgFilterMax: UINT) callconv(WINAPI) BOOL;1058pub extern "user32" fn GetMessageW(lpMsg: *MSG, hWnd: ?HWND, wMsgFilterMin: UINT, wMsgFilterMax: UINT) callconv(WINAPI) BOOL;
1059pub var pfnGetMessageW: std.meta.FnPtr(@TypeOf(GetMessageW)) = undefined;1059pub var pfnGetMessageW: *const @TypeOf(GetMessageW) = undefined;
1060pub fn getMessageW(lpMsg: *MSG, hWnd: ?HWND, wMsgFilterMin: u32, wMsgFilterMax: u32) !void {1060pub fn getMessageW(lpMsg: *MSG, hWnd: ?HWND, wMsgFilterMin: u32, wMsgFilterMax: u32) !void {
1061 const function = selectSymbol(GetMessageW, pfnGetMessageW, .win2k);1061 const function = selectSymbol(GetMessageW, pfnGetMessageW, .win2k);
10621062
...@@ -1087,7 +1087,7 @@ pub fn peekMessageA(lpMsg: *MSG, hWnd: ?HWND, wMsgFilterMin: u32, wMsgFilterMax:...@@ -1087,7 +1087,7 @@ pub fn peekMessageA(lpMsg: *MSG, hWnd: ?HWND, wMsgFilterMin: u32, wMsgFilterMax:
1087}1087}
10881088
1089pub extern "user32" fn PeekMessageW(lpMsg: *MSG, hWnd: ?HWND, wMsgFilterMin: UINT, wMsgFilterMax: UINT, wRemoveMsg: UINT) callconv(WINAPI) BOOL;1089pub extern "user32" fn PeekMessageW(lpMsg: *MSG, hWnd: ?HWND, wMsgFilterMin: UINT, wMsgFilterMax: UINT, wRemoveMsg: UINT) callconv(WINAPI) BOOL;
1090pub var pfnPeekMessageW: std.meta.FnPtr(@TypeOf(PeekMessageW)) = undefined;1090pub var pfnPeekMessageW: *const @TypeOf(PeekMessageW) = undefined;
1091pub fn peekMessageW(lpMsg: *MSG, hWnd: ?HWND, wMsgFilterMin: u32, wMsgFilterMax: u32, wRemoveMsg: u32) !bool {1091pub fn peekMessageW(lpMsg: *MSG, hWnd: ?HWND, wMsgFilterMin: u32, wMsgFilterMax: u32, wRemoveMsg: u32) !bool {
1092 const function = selectSymbol(PeekMessageW, pfnPeekMessageW, .win2k);1092 const function = selectSymbol(PeekMessageW, pfnPeekMessageW, .win2k);
10931093
...@@ -1112,7 +1112,7 @@ pub fn dispatchMessageA(lpMsg: *const MSG) LRESULT {...@@ -1112,7 +1112,7 @@ pub fn dispatchMessageA(lpMsg: *const MSG) LRESULT {
1112}1112}
11131113
1114pub extern "user32" fn DispatchMessageW(lpMsg: *const MSG) callconv(WINAPI) LRESULT;1114pub extern "user32" fn DispatchMessageW(lpMsg: *const MSG) callconv(WINAPI) LRESULT;
1115pub var pfnDispatchMessageW: std.meta.FnPtr(@TypeOf(DispatchMessageW)) = undefined;1115pub var pfnDispatchMessageW: *const @TypeOf(DispatchMessageW) = undefined;
1116pub fn dispatchMessageW(lpMsg: *const MSG) LRESULT {1116pub fn dispatchMessageW(lpMsg: *const MSG) LRESULT {
1117 const function = selectSymbol(DispatchMessageW, pfnDispatchMessageW, .win2k);1117 const function = selectSymbol(DispatchMessageW, pfnDispatchMessageW, .win2k);
1118 return function(lpMsg);1118 return function(lpMsg);
...@@ -1129,7 +1129,7 @@ pub fn defWindowProcA(hWnd: HWND, Msg: UINT, wParam: WPARAM, lParam: LPARAM) LRE...@@ -1129,7 +1129,7 @@ pub fn defWindowProcA(hWnd: HWND, Msg: UINT, wParam: WPARAM, lParam: LPARAM) LRE
1129}1129}
11301130
1131pub extern "user32" fn DefWindowProcW(hWnd: HWND, Msg: UINT, wParam: WPARAM, lParam: LPARAM) callconv(WINAPI) LRESULT;1131pub extern "user32" fn DefWindowProcW(hWnd: HWND, Msg: UINT, wParam: WPARAM, lParam: LPARAM) callconv(WINAPI) LRESULT;
1132pub var pfnDefWindowProcW: std.meta.FnPtr(@TypeOf(DefWindowProcW)) = undefined;1132pub var pfnDefWindowProcW: *const @TypeOf(DefWindowProcW) = undefined;
1133pub fn defWindowProcW(hWnd: HWND, Msg: UINT, wParam: WPARAM, lParam: LPARAM) LRESULT {1133pub fn defWindowProcW(hWnd: HWND, Msg: UINT, wParam: WPARAM, lParam: LPARAM) LRESULT {
1134 const function = selectSymbol(DefWindowProcW, pfnDefWindowProcW, .win2k);1134 const function = selectSymbol(DefWindowProcW, pfnDefWindowProcW, .win2k);
1135 return function(hWnd, Msg, wParam, lParam);1135 return function(hWnd, Msg, wParam, lParam);
...@@ -1191,7 +1191,7 @@ pub fn registerClassExA(window_class: *const WNDCLASSEXA) !ATOM {...@@ -1191,7 +1191,7 @@ pub fn registerClassExA(window_class: *const WNDCLASSEXA) !ATOM {
1191}1191}
11921192
1193pub extern "user32" fn RegisterClassExW(*const WNDCLASSEXW) callconv(WINAPI) ATOM;1193pub extern "user32" fn RegisterClassExW(*const WNDCLASSEXW) callconv(WINAPI) ATOM;
1194pub var pfnRegisterClassExW: std.meta.FnPtr(@TypeOf(RegisterClassExW)) = undefined;1194pub var pfnRegisterClassExW: *const @TypeOf(RegisterClassExW) = undefined;
1195pub fn registerClassExW(window_class: *const WNDCLASSEXW) !ATOM {1195pub fn registerClassExW(window_class: *const WNDCLASSEXW) !ATOM {
1196 const function = selectSymbol(RegisterClassExW, pfnRegisterClassExW, .win2k);1196 const function = selectSymbol(RegisterClassExW, pfnRegisterClassExW, .win2k);
1197 const atom = function(window_class);1197 const atom = function(window_class);
...@@ -1215,7 +1215,7 @@ pub fn unregisterClassA(lpClassName: [*:0]const u8, hInstance: HINSTANCE) !void...@@ -1215,7 +1215,7 @@ pub fn unregisterClassA(lpClassName: [*:0]const u8, hInstance: HINSTANCE) !void
1215}1215}
12161216
1217pub extern "user32" fn UnregisterClassW(lpClassName: [*:0]const u16, hInstance: HINSTANCE) callconv(WINAPI) BOOL;1217pub extern "user32" fn UnregisterClassW(lpClassName: [*:0]const u16, hInstance: HINSTANCE) callconv(WINAPI) BOOL;
1218pub var pfnUnregisterClassW: std.meta.FnPtr(@TypeOf(UnregisterClassW)) = undefined;1218pub var pfnUnregisterClassW: *const @TypeOf(UnregisterClassW) = undefined;
1219pub fn unregisterClassW(lpClassName: [*:0]const u16, hInstance: HINSTANCE) !void {1219pub fn unregisterClassW(lpClassName: [*:0]const u16, hInstance: HINSTANCE) !void {
1220 const function = selectSymbol(UnregisterClassW, pfnUnregisterClassW, .win2k);1220 const function = selectSymbol(UnregisterClassW, pfnUnregisterClassW, .win2k);
1221 if (function(lpClassName, hInstance) == 0) {1221 if (function(lpClassName, hInstance) == 0) {
...@@ -1292,7 +1292,7 @@ pub fn createWindowExA(dwExStyle: u32, lpClassName: [*:0]const u8, lpWindowName:...@@ -1292,7 +1292,7 @@ pub fn createWindowExA(dwExStyle: u32, lpClassName: [*:0]const u8, lpWindowName:
1292}1292}
12931293
1294pub extern "user32" fn CreateWindowExW(dwExStyle: DWORD, lpClassName: [*:0]const u16, lpWindowName: [*:0]const u16, dwStyle: DWORD, X: i32, Y: i32, nWidth: i32, nHeight: i32, hWindParent: ?HWND, hMenu: ?HMENU, hInstance: HINSTANCE, lpParam: ?LPVOID) callconv(WINAPI) ?HWND;1294pub extern "user32" fn CreateWindowExW(dwExStyle: DWORD, lpClassName: [*:0]const u16, lpWindowName: [*:0]const u16, dwStyle: DWORD, X: i32, Y: i32, nWidth: i32, nHeight: i32, hWindParent: ?HWND, hMenu: ?HMENU, hInstance: HINSTANCE, lpParam: ?LPVOID) callconv(WINAPI) ?HWND;
1295pub var pfnCreateWindowExW: std.meta.FnPtr(@TypeOf(CreateWindowExW)) = undefined;1295pub var pfnCreateWindowExW: *const @TypeOf(CreateWindowExW) = undefined;
1296pub fn createWindowExW(dwExStyle: u32, lpClassName: [*:0]const u16, lpWindowName: [*:0]const u16, dwStyle: u32, X: i32, Y: i32, nWidth: i32, nHeight: i32, hWindParent: ?HWND, hMenu: ?HMENU, hInstance: HINSTANCE, lpParam: ?*anyopaque) !HWND {1296pub fn createWindowExW(dwExStyle: u32, lpClassName: [*:0]const u16, lpWindowName: [*:0]const u16, dwStyle: u32, X: i32, Y: i32, nWidth: i32, nHeight: i32, hWindParent: ?HWND, hMenu: ?HMENU, hInstance: HINSTANCE, lpParam: ?*anyopaque) !HWND {
1297 const function = selectSymbol(CreateWindowExW, pfnCreateWindowExW, .win2k);1297 const function = selectSymbol(CreateWindowExW, pfnCreateWindowExW, .win2k);
1298 const window = function(dwExStyle, lpClassName, lpWindowName, dwStyle, X, Y, nWidth, nHeight, hWindParent, hMenu, hInstance, lpParam);1298 const window = function(dwExStyle, lpClassName, lpWindowName, dwStyle, X, Y, nWidth, nHeight, hWindParent, hMenu, hInstance, lpParam);
...@@ -1382,7 +1382,7 @@ pub fn getWindowLongA(hWnd: HWND, nIndex: i32) !i32 {...@@ -1382,7 +1382,7 @@ pub fn getWindowLongA(hWnd: HWND, nIndex: i32) !i32 {
1382}1382}
13831383
1384pub extern "user32" fn GetWindowLongW(hWnd: HWND, nIndex: i32) callconv(WINAPI) LONG;1384pub extern "user32" fn GetWindowLongW(hWnd: HWND, nIndex: i32) callconv(WINAPI) LONG;
1385pub var pfnGetWindowLongW: std.meta.FnPtr(@TypeOf(GetWindowLongW)) = undefined;1385pub var pfnGetWindowLongW: *const @TypeOf(GetWindowLongW) = undefined;
1386pub fn getWindowLongW(hWnd: HWND, nIndex: i32) !i32 {1386pub fn getWindowLongW(hWnd: HWND, nIndex: i32) !i32 {
1387 const function = selectSymbol(GetWindowLongW, pfnGetWindowLongW, .win2k);1387 const function = selectSymbol(GetWindowLongW, pfnGetWindowLongW, .win2k);
13881388
...@@ -1415,7 +1415,7 @@ pub fn getWindowLongPtrA(hWnd: HWND, nIndex: i32) !isize {...@@ -1415,7 +1415,7 @@ pub fn getWindowLongPtrA(hWnd: HWND, nIndex: i32) !isize {
1415}1415}
14161416
1417pub extern "user32" fn GetWindowLongPtrW(hWnd: HWND, nIndex: i32) callconv(WINAPI) LONG_PTR;1417pub extern "user32" fn GetWindowLongPtrW(hWnd: HWND, nIndex: i32) callconv(WINAPI) LONG_PTR;
1418pub var pfnGetWindowLongPtrW: std.meta.FnPtr(@TypeOf(GetWindowLongPtrW)) = undefined;1418pub var pfnGetWindowLongPtrW: *const @TypeOf(GetWindowLongPtrW) = undefined;
1419pub fn getWindowLongPtrW(hWnd: HWND, nIndex: i32) !isize {1419pub fn getWindowLongPtrW(hWnd: HWND, nIndex: i32) !isize {
1420 if (@sizeOf(LONG_PTR) == 4) return getWindowLongW(hWnd, nIndex);1420 if (@sizeOf(LONG_PTR) == 4) return getWindowLongW(hWnd, nIndex);
1421 const function = selectSymbol(GetWindowLongPtrW, pfnGetWindowLongPtrW, .win2k);1421 const function = selectSymbol(GetWindowLongPtrW, pfnGetWindowLongPtrW, .win2k);
...@@ -1449,7 +1449,7 @@ pub fn setWindowLongA(hWnd: HWND, nIndex: i32, dwNewLong: i32) !i32 {...@@ -1449,7 +1449,7 @@ pub fn setWindowLongA(hWnd: HWND, nIndex: i32, dwNewLong: i32) !i32 {
1449}1449}
14501450
1451pub extern "user32" fn SetWindowLongW(hWnd: HWND, nIndex: i32, dwNewLong: LONG) callconv(WINAPI) LONG;1451pub extern "user32" fn SetWindowLongW(hWnd: HWND, nIndex: i32, dwNewLong: LONG) callconv(WINAPI) LONG;
1452pub var pfnSetWindowLongW: std.meta.FnPtr(@TypeOf(SetWindowLongW)) = undefined;1452pub var pfnSetWindowLongW: *const @TypeOf(SetWindowLongW) = undefined;
1453pub fn setWindowLongW(hWnd: HWND, nIndex: i32, dwNewLong: i32) !i32 {1453pub fn setWindowLongW(hWnd: HWND, nIndex: i32, dwNewLong: i32) !i32 {
1454 const function = selectSymbol(SetWindowLongW, pfnSetWindowLongW, .win2k);1454 const function = selectSymbol(SetWindowLongW, pfnSetWindowLongW, .win2k);
14551455
...@@ -1484,7 +1484,7 @@ pub fn setWindowLongPtrA(hWnd: HWND, nIndex: i32, dwNewLong: isize) !isize {...@@ -1484,7 +1484,7 @@ pub fn setWindowLongPtrA(hWnd: HWND, nIndex: i32, dwNewLong: isize) !isize {
1484}1484}
14851485
1486pub extern "user32" fn SetWindowLongPtrW(hWnd: HWND, nIndex: i32, dwNewLong: LONG_PTR) callconv(WINAPI) LONG_PTR;1486pub extern "user32" fn SetWindowLongPtrW(hWnd: HWND, nIndex: i32, dwNewLong: LONG_PTR) callconv(WINAPI) LONG_PTR;
1487pub var pfnSetWindowLongPtrW: std.meta.FnPtr(@TypeOf(SetWindowLongPtrW)) = undefined;1487pub var pfnSetWindowLongPtrW: *const @TypeOf(SetWindowLongPtrW) = undefined;
1488pub fn setWindowLongPtrW(hWnd: HWND, nIndex: i32, dwNewLong: isize) !isize {1488pub fn setWindowLongPtrW(hWnd: HWND, nIndex: i32, dwNewLong: isize) !isize {
1489 if (@sizeOf(LONG_PTR) == 4) return setWindowLongW(hWnd, nIndex, dwNewLong);1489 if (@sizeOf(LONG_PTR) == 4) return setWindowLongW(hWnd, nIndex, dwNewLong);
1490 const function = selectSymbol(SetWindowLongPtrW, pfnSetWindowLongPtrW, .win2k);1490 const function = selectSymbol(SetWindowLongPtrW, pfnSetWindowLongPtrW, .win2k);
...@@ -1580,7 +1580,7 @@ pub fn messageBoxA(hWnd: ?HWND, lpText: [*:0]const u8, lpCaption: [*:0]const u8,...@@ -1580,7 +1580,7 @@ pub fn messageBoxA(hWnd: ?HWND, lpText: [*:0]const u8, lpCaption: [*:0]const u8,
1580}1580}
15811581
1582pub extern "user32" fn MessageBoxW(hWnd: ?HWND, lpText: [*:0]const u16, lpCaption: ?[*:0]const u16, uType: UINT) callconv(WINAPI) i32;1582pub extern "user32" fn MessageBoxW(hWnd: ?HWND, lpText: [*:0]const u16, lpCaption: ?[*:0]const u16, uType: UINT) callconv(WINAPI) i32;
1583pub var pfnMessageBoxW: std.meta.FnPtr(@TypeOf(MessageBoxW)) = undefined;1583pub var pfnMessageBoxW: *const @TypeOf(MessageBoxW) = undefined;
1584pub fn messageBoxW(hWnd: ?HWND, lpText: [*:0]const u16, lpCaption: [*:0]const u16, uType: u32) !i32 {1584pub fn messageBoxW(hWnd: ?HWND, lpText: [*:0]const u16, lpCaption: [*:0]const u16, uType: u32) !i32 {
1585 const function = selectSymbol(MessageBoxW, pfnMessageBoxW, .win2k);1585 const function = selectSymbol(MessageBoxW, pfnMessageBoxW, .win2k);
1586 const value = function(hWnd, lpText, lpCaption, uType);1586 const value = function(hWnd, lpText, lpCaption, uType);
lib/std/os/windows/ws2_32.zig+18-18
...@@ -942,7 +942,7 @@ pub const UDP_NOCHECKSUM = 1;...@@ -942,7 +942,7 @@ pub const UDP_NOCHECKSUM = 1;
942pub const UDP_CHECKSUM_COVERAGE = 20;942pub const UDP_CHECKSUM_COVERAGE = 20;
943pub const GAI_STRERROR_BUFFER_SIZE = 1024;943pub const GAI_STRERROR_BUFFER_SIZE = 1024;
944944
945pub const LPCONDITIONPROC = std.meta.FnPtr(fn (945pub const LPCONDITIONPROC = *const fn (
946 lpCallerId: *WSABUF,946 lpCallerId: *WSABUF,
947 lpCallerData: *WSABUF,947 lpCallerData: *WSABUF,
948 lpSQOS: *QOS,948 lpSQOS: *QOS,
...@@ -951,14 +951,14 @@ pub const LPCONDITIONPROC = std.meta.FnPtr(fn (...@@ -951,14 +951,14 @@ pub const LPCONDITIONPROC = std.meta.FnPtr(fn (
951 lpCalleeData: *WSABUF,951 lpCalleeData: *WSABUF,
952 g: *u32,952 g: *u32,
953 dwCallbackData: usize,953 dwCallbackData: usize,
954) callconv(WINAPI) i32);954) callconv(WINAPI) i32;
955955
956pub const LPWSAOVERLAPPED_COMPLETION_ROUTINE = std.meta.FnPtr(fn (956pub const LPWSAOVERLAPPED_COMPLETION_ROUTINE = *const fn (
957 dwError: u32,957 dwError: u32,
958 cbTransferred: u32,958 cbTransferred: u32,
959 lpOverlapped: *OVERLAPPED,959 lpOverlapped: *OVERLAPPED,
960 dwFlags: u32,960 dwFlags: u32,
961) callconv(WINAPI) void);961) callconv(WINAPI) void;
962962
963pub const FLOWSPEC = extern struct {963pub const FLOWSPEC = extern struct {
964 TokenRate: u32,964 TokenRate: u32,
...@@ -1173,7 +1173,7 @@ pub const TRANSMIT_FILE_BUFFERS = extern struct {...@@ -1173,7 +1173,7 @@ pub const TRANSMIT_FILE_BUFFERS = extern struct {
1173 TailLength: u32,1173 TailLength: u32,
1174};1174};
11751175
1176pub const LPFN_TRANSMITFILE = std.meta.FnPtr(fn (1176pub const LPFN_TRANSMITFILE = *const fn (
1177 hSocket: SOCKET,1177 hSocket: SOCKET,
1178 hFile: HANDLE,1178 hFile: HANDLE,
1179 nNumberOfBytesToWrite: u32,1179 nNumberOfBytesToWrite: u32,
...@@ -1181,9 +1181,9 @@ pub const LPFN_TRANSMITFILE = std.meta.FnPtr(fn (...@@ -1181,9 +1181,9 @@ pub const LPFN_TRANSMITFILE = std.meta.FnPtr(fn (
1181 lpOverlapped: ?*OVERLAPPED,1181 lpOverlapped: ?*OVERLAPPED,
1182 lpTransmitBuffers: ?*TRANSMIT_FILE_BUFFERS,1182 lpTransmitBuffers: ?*TRANSMIT_FILE_BUFFERS,
1183 dwReserved: u32,1183 dwReserved: u32,
1184) callconv(WINAPI) BOOL);1184) callconv(WINAPI) BOOL;
11851185
1186pub const LPFN_ACCEPTEX = std.meta.FnPtr(fn (1186pub const LPFN_ACCEPTEX = *const fn (
1187 sListenSocket: SOCKET,1187 sListenSocket: SOCKET,
1188 sAcceptSocket: SOCKET,1188 sAcceptSocket: SOCKET,
1189 lpOutputBuffer: *anyopaque,1189 lpOutputBuffer: *anyopaque,
...@@ -1192,9 +1192,9 @@ pub const LPFN_ACCEPTEX = std.meta.FnPtr(fn (...@@ -1192,9 +1192,9 @@ pub const LPFN_ACCEPTEX = std.meta.FnPtr(fn (
1192 dwRemoteAddressLength: u32,1192 dwRemoteAddressLength: u32,
1193 lpdwBytesReceived: *u32,1193 lpdwBytesReceived: *u32,
1194 lpOverlapped: *OVERLAPPED,1194 lpOverlapped: *OVERLAPPED,
1195) callconv(WINAPI) BOOL);1195) callconv(WINAPI) BOOL;
11961196
1197pub const LPFN_GETACCEPTEXSOCKADDRS = std.meta.FnPtr(fn (1197pub const LPFN_GETACCEPTEXSOCKADDRS = *const fn (
1198 lpOutputBuffer: *anyopaque,1198 lpOutputBuffer: *anyopaque,
1199 dwReceiveDataLength: u32,1199 dwReceiveDataLength: u32,
1200 dwLocalAddressLength: u32,1200 dwLocalAddressLength: u32,
...@@ -1203,29 +1203,29 @@ pub const LPFN_GETACCEPTEXSOCKADDRS = std.meta.FnPtr(fn (...@@ -1203,29 +1203,29 @@ pub const LPFN_GETACCEPTEXSOCKADDRS = std.meta.FnPtr(fn (
1203 LocalSockaddrLength: *i32,1203 LocalSockaddrLength: *i32,
1204 RemoteSockaddr: **sockaddr,1204 RemoteSockaddr: **sockaddr,
1205 RemoteSockaddrLength: *i32,1205 RemoteSockaddrLength: *i32,
1206) callconv(WINAPI) void);1206) callconv(WINAPI) void;
12071207
1208pub const LPFN_WSASENDMSG = std.meta.FnPtr(fn (1208pub const LPFN_WSASENDMSG = *const fn (
1209 s: SOCKET,1209 s: SOCKET,
1210 lpMsg: *const std.x.os.Socket.Message,1210 lpMsg: *const std.x.os.Socket.Message,
1211 dwFlags: u32,1211 dwFlags: u32,
1212 lpNumberOfBytesSent: ?*u32,1212 lpNumberOfBytesSent: ?*u32,
1213 lpOverlapped: ?*OVERLAPPED,1213 lpOverlapped: ?*OVERLAPPED,
1214 lpCompletionRoutine: ?LPWSAOVERLAPPED_COMPLETION_ROUTINE,1214 lpCompletionRoutine: ?LPWSAOVERLAPPED_COMPLETION_ROUTINE,
1215) callconv(WINAPI) i32);1215) callconv(WINAPI) i32;
12161216
1217pub const LPFN_WSARECVMSG = std.meta.FnPtr(fn (1217pub const LPFN_WSARECVMSG = *const fn (
1218 s: SOCKET,1218 s: SOCKET,
1219 lpMsg: *std.x.os.Socket.Message,1219 lpMsg: *std.x.os.Socket.Message,
1220 lpdwNumberOfBytesRecv: ?*u32,1220 lpdwNumberOfBytesRecv: ?*u32,
1221 lpOverlapped: ?*OVERLAPPED,1221 lpOverlapped: ?*OVERLAPPED,
1222 lpCompletionRoutine: ?LPWSAOVERLAPPED_COMPLETION_ROUTINE,1222 lpCompletionRoutine: ?LPWSAOVERLAPPED_COMPLETION_ROUTINE,
1223) callconv(WINAPI) i32);1223) callconv(WINAPI) i32;
12241224
1225pub const LPSERVICE_CALLBACK_PROC = std.meta.FnPtr(fn (1225pub const LPSERVICE_CALLBACK_PROC = *const fn (
1226 lParam: LPARAM,1226 lParam: LPARAM,
1227 hAsyncTaskHandle: HANDLE,1227 hAsyncTaskHandle: HANDLE,
1228) callconv(WINAPI) void);1228) callconv(WINAPI) void;
12291229
1230pub const SERVICE_ASYNC_INFO = extern struct {1230pub const SERVICE_ASYNC_INFO = extern struct {
1231 lpServiceCallbackProc: LPSERVICE_CALLBACK_PROC,1231 lpServiceCallbackProc: LPSERVICE_CALLBACK_PROC,
...@@ -1233,11 +1233,11 @@ pub const SERVICE_ASYNC_INFO = extern struct {...@@ -1233,11 +1233,11 @@ pub const SERVICE_ASYNC_INFO = extern struct {
1233 hAsyncTaskHandle: HANDLE,1233 hAsyncTaskHandle: HANDLE,
1234};1234};
12351235
1236pub const LPLOOKUPSERVICE_COMPLETION_ROUTINE = std.meta.FnPtr(fn (1236pub const LPLOOKUPSERVICE_COMPLETION_ROUTINE = *const fn (
1237 dwError: u32,1237 dwError: u32,
1238 dwBytes: u32,1238 dwBytes: u32,
1239 lpOverlapped: *OVERLAPPED,1239 lpOverlapped: *OVERLAPPED,
1240) callconv(WINAPI) void);1240) callconv(WINAPI) void;
12411241
1242pub const fd_set = extern struct {1242pub const fd_set = extern struct {
1243 fd_count: u32,1243 fd_count: u32,
lib/std/packed_int_array.zig+9-5
...@@ -338,12 +338,12 @@ pub fn PackedIntSliceEndian(comptime Int: type, comptime endian: Endian) type {...@@ -338,12 +338,12 @@ pub fn PackedIntSliceEndian(comptime Int: type, comptime endian: Endian) type {
338 };338 };
339}339}
340340
341const we_are_testing_this_with_stage1_which_leaks_comptime_memory = true;
342
343test "PackedIntArray" {341test "PackedIntArray" {
344 // TODO @setEvalBranchQuota generates panics in wasm32. Investigate.342 // TODO @setEvalBranchQuota generates panics in wasm32. Investigate.
345 if (builtin.target.cpu.arch == .wasm32) return error.SkipZigTest;343 if (builtin.target.cpu.arch == .wasm32) return error.SkipZigTest;
346 if (we_are_testing_this_with_stage1_which_leaks_comptime_memory) return error.SkipZigTest;344
345 // TODO: enable this test
346 if (true) return error.SkipZigTest;
347347
348 @setEvalBranchQuota(10000);348 @setEvalBranchQuota(10000);
349 const max_bits = 256;349 const max_bits = 256;
...@@ -405,7 +405,9 @@ test "PackedIntArray initAllTo" {...@@ -405,7 +405,9 @@ test "PackedIntArray initAllTo" {
405test "PackedIntSlice" {405test "PackedIntSlice" {
406 // TODO @setEvalBranchQuota generates panics in wasm32. Investigate.406 // TODO @setEvalBranchQuota generates panics in wasm32. Investigate.
407 if (builtin.target.cpu.arch == .wasm32) return error.SkipZigTest;407 if (builtin.target.cpu.arch == .wasm32) return error.SkipZigTest;
408 if (we_are_testing_this_with_stage1_which_leaks_comptime_memory) return error.SkipZigTest;408
409 // TODO enable this test
410 if (true) return error.SkipZigTest;
409411
410 @setEvalBranchQuota(10000);412 @setEvalBranchQuota(10000);
411 const max_bits = 256;413 const max_bits = 256;
...@@ -444,7 +446,9 @@ test "PackedIntSlice" {...@@ -444,7 +446,9 @@ test "PackedIntSlice" {
444}446}
445447
446test "PackedIntSlice of PackedInt(Array/Slice)" {448test "PackedIntSlice of PackedInt(Array/Slice)" {
447 if (we_are_testing_this_with_stage1_which_leaks_comptime_memory) return error.SkipZigTest;449 // TODO enable this test
450 if (true) return error.SkipZigTest;
451
448 const max_bits = 16;452 const max_bits = 16;
449 const int_count = 19;453 const int_count = 19;
450454
lib/std/rand.zig+1-1
...@@ -30,7 +30,7 @@ pub const RomuTrio = @import("rand/RomuTrio.zig");...@@ -30,7 +30,7 @@ pub const RomuTrio = @import("rand/RomuTrio.zig");
3030
31pub const Random = struct {31pub const Random = struct {
32 ptr: *anyopaque,32 ptr: *anyopaque,
33 fillFn: std.meta.FnPtr(fn (ptr: *anyopaque, buf: []u8) void),33 fillFn: *const fn (ptr: *anyopaque, buf: []u8) void,
3434
35 pub fn init(pointer: anytype, comptime fillFn: fn (ptr: @TypeOf(pointer), buf: []u8) void) Random {35 pub fn init(pointer: anytype, comptime fillFn: fn (ptr: @TypeOf(pointer), buf: []u8) void) Random {
36 const Ptr = @TypeOf(pointer);36 const Ptr = @TypeOf(pointer);
lib/std/segmented_list.zig+1-1
...@@ -412,7 +412,7 @@ pub fn SegmentedList(comptime T: type, comptime prealloc_item_count: usize) type...@@ -412,7 +412,7 @@ pub fn SegmentedList(comptime T: type, comptime prealloc_item_count: usize) type
412}412}
413413
414test "SegmentedList basic usage" {414test "SegmentedList basic usage" {
415 if (@import("builtin").zig_backend == .stage1) {415 if (false) {
416 // https://github.com/ziglang/zig/issues/11787416 // https://github.com/ziglang/zig/issues/11787
417 try testSegmentedList(0);417 try testSegmentedList(0);
418 }418 }
lib/std/simd.zig+2-4
...@@ -191,9 +191,7 @@ pub fn extract(...@@ -191,9 +191,7 @@ pub fn extract(
191}191}
192192
193test "vector patterns" {193test "vector patterns" {
194 if ((builtin.zig_backend == .stage1 or builtin.zig_backend == .stage2_llvm) and194 if (builtin.zig_backend == .stage2_llvm and builtin.cpu.arch == .aarch64) {
195 builtin.cpu.arch == .aarch64)
196 {
197 // https://github.com/ziglang/zig/issues/12012195 // https://github.com/ziglang/zig/issues/12012
198 return error.SkipZigTest;196 return error.SkipZigTest;
199 }197 }
...@@ -419,7 +417,7 @@ test "vector prefix scan" {...@@ -419,7 +417,7 @@ test "vector prefix scan" {
419 return error.SkipZigTest;417 return error.SkipZigTest;
420 }418 }
421419
422 if (builtin.zig_backend == .stage1 or builtin.zig_backend == .stage2_llvm) {420 if (builtin.zig_backend == .stage2_llvm) {
423 // Regressed in LLVM 14:421 // Regressed in LLVM 14:
424 // https://github.com/llvm/llvm-project/issues/55522422 // https://github.com/llvm/llvm-project/issues/55522
425 return error.SkipZigTest;423 return error.SkipZigTest;
lib/std/unicode.zig+1-3
...@@ -354,9 +354,7 @@ fn testUtf16CountCodepoints() !void {...@@ -354,9 +354,7 @@ fn testUtf16CountCodepoints() !void {
354354
355test "utf16 count codepoints" {355test "utf16 count codepoints" {
356 try testUtf16CountCodepoints();356 try testUtf16CountCodepoints();
357 // TODO stage1 error: out of bounds slice357 comptime try testUtf16CountCodepoints();
358 if (@import("builtin").zig_backend != .stage1)
359 comptime try testUtf16CountCodepoints();
360}358}
361359
362test "utf8 encode" {360test "utf8 encode" {
lib/std/zig/Ast.zig-2
...@@ -2009,8 +2009,6 @@ fn fullStructInit(tree: Ast, info: full.StructInit.Components) full.StructInit {...@@ -2009,8 +2009,6 @@ fn fullStructInit(tree: Ast, info: full.StructInit.Components) full.StructInit {
20092009
2010fn fullPtrType(tree: Ast, info: full.PtrType.Components) full.PtrType {2010fn fullPtrType(tree: Ast, info: full.PtrType.Components) full.PtrType {
2011 const token_tags = tree.tokens.items(.tag);2011 const token_tags = tree.tokens.items(.tag);
2012 // TODO: looks like stage1 isn't quite smart enough to handle enum
2013 // literals in some places here
2014 const Size = std.builtin.Type.Pointer.Size;2012 const Size = std.builtin.Type.Pointer.Size;
2015 const size: Size = switch (token_tags[info.main_token]) {2013 const size: Size = switch (token_tags[info.main_token]) {
2016 .asterisk,2014 .asterisk,
lib/std/zig/c_translation.zig+4-18
...@@ -9,19 +9,13 @@ pub fn cast(comptime DestType: type, target: anytype) DestType {...@@ -9,19 +9,13 @@ pub fn cast(comptime DestType: type, target: anytype) DestType {
9 // this function should behave like transCCast in translate-c, except it's for macros9 // this function should behave like transCCast in translate-c, except it's for macros
10 const SourceType = @TypeOf(target);10 const SourceType = @TypeOf(target);
11 switch (@typeInfo(DestType)) {11 switch (@typeInfo(DestType)) {
12 .Fn => if (builtin.zig_backend == .stage1)12 .Fn => return castToPtr(*const DestType, SourceType, target),
13 return castToPtr(DestType, SourceType, target)
14 else
15 return castToPtr(*const DestType, SourceType, target),
16 .Pointer => return castToPtr(DestType, SourceType, target),13 .Pointer => return castToPtr(DestType, SourceType, target),
17 .Optional => |dest_opt| {14 .Optional => |dest_opt| {
18 if (@typeInfo(dest_opt.child) == .Pointer) {15 if (@typeInfo(dest_opt.child) == .Pointer) {
19 return castToPtr(DestType, SourceType, target);16 return castToPtr(DestType, SourceType, target);
20 } else if (@typeInfo(dest_opt.child) == .Fn) {17 } else if (@typeInfo(dest_opt.child) == .Fn) {
21 if (builtin.zig_backend == .stage1)18 return castToPtr(?*const dest_opt.child, SourceType, target);
22 return castToPtr(DestType, SourceType, target)
23 else
24 return castToPtr(?*const dest_opt.child, SourceType, target);
25 }19 }
26 },20 },
27 .Int => {21 .Int => {
...@@ -149,7 +143,7 @@ test "cast" {...@@ -149,7 +143,7 @@ test "cast" {
149 try testing.expect(cast(?*anyopaque, -1) == @intToPtr(?*anyopaque, @bitCast(usize, @as(isize, -1))));143 try testing.expect(cast(?*anyopaque, -1) == @intToPtr(?*anyopaque, @bitCast(usize, @as(isize, -1))));
150 try testing.expect(cast(?*anyopaque, foo) == @intToPtr(?*anyopaque, @bitCast(usize, @as(isize, -1))));144 try testing.expect(cast(?*anyopaque, foo) == @intToPtr(?*anyopaque, @bitCast(usize, @as(isize, -1))));
151145
152 const FnPtr = ?if (builtin.zig_backend == .stage1) fn (*anyopaque) void else *align(1) const fn (*anyopaque) void;146 const FnPtr = ?*align(1) const fn (*anyopaque) void;
153 try testing.expect(cast(FnPtr, 0) == @intToPtr(FnPtr, @as(usize, 0)));147 try testing.expect(cast(FnPtr, 0) == @intToPtr(FnPtr, @as(usize, 0)));
154 try testing.expect(cast(FnPtr, foo) == @intToPtr(FnPtr, @bitCast(usize, @as(isize, -1))));148 try testing.expect(cast(FnPtr, foo) == @intToPtr(FnPtr, @bitCast(usize, @as(isize, -1))));
155}149}
...@@ -160,12 +154,6 @@ pub fn sizeof(target: anytype) usize {...@@ -160,12 +154,6 @@ pub fn sizeof(target: anytype) usize {
160 switch (@typeInfo(T)) {154 switch (@typeInfo(T)) {
161 .Float, .Int, .Struct, .Union, .Array, .Bool, .Vector => return @sizeOf(T),155 .Float, .Int, .Struct, .Union, .Array, .Bool, .Vector => return @sizeOf(T),
162 .Fn => {156 .Fn => {
163 if (builtin.zig_backend == .stage1) {
164 // sizeof(main) returns 1, sizeof(&main) returns pointer size.
165 // We cannot distinguish those types in Zig, so use pointer size.
166 return @sizeOf(T);
167 }
168
169 // sizeof(main) in C returns 1157 // sizeof(main) in C returns 1
170 return 1;158 return 1;
171 },159 },
...@@ -263,9 +251,7 @@ test "sizeof" {...@@ -263,9 +251,7 @@ test "sizeof" {
263 try testing.expect(sizeof(*const *const [4:0]u8) == ptr_size);251 try testing.expect(sizeof(*const *const [4:0]u8) == ptr_size);
264 try testing.expect(sizeof(*const [4]u8) == ptr_size);252 try testing.expect(sizeof(*const [4]u8) == ptr_size);
265253
266 if (builtin.zig_backend == .stage1) {254 if (false) { // TODO
267 try testing.expect(sizeof(sizeof) == @sizeOf(@TypeOf(sizeof)));
268 } else if (false) { // TODO
269 try testing.expect(sizeof(&sizeof) == @sizeOf(@TypeOf(&sizeof)));255 try testing.expect(sizeof(&sizeof) == @sizeOf(@TypeOf(&sizeof)));
270 try testing.expect(sizeof(sizeof) == 1);256 try testing.expect(sizeof(sizeof) == 1);
271 }257 }
src/Compilation.zig+11-12
...@@ -5427,11 +5427,6 @@ pub fn build_crt_file(...@@ -5427,11 +5427,6 @@ pub fn build_crt_file(
5427 });5427 });
5428 errdefer comp.gpa.free(basename);5428 errdefer comp.gpa.free(basename);
54295429
5430 // TODO: This is extracted into a local variable to work around a stage1 miscompilation.
5431 const emit_bin = Compilation.EmitLoc{
5432 .directory = null, // Put it in the cache directory.
5433 .basename = basename,
5434 };
5435 const sub_compilation = try Compilation.create(comp.gpa, .{5430 const sub_compilation = try Compilation.create(comp.gpa, .{
5436 .local_cache_directory = comp.global_cache_directory,5431 .local_cache_directory = comp.global_cache_directory,
5437 .global_cache_directory = comp.global_cache_directory,5432 .global_cache_directory = comp.global_cache_directory,
...@@ -5443,7 +5438,10 @@ pub fn build_crt_file(...@@ -5443,7 +5438,10 @@ pub fn build_crt_file(
5443 .output_mode = output_mode,5438 .output_mode = output_mode,
5444 .thread_pool = comp.thread_pool,5439 .thread_pool = comp.thread_pool,
5445 .libc_installation = comp.bin_file.options.libc_installation,5440 .libc_installation = comp.bin_file.options.libc_installation,
5446 .emit_bin = emit_bin,5441 .emit_bin = .{
5442 .directory = null, // Put it in the cache directory.
5443 .basename = basename,
5444 },
5447 .optimize_mode = comp.compilerRtOptMode(),5445 .optimize_mode = comp.compilerRtOptMode(),
5448 .want_sanitize_c = false,5446 .want_sanitize_c = false,
5449 .want_stack_check = false,5447 .want_stack_check = false,
...@@ -5488,15 +5486,16 @@ pub fn build_crt_file(...@@ -5488,15 +5486,16 @@ pub fn build_crt_file(
5488 });5486 });
5489}5487}
54905488
5491pub fn stage1AddLinkLib(comp: *Compilation, lib_name: []const u8) !void {5489pub fn addLinkLib(comp: *Compilation, lib_name: []const u8) !void {
5492 // Avoid deadlocking on building import libs such as kernel32.lib5490 // Avoid deadlocking on building import libs such as kernel32.lib
5493 // This can happen when the user uses `build-exe foo.obj -lkernel32` and then5491 // This can happen when the user uses `build-exe foo.obj -lkernel32` and
5494 // when we create a sub-Compilation for zig libc, it also tries to build kernel32.lib.5492 // then when we create a sub-Compilation for zig libc, it also tries to
5493 // build kernel32.lib.
5495 if (comp.bin_file.options.skip_linker_dependencies) return;5494 if (comp.bin_file.options.skip_linker_dependencies) return;
54965495
5497 // This happens when an `extern "foo"` function is referenced by the stage1 backend.5496 // This happens when an `extern "foo"` function is referenced.
5498 // If we haven't seen this library yet and we're targeting Windows, we need to queue up5497 // If we haven't seen this library yet and we're targeting Windows, we need
5499 // a work item to produce the DLL import library for this.5498 // to queue up a work item to produce the DLL import library for this.
5500 const gop = try comp.bin_file.options.system_libs.getOrPut(comp.gpa, lib_name);5499 const gop = try comp.bin_file.options.system_libs.getOrPut(comp.gpa, lib_name);
5501 if (!gop.found_existing and comp.getTarget().os.tag == .windows) {5500 if (!gop.found_existing and comp.getTarget().os.tag == .windows) {
5502 try comp.work_queue.writeItem(.{5501 try comp.work_queue.writeItem(.{
src/Module.zig+6-8
...@@ -71,7 +71,7 @@ import_table: std.StringArrayHashMapUnmanaged(*File) = .{},...@@ -71,7 +71,7 @@ import_table: std.StringArrayHashMapUnmanaged(*File) = .{},
71/// Keys are fully resolved file paths. This table owns the keys and values.71/// Keys are fully resolved file paths. This table owns the keys and values.
72embed_table: std.StringHashMapUnmanaged(*EmbedFile) = .{},72embed_table: std.StringHashMapUnmanaged(*EmbedFile) = .{},
7373
74/// This is a temporary addition to stage2 in order to match stage1 behavior,74/// This is a temporary addition to stage2 in order to match legacy behavior,
75/// however the end-game once the lang spec is settled will be to use a global75/// however the end-game once the lang spec is settled will be to use a global
76/// InternPool for comptime memoized objects, making this behavior consistent across all types,76/// InternPool for comptime memoized objects, making this behavior consistent across all types,
77/// not only string literals. Or, we might decide to not guarantee string literals77/// not only string literals. Or, we might decide to not guarantee string literals
...@@ -3544,17 +3544,15 @@ fn freeExportList(gpa: Allocator, export_list: *ArrayListUnmanaged(*Export)) voi...@@ -3544,17 +3544,15 @@ fn freeExportList(gpa: Allocator, export_list: *ArrayListUnmanaged(*Export)) voi
3544 export_list.deinit(gpa);3544 export_list.deinit(gpa);
3545}3545}
35463546
3547// TODO https://github.com/ziglang/zig/issues/8643
3547const data_has_safety_tag = @sizeOf(Zir.Inst.Data) != 8;3548const data_has_safety_tag = @sizeOf(Zir.Inst.Data) != 8;
3548// TODO This is taking advantage of matching stage1 debug union layout.3549const HackDataLayout = extern struct {
3549// We need a better language feature for initializing a union with
3550// a runtime-known tag.
3551const Stage1DataLayout = extern struct {
3552 data: [8]u8 align(@alignOf(Zir.Inst.Data)),3550 data: [8]u8 align(@alignOf(Zir.Inst.Data)),
3553 safety_tag: u8,3551 safety_tag: u8,
3554};3552};
3555comptime {3553comptime {
3556 if (data_has_safety_tag) {3554 if (data_has_safety_tag) {
3557 assert(@sizeOf(Stage1DataLayout) == @sizeOf(Zir.Inst.Data));3555 assert(@sizeOf(HackDataLayout) == @sizeOf(Zir.Inst.Data));
3558 }3556 }
3559}3557}
35603558
...@@ -3695,7 +3693,7 @@ pub fn astGenFile(mod: *Module, file: *File) !void {...@@ -3695,7 +3693,7 @@ pub fn astGenFile(mod: *Module, file: *File) !void {
3695 const tags = zir.instructions.items(.tag);3693 const tags = zir.instructions.items(.tag);
3696 for (zir.instructions.items(.data)) |*data, i| {3694 for (zir.instructions.items(.data)) |*data, i| {
3697 const union_tag = Zir.Inst.Tag.data_tags[@enumToInt(tags[i])];3695 const union_tag = Zir.Inst.Tag.data_tags[@enumToInt(tags[i])];
3698 const as_struct = @ptrCast(*Stage1DataLayout, data);3696 const as_struct = @ptrCast(*HackDataLayout, data);
3699 as_struct.* = .{3697 as_struct.* = .{
3700 .safety_tag = @enumToInt(union_tag),3698 .safety_tag = @enumToInt(union_tag),
3701 .data = safety_buffer[i],3699 .data = safety_buffer[i],
...@@ -3881,7 +3879,7 @@ pub fn astGenFile(mod: *Module, file: *File) !void {...@@ -3881,7 +3879,7 @@ pub fn astGenFile(mod: *Module, file: *File) !void {
3881 if (data_has_safety_tag) {3879 if (data_has_safety_tag) {
3882 // The `Data` union has a safety tag but in the file format we store it without.3880 // The `Data` union has a safety tag but in the file format we store it without.
3883 for (file.zir.instructions.items(.data)) |*data, i| {3881 for (file.zir.instructions.items(.data)) |*data, i| {
3884 const as_struct = @ptrCast(*const Stage1DataLayout, data);3882 const as_struct = @ptrCast(*const HackDataLayout, data);
3885 safety_buffer[i] = as_struct.data;3883 safety_buffer[i] = as_struct.data;
3886 }3884 }
3887 }3885 }
src/Sema.zig+11-17
...@@ -8307,7 +8307,7 @@ fn handleExternLibName(...@@ -8307,7 +8307,7 @@ fn handleExternLibName(
8307 .{ lib_name, lib_name },8307 .{ lib_name, lib_name },
8308 );8308 );
8309 }8309 }
8310 comp.stage1AddLinkLib(lib_name) catch |err| {8310 comp.addLinkLib(lib_name) catch |err| {
8311 return sema.fail(block, src_loc, "unable to add link lib '{s}': {s}", .{8311 return sema.fail(block, src_loc, "unable to add link lib '{s}': {s}", .{
8312 lib_name, @errorName(err),8312 lib_name, @errorName(err),
8313 });8313 });
...@@ -8401,15 +8401,11 @@ fn funcCommon(...@@ -8401,15 +8401,11 @@ fn funcCommon(
8401 }8401 }
8402 }8402 }
84038403
8404 // These locals are pulled out from the init expression below to work around
8405 // a stage1 compiler bug.
8406 // In the case of generic calling convention, or generic alignment, we use8404 // In the case of generic calling convention, or generic alignment, we use
8407 // default values which are only meaningful for the generic function, *not*8405 // default values which are only meaningful for the generic function, *not*
8408 // the instantiation, which can depend on comptime parameters.8406 // the instantiation, which can depend on comptime parameters.
8409 // Related proposal: https://github.com/ziglang/zig/issues/118348407 // Related proposal: https://github.com/ziglang/zig/issues/11834
8410 const cc_workaround = cc orelse .Unspecified;8408 const cc_resolved = cc orelse .Unspecified;
8411 const align_workaround = alignment orelse 0;
8412
8413 const param_types = try sema.arena.alloc(Type, block.params.items.len);8409 const param_types = try sema.arena.alloc(Type, block.params.items.len);
8414 const comptime_params = try sema.arena.alloc(bool, block.params.items.len);8410 const comptime_params = try sema.arena.alloc(bool, block.params.items.len);
8415 for (block.params.items) |param, i| {8411 for (block.params.items) |param, i| {
...@@ -8421,7 +8417,7 @@ fn funcCommon(...@@ -8421,7 +8417,7 @@ fn funcCommon(
8421 comptime_params,8417 comptime_params,
8422 i,8418 i,
8423 &is_generic,8419 &is_generic,
8424 cc_workaround,8420 cc_resolved,
8425 has_body,8421 has_body,
8426 ) catch |err| switch (err) {8422 ) catch |err| switch (err) {
8427 error.NeededSourceLocation => {8423 error.NeededSourceLocation => {
...@@ -8433,7 +8429,7 @@ fn funcCommon(...@@ -8433,7 +8429,7 @@ fn funcCommon(
8433 comptime_params,8429 comptime_params,
8434 i,8430 i,
8435 &is_generic,8431 &is_generic,
8436 cc_workaround,8432 cc_resolved,
8437 has_body,8433 has_body,
8438 );8434 );
8439 return error.AnalysisFail;8435 return error.AnalysisFail;
...@@ -8481,10 +8477,10 @@ fn funcCommon(...@@ -8481,10 +8477,10 @@ fn funcCommon(
8481 };8477 };
8482 return sema.failWithOwnedErrorMsg(msg);8478 return sema.failWithOwnedErrorMsg(msg);
8483 }8479 }
8484 if (!Type.fnCallingConventionAllowsZigTypes(cc_workaround) and !try sema.validateExternType(return_type, .ret_ty)) {8480 if (!Type.fnCallingConventionAllowsZigTypes(cc_resolved) and !try sema.validateExternType(return_type, .ret_ty)) {
8485 const msg = msg: {8481 const msg = msg: {
8486 const msg = try sema.errMsg(block, ret_ty_src, "return type '{}' not allowed in function with calling convention '{s}'", .{8482 const msg = try sema.errMsg(block, ret_ty_src, "return type '{}' not allowed in function with calling convention '{s}'", .{
8487 return_type.fmt(sema.mod), @tagName(cc_workaround),8483 return_type.fmt(sema.mod), @tagName(cc_resolved),
8488 });8484 });
8489 errdefer msg.destroy(sema.gpa);8485 errdefer msg.destroy(sema.gpa);
84908486
...@@ -8533,7 +8529,7 @@ fn funcCommon(...@@ -8533,7 +8529,7 @@ fn funcCommon(
8533 }8529 }
85348530
8535 const arch = sema.mod.getTarget().cpu.arch;8531 const arch = sema.mod.getTarget().cpu.arch;
8536 if (switch (cc_workaround) {8532 if (switch (cc_resolved) {
8537 .Unspecified, .C, .Naked, .Async, .Inline => null,8533 .Unspecified, .C, .Naked, .Async, .Inline => null,
8538 .Interrupt => switch (arch) {8534 .Interrupt => switch (arch) {
8539 .x86, .x86_64, .avr, .msp430 => null,8535 .x86, .x86_64, .avr, .msp430 => null,
...@@ -8569,13 +8565,13 @@ fn funcCommon(...@@ -8569,13 +8565,13 @@ fn funcCommon(
8569 },8565 },
8570 }) |allowed_platform| {8566 }) |allowed_platform| {
8571 return sema.fail(block, cc_src, "callconv '{s}' is only available on {s}, not {s}", .{8567 return sema.fail(block, cc_src, "callconv '{s}' is only available on {s}, not {s}", .{
8572 @tagName(cc_workaround),8568 @tagName(cc_resolved),
8573 allowed_platform,8569 allowed_platform,
8574 @tagName(arch),8570 @tagName(arch),
8575 });8571 });
8576 }8572 }
85778573
8578 if (cc_workaround == .Inline and is_noinline) {8574 if (cc_resolved == .Inline and is_noinline) {
8579 return sema.fail(block, cc_src, "'noinline' function cannot have callconv 'Inline'", .{});8575 return sema.fail(block, cc_src, "'noinline' function cannot have callconv 'Inline'", .{});
8580 }8576 }
8581 if (is_generic and sema.no_partial_func_ty) return error.GenericPoison;8577 if (is_generic and sema.no_partial_func_ty) return error.GenericPoison;
...@@ -8593,9 +8589,9 @@ fn funcCommon(...@@ -8593,9 +8589,9 @@ fn funcCommon(
8593 .param_types = param_types,8589 .param_types = param_types,
8594 .comptime_params = comptime_params.ptr,8590 .comptime_params = comptime_params.ptr,
8595 .return_type = return_type,8591 .return_type = return_type,
8596 .cc = cc_workaround,8592 .cc = cc_resolved,
8597 .cc_is_generic = cc == null,8593 .cc_is_generic = cc == null,
8598 .alignment = align_workaround,8594 .alignment = alignment orelse 0,
8599 .align_is_generic = alignment == null,8595 .align_is_generic = alignment == null,
8600 .section_is_generic = section == .generic,8596 .section_is_generic = section == .generic,
8601 .addrspace_is_generic = address_space == null,8597 .addrspace_is_generic = address_space == null,
...@@ -19107,8 +19103,6 @@ fn zirPtrCast(sema: *Sema, block: *Block, inst: Zir.Inst.Index) CompileError!Air...@@ -19107,8 +19103,6 @@ fn zirPtrCast(sema: *Sema, block: *Block, inst: Zir.Inst.Index) CompileError!Air
19107 const operand_elem_size = operand_elem_ty.abiSize(target);19103 const operand_elem_size = operand_elem_ty.abiSize(target);
19108 const dest_elem_size = dest_elem_ty.abiSize(target);19104 const dest_elem_size = dest_elem_ty.abiSize(target);
19109 if (operand_elem_size != dest_elem_size) {19105 if (operand_elem_size != dest_elem_size) {
19110 // note that this is not implemented in stage1 so we should probably wait
19111 // until that codebase is replaced before implementing this in stage2.
19112 return sema.fail(block, dest_ty_src, "TODO: implement @ptrCast between slices changing the length", .{});19106 return sema.fail(block, dest_ty_src, "TODO: implement @ptrCast between slices changing the length", .{});
19113 }19107 }
19114 }19108 }
src/ThreadPool.zig+1-4
...@@ -15,10 +15,7 @@ const Runnable = struct {...@@ -15,10 +15,7 @@ const Runnable = struct {
15 runFn: RunProto,15 runFn: RunProto,
16};16};
1717
18const RunProto = switch (builtin.zig_backend) {18const RunProto = *const fn (*Runnable) void;
19 .stage1 => fn (*Runnable) void,
20 else => *const fn (*Runnable) void,
21};
2219
23pub fn init(pool: *ThreadPool, allocator: std.mem.Allocator) !void {20pub fn init(pool: *ThreadPool, allocator: std.mem.Allocator) !void {
24 pool.* = .{21 pool.* = .{
src/clang.zig+5-6
...@@ -161,12 +161,11 @@ pub const ASTUnit = opaque {...@@ -161,12 +161,11 @@ pub const ASTUnit = opaque {
161 extern fn ZigClangASTUnit_getSourceManager(*ASTUnit) *SourceManager;161 extern fn ZigClangASTUnit_getSourceManager(*ASTUnit) *SourceManager;
162162
163 pub const visitLocalTopLevelDecls = ZigClangASTUnit_visitLocalTopLevelDecls;163 pub const visitLocalTopLevelDecls = ZigClangASTUnit_visitLocalTopLevelDecls;
164 extern fn ZigClangASTUnit_visitLocalTopLevelDecls(*ASTUnit, context: ?*anyopaque, Fn: ?VisitorFn) bool;164 extern fn ZigClangASTUnit_visitLocalTopLevelDecls(
165165 *ASTUnit,
166 const VisitorFn = if (@import("builtin").zig_backend == .stage1)166 context: ?*anyopaque,
167 fn (?*anyopaque, *const Decl) callconv(.C) bool167 Fn: ?*const fn (?*anyopaque, *const Decl) callconv(.C) bool,
168 else168 ) bool;
169 *const fn (?*anyopaque, *const Decl) callconv(.C) bool;
170169
171 pub const getLocalPreprocessingEntities_begin = ZigClangASTUnit_getLocalPreprocessingEntities_begin;170 pub const getLocalPreprocessingEntities_begin = ZigClangASTUnit_getLocalPreprocessingEntities_begin;
172 extern fn ZigClangASTUnit_getLocalPreprocessingEntities_begin(*ASTUnit) PreprocessingRecord.iterator;171 extern fn ZigClangASTUnit_getLocalPreprocessingEntities_begin(*ASTUnit) PreprocessingRecord.iterator;
src/codegen.zig+1-42
...@@ -98,54 +98,13 @@ pub fn generateFunction(...@@ -98,54 +98,13 @@ pub fn generateFunction(
98 .aarch64_be,98 .aarch64_be,
99 .aarch64_32,99 .aarch64_32,
100 => return @import("arch/aarch64/CodeGen.zig").generate(bin_file, src_loc, func, air, liveness, code, debug_output),100 => return @import("arch/aarch64/CodeGen.zig").generate(bin_file, src_loc, func, air, liveness, code, debug_output),
101 //.arc => return Function(.arc).generate(bin_file, src_loc, func, air, liveness, code, debug_output),
102 //.avr => return Function(.avr).generate(bin_file, src_loc, func, air, liveness, code, debug_output),
103 //.bpfel => return Function(.bpfel).generate(bin_file, src_loc, func, air, liveness, code, debug_output),
104 //.bpfeb => return Function(.bpfeb).generate(bin_file, src_loc, func, air, liveness, code, debug_output),
105 //.hexagon => return Function(.hexagon).generate(bin_file, src_loc, func, air, liveness, code, debug_output),
106 //.mips => return Function(.mips).generate(bin_file, src_loc, func, air, liveness, code, debug_output),
107 //.mipsel => return Function(.mipsel).generate(bin_file, src_loc, func, air, liveness, code, debug_output),
108 //.mips64 => return Function(.mips64).generate(bin_file, src_loc, func, air, liveness, code, debug_output),
109 //.mips64el => return Function(.mips64el).generate(bin_file, src_loc, func, air, liveness, code, debug_output),
110 //.msp430 => return Function(.msp430).generate(bin_file, src_loc, func, air, liveness, code, debug_output),
111 //.powerpc => return Function(.powerpc).generate(bin_file, src_loc, func, air, liveness, code, debug_output),
112 //.powerpc64 => return Function(.powerpc64).generate(bin_file, src_loc, func, air, liveness, code, debug_output),
113 //.powerpc64le => return Function(.powerpc64le).generate(bin_file, src_loc, func, air, liveness, code, debug_output),
114 //.r600 => return Function(.r600).generate(bin_file, src_loc, func, air, liveness, code, debug_output),
115 //.amdgcn => return Function(.amdgcn).generate(bin_file, src_loc, func, air, liveness, code, debug_output),
116 //.riscv32 => return Function(.riscv32).generate(bin_file, src_loc, func, air, liveness, code, debug_output),
117 .riscv64 => return @import("arch/riscv64/CodeGen.zig").generate(bin_file, src_loc, func, air, liveness, code, debug_output),101 .riscv64 => return @import("arch/riscv64/CodeGen.zig").generate(bin_file, src_loc, func, air, liveness, code, debug_output),
118 //.sparc => return Function(.sparc).generate(bin_file, src_loc, func, air, liveness, code, debug_output),
119 .sparc64 => return @import("arch/sparc64/CodeGen.zig").generate(bin_file, src_loc, func, air, liveness, code, debug_output),102 .sparc64 => return @import("arch/sparc64/CodeGen.zig").generate(bin_file, src_loc, func, air, liveness, code, debug_output),
120 //.sparcel => return Function(.sparcel).generate(bin_file, src_loc, func, air, liveness, code, debug_output),
121 //.s390x => return Function(.s390x).generate(bin_file, src_loc, func, air, liveness, code, debug_output),
122 //.tce => return Function(.tce).generate(bin_file, src_loc, func, air, liveness, code, debug_output),
123 //.tcele => return Function(.tcele).generate(bin_file, src_loc, func, air, liveness, code, debug_output),
124 //.thumb => return Function(.thumb).generate(bin_file, src_loc, func, air, liveness, code, debug_output),
125 //.thumbeb => return Function(.thumbeb).generate(bin_file, src_loc, func, air, liveness, code, debug_output),
126 //.x86 => return Function(.x86).generate(bin_file, src_loc, func, air, liveness, code, debug_output),
127 .x86_64 => return @import("arch/x86_64/CodeGen.zig").generate(bin_file, src_loc, func, air, liveness, code, debug_output),103 .x86_64 => return @import("arch/x86_64/CodeGen.zig").generate(bin_file, src_loc, func, air, liveness, code, debug_output),
128 //.xcore => return Function(.xcore).generate(bin_file, src_loc, func, air, liveness, code, debug_output),
129 //.nvptx => return Function(.nvptx).generate(bin_file, src_loc, func, air, liveness, code, debug_output),
130 //.nvptx64 => return Function(.nvptx64).generate(bin_file, src_loc, func, air, liveness, code, debug_output),
131 //.le32 => return Function(.le32).generate(bin_file, src_loc, func, air, liveness, code, debug_output),
132 //.le64 => return Function(.le64).generate(bin_file, src_loc, func, air, liveness, code, debug_output),
133 //.amdil => return Function(.amdil).generate(bin_file, src_loc, func, air, liveness, code, debug_output),
134 //.amdil64 => return Function(.amdil64).generate(bin_file, src_loc, func, air, liveness, code, debug_output),
135 //.hsail => return Function(.hsail).generate(bin_file, src_loc, func, air, liveness, code, debug_output),
136 //.hsail64 => return Function(.hsail64).generate(bin_file, src_loc, func, air, liveness, code, debug_output),
137 //.spir => return Function(.spir).generate(bin_file, src_loc, func, air, liveness, code, debug_output),
138 //.spir64 => return Function(.spir64).generate(bin_file, src_loc, func, air, liveness, code, debug_output),
139 //.kalimba => return Function(.kalimba).generate(bin_file, src_loc, func, air, liveness, code, debug_output),
140 //.shave => return Function(.shave).generate(bin_file, src_loc, func, air, liveness, code, debug_output),
141 //.lanai => return Function(.lanai).generate(bin_file, src_loc, func, air, liveness, code, debug_output),
142 //.renderscript32 => return Function(.renderscript32).generate(bin_file, src_loc, func, air, liveness, code, debug_output),
143 //.renderscript64 => return Function(.renderscript64).generate(bin_file, src_loc, func, air, liveness, code, debug_output),
144 //.ve => return Function(.ve).generate(bin_file, src_loc, func, air, liveness, code, debug_output),
145 .wasm32,104 .wasm32,
146 .wasm64,105 .wasm64,
147 => return @import("arch/wasm/CodeGen.zig").generate(bin_file, src_loc, func, air, liveness, code, debug_output),106 => return @import("arch/wasm/CodeGen.zig").generate(bin_file, src_loc, func, air, liveness, code, debug_output),
148 else => @panic("Backend architectures that don't have good support yet are commented out, to improve compilation performance. If you are interested in one of these other backends feel free to uncomment them. Eventually these will be completed, but stage1 is slow and a memory hog."),107 else => unreachable,
149 }108 }
150}109}
151110
src/codegen/c.zig+2-4
...@@ -4972,8 +4972,7 @@ fn airStructFieldPtr(f: *Function, inst: Air.Inst.Index) !CValue {...@@ -4972,8 +4972,7 @@ fn airStructFieldPtr(f: *Function, inst: Air.Inst.Index) !CValue {
49724972
4973 if (f.liveness.isUnused(inst)) {4973 if (f.liveness.isUnused(inst)) {
4974 try reap(f, inst, &.{extra.struct_operand});4974 try reap(f, inst, &.{extra.struct_operand});
4975 // TODO this @as is needed because of a stage1 bug4975 return .none;
4976 return @as(CValue, CValue.none);
4977 }4976 }
49784977
4979 const struct_ptr = try f.resolveInst(extra.struct_operand);4978 const struct_ptr = try f.resolveInst(extra.struct_operand);
...@@ -4987,8 +4986,7 @@ fn airStructFieldPtrIndex(f: *Function, inst: Air.Inst.Index, index: u8) !CValue...@@ -4987,8 +4986,7 @@ fn airStructFieldPtrIndex(f: *Function, inst: Air.Inst.Index, index: u8) !CValue
49874986
4988 if (f.liveness.isUnused(inst)) {4987 if (f.liveness.isUnused(inst)) {
4989 try reap(f, inst, &.{ty_op.operand});4988 try reap(f, inst, &.{ty_op.operand});
4990 // TODO this @as is needed because of a stage1 bug4989 return .none;
4991 return @as(CValue, CValue.none);
4992 }4990 }
49934991
4994 const struct_ptr = try f.resolveInst(ty_op.operand);4992 const struct_ptr = try f.resolveInst(ty_op.operand);
src/codegen/llvm.zig+8-8
...@@ -1392,8 +1392,9 @@ pub const Object = struct {...@@ -1392,8 +1392,9 @@ pub const Object = struct {
1392 const dir_path = file.pkg.root_src_directory.path orelse ".";1392 const dir_path = file.pkg.root_src_directory.path orelse ".";
1393 const sub_file_path_z = try gpa.dupeZ(u8, std.fs.path.basename(file.sub_file_path));1393 const sub_file_path_z = try gpa.dupeZ(u8, std.fs.path.basename(file.sub_file_path));
1394 defer gpa.free(sub_file_path_z);1394 defer gpa.free(sub_file_path_z);
1395 const stage1_workaround = std.fs.path.dirname(file.sub_file_path) orelse "";1395 const dir_path_z = try std.fs.path.joinZ(gpa, &.{
1396 const dir_path_z = try std.fs.path.joinZ(gpa, &.{ dir_path, stage1_workaround });1396 dir_path, std.fs.path.dirname(file.sub_file_path) orelse "",
1397 });
1397 defer gpa.free(dir_path_z);1398 defer gpa.free(dir_path_z);
1398 const di_file = o.di_builder.?.createFile(sub_file_path_z, dir_path_z);1399 const di_file = o.di_builder.?.createFile(sub_file_path_z, dir_path_z);
1399 gop.value_ptr.* = di_file.toNode();1400 gop.value_ptr.* = di_file.toNode();
...@@ -6107,12 +6108,11 @@ pub const FuncGen = struct {...@@ -6107,12 +6108,11 @@ pub const FuncGen = struct {
6107 }6108 }
61086109
6109 fn airAssembly(self: *FuncGen, inst: Air.Inst.Index) !?*llvm.Value {6110 fn airAssembly(self: *FuncGen, inst: Air.Inst.Index) !?*llvm.Value {
6110 // Eventually, the Zig compiler needs to be reworked to have inline assembly go6111 // Eventually, the Zig compiler needs to be reworked to have inline
6111 // through the same parsing code regardless of backend, and have LLVM-flavored6112 // assembly go through the same parsing code regardless of backend, and
6112 // inline assembly be *output* from that assembler.6113 // have LLVM-flavored inline assembly be *output* from that assembler.
6113 // We don't have such an assembler implemented yet though. For now, this6114 // We don't have such an assembler implemented yet though. For now,
6114 // implementation feeds the inline assembly code directly to LLVM, same6115 // this implementation feeds the inline assembly code directly to LLVM.
6115 // as stage1.
61166116
6117 const ty_pl = self.air.instructions.items(.data)[inst].ty_pl;6117 const ty_pl = self.air.instructions.items(.data)[inst].ty_pl;
6118 const extra = self.air.extraData(Air.Asm, ty_pl.payload);6118 const extra = self.air.extraData(Air.Asm, ty_pl.payload);
src/codegen/spirv/Section.zig-10
...@@ -333,8 +333,6 @@ fn extendedUnionSize(comptime Operand: type, operand: Operand) usize {...@@ -333,8 +333,6 @@ fn extendedUnionSize(comptime Operand: type, operand: Operand) usize {
333}333}
334334
335test "SPIR-V Section emit() - no operands" {335test "SPIR-V Section emit() - no operands" {
336 if (@import("builtin").zig_backend == .stage1) return error.SkipZigTest;
337
338 var section = Section{};336 var section = Section{};
339 defer section.deinit(std.testing.allocator);337 defer section.deinit(std.testing.allocator);
340338
...@@ -344,8 +342,6 @@ test "SPIR-V Section emit() - no operands" {...@@ -344,8 +342,6 @@ test "SPIR-V Section emit() - no operands" {
344}342}
345343
346test "SPIR-V Section emit() - simple" {344test "SPIR-V Section emit() - simple" {
347 if (@import("builtin").zig_backend == .stage1) return error.SkipZigTest;
348
349 var section = Section{};345 var section = Section{};
350 defer section.deinit(std.testing.allocator);346 defer section.deinit(std.testing.allocator);
351347
...@@ -362,8 +358,6 @@ test "SPIR-V Section emit() - simple" {...@@ -362,8 +358,6 @@ test "SPIR-V Section emit() - simple" {
362}358}
363359
364test "SPIR-V Section emit() - string" {360test "SPIR-V Section emit() - string" {
365 if (@import("builtin").zig_backend == .stage1) return error.SkipZigTest;
366
367 var section = Section{};361 var section = Section{};
368 defer section.deinit(std.testing.allocator);362 defer section.deinit(std.testing.allocator);
369363
...@@ -389,8 +383,6 @@ test "SPIR-V Section emit() - string" {...@@ -389,8 +383,6 @@ test "SPIR-V Section emit() - string" {
389}383}
390384
391test "SPIR-V Section emit()- extended mask" {385test "SPIR-V Section emit()- extended mask" {
392 if (@import("builtin").zig_backend == .stage1) return error.SkipZigTest;
393
394 var section = Section{};386 var section = Section{};
395 defer section.deinit(std.testing.allocator);387 defer section.deinit(std.testing.allocator);
396388
...@@ -415,8 +407,6 @@ test "SPIR-V Section emit()- extended mask" {...@@ -415,8 +407,6 @@ test "SPIR-V Section emit()- extended mask" {
415}407}
416408
417test "SPIR-V Section emit() - extended union" {409test "SPIR-V Section emit() - extended union" {
418 if (@import("builtin").zig_backend == .stage1) return error.SkipZigTest;
419
420 var section = Section{};410 var section = Section{};
421 defer section.deinit(std.testing.allocator);411 defer section.deinit(std.testing.allocator);
422412
src/main.zig+2-6
...@@ -3289,15 +3289,11 @@ fn parseCrossTargetOrReportFatalError(...@@ -3289,15 +3289,11 @@ fn parseCrossTargetOrReportFatalError(
3289 fatal("unknown CPU feature: '{s}'", .{diags.unknown_feature_name.?});3289 fatal("unknown CPU feature: '{s}'", .{diags.unknown_feature_name.?});
3290 },3290 },
3291 error.UnknownObjectFormat => {3291 error.UnknownObjectFormat => {
3292 {3292 help: {
3293 var help_text = std.ArrayList(u8).init(allocator);3293 var help_text = std.ArrayList(u8).init(allocator);
3294 defer help_text.deinit();3294 defer help_text.deinit();
3295 inline for (@typeInfo(std.Target.ObjectFormat).Enum.fields) |field| {3295 inline for (@typeInfo(std.Target.ObjectFormat).Enum.fields) |field| {
3296 help_text.writer().print(" {s}\n", .{field.name}) catch3296 help_text.writer().print(" {s}\n", .{field.name}) catch break :help;
3297 // TODO change this back to `break :help`
3298 // this working around a stage1 bug.
3299 //break :help;
3300 @panic("out of memory");
3301 }3297 }
3302 std.log.info("available object formats:\n{s}", .{help_text.items});3298 std.log.info("available object formats:\n{s}", .{help_text.items});
3303 }3299 }
src/target.zig+2-2
...@@ -523,13 +523,13 @@ pub const AtomicPtrAlignmentDiagnostics = struct {...@@ -523,13 +523,13 @@ pub const AtomicPtrAlignmentDiagnostics = struct {
523/// If ABI alignment of `ty` is OK for atomic operations, returns 0.523/// If ABI alignment of `ty` is OK for atomic operations, returns 0.
524/// Otherwise returns the alignment required on a pointer for the target524/// Otherwise returns the alignment required on a pointer for the target
525/// to perform atomic operations.525/// to perform atomic operations.
526// TODO this function does not take into account CPU features, which can affect
527// this value. Audit this!
526pub fn atomicPtrAlignment(528pub fn atomicPtrAlignment(
527 target: std.Target,529 target: std.Target,
528 ty: Type,530 ty: Type,
529 diags: *AtomicPtrAlignmentDiagnostics,531 diags: *AtomicPtrAlignmentDiagnostics,
530) AtomicPtrAlignmentError!u32 {532) AtomicPtrAlignmentError!u32 {
531 // TODO this was ported from stage1 but it does not take into account CPU features,
532 // which can affect this value. Audit this!
533 const max_atomic_bits: u16 = switch (target.cpu.arch) {533 const max_atomic_bits: u16 = switch (target.cpu.arch) {
534 .avr,534 .avr,
535 .msp430,535 .msp430,
src/translate_c.zig-3
...@@ -1,6 +1,3 @@...@@ -1,6 +1,3 @@
1//! This is the userland implementation of translate-c which is used by both stage1
2//! and stage2.
3
4const std = @import("std");1const std = @import("std");
5const testing = std.testing;2const testing = std.testing;
6const assert = std.debug.assert;3const assert = std.debug.assert;
src/type.zig+4-6
...@@ -1554,10 +1554,10 @@ pub const Type = extern union {...@@ -1554,10 +1554,10 @@ pub const Type = extern union {
1554 ) @TypeOf(writer).Error!void {1554 ) @TypeOf(writer).Error!void {
1555 _ = options;1555 _ = options;
1556 comptime assert(unused_format_string.len == 0);1556 comptime assert(unused_format_string.len == 0);
1557 if (@import("builtin").zig_backend != .stage1) {1557 if (true) {
1558 // This is disabled to work around a stage2 bug where this function recursively1558 // This is disabled to work around a bug where this function
1559 // causes more generic function instantiations resulting in an infinite loop1559 // recursively causes more generic function instantiations
1560 // in the compiler.1560 // resulting in an infinite loop in the compiler.
1561 try writer.writeAll("[TODO fix internal compiler bug regarding dump]");1561 try writer.writeAll("[TODO fix internal compiler bug regarding dump]");
1562 return;1562 return;
1563 }1563 }
...@@ -6551,9 +6551,7 @@ pub const Type = extern union {...@@ -6551,9 +6551,7 @@ pub const Type = extern union {
6551 else => {},6551 else => {},
6552 }6552 }
6553 } else {6553 } else {
6554 // TODO stage1 type inference bug
6555 const T = Type.Tag;6554 const T = Type.Tag;
6556
6557 const type_payload = try arena.create(Type.Payload.ElemType);6555 const type_payload = try arena.create(Type.Payload.ElemType);
6558 type_payload.* = .{6556 type_payload.* = .{
6559 .base = .{6557 .base = .{
src/zig_llvm.h-2
...@@ -337,7 +337,6 @@ ZIG_EXTERN_C void ZigLLVMParseCommandLineOptions(size_t argc, const char *const...@@ -337,7 +337,6 @@ ZIG_EXTERN_C void ZigLLVMParseCommandLineOptions(size_t argc, const char *const
337337
338// synchronize with llvm/include/ADT/Triple.h::ArchType338// synchronize with llvm/include/ADT/Triple.h::ArchType
339// synchronize with std.Target.Cpu.Arch339// synchronize with std.Target.Cpu.Arch
340// synchronize with src/stage1/target.cpp::arch_list
341// synchronize with codegen/llvm/bindings.zig::ArchType340// synchronize with codegen/llvm/bindings.zig::ArchType
342enum ZigLLVM_ArchType {341enum ZigLLVM_ArchType {
343 ZigLLVM_UnknownArch,342 ZigLLVM_UnknownArch,
...@@ -428,7 +427,6 @@ enum ZigLLVM_VendorType {...@@ -428,7 +427,6 @@ enum ZigLLVM_VendorType {
428// synchronize with llvm/include/ADT/Triple.h::OsType427// synchronize with llvm/include/ADT/Triple.h::OsType
429// synchronize with std.Target.Os.Tag428// synchronize with std.Target.Os.Tag
430// synchronize with codegen/llvm/bindings.zig::OsType429// synchronize with codegen/llvm/bindings.zig::OsType
431// synchronize with src/stage1/target.cpp::os_list
432enum ZigLLVM_OSType {430enum ZigLLVM_OSType {
433 ZigLLVM_UnknownOS,431 ZigLLVM_UnknownOS,
434432