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 {
214214 inline fn bitRmw(self: *Self, comptime op: BitRmwOp, bit: Bit, comptime ordering: Ordering) u1 {
215215 // x86 supports dedicated bitwise instructions
216216 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.
218 if (builtin.zig_backend == .stage1) {
217 // TODO: this causes std lib test failures when enabled
218 if (false) {
219219 return x86BitRmw(self, op, bit, ordering);
220220 }
221221 }
lib/std/base64.zig+1-1
......@@ -9,7 +9,7 @@ pub const Error = error{
99 NoSpaceLeft,
1010};
1111
12const decoderWithIgnoreProto = std.meta.FnPtr(fn (ignore: []const u8) Base64DecoderWithIgnore);
12const decoderWithIgnoreProto = *const fn (ignore: []const u8) Base64DecoderWithIgnore;
1313
1414/// Base64 codecs
1515pub const Codecs = struct {
lib/std/build.zig+2-3
......@@ -3293,8 +3293,7 @@ pub const LibExeObjStep = struct {
32933293 while (try it.next()) |entry| {
32943294 // The compiler can put these files into the same directory, but we don't
32953295 // want to copy them over.
3296 if (mem.eql(u8, entry.name, "stage1.id") or
3297 mem.eql(u8, entry.name, "llvm-ar.id") or
3296 if (mem.eql(u8, entry.name, "llvm-ar.id") or
32983297 mem.eql(u8, entry.name, "libs.txt") or
32993298 mem.eql(u8, entry.name, "builtin.zig") or
33003299 mem.eql(u8, entry.name, "zld.id") or
......@@ -3607,7 +3606,7 @@ pub const Step = struct {
36073606 loop_flag: bool,
36083607 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
36123611 pub const Id = enum {
36133612 top_level,
lib/std/build/WriteFileStep.zig+3-3
......@@ -62,9 +62,9 @@ fn make(step: *Step) !void {
6262 // If, for example, a hard-coded path was used as the location to put WriteFileStep
6363 // 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 blake2b
66 // directly and construct the path, and no "cache hit" detection happens; the files
67 // are always written.
65 // TODO port the cache system from the compiler to zig std lib. Until then
66 // we use blake2b directly and construct the path, and no "cache hit"
67 // detection happens; the files are always written.
6868 var hash = std.crypto.hash.blake2.Blake2b384.init(.{});
6969
7070 // Random bytes to make WriteFileStep unique. Refresh this with
lib/std/builtin.zig+6-5
......@@ -698,8 +698,9 @@ pub const CompilerBackend = enum(u64) {
698698 /// in which case this value is appropriate. Be cool and make sure your
699699 /// code supports `other` Zig compilers!
700700 other = 0,
701 /// The original Zig compiler created in 2015 by Andrew Kelley.
702 /// Implemented in C++. Uses LLVM.
701 /// The original Zig compiler created in 2015 by Andrew Kelley. Implemented
702 /// in C++. Used LLVM. Deleted from the ZSF ziglang/zig codebase on
703 /// December 6th, 2022.
703704 stage1 = 1,
704705 /// The reference implementation self-hosted compiler of Zig, using the
705706 /// LLVM backend.
......@@ -738,7 +739,7 @@ pub const CompilerBackend = enum(u64) {
738739/// therefore must be kept in sync with the compiler implementation.
739740pub const TestFn = struct {
740741 name: []const u8,
741 func: std.meta.FnPtr(fn () anyerror!void),
742 func: *const fn () anyerror!void,
742743 async_frame_size: ?usize,
743744};
744745
......@@ -760,8 +761,8 @@ else
760761pub fn default_panic(msg: []const u8, error_return_trace: ?*StackTrace, ret_addr: ?usize) noreturn {
761762 @setCold(true);
762763
763 // Until self-hosted catches up with stage1 language features, we have a simpler
764 // default panic function:
764 // For backends that cannot handle the language features depended on by the
765 // default panic handler, we have a simpler panic handler:
765766 if (builtin.zig_backend == .stage2_c or
766767 builtin.zig_backend == .stage2_wasm or
767768 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;
241241pub extern "c" fn utimensat(dirfd: c.fd_t, pathname: [*:0]const u8, times: *[2]c.timespec, flags: u32) c_int;
242242pub 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);
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;
244pub extern "c" fn pthread_create(
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;
246250pub extern "c" fn pthread_attr_init(attr: *c.pthread_attr_t) c.E;
247251pub extern "c" fn pthread_attr_setstack(attr: *c.pthread_attr_t, stackaddr: *anyopaque, stacksize: usize) c.E;
248252pub 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;
251255pub extern "c" fn pthread_self() pthread_t;
252256pub extern "c" fn pthread_join(thread: pthread_t, arg_return: ?*?*anyopaque) c.E;
253257pub extern "c" fn pthread_detach(thread: pthread_t) c.E;
254const PThreadForkFn = std.meta.FnPtr(fn () callconv(.C) void);
255258pub extern "c" fn pthread_atfork(
256 prepare: ?PThreadForkFn,
257 parent: ?PThreadForkFn,
258 child: ?PThreadForkFn,
259 prepare: ?*const fn () callconv(.C) void,
260 parent: ?*const fn () callconv(.C) void,
261 child: ?*const fn () callconv(.C) void,
259262) c_int;
260const PThreadKeyCreateFn = std.meta.FnPtr(fn (value: *anyopaque) callconv(.C) void);
261pub extern "c" fn pthread_key_create(key: *c.pthread_key_t, destructor: ?PThreadKeyCreateFn) c.E;
263pub extern "c" fn pthread_key_create(
264 key: *c.pthread_key_t,
265 destructor: ?*const fn (value: *anyopaque) callconv(.C) void,
266) c.E;
262267pub extern "c" fn pthread_key_delete(key: c.pthread_key_t) c.E;
263268pub extern "c" fn pthread_getspecific(key: c.pthread_key_t) ?*anyopaque;
264269pub 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 {
918918
919919/// Renamed from `sigaction` to `Sigaction` to avoid conflict with function name.
920920pub const Sigaction = extern struct {
921 pub const handler_fn = std.meta.FnPtr(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);
921 pub const handler_fn = *const fn (c_int) align(1) callconv(.C) void;
922 pub const sigaction_fn = *const fn (c_int, *const siginfo_t, ?*const anyopaque) callconv(.C) void;
923923
924924 handler: extern union {
925925 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;
1313pub extern "c" fn getrandom(buf_ptr: [*]u8, buf_len: usize, flags: c_uint) isize;
1414pub 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;
1717pub extern "c" fn dl_iterate_phdr(callback: dl_iterate_phdr_callback, data: ?*anyopaque) c_int;
1818
1919pub extern "c" fn lwp_gettid() c_int;
......@@ -681,8 +681,8 @@ pub const empty_sigset = sigset_t{ .__bits = [_]c_uint{0} ** _SIG_WORDS };
681681pub const sig_atomic_t = c_int;
682682
683683pub const Sigaction = extern struct {
684 pub const handler_fn = std.meta.FnPtr(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);
684 pub const handler_fn = *const fn (c_int) align(1) callconv(.C) void;
685 pub const sigaction_fn = *const fn (c_int, *const siginfo_t, ?*const anyopaque) callconv(.C) void;
686686
687687 /// signal handler
688688 handler: extern union {
lib/std/c/freebsd.zig+3-3
......@@ -37,7 +37,7 @@ pub extern "c" fn sendfile(
3737 flags: u32,
3838) 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;
4141pub extern "c" fn dl_iterate_phdr(callback: dl_iterate_phdr_callback, data: ?*anyopaque) c_int;
4242
4343pub const pthread_mutex_t = extern struct {
......@@ -1197,8 +1197,8 @@ const NSIG = 32;
11971197
11981198/// Renamed from `sigaction` to `Sigaction` to avoid conflict with the syscall.
11991199pub const Sigaction = extern struct {
1200 pub const handler_fn = std.meta.FnPtr(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);
1200 pub const handler_fn = *const fn (c_int) align(1) callconv(.C) void;
1201 pub const sigaction_fn = *const fn (c_int, *const siginfo_t, ?*const anyopaque) callconv(.C) void;
12021202
12031203 /// signal handler
12041204 handler: extern union {
lib/std/c/haiku.zig+1-1
......@@ -742,7 +742,7 @@ const NSIG = 32;
742742
743743/// Renamed from `sigaction` to `Sigaction` to avoid conflict with the syscall.
744744pub 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
747747 /// signal handler
748748 __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;
263263/// See std.elf for constants for this
264264pub 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
268268pub 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;
99extern "c" fn __errno() *c_int;
1010pub 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;
1313pub extern "c" fn dl_iterate_phdr(callback: dl_iterate_phdr_callback, data: ?*anyopaque) c_int;
1414
1515pub extern "c" fn _lwp_self() lwpid_t;
......@@ -971,8 +971,8 @@ pub const SIG = struct {
971971
972972/// Renamed from `sigaction` to `Sigaction` to avoid conflict with the syscall.
973973pub const Sigaction = extern struct {
974 pub const handler_fn = std.meta.FnPtr(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);
974 pub const handler_fn = *const fn (c_int) align(1) callconv(.C) void;
975 pub const sigaction_fn = *const fn (c_int, *const siginfo_t, ?*const anyopaque) callconv(.C) void;
976976
977977 /// signal handler
978978 handler: extern union {
lib/std/c/openbsd.zig+3-3
......@@ -7,7 +7,7 @@ const iovec_const = std.os.iovec_const;
77extern "c" fn __errno() *c_int;
88pub 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;
1111pub extern "c" fn dl_iterate_phdr(callback: dl_iterate_phdr_callback, data: ?*anyopaque) c_int;
1212
1313pub extern "c" fn arc4random_buf(buf: [*]u8, len: usize) void;
......@@ -1026,8 +1026,8 @@ pub const SIG = struct {
10261026
10271027/// Renamed from `sigaction` to `Sigaction` to avoid conflict with the syscall.
10281028pub const Sigaction = extern struct {
1029 pub const handler_fn = std.meta.FnPtr(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);
1029 pub const handler_fn = *const fn (c_int) align(1) callconv(.C) void;
1030 pub const sigaction_fn = *const fn (c_int, *const siginfo_t, ?*const anyopaque) callconv(.C) void;
10311031
10321032 /// signal handler
10331033 handler: extern union {
lib/std/c/solaris.zig+3-3
......@@ -8,7 +8,7 @@ const timezone = std.c.timezone;
88extern "c" fn ___errno() *c_int;
99pub 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;
1212pub extern "c" fn dl_iterate_phdr(callback: dl_iterate_phdr_callback, data: ?*anyopaque) c_int;
1313
1414pub extern "c" fn getdents(fd: c_int, buf_ptr: [*]u8, nbytes: usize) usize;
......@@ -952,8 +952,8 @@ pub const SIG = struct {
952952
953953/// Renamed from `sigaction` to `Sigaction` to avoid conflict with the syscall.
954954pub const Sigaction = extern struct {
955 pub const handler_fn = std.meta.FnPtr(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);
955 pub const handler_fn = *const fn (c_int) align(1) callconv(.C) void;
956 pub const sigaction_fn = *const fn (c_int, *const siginfo_t, ?*const anyopaque) callconv(.C) void;
957957
958958 /// signal options
959959 flags: c_uint,
lib/std/compress/deflate/compressor.zig+1-1
......@@ -254,7 +254,7 @@ pub fn Compressor(comptime WriterType: anytype) type {
254254
255255 // Inner writer wrapped in a HuffmanBitWriter
256256 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
259259 sync: bool, // requesting flush
260260 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
133133 try expect(read == input.len);
134134 try expect(mem.eql(u8, input, decompressed));
135135
136 if (builtin.zig_backend == .stage1) {
136 if (false) {
137 // TODO: this test has regressed
137138 try testSync(level, input);
138139 }
139140}
lib/std/compress/deflate/decompressor.zig+1-7
......@@ -334,7 +334,7 @@ pub fn Decompressor(comptime ReaderType: type) type {
334334
335335 // Next step in the decompression,
336336 // and decompression state.
337 step: std.meta.FnPtr(fn (*Self) Error!void),
337 step: *const fn (*Self) Error!void,
338338 step_state: DecompressorState,
339339 final: bool,
340340 err: ?Error,
......@@ -479,12 +479,6 @@ pub fn Decompressor(comptime ReaderType: type) type {
479479 }
480480
481481 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 }
488482 if (self.err == @as(?Error, error.EndOfStreamWithNoError)) {
489483 return null;
490484 }
lib/std/dwarf.zig+1-1
......@@ -638,7 +638,7 @@ fn parseFormValue(allocator: mem.Allocator, in_stream: anytype, form_id: u64, en
638638 FORM.line_strp => FormValue{ .LineStrPtr = try readAddress(in_stream, endian, is_64) },
639639 FORM.indirect => {
640640 const child_form_id = try nosuspend leb.readULEB128(u64, in_stream);
641 if (builtin.zig_backend != .stage1) {
641 if (true) {
642642 return parseFormValue(allocator, in_stream, child_form_id, endian, is_64);
643643 }
644644 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(
109109}
110110
111111test "std.event.Batch" {
112 if (@import("builtin").zig_backend != .stage1) return error.SkipZigTest;
112 if (true) return error.SkipZigTest;
113113 var count: usize = 0;
114114 var batch = Batch(void, 2, .auto_async).init();
115115 batch.add(&async sleepALittle(&count));
lib/std/fmt.zig+1-39
......@@ -2209,7 +2209,7 @@ test "pointer" {
22092209 try expectFmt("pointer: i32@deadbeef\n", "pointer: {}\n", .{value});
22102210 try expectFmt("pointer: i32@deadbeef\n", "pointer: {*}\n", .{value});
22112211 }
2212 const FnPtr = if (builtin.zig_backend == .stage1) fn () void else *align(1) const fn () void;
2212 const FnPtr = *align(1) const fn () void;
22132213 {
22142214 const value = @intToPtr(FnPtr, 0xdeadbeef);
22152215 try expectFmt("pointer: fn() void@deadbeef\n", "pointer: {}\n", .{value});
......@@ -2266,10 +2266,6 @@ test "struct" {
22662266}
22672267
22682268test "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 }
22732269 const Enum = enum {
22742270 One,
22752271 Two,
......@@ -2285,10 +2281,6 @@ test "enum" {
22852281}
22862282
22872283test "non-exhaustive enum" {
2288 if (builtin.zig_backend == .stage1) {
2289 // stage1 fails to return fully qualified namespaces.
2290 return error.SkipZigTest;
2291 }
22922284 const Enum = enum(u16) {
22932285 One = 0x000f,
22942286 Two = 0xbeef,
......@@ -2462,10 +2454,6 @@ test "custom" {
24622454}
24632455
24642456test "struct" {
2465 if (builtin.zig_backend == .stage1) {
2466 // stage1 fails to return fully qualified namespaces.
2467 return error.SkipZigTest;
2468 }
24692457 const S = struct {
24702458 a: u32,
24712459 b: anyerror,
......@@ -2484,10 +2472,6 @@ test "struct" {
24842472}
24852473
24862474test "union" {
2487 if (builtin.zig_backend == .stage1) {
2488 // stage1 fails to return fully qualified namespaces.
2489 return error.SkipZigTest;
2490 }
24912475 const TU = union(enum) {
24922476 float: f32,
24932477 int: u32,
......@@ -2518,10 +2502,6 @@ test "union" {
25182502}
25192503
25202504test "enum" {
2521 if (builtin.zig_backend == .stage1) {
2522 // stage1 fails to return fully qualified namespaces.
2523 return error.SkipZigTest;
2524 }
25252505 const E = enum {
25262506 One,
25272507 Two,
......@@ -2534,10 +2514,6 @@ test "enum" {
25342514}
25352515
25362516test "struct.self-referential" {
2537 if (builtin.zig_backend == .stage1) {
2538 // stage1 fails to return fully qualified namespaces.
2539 return error.SkipZigTest;
2540 }
25412517 const S = struct {
25422518 const SelfType = @This();
25432519 a: ?*SelfType,
......@@ -2552,10 +2528,6 @@ test "struct.self-referential" {
25522528}
25532529
25542530test "struct.zero-size" {
2555 if (builtin.zig_backend == .stage1) {
2556 // stage1 fails to return fully qualified namespaces.
2557 return error.SkipZigTest;
2558 }
25592531 const A = struct {
25602532 fn foo() void {}
25612533 };
......@@ -2633,10 +2605,6 @@ test "formatFloatValue with comptime_float" {
26332605}
26342606
26352607test "formatType max_depth" {
2636 if (builtin.zig_backend == .stage1) {
2637 // stage1 fails to return fully qualified namespaces.
2638 return error.SkipZigTest;
2639 }
26402608 const Vec2 = struct {
26412609 const SelfType = @This();
26422610 x: f32,
......@@ -2724,12 +2692,6 @@ test "vector" {
27242692 return error.SkipZigTest;
27252693 }
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
27332695 const vbool: @Vector(4, bool) = [_]bool{ true, false, true, false };
27342696 const vi64: @Vector(4, i64) = [_]i64{ -2, -1, 0, 1 };
27352697 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" {
7070}
7171
7272test "fmt.parseFloat nan and inf" {
73 if ((builtin.zig_backend == .stage1 or builtin.zig_backend == .stage2_llvm) and
74 builtin.cpu.arch == .aarch64)
75 {
73 if (builtin.zig_backend == .stage2_llvm and builtin.cpu.arch == .aarch64) {
7674 // https://github.com/ziglang/zig/issues/12027
7775 return error.SkipZigTest;
7876 }
lib/std/json.zig+1-4
......@@ -2373,10 +2373,7 @@ pub fn stringifyAlloc(allocator: std.mem.Allocator, value: anytype, options: Str
23732373}
23742374
23752375test {
2376 if (builtin.zig_backend != .stage1) {
2377 // https://github.com/ziglang/zig/issues/8442
2378 _ = @import("json/test.zig");
2379 }
2376 _ = @import("json/test.zig");
23802377 _ = @import("json/write_stream.zig");
23812378}
23822379
lib/std/leb128.zig+2-6
......@@ -347,9 +347,7 @@ fn test_write_leb128(value: anytype) !void {
347347}
348348
349349test "serialize unsigned LEB128" {
350 if ((builtin.zig_backend == .stage1 or builtin.zig_backend == .stage2_llvm) and
351 builtin.cpu.arch == .riscv64)
352 {
350 if (builtin.zig_backend == .stage2_llvm and builtin.cpu.arch == .riscv64) {
353351 // https://github.com/ziglang/zig/issues/12031
354352 return error.SkipZigTest;
355353 }
......@@ -368,9 +366,7 @@ test "serialize unsigned LEB128" {
368366}
369367
370368test "serialize signed LEB128" {
371 if ((builtin.zig_backend == .stage1 or builtin.zig_backend == .stage2_llvm) and
372 builtin.cpu.arch == .riscv64)
373 {
369 if (builtin.zig_backend == .stage2_llvm and builtin.cpu.arch == .riscv64) {
374370 // https://github.com/ziglang/zig/issues/12031
375371 return error.SkipZigTest;
376372 }
lib/std/math.zig+5-13
......@@ -528,9 +528,7 @@ pub fn shl(comptime T: type, a: T, shift_amt: anytype) T {
528528}
529529
530530test "shl" {
531 if ((builtin.zig_backend == .stage1 or builtin.zig_backend == .stage2_llvm) and
532 builtin.cpu.arch == .aarch64)
533 {
531 if (builtin.zig_backend == .stage2_llvm and builtin.cpu.arch == .aarch64) {
534532 // https://github.com/ziglang/zig/issues/12012
535533 return error.SkipZigTest;
536534 }
......@@ -574,9 +572,7 @@ pub fn shr(comptime T: type, a: T, shift_amt: anytype) T {
574572}
575573
576574test "shr" {
577 if ((builtin.zig_backend == .stage1 or builtin.zig_backend == .stage2_llvm) and
578 builtin.cpu.arch == .aarch64)
579 {
575 if (builtin.zig_backend == .stage2_llvm and builtin.cpu.arch == .aarch64) {
580576 // https://github.com/ziglang/zig/issues/12012
581577 return error.SkipZigTest;
582578 }
......@@ -621,9 +617,7 @@ pub fn rotr(comptime T: type, x: T, r: anytype) T {
621617}
622618
623619test "rotr" {
624 if ((builtin.zig_backend == .stage1 or builtin.zig_backend == .stage2_llvm) and
625 builtin.cpu.arch == .aarch64)
626 {
620 if (builtin.zig_backend == .stage2_llvm and builtin.cpu.arch == .aarch64) {
627621 // https://github.com/ziglang/zig/issues/12012
628622 return error.SkipZigTest;
629623 }
......@@ -667,9 +661,7 @@ pub fn rotl(comptime T: type, x: T, r: anytype) T {
667661}
668662
669663test "rotl" {
670 if ((builtin.zig_backend == .stage1 or builtin.zig_backend == .stage2_llvm) and
671 builtin.cpu.arch == .aarch64)
672 {
664 if (builtin.zig_backend == .stage2_llvm and builtin.cpu.arch == .aarch64) {
673665 // https://github.com/ziglang/zig/issues/12012
674666 return error.SkipZigTest;
675667 }
......@@ -1695,7 +1687,7 @@ fn testSign() !void {
16951687}
16961688
16971689test "sign" {
1698 if (builtin.zig_backend == .stage1 or builtin.zig_backend == .stage2_llvm) {
1690 if (builtin.zig_backend == .stage2_llvm) {
16991691 // https://github.com/ziglang/zig/issues/12012
17001692 return error.SkipZigTest;
17011693 }
lib/std/mem.zig+1-7
......@@ -322,7 +322,7 @@ pub fn zeroes(comptime T: type) T {
322322}
323323
324324test "zeroes" {
325 if (builtin.zig_backend == .stage1 or builtin.zig_backend == .stage2_llvm) {
325 if (builtin.zig_backend == .stage2_llvm) {
326326 // Regressed in LLVM 14:
327327 // https://github.com/llvm/llvm-project/issues/55522
328328 return error.SkipZigTest;
......@@ -3187,8 +3187,6 @@ pub fn asBytes(ptr: anytype) AsBytesReturnType(@TypeOf(ptr)) {
31873187}
31883188
31893189test "asBytes" {
3190 if (builtin.zig_backend == .stage1) return error.SkipZigTest;
3191
31923190 const deadbeef = @as(u32, 0xDEADBEEF);
31933191 const deadbeef_bytes = switch (native_endian) {
31943192 .Big => "\xDE\xAD\xBE\xEF",
......@@ -3282,8 +3280,6 @@ pub fn bytesAsValue(comptime T: type, bytes: anytype) BytesAsValueReturnType(T,
32823280}
32833281
32843282test "bytesAsValue" {
3285 if (builtin.zig_backend == .stage1) return error.SkipZigTest;
3286
32873283 const deadbeef = @as(u32, 0xDEADBEEF);
32883284 const deadbeef_bytes = switch (native_endian) {
32893285 .Big => "\xDE\xAD\xBE\xEF",
......@@ -3485,8 +3481,6 @@ test "sliceAsBytes with sentinel slice" {
34853481}
34863482
34873483test "sliceAsBytes packed struct at runtime and comptime" {
3488 if (builtin.zig_backend == .stage1) return error.SkipZigTest;
3489
34903484 const Foo = packed struct {
34913485 a: u4,
34923486 b: u4,
lib/std/mem/Allocator.zig+3-3
......@@ -20,7 +20,7 @@ pub const VTable = struct {
2020 /// `ret_addr` is optionally provided as the first return address of the
2121 /// allocation call stack. If the value is `0` it means no return address
2222 /// 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
2525 /// Attempt to expand or shrink memory in place. `buf.len` must equal the
2626 /// length requested from the most recent successful call to `alloc` or
......@@ -37,7 +37,7 @@ pub const VTable = struct {
3737 /// `ret_addr` is optionally provided as the first return address of the
3838 /// allocation call stack. If the value is `0` it means no return address
3939 /// 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
4242 /// Free and invalidate a buffer.
4343 ///
......@@ -50,7 +50,7 @@ pub const VTable = struct {
5050 /// `ret_addr` is optionally provided as the first return address of the
5151 /// allocation call stack. If the value is `0` it means no return address
5252 /// 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,
5454};
5555
5656pub fn noResize(
lib/std/meta.zig+2-34
......@@ -361,11 +361,7 @@ pub fn assumeSentinel(p: anytype, comptime sentinel_val: Elem(@TypeOf(p))) Senti
361361 const ReturnType = Sentinel(T, sentinel_val);
362362 switch (@typeInfo(T)) {
363363 .Pointer => |info| switch (info.size) {
364 .Slice => if (@import("builtin").zig_backend == .stage1)
365 return @bitCast(ReturnType, p)
366 else
367 return @ptrCast(ReturnType, p),
368 .Many, .One => return @ptrCast(ReturnType, p),
364 .Slice, .Many, .One => return @ptrCast(ReturnType, p),
369365 .C => {},
370366 },
371367 .Optional => |info| switch (@typeInfo(info.child)) {
......@@ -658,8 +654,6 @@ pub fn FieldEnum(comptime T: type) type {
658654 const field_infos = fields(T);
659655
660656 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");
663657 return @Type(.{
664658 .Enum = .{
665659 .layout = .Auto,
......@@ -742,9 +736,7 @@ fn expectEqualEnum(expected: anytype, actual: @TypeOf(expected)) !void {
742736}
743737
744738test "std.meta.FieldEnum" {
745 if (comptime @import("builtin").zig_backend != .stage1) {
746 try expectEqualEnum(enum {}, FieldEnum(struct {}));
747 }
739 try expectEqualEnum(enum {}, FieldEnum(struct {}));
748740 try expectEqualEnum(enum { a }, FieldEnum(struct { a: u8 }));
749741 try expectEqualEnum(enum { a, b, c }, FieldEnum(struct { a: u8, b: void, c: f32 }));
750742 try expectEqualEnum(enum { a, b, c }, FieldEnum(union { a: u8, b: void, c: f32 }));
......@@ -1239,27 +1231,3 @@ test "isError" {
12391231 try std.testing.expect(isError(math.absInt(@as(i8, -128))));
12401232 try std.testing.expect(!isError(math.absInt(@as(i8, -127))));
12411233}
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 {
9090 };
9191 }
9292 const Sort = struct {
93 fn lessThan(trash: *i32, lhs: Data, rhs: Data) bool {
94 _ = trash;
93 fn lessThan(context: void, lhs: Data, rhs: Data) bool {
94 _ = context;
9595 return lhs.alignment > rhs.alignment;
9696 }
9797 };
98 var trash: i32 = undefined; // workaround for stage1 compiler bug
99 std.sort.sort(Data, &data, &trash, Sort.lessThan);
98 std.sort.sort(Data, &data, {}, Sort.lessThan);
10099 var sizes_bytes: [fields.len]usize = undefined;
101100 var field_indexes: [fields.len]usize = undefined;
102101 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 {
53605360/// if this happens the fix is to add the error code to the corresponding
53615361/// switch expression, possibly introduce a new error in the error set, and
53625362/// 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
53655365pub const UnexpectedError = error{
53665366 /// 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 {
936936 return syscall2(.flock, @bitCast(usize, @as(isize, fd)), @bitCast(usize, @as(isize, operation)));
937937}
938938
939var vdso_clock_gettime = if (builtin.zig_backend == .stage1)
940 @ptrCast(?*const anyopaque, init_vdso_clock_gettime)
941else
942 @ptrCast(?*const anyopaque, &init_vdso_clock_gettime);
939var vdso_clock_gettime = @ptrCast(?*const anyopaque, &init_vdso_clock_gettime);
943940
944941// We must follow the C calling convention when we call into the VDSO
945const vdso_clock_gettime_ty = if (builtin.zig_backend == .stage1)
946 fn (i32, *timespec) callconv(.C) usize
947else
948 *align(1) const fn (i32, *timespec) callconv(.C) usize;
942const vdso_clock_gettime_ty = *align(1) const fn (i32, *timespec) callconv(.C) usize;
949943
950944pub fn clock_gettime(clk_id: i32, tp: *timespec) usize {
951945 if (@hasDecl(VDSO, "CGT_SYM")) {
......@@ -1151,8 +1145,8 @@ pub fn sigaction(sig: u6, noalias act: ?*const Sigaction, noalias oact: ?*Sigact
11511145 const mask_size = @sizeOf(@TypeOf(ksa.mask));
11521146
11531147 if (act) |new| {
1154 const restore_rt_ptr = if (builtin.zig_backend == .stage1) restore_rt else &restore_rt;
1155 const restore_ptr = if (builtin.zig_backend == .stage1) restore else &restore;
1148 const restore_rt_ptr = &restore_rt;
1149 const restore_ptr = &restore;
11561150 const restorer_fn = if ((new.flags & SA.SIGINFO) != 0) restore_rt_ptr else restore_ptr;
11571151 ksa = k_sigaction{
11581152 .handler = new.handler.handler,
......@@ -3145,8 +3139,8 @@ pub const all_mask: sigset_t = [_]u32{0xffffffff} ** @typeInfo(sigset_t).Array.l
31453139pub const app_mask: sigset_t = [2]u32{ 0xfffffffc, 0x7fffffff } ++ [_]u32{0xffffffff} ** 30;
31463140
31473141const k_sigaction_funcs = struct {
3148 const handler = ?std.meta.FnPtr(fn (c_int) align(1) callconv(.C) void);
3149 const restorer = std.meta.FnPtr(fn () callconv(.C) void);
3142 const handler = ?*const fn (c_int) align(1) callconv(.C) void;
3143 const restorer = *const fn () callconv(.C) void;
31503144};
31513145
31523146pub const k_sigaction = switch (native_arch) {
......@@ -3172,8 +3166,8 @@ pub const k_sigaction = switch (native_arch) {
31723166
31733167/// Renamed from `sigaction` to `Sigaction` to avoid conflict with the syscall.
31743168pub const Sigaction = extern struct {
3175 pub const handler_fn = std.meta.FnPtr(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);
3169 pub const handler_fn = *const fn (c_int) align(1) callconv(.C) void;
3170 pub const sigaction_fn = *const fn (c_int, *const siginfo_t, ?*const anyopaque) callconv(.C) void;
31773171
31783172 handler: extern union {
31793173 handler: ?handler_fn,
......@@ -3181,7 +3175,7 @@ pub const Sigaction = extern struct {
31813175 },
31823176 mask: sigset_t,
31833177 flags: c_uint,
3184 restorer: ?std.meta.FnPtr(fn () callconv(.C) void) = null,
3178 restorer: ?*const fn () callconv(.C) void = null,
31853179};
31863180
31873181pub const empty_sigset = [_]u32{0} ** @typeInfo(sigset_t).Array.len;
......@@ -3314,25 +3308,12 @@ pub const epoll_data = extern union {
33143308 u64: u64,
33153309};
33163310
3317pub const epoll_event = switch (builtin.zig_backend) {
3318 // stage1 crashes with the align(4) field so we have this workaround
3319 .stage1 => switch (native_arch) {
3320 .x86_64 => packed struct {
3321 events: u32,
3322 data: epoll_data,
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 },
3311pub const epoll_event = extern struct {
3312 events: u32,
3313 data: epoll_data align(switch (native_arch) {
3314 .x86_64 => 4,
3315 else => @alignOf(epoll_data),
3316 }),
33363317};
33373318
33383319pub const VFS_CAP_REVISION_MASK = 0xFF000000;
lib/std/os/linux/arm-eabi.zig+1-1
......@@ -98,7 +98,7 @@ pub fn syscall6(
9898 );
9999}
100100
101const CloneFn = std.meta.FnPtr(fn (arg: usize) callconv(.C) u8);
101const CloneFn = *const fn (arg: usize) callconv(.C) u8;
102102
103103/// This matches the libc clone function.
104104pub 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(
9898 );
9999}
100100
101const CloneFn = std.meta.FnPtr(fn (arg: usize) callconv(.C) u8);
101const CloneFn = *const fn (arg: usize) callconv(.C) u8;
102102
103103/// This matches the libc clone function.
104104pub 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(
190190 );
191191}
192192
193const CloneFn = std.meta.FnPtr(fn (arg: usize) callconv(.C) u8);
193const CloneFn = *const fn (arg: usize) callconv(.C) u8;
194194
195195/// This matches the libc clone function.
196196pub 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(
126126 );
127127}
128128
129const CloneFn = std.meta.FnPtr(fn (arg: usize) callconv(.C) u8);
129const CloneFn = *const fn (arg: usize) callconv(.C) u8;
130130
131131/// This matches the libc clone function.
132132pub 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(
126126 );
127127}
128128
129const CloneFn = std.meta.FnPtr(fn (arg: usize) callconv(.C) u8);
129const CloneFn = *const fn (arg: usize) callconv(.C) u8;
130130
131131/// This matches the libc clone function.
132132pub 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(
9595 );
9696}
9797
98const CloneFn = std.meta.FnPtr(fn (arg: usize) callconv(.C) u8);
98const CloneFn = *const fn (arg: usize) callconv(.C) u8;
9999
100100pub 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(
178178 );
179179}
180180
181const CloneFn = std.meta.FnPtr(fn (arg: usize) callconv(.C) u8);
181const CloneFn = *const fn (arg: usize) callconv(.C) u8;
182182
183183/// This matches the libc clone function.
184184pub 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 {
118118 );
119119}
120120
121const CloneFn = std.meta.FnPtr(fn (arg: usize) callconv(.C) u8);
121const CloneFn = *const fn (arg: usize) callconv(.C) u8;
122122
123123/// This matches the libc clone function.
124124pub 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(
100100 );
101101}
102102
103const CloneFn = std.meta.FnPtr(fn (arg: usize) callconv(.C) u8);
103const CloneFn = *const fn (arg: usize) callconv(.C) u8;
104104
105105/// This matches the libc clone function.
106106pub 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" {
785785 }
786786 };
787787
788 const actual_handler = if (builtin.zig_backend == .stage1) S.handler else &S.handler;
789
790788 var sa = os.Sigaction{
791 .handler = .{ .sigaction = actual_handler },
789 .handler = .{ .sigaction = &S.handler },
792790 .mask = os.empty_sigset,
793791 .flags = os.SA.SIGINFO | os.SA.RESETHAND,
794792 };
......@@ -799,7 +797,7 @@ test "sigaction" {
799797
800798 // Check that we can read it back correctly.
801799 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.?);
803801 try testing.expect((old_sa.flags & os.SA.SIGINFO) != 0);
804802
805803 // Invoke the handler.
lib/std/os/uefi/protocols/absolute_pointer_protocol.zig+2-2
......@@ -6,8 +6,8 @@ const Status = uefi.Status;
66
77/// Protocol for touchscreens
88pub const AbsolutePointerProtocol = extern struct {
9 _reset: std.meta.FnPtr(fn (*const AbsolutePointerProtocol, bool) callconv(.C) Status),
10 _get_state: std.meta.FnPtr(fn (*const AbsolutePointerProtocol, *AbsolutePointerState) callconv(.C) Status),
9 _reset: *const fn (*const AbsolutePointerProtocol, bool) callconv(.C) Status,
10 _get_state: *const fn (*const AbsolutePointerProtocol, *AbsolutePointerState) callconv(.C) Status,
1111 wait_for_input: Event,
1212 mode: *AbsolutePointerMode,
1313
lib/std/os/uefi/protocols/block_io_protocol.zig+4-4
......@@ -44,10 +44,10 @@ pub const BlockIoProtocol = extern struct {
4444 revision: u64,
4545 media: *EfiBlockMedia,
4646
47 _reset: std.meta.FnPtr(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),
49 _write_blocks: std.meta.FnPtr(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),
47 _reset: *const fn (*BlockIoProtocol, extended_verification: bool) 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: *const fn (*BlockIoProtocol, media_id: u32, lba: u64, buffer_size: usize, buf: [*]u8) callconv(.C) Status,
50 _flush_blocks: *const fn (*BlockIoProtocol) callconv(.C) Status,
5151
5252 /// Resets the block device hardware.
5353 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;
66
77/// Override EDID information
88pub 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
1111 /// Returns policy information and potentially a replacement EDID for the specified video output device.
1212 pub fn getEdid(
lib/std/os/uefi/protocols/file_protocol.zig+10-10
......@@ -7,16 +7,16 @@ const Status = uefi.Status;
77
88pub const FileProtocol = extern struct {
99 revision: u64,
10 _open: std.meta.FnPtr(fn (*const FileProtocol, **const FileProtocol, [*:0]const u16, u64, u64) callconv(.C) Status),
11 _close: std.meta.FnPtr(fn (*const FileProtocol) callconv(.C) Status),
12 _delete: std.meta.FnPtr(fn (*const FileProtocol) callconv(.C) Status),
13 _read: std.meta.FnPtr(fn (*const FileProtocol, *usize, [*]u8) callconv(.C) Status),
14 _write: std.meta.FnPtr(fn (*const FileProtocol, *usize, [*]const u8) callconv(.C) Status),
15 _get_position: std.meta.FnPtr(fn (*const FileProtocol, *u64) callconv(.C) Status),
16 _set_position: std.meta.FnPtr(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),
18 _set_info: std.meta.FnPtr(fn (*const FileProtocol, *align(8) const Guid, usize, [*]const u8) callconv(.C) Status),
19 _flush: std.meta.FnPtr(fn (*const FileProtocol) callconv(.C) Status),
10 _open: *const fn (*const FileProtocol, **const FileProtocol, [*:0]const u16, u64, u64) callconv(.C) Status,
11 _close: *const fn (*const FileProtocol) callconv(.C) Status,
12 _delete: *const fn (*const FileProtocol) callconv(.C) Status,
13 _read: *const fn (*const FileProtocol, *usize, [*]u8) callconv(.C) Status,
14 _write: *const fn (*const FileProtocol, *usize, [*]const u8) callconv(.C) Status,
15 _get_position: *const fn (*const FileProtocol, *u64) callconv(.C) Status,
16 _set_position: *const fn (*const FileProtocol, u64) callconv(.C) Status,
17 _get_info: *const fn (*const FileProtocol, *align(8) const Guid, *const usize, [*]u8) callconv(.C) Status,
18 _set_info: *const fn (*const FileProtocol, *align(8) const Guid, usize, [*]const u8) callconv(.C) Status,
19 _flush: *const fn (*const FileProtocol) callconv(.C) Status,
2020
2121 pub const SeekError = error{SeekError};
2222 pub const GetSeekPosError = error{GetSeekPosError};
lib/std/os/uefi/protocols/graphics_output_protocol.zig+3-3
......@@ -5,9 +5,9 @@ const Status = uefi.Status;
55
66/// Graphics output
77pub const GraphicsOutputProtocol = extern struct {
8 _query_mode: std.meta.FnPtr(fn (*const GraphicsOutputProtocol, u32, *usize, **GraphicsOutputModeInformation) callconv(.C) Status),
9 _set_mode: std.meta.FnPtr(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),
8 _query_mode: *const fn (*const GraphicsOutputProtocol, u32, *usize, **GraphicsOutputModeInformation) callconv(.C) Status,
9 _set_mode: *const fn (*const GraphicsOutputProtocol, u32) callconv(.C) Status,
10 _blt: *const fn (*const GraphicsOutputProtocol, ?[*]GraphicsOutputBltPixel, GraphicsOutputBltOperation, usize, usize, usize, usize, usize, usize, usize) callconv(.C) Status,
1111 mode: *GraphicsOutputProtocolMode,
1212
1313 /// 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;
77/// Database manager for HII-related data structures.
88pub const HIIDatabaseProtocol = extern struct {
99 _new_package_list: Status, // TODO
10 _remove_package_list: std.meta.FnPtr(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),
12 _list_package_lists: std.meta.FnPtr(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),
10 _remove_package_list: *const fn (*const HIIDatabaseProtocol, hii.HIIHandle) callconv(.C) Status,
11 _update_package_list: *const fn (*const HIIDatabaseProtocol, hii.HIIHandle, *const hii.HIIPackageList) callconv(.C) Status,
12 _list_package_lists: *const fn (*const HIIDatabaseProtocol, u8, ?*const Guid, *usize, [*]hii.HIIHandle) callconv(.C) Status,
13 _export_package_lists: *const fn (*const HIIDatabaseProtocol, ?hii.HIIHandle, *usize, *hii.HIIPackageList) callconv(.C) Status,
1414 _register_package_notify: Status, // TODO
1515 _unregister_package_notify: Status, // TODO
1616 _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;
77/// Display a popup window
88pub const HIIPopupProtocol = extern struct {
99 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
1212 /// Displays a popup window.
1313 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;
55const Status = uefi.Status;
66
77pub const Ip6ConfigProtocol = extern struct {
8 _set_data: std.meta.FnPtr(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),
10 _register_data_notify: std.meta.FnPtr(fn (*const Ip6ConfigProtocol, Ip6ConfigDataType, Event) callconv(.C) Status),
11 _unregister_data_notify: std.meta.FnPtr(fn (*const Ip6ConfigProtocol, Ip6ConfigDataType, Event) callconv(.C) Status),
8 _set_data: *const 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: *const fn (*const Ip6ConfigProtocol, Ip6ConfigDataType, Event) callconv(.C) Status,
11 _unregister_data_notify: *const fn (*const Ip6ConfigProtocol, Ip6ConfigDataType, Event) callconv(.C) Status,
1212
1313 pub fn setData(self: *const Ip6ConfigProtocol, data_type: Ip6ConfigDataType, data_size: usize, data: *const anyopaque) Status {
1414 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;
88const SimpleNetworkMode = uefi.protocols.SimpleNetworkMode;
99
1010pub const Ip6Protocol = extern struct {
11 _get_mode_data: std.meta.FnPtr(fn (*const Ip6Protocol, ?*Ip6ModeData, ?*ManagedNetworkConfigData, ?*SimpleNetworkMode) callconv(.C) Status),
12 _configure: std.meta.FnPtr(fn (*const Ip6Protocol, ?*const Ip6ConfigData) callconv(.C) Status),
13 _groups: std.meta.FnPtr(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),
15 _neighbors: std.meta.FnPtr(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),
17 _receive: std.meta.FnPtr(fn (*const Ip6Protocol, *Ip6CompletionToken) callconv(.C) Status),
18 _cancel: std.meta.FnPtr(fn (*const Ip6Protocol, ?*Ip6CompletionToken) callconv(.C) Status),
19 _poll: std.meta.FnPtr(fn (*const Ip6Protocol) callconv(.C) Status),
11 _get_mode_data: *const fn (*const Ip6Protocol, ?*Ip6ModeData, ?*ManagedNetworkConfigData, ?*SimpleNetworkMode) callconv(.C) Status,
12 _configure: *const fn (*const Ip6Protocol, ?*const Ip6ConfigData) callconv(.C) Status,
13 _groups: *const fn (*const Ip6Protocol, bool, ?*const Ip6Address) callconv(.C) Status,
14 _routes: *const fn (*const Ip6Protocol, bool, ?*const Ip6Address, u8, ?*const Ip6Address) callconv(.C) Status,
15 _neighbors: *const fn (*const Ip6Protocol, bool, *const Ip6Address, ?*const MacAddress, u32, bool) callconv(.C) Status,
16 _transmit: *const fn (*const Ip6Protocol, *Ip6CompletionToken) callconv(.C) Status,
17 _receive: *const fn (*const Ip6Protocol, *Ip6CompletionToken) callconv(.C) Status,
18 _cancel: *const fn (*const Ip6Protocol, ?*Ip6CompletionToken) callconv(.C) Status,
19 _poll: *const fn (*const Ip6Protocol) callconv(.C) Status,
2020
2121 /// Gets the current operational settings for this instance of the EFI IPv6 Protocol driver.
2222 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;
55const Status = uefi.Status;
66
77pub const Ip6ServiceBindingProtocol = extern struct {
8 _create_child: std.meta.FnPtr(fn (*const Ip6ServiceBindingProtocol, *?Handle) callconv(.C) Status),
9 _destroy_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: *const fn (*const Ip6ServiceBindingProtocol, Handle) callconv(.C) Status,
1010
1111 pub fn createChild(self: *const Ip6ServiceBindingProtocol, handle: *?Handle) Status {
1212 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 {
2020 image_size: u64,
2121 image_code_type: MemoryType,
2222 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
2525 /// Unloads an image from memory.
2626 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;
88const MacAddress = uefi.protocols.MacAddress;
99
1010pub const ManagedNetworkProtocol = extern struct {
11 _get_mode_data: std.meta.FnPtr(fn (*const ManagedNetworkProtocol, ?*ManagedNetworkConfigData, ?*SimpleNetworkMode) callconv(.C) Status),
12 _configure: std.meta.FnPtr(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),
14 _groups: std.meta.FnPtr(fn (*const ManagedNetworkProtocol, bool, ?*const MacAddress) callconv(.C) Status),
15 _transmit: std.meta.FnPtr(fn (*const ManagedNetworkProtocol, *const ManagedNetworkCompletionToken) callconv(.C) Status),
16 _receive: std.meta.FnPtr(fn (*const ManagedNetworkProtocol, *const ManagedNetworkCompletionToken) callconv(.C) Status),
17 _cancel: std.meta.FnPtr(fn (*const ManagedNetworkProtocol, ?*const ManagedNetworkCompletionToken) callconv(.C) Status),
18 _poll: std.meta.FnPtr(fn (*const ManagedNetworkProtocol) callconv(.C) Status),
11 _get_mode_data: *const fn (*const ManagedNetworkProtocol, ?*ManagedNetworkConfigData, ?*SimpleNetworkMode) callconv(.C) Status,
12 _configure: *const fn (*const ManagedNetworkProtocol, ?*const ManagedNetworkConfigData) callconv(.C) Status,
13 _mcast_ip_to_mac: *const fn (*const ManagedNetworkProtocol, bool, *const anyopaque, *MacAddress) callconv(.C) Status,
14 _groups: *const fn (*const ManagedNetworkProtocol, bool, ?*const MacAddress) callconv(.C) Status,
15 _transmit: *const fn (*const ManagedNetworkProtocol, *const ManagedNetworkCompletionToken) callconv(.C) Status,
16 _receive: *const fn (*const ManagedNetworkProtocol, *const ManagedNetworkCompletionToken) callconv(.C) Status,
17 _cancel: *const fn (*const ManagedNetworkProtocol, ?*const ManagedNetworkCompletionToken) callconv(.C) Status,
18 _poll: *const fn (*const ManagedNetworkProtocol) callconv(.C) Status,
1919
2020 /// Returns the operational parameters for the current MNP child driver.
2121 /// 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;
55const Status = uefi.Status;
66
77pub const ManagedNetworkServiceBindingProtocol = extern struct {
8 _create_child: std.meta.FnPtr(fn (*const ManagedNetworkServiceBindingProtocol, *?Handle) callconv(.C) Status),
9 _destroy_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: *const fn (*const ManagedNetworkServiceBindingProtocol, Handle) callconv(.C) Status,
1010
1111 pub fn createChild(self: *const ManagedNetworkServiceBindingProtocol, handle: *?Handle) Status {
1212 return self._create_child(self, handle);
lib/std/os/uefi/protocols/rng_protocol.zig+2-2
......@@ -5,8 +5,8 @@ const Status = uefi.Status;
55
66/// Random Number Generator protocol
77pub const RNGProtocol = extern struct {
8 _get_info: std.meta.FnPtr(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),
8 _get_info: *const fn (*const RNGProtocol, *usize, [*]align(8) Guid) callconv(.C) Status,
9 _get_rng: *const fn (*const RNGProtocol, ?*align(8) const Guid, usize, [*]u8) callconv(.C) Status,
1010
1111 /// Returns information about the random number generation implementation.
1212 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;
66
77pub const SimpleFileSystemProtocol = extern struct {
88 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
1111 pub fn openVolume(self: *const SimpleFileSystemProtocol, root: **const FileProtocol) Status {
1212 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;
66
77pub const SimpleNetworkProtocol = extern struct {
88 revision: u64,
9 _start: std.meta.FnPtr(fn (*const SimpleNetworkProtocol) callconv(.C) Status),
10 _stop: std.meta.FnPtr(fn (*const SimpleNetworkProtocol) callconv(.C) Status),
11 _initialize: std.meta.FnPtr(fn (*const SimpleNetworkProtocol, usize, usize) callconv(.C) Status),
12 _reset: std.meta.FnPtr(fn (*const SimpleNetworkProtocol, bool) callconv(.C) Status),
13 _shutdown: std.meta.FnPtr(fn (*const SimpleNetworkProtocol) callconv(.C) Status),
14 _receive_filters: std.meta.FnPtr(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),
16 _statistics: std.meta.FnPtr(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),
18 _nvdata: std.meta.FnPtr(fn (*const SimpleNetworkProtocol, bool, usize, usize, [*]u8) callconv(.C) Status),
19 _get_status: std.meta.FnPtr(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),
21 _receive: std.meta.FnPtr(fn (*const SimpleNetworkProtocol, ?*usize, *usize, [*]u8, ?*MacAddress, ?*MacAddress, ?*u16) callconv(.C) Status),
9 _start: *const fn (*const SimpleNetworkProtocol) callconv(.C) Status,
10 _stop: *const fn (*const SimpleNetworkProtocol) callconv(.C) Status,
11 _initialize: *const fn (*const SimpleNetworkProtocol, usize, usize) callconv(.C) Status,
12 _reset: *const fn (*const SimpleNetworkProtocol, bool) callconv(.C) Status,
13 _shutdown: *const fn (*const SimpleNetworkProtocol) callconv(.C) Status,
14 _receive_filters: *const fn (*const SimpleNetworkProtocol, SimpleNetworkReceiveFilter, SimpleNetworkReceiveFilter, bool, usize, ?[*]const MacAddress) callconv(.C) Status,
15 _station_address: *const fn (*const SimpleNetworkProtocol, bool, ?*const MacAddress) callconv(.C) Status,
16 _statistics: *const fn (*const SimpleNetworkProtocol, bool, ?*usize, ?*NetworkStatistics) callconv(.C) Status,
17 _mcast_ip_to_mac: *const fn (*const SimpleNetworkProtocol, bool, *const anyopaque, *MacAddress) callconv(.C) Status,
18 _nvdata: *const fn (*const SimpleNetworkProtocol, bool, usize, usize, [*]u8) callconv(.C) Status,
19 _get_status: *const fn (*const SimpleNetworkProtocol, *SimpleNetworkInterruptStatus, ?*?[*]u8) callconv(.C) Status,
20 _transmit: *const fn (*const SimpleNetworkProtocol, usize, usize, [*]const u8, ?*const MacAddress, ?*const MacAddress, ?*const u16) callconv(.C) Status,
21 _receive: *const fn (*const SimpleNetworkProtocol, ?*usize, *usize, [*]u8, ?*MacAddress, ?*MacAddress, ?*u16) callconv(.C) Status,
2222 wait_for_packet: Event,
2323 mode: *SimpleNetworkMode,
2424
lib/std/os/uefi/protocols/simple_pointer_protocol.zig+2-2
......@@ -6,8 +6,8 @@ const Status = uefi.Status;
66
77/// Protocol for mice
88pub const SimplePointerProtocol = struct {
9 _reset: std.meta.FnPtr(fn (*const SimplePointerProtocol, bool) callconv(.C) Status),
10 _get_state: std.meta.FnPtr(fn (*const SimplePointerProtocol, *SimplePointerState) callconv(.C) Status),
9 _reset: *const fn (*const SimplePointerProtocol, bool) callconv(.C) Status,
10 _get_state: *const fn (*const SimplePointerProtocol, *SimplePointerState) callconv(.C) Status,
1111 wait_for_input: Event,
1212 mode: *SimplePointerMode,
1313
lib/std/os/uefi/protocols/simple_text_input_ex_protocol.zig+6-6
......@@ -6,12 +6,12 @@ const Status = uefi.Status;
66
77/// Character input devices, e.g. Keyboard
88pub const SimpleTextInputExProtocol = extern struct {
9 _reset: std.meta.FnPtr(fn (*const SimpleTextInputExProtocol, bool) callconv(.C) Status),
10 _read_key_stroke_ex: std.meta.FnPtr(fn (*const SimpleTextInputExProtocol, *KeyData) callconv(.C) Status),
9 _reset: *const fn (*const SimpleTextInputExProtocol, bool) callconv(.C) Status,
10 _read_key_stroke_ex: *const fn (*const SimpleTextInputExProtocol, *KeyData) callconv(.C) Status,
1111 wait_for_key_ex: Event,
12 _set_state: std.meta.FnPtr(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),
14 _unregister_key_notify: std.meta.FnPtr(fn (*const SimpleTextInputExProtocol, *const anyopaque) callconv(.C) Status),
12 _set_state: *const fn (*const SimpleTextInputExProtocol, *const u8) 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: *const fn (*const SimpleTextInputExProtocol, *const anyopaque) callconv(.C) Status,
1515
1616 /// Resets the input device hardware.
1717 pub fn reset(self: *const SimpleTextInputExProtocol, verify: bool) Status {
......@@ -29,7 +29,7 @@ pub const SimpleTextInputExProtocol = extern struct {
2929 }
3030
3131 /// 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 {
3333 return self._register_key_notify(self, key_data, notify, handle);
3434 }
3535
lib/std/os/uefi/protocols/simple_text_input_protocol.zig+2-2
......@@ -7,8 +7,8 @@ const Status = uefi.Status;
77
88/// Character input devices, e.g. Keyboard
99pub const SimpleTextInputProtocol = extern struct {
10 _reset: std.meta.FnPtr(fn (*const SimpleTextInputProtocol, bool) callconv(.C) Status),
11 _read_key_stroke: std.meta.FnPtr(fn (*const SimpleTextInputProtocol, *InputKey) callconv(.C) Status),
10 _reset: *const fn (*const SimpleTextInputProtocol, bool) callconv(.C) Status,
11 _read_key_stroke: *const fn (*const SimpleTextInputProtocol, *InputKey) callconv(.C) Status,
1212 wait_for_key: Event,
1313
1414 /// 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;
55
66/// Character output devices
77pub const SimpleTextOutputProtocol = extern struct {
8 _reset: std.meta.FnPtr(fn (*const SimpleTextOutputProtocol, bool) callconv(.C) Status),
9 _output_string: std.meta.FnPtr(fn (*const SimpleTextOutputProtocol, [*:0]const u16) callconv(.C) Status),
10 _test_string: std.meta.FnPtr(fn (*const SimpleTextOutputProtocol, [*:0]const u16) callconv(.C) Status),
11 _query_mode: std.meta.FnPtr(fn (*const SimpleTextOutputProtocol, usize, *usize, *usize) callconv(.C) Status),
12 _set_mode: std.meta.FnPtr(fn (*const SimpleTextOutputProtocol, usize) callconv(.C) Status),
13 _set_attribute: std.meta.FnPtr(fn (*const SimpleTextOutputProtocol, usize) callconv(.C) Status),
14 _clear_screen: std.meta.FnPtr(fn (*const SimpleTextOutputProtocol) callconv(.C) Status),
15 _set_cursor_position: std.meta.FnPtr(fn (*const SimpleTextOutputProtocol, usize, usize) callconv(.C) Status),
16 _enable_cursor: std.meta.FnPtr(fn (*const SimpleTextOutputProtocol, bool) callconv(.C) Status),
8 _reset: *const fn (*const SimpleTextOutputProtocol, bool) callconv(.C) Status,
9 _output_string: *const 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: *const fn (*const SimpleTextOutputProtocol, usize, *usize, *usize) callconv(.C) Status,
12 _set_mode: *const fn (*const SimpleTextOutputProtocol, usize) callconv(.C) Status,
13 _set_attribute: *const fn (*const SimpleTextOutputProtocol, usize) callconv(.C) Status,
14 _clear_screen: *const fn (*const SimpleTextOutputProtocol) callconv(.C) Status,
15 _set_cursor_position: *const fn (*const SimpleTextOutputProtocol, usize, usize) callconv(.C) Status,
16 _enable_cursor: *const fn (*const SimpleTextOutputProtocol, bool) callconv(.C) Status,
1717 mode: *SimpleTextOutputMode,
1818
1919 /// 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;
1010const SimpleNetworkMode = uefi.protocols.SimpleNetworkMode;
1111
1212pub const Udp6Protocol = extern struct {
13 _get_mode_data: std.meta.FnPtr(fn (*const Udp6Protocol, ?*Udp6ConfigData, ?*Ip6ModeData, ?*ManagedNetworkConfigData, ?*SimpleNetworkMode) callconv(.C) Status),
14 _configure: std.meta.FnPtr(fn (*const Udp6Protocol, ?*const Udp6ConfigData) callconv(.C) Status),
15 _groups: std.meta.FnPtr(fn (*const Udp6Protocol, bool, ?*const Ip6Address) callconv(.C) Status),
16 _transmit: std.meta.FnPtr(fn (*const Udp6Protocol, *Udp6CompletionToken) callconv(.C) Status),
17 _receive: std.meta.FnPtr(fn (*const Udp6Protocol, *Udp6CompletionToken) callconv(.C) Status),
18 _cancel: std.meta.FnPtr(fn (*const Udp6Protocol, ?*Udp6CompletionToken) callconv(.C) Status),
19 _poll: std.meta.FnPtr(fn (*const Udp6Protocol) callconv(.C) Status),
13 _get_mode_data: *const fn (*const Udp6Protocol, ?*Udp6ConfigData, ?*Ip6ModeData, ?*ManagedNetworkConfigData, ?*SimpleNetworkMode) callconv(.C) Status,
14 _configure: *const fn (*const Udp6Protocol, ?*const Udp6ConfigData) callconv(.C) Status,
15 _groups: *const fn (*const Udp6Protocol, bool, ?*const Ip6Address) callconv(.C) Status,
16 _transmit: *const fn (*const Udp6Protocol, *Udp6CompletionToken) callconv(.C) Status,
17 _receive: *const fn (*const Udp6Protocol, *Udp6CompletionToken) callconv(.C) Status,
18 _cancel: *const fn (*const Udp6Protocol, ?*Udp6CompletionToken) callconv(.C) Status,
19 _poll: *const fn (*const Udp6Protocol) callconv(.C) Status,
2020
2121 pub fn getModeData(self: *const Udp6Protocol, udp6_config_data: ?*Udp6ConfigData, ip6_mode_data: ?*Ip6ModeData, mnp_config_data: ?*ManagedNetworkConfigData, snp_mode_data: ?*SimpleNetworkMode) Status {
2222 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;
55const Status = uefi.Status;
66
77pub const Udp6ServiceBindingProtocol = extern struct {
8 _create_child: std.meta.FnPtr(fn (*const Udp6ServiceBindingProtocol, *?Handle) callconv(.C) Status),
9 _destroy_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: *const fn (*const Udp6ServiceBindingProtocol, Handle) callconv(.C) Status,
1010
1111 pub fn createChild(self: *const Udp6ServiceBindingProtocol, handle: *?Handle) Status {
1212 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 {
2222 hdr: TableHeader,
2323
2424 /// 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
2727 /// 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
3030 /// 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
3333 /// 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
3636 /// 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
3939 /// 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
4242 /// 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
4545 /// 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
4848 /// 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
5151 /// 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
5454 /// Signals an event.
55 signalEvent: std.meta.FnPtr(fn (event: Event) callconv(.C) Status),
55 signalEvent: *const fn (event: Event) callconv(.C) Status,
5656
5757 /// Closes an event.
58 closeEvent: std.meta.FnPtr(fn (event: Event) callconv(.C) Status),
58 closeEvent: *const fn (event: Event) callconv(.C) Status,
5959
6060 /// 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
6363 /// Installs a protocol interface on a device handle. If the handle does not exist, it is created
6464 /// and added to the list of handles in the system. installMultipleProtocolInterfaces()
6565 /// 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
6868 /// 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
7171 /// Removes a protocol interface from a device handle. Usage of
7272 /// 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
7575 /// 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
7878 reserved: *anyopaque,
7979
8080 /// 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
8383 /// 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
8686 /// 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
8989 /// 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
9292 /// 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
9595 /// 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
9898 /// 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
101101 /// 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
104104 /// 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
107107 /// 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
110110 /// 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
113113 /// 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
116116 /// 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
119119 // 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
122122 /// 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
125125 /// 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
128128 /// 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
131131 /// 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
134134 /// 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
137137 /// 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
140140 /// 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
143143 /// 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
146146 /// 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
149149 /// 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
152152 /// 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
155155 /// 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
158158 /// Opens a protocol with a structure as the loaded image for a UEFI application
159159 pub fn openProtocolSt(self: *BootServices, comptime protocol: type, handle: Handle) !*protocol {
......@@ -191,7 +191,7 @@ pub const BootServices = extern struct {
191191 pub const tpl_high_level: usize = 31;
192192};
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
196196pub const TimerDelay = enum(u32) {
197197 TimerCancel,
lib/std/os/uefi/tables/runtime_services.zig+14-14
......@@ -19,50 +19,50 @@ pub const RuntimeServices = extern struct {
1919 hdr: TableHeader,
2020
2121 /// 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
2424 /// 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
2727 /// 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
3030 /// 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
3333 /// 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
3636 /// 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
3939 /// 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
4242 /// 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
4545 /// 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
4848 /// 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
5151 /// 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
5454 /// Passes capsules to the firmware with both virtual and physical mapping.
5555 /// Depending on the intended consumption, the firmware may process the capsule immediately.
5656 /// If the payload should persist across a system reset, the reset value returned from
5757 /// `queryCapsuleCapabilities` must be passed into resetSystem and will cause the capsule
5858 /// 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
6161 /// 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
6464 /// 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
6767 pub const signature: u64 = 0x56524553544e5552;
6868};
lib/std/os/windows.zig+12-12
......@@ -2696,7 +2696,7 @@ pub const MEM_RESERVE_PLACEHOLDERS = 0x2;
26962696pub const MEM_DECOMMIT = 0x4000;
26972697pub 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;
27002700pub const LPTHREAD_START_ROUTINE = PTHREAD_START_ROUTINE;
27012701
27022702pub const WIN32_FIND_DATAW = extern struct {
......@@ -2869,7 +2869,7 @@ pub const IMAGE_TLS_DIRECTORY = extern struct {
28692869pub const IMAGE_TLS_DIRECTORY64 = IMAGE_TLS_DIRECTORY;
28702870pub 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
28742874pub const PROV_RSA_FULL = 1;
28752875
......@@ -2922,14 +2922,14 @@ pub const RTL_QUERY_REGISTRY_TABLE = extern struct {
29222922 DefaultLength: ULONG,
29232923};
29242924
2925pub const RTL_QUERY_REGISTRY_ROUTINE = ?std.meta.FnPtr(fn (
2925pub const RTL_QUERY_REGISTRY_ROUTINE = ?*const fn (
29262926 PWSTR,
29272927 ULONG,
29282928 ?*anyopaque,
29292929 ULONG,
29302930 ?*anyopaque,
29312931 ?*anyopaque,
2932) callconv(WINAPI) NTSTATUS);
2932) callconv(WINAPI) NTSTATUS;
29332933
29342934/// Path is a full path
29352935pub const RTL_REGISTRY_ABSOLUTE = 0;
......@@ -3026,7 +3026,7 @@ pub const FILE_ACTION_MODIFIED = 0x00000003;
30263026pub const FILE_ACTION_RENAMED_OLD_NAME = 0x00000004;
30273027pub 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
30313031pub const FILE_NOTIFY_CHANGE_CREATION = 64;
30323032pub const FILE_NOTIFY_CHANGE_SIZE = 8;
......@@ -3079,7 +3079,7 @@ pub const RTL_CRITICAL_SECTION = extern struct {
30793079pub const CRITICAL_SECTION = RTL_CRITICAL_SECTION;
30803080pub const INIT_ONCE = RTL_RUN_ONCE;
30813081pub 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
30843084pub const RTL_RUN_ONCE = extern struct {
30853085 Ptr: ?*anyopaque,
......@@ -3382,7 +3382,7 @@ pub const EXCEPTION_POINTERS = extern struct {
33823382 ContextRecord: *std.os.windows.CONTEXT,
33833383};
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
33873387pub const OBJECT_ATTRIBUTES = extern struct {
33883388 Length: ULONG,
......@@ -3658,7 +3658,7 @@ pub const RTL_DRIVE_LETTER_CURDIR = extern struct {
36583658 DosPath: UNICODE_STRING,
36593659};
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
36633663pub const FILE_BOTH_DIR_INFORMATION = extern struct {
36643664 NextEntryOffset: ULONG,
......@@ -3678,7 +3678,7 @@ pub const FILE_BOTH_DIR_INFORMATION = extern struct {
36783678};
36793679pub 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
36833683pub const CURDIR = extern struct {
36843684 DosPath: UNICODE_STRING,
......@@ -3750,8 +3750,8 @@ pub const ENUM_PAGE_FILE_INFORMATION = extern struct {
37503750 PeakUsage: SIZE_T,
37513751};
37523752
3753pub const PENUM_PAGE_FILE_CALLBACKW = ?std.meta.FnPtr(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);
3753pub const PENUM_PAGE_FILE_CALLBACKW = ?*const fn (?LPVOID, *ENUM_PAGE_FILE_INFORMATION, LPCWSTR) callconv(.C) BOOL;
3754pub const PENUM_PAGE_FILE_CALLBACKA = ?*const fn (?LPVOID, *ENUM_PAGE_FILE_INFORMATION, LPCSTR) callconv(.C) BOOL;
37553755
37563756pub const PSAPI_WS_WATCH_INFORMATION_EX = extern struct {
37573757 BasicInfo: PSAPI_WS_WATCH_INFORMATION,
......@@ -3851,7 +3851,7 @@ pub const CTRL_CLOSE_EVENT: DWORD = 2;
38513851pub const CTRL_LOGOFF_EVENT: DWORD = 5;
38523852pub 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
38563856/// Processor feature enumeration.
38573857pub 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
3939
4040// === 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
4444pub const MSG = extern struct {
4545 hWnd: ?HWND,
......@@ -1056,7 +1056,7 @@ pub fn getMessageA(lpMsg: *MSG, hWnd: ?HWND, wMsgFilterMin: u32, wMsgFilterMax:
10561056}
10571057
10581058pub 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;
10601060pub fn getMessageW(lpMsg: *MSG, hWnd: ?HWND, wMsgFilterMin: u32, wMsgFilterMax: u32) !void {
10611061 const function = selectSymbol(GetMessageW, pfnGetMessageW, .win2k);
10621062
......@@ -1087,7 +1087,7 @@ pub fn peekMessageA(lpMsg: *MSG, hWnd: ?HWND, wMsgFilterMin: u32, wMsgFilterMax:
10871087}
10881088
10891089pub 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;
10911091pub fn peekMessageW(lpMsg: *MSG, hWnd: ?HWND, wMsgFilterMin: u32, wMsgFilterMax: u32, wRemoveMsg: u32) !bool {
10921092 const function = selectSymbol(PeekMessageW, pfnPeekMessageW, .win2k);
10931093
......@@ -1112,7 +1112,7 @@ pub fn dispatchMessageA(lpMsg: *const MSG) LRESULT {
11121112}
11131113
11141114pub 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;
11161116pub fn dispatchMessageW(lpMsg: *const MSG) LRESULT {
11171117 const function = selectSymbol(DispatchMessageW, pfnDispatchMessageW, .win2k);
11181118 return function(lpMsg);
......@@ -1129,7 +1129,7 @@ pub fn defWindowProcA(hWnd: HWND, Msg: UINT, wParam: WPARAM, lParam: LPARAM) LRE
11291129}
11301130
11311131pub 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;
11331133pub fn defWindowProcW(hWnd: HWND, Msg: UINT, wParam: WPARAM, lParam: LPARAM) LRESULT {
11341134 const function = selectSymbol(DefWindowProcW, pfnDefWindowProcW, .win2k);
11351135 return function(hWnd, Msg, wParam, lParam);
......@@ -1191,7 +1191,7 @@ pub fn registerClassExA(window_class: *const WNDCLASSEXA) !ATOM {
11911191}
11921192
11931193pub 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;
11951195pub fn registerClassExW(window_class: *const WNDCLASSEXW) !ATOM {
11961196 const function = selectSymbol(RegisterClassExW, pfnRegisterClassExW, .win2k);
11971197 const atom = function(window_class);
......@@ -1215,7 +1215,7 @@ pub fn unregisterClassA(lpClassName: [*:0]const u8, hInstance: HINSTANCE) !void
12151215}
12161216
12171217pub 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;
12191219pub fn unregisterClassW(lpClassName: [*:0]const u16, hInstance: HINSTANCE) !void {
12201220 const function = selectSymbol(UnregisterClassW, pfnUnregisterClassW, .win2k);
12211221 if (function(lpClassName, hInstance) == 0) {
......@@ -1292,7 +1292,7 @@ pub fn createWindowExA(dwExStyle: u32, lpClassName: [*:0]const u8, lpWindowName:
12921292}
12931293
12941294pub 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;
12961296pub 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 {
12971297 const function = selectSymbol(CreateWindowExW, pfnCreateWindowExW, .win2k);
12981298 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 {
13821382}
13831383
13841384pub 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;
13861386pub fn getWindowLongW(hWnd: HWND, nIndex: i32) !i32 {
13871387 const function = selectSymbol(GetWindowLongW, pfnGetWindowLongW, .win2k);
13881388
......@@ -1415,7 +1415,7 @@ pub fn getWindowLongPtrA(hWnd: HWND, nIndex: i32) !isize {
14151415}
14161416
14171417pub 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;
14191419pub fn getWindowLongPtrW(hWnd: HWND, nIndex: i32) !isize {
14201420 if (@sizeOf(LONG_PTR) == 4) return getWindowLongW(hWnd, nIndex);
14211421 const function = selectSymbol(GetWindowLongPtrW, pfnGetWindowLongPtrW, .win2k);
......@@ -1449,7 +1449,7 @@ pub fn setWindowLongA(hWnd: HWND, nIndex: i32, dwNewLong: i32) !i32 {
14491449}
14501450
14511451pub 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;
14531453pub fn setWindowLongW(hWnd: HWND, nIndex: i32, dwNewLong: i32) !i32 {
14541454 const function = selectSymbol(SetWindowLongW, pfnSetWindowLongW, .win2k);
14551455
......@@ -1484,7 +1484,7 @@ pub fn setWindowLongPtrA(hWnd: HWND, nIndex: i32, dwNewLong: isize) !isize {
14841484}
14851485
14861486pub 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;
14881488pub fn setWindowLongPtrW(hWnd: HWND, nIndex: i32, dwNewLong: isize) !isize {
14891489 if (@sizeOf(LONG_PTR) == 4) return setWindowLongW(hWnd, nIndex, dwNewLong);
14901490 const function = selectSymbol(SetWindowLongPtrW, pfnSetWindowLongPtrW, .win2k);
......@@ -1580,7 +1580,7 @@ pub fn messageBoxA(hWnd: ?HWND, lpText: [*:0]const u8, lpCaption: [*:0]const u8,
15801580}
15811581
15821582pub 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;
15841584pub fn messageBoxW(hWnd: ?HWND, lpText: [*:0]const u16, lpCaption: [*:0]const u16, uType: u32) !i32 {
15851585 const function = selectSymbol(MessageBoxW, pfnMessageBoxW, .win2k);
15861586 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;
942942pub const UDP_CHECKSUM_COVERAGE = 20;
943943pub const GAI_STRERROR_BUFFER_SIZE = 1024;
944944
945pub const LPCONDITIONPROC = std.meta.FnPtr(fn (
945pub const LPCONDITIONPROC = *const fn (
946946 lpCallerId: *WSABUF,
947947 lpCallerData: *WSABUF,
948948 lpSQOS: *QOS,
......@@ -951,14 +951,14 @@ pub const LPCONDITIONPROC = std.meta.FnPtr(fn (
951951 lpCalleeData: *WSABUF,
952952 g: *u32,
953953 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 (
957957 dwError: u32,
958958 cbTransferred: u32,
959959 lpOverlapped: *OVERLAPPED,
960960 dwFlags: u32,
961) callconv(WINAPI) void);
961) callconv(WINAPI) void;
962962
963963pub const FLOWSPEC = extern struct {
964964 TokenRate: u32,
......@@ -1173,7 +1173,7 @@ pub const TRANSMIT_FILE_BUFFERS = extern struct {
11731173 TailLength: u32,
11741174};
11751175
1176pub const LPFN_TRANSMITFILE = std.meta.FnPtr(fn (
1176pub const LPFN_TRANSMITFILE = *const fn (
11771177 hSocket: SOCKET,
11781178 hFile: HANDLE,
11791179 nNumberOfBytesToWrite: u32,
......@@ -1181,9 +1181,9 @@ pub const LPFN_TRANSMITFILE = std.meta.FnPtr(fn (
11811181 lpOverlapped: ?*OVERLAPPED,
11821182 lpTransmitBuffers: ?*TRANSMIT_FILE_BUFFERS,
11831183 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 (
11871187 sListenSocket: SOCKET,
11881188 sAcceptSocket: SOCKET,
11891189 lpOutputBuffer: *anyopaque,
......@@ -1192,9 +1192,9 @@ pub const LPFN_ACCEPTEX = std.meta.FnPtr(fn (
11921192 dwRemoteAddressLength: u32,
11931193 lpdwBytesReceived: *u32,
11941194 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 (
11981198 lpOutputBuffer: *anyopaque,
11991199 dwReceiveDataLength: u32,
12001200 dwLocalAddressLength: u32,
......@@ -1203,29 +1203,29 @@ pub const LPFN_GETACCEPTEXSOCKADDRS = std.meta.FnPtr(fn (
12031203 LocalSockaddrLength: *i32,
12041204 RemoteSockaddr: **sockaddr,
12051205 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 (
12091209 s: SOCKET,
12101210 lpMsg: *const std.x.os.Socket.Message,
12111211 dwFlags: u32,
12121212 lpNumberOfBytesSent: ?*u32,
12131213 lpOverlapped: ?*OVERLAPPED,
12141214 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 (
12181218 s: SOCKET,
12191219 lpMsg: *std.x.os.Socket.Message,
12201220 lpdwNumberOfBytesRecv: ?*u32,
12211221 lpOverlapped: ?*OVERLAPPED,
12221222 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 (
12261226 lParam: LPARAM,
12271227 hAsyncTaskHandle: HANDLE,
1228) callconv(WINAPI) void);
1228) callconv(WINAPI) void;
12291229
12301230pub const SERVICE_ASYNC_INFO = extern struct {
12311231 lpServiceCallbackProc: LPSERVICE_CALLBACK_PROC,
......@@ -1233,11 +1233,11 @@ pub const SERVICE_ASYNC_INFO = extern struct {
12331233 hAsyncTaskHandle: HANDLE,
12341234};
12351235
1236pub const LPLOOKUPSERVICE_COMPLETION_ROUTINE = std.meta.FnPtr(fn (
1236pub const LPLOOKUPSERVICE_COMPLETION_ROUTINE = *const fn (
12371237 dwError: u32,
12381238 dwBytes: u32,
12391239 lpOverlapped: *OVERLAPPED,
1240) callconv(WINAPI) void);
1240) callconv(WINAPI) void;
12411241
12421242pub const fd_set = extern struct {
12431243 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 {
338338 };
339339}
340340
341const we_are_testing_this_with_stage1_which_leaks_comptime_memory = true;
342
343341test "PackedIntArray" {
344342 // TODO @setEvalBranchQuota generates panics in wasm32. Investigate.
345343 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
348348 @setEvalBranchQuota(10000);
349349 const max_bits = 256;
......@@ -405,7 +405,9 @@ test "PackedIntArray initAllTo" {
405405test "PackedIntSlice" {
406406 // TODO @setEvalBranchQuota generates panics in wasm32. Investigate.
407407 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
410412 @setEvalBranchQuota(10000);
411413 const max_bits = 256;
......@@ -444,7 +446,9 @@ test "PackedIntSlice" {
444446}
445447
446448test "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
448452 const max_bits = 16;
449453 const int_count = 19;
450454
lib/std/rand.zig+1-1
......@@ -30,7 +30,7 @@ pub const RomuTrio = @import("rand/RomuTrio.zig");
3030
3131pub const Random = struct {
3232 ptr: *anyopaque,
33 fillFn: std.meta.FnPtr(fn (ptr: *anyopaque, buf: []u8) void),
33 fillFn: *const fn (ptr: *anyopaque, buf: []u8) void,
3434
3535 pub fn init(pointer: anytype, comptime fillFn: fn (ptr: @TypeOf(pointer), buf: []u8) void) Random {
3636 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
412412}
413413
414414test "SegmentedList basic usage" {
415 if (@import("builtin").zig_backend == .stage1) {
415 if (false) {
416416 // https://github.com/ziglang/zig/issues/11787
417417 try testSegmentedList(0);
418418 }
lib/std/simd.zig+2-4
......@@ -191,9 +191,7 @@ pub fn extract(
191191}
192192
193193test "vector patterns" {
194 if ((builtin.zig_backend == .stage1 or builtin.zig_backend == .stage2_llvm) and
195 builtin.cpu.arch == .aarch64)
196 {
194 if (builtin.zig_backend == .stage2_llvm and builtin.cpu.arch == .aarch64) {
197195 // https://github.com/ziglang/zig/issues/12012
198196 return error.SkipZigTest;
199197 }
......@@ -419,7 +417,7 @@ test "vector prefix scan" {
419417 return error.SkipZigTest;
420418 }
421419
422 if (builtin.zig_backend == .stage1 or builtin.zig_backend == .stage2_llvm) {
420 if (builtin.zig_backend == .stage2_llvm) {
423421 // Regressed in LLVM 14:
424422 // https://github.com/llvm/llvm-project/issues/55522
425423 return error.SkipZigTest;
lib/std/unicode.zig+1-3
......@@ -354,9 +354,7 @@ fn testUtf16CountCodepoints() !void {
354354
355355test "utf16 count codepoints" {
356356 try testUtf16CountCodepoints();
357 // TODO stage1 error: out of bounds slice
358 if (@import("builtin").zig_backend != .stage1)
359 comptime try testUtf16CountCodepoints();
357 comptime try testUtf16CountCodepoints();
360358}
361359
362360test "utf8 encode" {
lib/std/zig/Ast.zig-2
......@@ -2009,8 +2009,6 @@ fn fullStructInit(tree: Ast, info: full.StructInit.Components) full.StructInit {
20092009
20102010fn fullPtrType(tree: Ast, info: full.PtrType.Components) full.PtrType {
20112011 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
20142012 const Size = std.builtin.Type.Pointer.Size;
20152013 const size: Size = switch (token_tags[info.main_token]) {
20162014 .asterisk,
lib/std/zig/c_translation.zig+4-18
......@@ -9,19 +9,13 @@ pub fn cast(comptime DestType: type, target: anytype) DestType {
99 // this function should behave like transCCast in translate-c, except it's for macros
1010 const SourceType = @TypeOf(target);
1111 switch (@typeInfo(DestType)) {
12 .Fn => if (builtin.zig_backend == .stage1)
13 return castToPtr(DestType, SourceType, target)
14 else
15 return castToPtr(*const DestType, SourceType, target),
12 .Fn => return castToPtr(*const DestType, SourceType, target),
1613 .Pointer => return castToPtr(DestType, SourceType, target),
1714 .Optional => |dest_opt| {
1815 if (@typeInfo(dest_opt.child) == .Pointer) {
1916 return castToPtr(DestType, SourceType, target);
2017 } else if (@typeInfo(dest_opt.child) == .Fn) {
21 if (builtin.zig_backend == .stage1)
22 return castToPtr(DestType, SourceType, target)
23 else
24 return castToPtr(?*const dest_opt.child, SourceType, target);
18 return castToPtr(?*const dest_opt.child, SourceType, target);
2519 }
2620 },
2721 .Int => {
......@@ -149,7 +143,7 @@ test "cast" {
149143 try testing.expect(cast(?*anyopaque, -1) == @intToPtr(?*anyopaque, @bitCast(usize, @as(isize, -1))));
150144 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;
153147 try testing.expect(cast(FnPtr, 0) == @intToPtr(FnPtr, @as(usize, 0)));
154148 try testing.expect(cast(FnPtr, foo) == @intToPtr(FnPtr, @bitCast(usize, @as(isize, -1))));
155149}
......@@ -160,12 +154,6 @@ pub fn sizeof(target: anytype) usize {
160154 switch (@typeInfo(T)) {
161155 .Float, .Int, .Struct, .Union, .Array, .Bool, .Vector => return @sizeOf(T),
162156 .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
169157 // sizeof(main) in C returns 1
170158 return 1;
171159 },
......@@ -263,9 +251,7 @@ test "sizeof" {
263251 try testing.expect(sizeof(*const *const [4:0]u8) == ptr_size);
264252 try testing.expect(sizeof(*const [4]u8) == ptr_size);
265253
266 if (builtin.zig_backend == .stage1) {
267 try testing.expect(sizeof(sizeof) == @sizeOf(@TypeOf(sizeof)));
268 } else if (false) { // TODO
254 if (false) { // TODO
269255 try testing.expect(sizeof(&sizeof) == @sizeOf(@TypeOf(&sizeof)));
270256 try testing.expect(sizeof(sizeof) == 1);
271257 }
src/Compilation.zig+11-12
......@@ -5427,11 +5427,6 @@ pub fn build_crt_file(
54275427 });
54285428 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 };
54355430 const sub_compilation = try Compilation.create(comp.gpa, .{
54365431 .local_cache_directory = comp.global_cache_directory,
54375432 .global_cache_directory = comp.global_cache_directory,
......@@ -5443,7 +5438,10 @@ pub fn build_crt_file(
54435438 .output_mode = output_mode,
54445439 .thread_pool = comp.thread_pool,
54455440 .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 },
54475445 .optimize_mode = comp.compilerRtOptMode(),
54485446 .want_sanitize_c = false,
54495447 .want_stack_check = false,
......@@ -5488,15 +5486,16 @@ pub fn build_crt_file(
54885486 });
54895487}
54905488
5491pub fn stage1AddLinkLib(comp: *Compilation, lib_name: []const u8) !void {
5489pub fn addLinkLib(comp: *Compilation, lib_name: []const u8) !void {
54925490 // Avoid deadlocking on building import libs such as kernel32.lib
5493 // This can happen when the user uses `build-exe foo.obj -lkernel32` and then
5494 // when we create a sub-Compilation for zig libc, it also tries to build kernel32.lib.
5491 // This can happen when the user uses `build-exe foo.obj -lkernel32` and
5492 // then when we create a sub-Compilation for zig libc, it also tries to
5493 // build kernel32.lib.
54955494 if (comp.bin_file.options.skip_linker_dependencies) return;
54965495
5497 // This happens when an `extern "foo"` function is referenced by the stage1 backend.
5498 // If we haven't seen this library yet and we're targeting Windows, we need to queue up
5499 // a work item to produce the DLL import library for this.
5496 // This happens when an `extern "foo"` function is referenced.
5497 // If we haven't seen this library yet and we're targeting Windows, we need
5498 // to queue up a work item to produce the DLL import library for this.
55005499 const gop = try comp.bin_file.options.system_libs.getOrPut(comp.gpa, lib_name);
55015500 if (!gop.found_existing and comp.getTarget().os.tag == .windows) {
55025501 try comp.work_queue.writeItem(.{
src/Module.zig+6-8
......@@ -71,7 +71,7 @@ import_table: std.StringArrayHashMapUnmanaged(*File) = .{},
7171/// Keys are fully resolved file paths. This table owns the keys and values.
7272embed_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,
7575/// however the end-game once the lang spec is settled will be to use a global
7676/// InternPool for comptime memoized objects, making this behavior consistent across all types,
7777/// 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
35443544 export_list.deinit(gpa);
35453545}
35463546
3547// TODO https://github.com/ziglang/zig/issues/8643
35473548const data_has_safety_tag = @sizeOf(Zir.Inst.Data) != 8;
3548// TODO This is taking advantage of matching stage1 debug union layout.
3549// We need a better language feature for initializing a union with
3550// a runtime-known tag.
3551const Stage1DataLayout = extern struct {
3549const HackDataLayout = extern struct {
35523550 data: [8]u8 align(@alignOf(Zir.Inst.Data)),
35533551 safety_tag: u8,
35543552};
35553553comptime {
35563554 if (data_has_safety_tag) {
3557 assert(@sizeOf(Stage1DataLayout) == @sizeOf(Zir.Inst.Data));
3555 assert(@sizeOf(HackDataLayout) == @sizeOf(Zir.Inst.Data));
35583556 }
35593557}
35603558
......@@ -3695,7 +3693,7 @@ pub fn astGenFile(mod: *Module, file: *File) !void {
36953693 const tags = zir.instructions.items(.tag);
36963694 for (zir.instructions.items(.data)) |*data, i| {
36973695 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);
36993697 as_struct.* = .{
37003698 .safety_tag = @enumToInt(union_tag),
37013699 .data = safety_buffer[i],
......@@ -3881,7 +3879,7 @@ pub fn astGenFile(mod: *Module, file: *File) !void {
38813879 if (data_has_safety_tag) {
38823880 // The `Data` union has a safety tag but in the file format we store it without.
38833881 for (file.zir.instructions.items(.data)) |*data, i| {
3884 const as_struct = @ptrCast(*const Stage1DataLayout, data);
3882 const as_struct = @ptrCast(*const HackDataLayout, data);
38853883 safety_buffer[i] = as_struct.data;
38863884 }
38873885 }
src/Sema.zig+11-17
......@@ -8307,7 +8307,7 @@ fn handleExternLibName(
83078307 .{ lib_name, lib_name },
83088308 );
83098309 }
8310 comp.stage1AddLinkLib(lib_name) catch |err| {
8310 comp.addLinkLib(lib_name) catch |err| {
83118311 return sema.fail(block, src_loc, "unable to add link lib '{s}': {s}", .{
83128312 lib_name, @errorName(err),
83138313 });
......@@ -8401,15 +8401,11 @@ fn funcCommon(
84018401 }
84028402 }
84038403
8404 // These locals are pulled out from the init expression below to work around
8405 // a stage1 compiler bug.
84068404 // In the case of generic calling convention, or generic alignment, we use
84078405 // default values which are only meaningful for the generic function, *not*
84088406 // the instantiation, which can depend on comptime parameters.
84098407 // Related proposal: https://github.com/ziglang/zig/issues/11834
8410 const cc_workaround = cc orelse .Unspecified;
8411 const align_workaround = alignment orelse 0;
8412
8408 const cc_resolved = cc orelse .Unspecified;
84138409 const param_types = try sema.arena.alloc(Type, block.params.items.len);
84148410 const comptime_params = try sema.arena.alloc(bool, block.params.items.len);
84158411 for (block.params.items) |param, i| {
......@@ -8421,7 +8417,7 @@ fn funcCommon(
84218417 comptime_params,
84228418 i,
84238419 &is_generic,
8424 cc_workaround,
8420 cc_resolved,
84258421 has_body,
84268422 ) catch |err| switch (err) {
84278423 error.NeededSourceLocation => {
......@@ -8433,7 +8429,7 @@ fn funcCommon(
84338429 comptime_params,
84348430 i,
84358431 &is_generic,
8436 cc_workaround,
8432 cc_resolved,
84378433 has_body,
84388434 );
84398435 return error.AnalysisFail;
......@@ -8481,10 +8477,10 @@ fn funcCommon(
84818477 };
84828478 return sema.failWithOwnedErrorMsg(msg);
84838479 }
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)) {
84858481 const msg = msg: {
84868482 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),
84888484 });
84898485 errdefer msg.destroy(sema.gpa);
84908486
......@@ -8533,7 +8529,7 @@ fn funcCommon(
85338529 }
85348530
85358531 const arch = sema.mod.getTarget().cpu.arch;
8536 if (switch (cc_workaround) {
8532 if (switch (cc_resolved) {
85378533 .Unspecified, .C, .Naked, .Async, .Inline => null,
85388534 .Interrupt => switch (arch) {
85398535 .x86, .x86_64, .avr, .msp430 => null,
......@@ -8569,13 +8565,13 @@ fn funcCommon(
85698565 },
85708566 }) |allowed_platform| {
85718567 return sema.fail(block, cc_src, "callconv '{s}' is only available on {s}, not {s}", .{
8572 @tagName(cc_workaround),
8568 @tagName(cc_resolved),
85738569 allowed_platform,
85748570 @tagName(arch),
85758571 });
85768572 }
85778573
8578 if (cc_workaround == .Inline and is_noinline) {
8574 if (cc_resolved == .Inline and is_noinline) {
85798575 return sema.fail(block, cc_src, "'noinline' function cannot have callconv 'Inline'", .{});
85808576 }
85818577 if (is_generic and sema.no_partial_func_ty) return error.GenericPoison;
......@@ -8593,9 +8589,9 @@ fn funcCommon(
85938589 .param_types = param_types,
85948590 .comptime_params = comptime_params.ptr,
85958591 .return_type = return_type,
8596 .cc = cc_workaround,
8592 .cc = cc_resolved,
85978593 .cc_is_generic = cc == null,
8598 .alignment = align_workaround,
8594 .alignment = alignment orelse 0,
85998595 .align_is_generic = alignment == null,
86008596 .section_is_generic = section == .generic,
86018597 .addrspace_is_generic = address_space == null,
......@@ -19107,8 +19103,6 @@ fn zirPtrCast(sema: *Sema, block: *Block, inst: Zir.Inst.Index) CompileError!Air
1910719103 const operand_elem_size = operand_elem_ty.abiSize(target);
1910819104 const dest_elem_size = dest_elem_ty.abiSize(target);
1910919105 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.
1911219106 return sema.fail(block, dest_ty_src, "TODO: implement @ptrCast between slices changing the length", .{});
1911319107 }
1911419108 }
src/ThreadPool.zig+1-4
......@@ -15,10 +15,7 @@ const Runnable = struct {
1515 runFn: RunProto,
1616};
1717
18const RunProto = switch (builtin.zig_backend) {
19 .stage1 => fn (*Runnable) void,
20 else => *const fn (*Runnable) void,
21};
18const RunProto = *const fn (*Runnable) void;
2219
2320pub fn init(pool: *ThreadPool, allocator: std.mem.Allocator) !void {
2421 pool.* = .{
src/clang.zig+5-6
......@@ -161,12 +161,11 @@ pub const ASTUnit = opaque {
161161 extern fn ZigClangASTUnit_getSourceManager(*ASTUnit) *SourceManager;
162162
163163 pub const visitLocalTopLevelDecls = ZigClangASTUnit_visitLocalTopLevelDecls;
164 extern fn ZigClangASTUnit_visitLocalTopLevelDecls(*ASTUnit, context: ?*anyopaque, Fn: ?VisitorFn) bool;
165
166 const VisitorFn = if (@import("builtin").zig_backend == .stage1)
167 fn (?*anyopaque, *const Decl) callconv(.C) bool
168 else
169 *const fn (?*anyopaque, *const Decl) callconv(.C) bool;
164 extern fn ZigClangASTUnit_visitLocalTopLevelDecls(
165 *ASTUnit,
166 context: ?*anyopaque,
167 Fn: ?*const fn (?*anyopaque, *const Decl) callconv(.C) bool,
168 ) bool;
170169
171170 pub const getLocalPreprocessingEntities_begin = ZigClangASTUnit_getLocalPreprocessingEntities_begin;
172171 extern fn ZigClangASTUnit_getLocalPreprocessingEntities_begin(*ASTUnit) PreprocessingRecord.iterator;
src/codegen.zig+1-42
......@@ -98,54 +98,13 @@ pub fn generateFunction(
9898 .aarch64_be,
9999 .aarch64_32,
100100 => 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),
117101 .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),
119102 .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),
127103 .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),
145104 .wasm32,
146105 .wasm64,
147106 => 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,
149108 }
150109}
151110
src/codegen/c.zig+2-4
......@@ -4972,8 +4972,7 @@ fn airStructFieldPtr(f: *Function, inst: Air.Inst.Index) !CValue {
49724972
49734973 if (f.liveness.isUnused(inst)) {
49744974 try reap(f, inst, &.{extra.struct_operand});
4975 // TODO this @as is needed because of a stage1 bug
4976 return @as(CValue, CValue.none);
4975 return .none;
49774976 }
49784977
49794978 const struct_ptr = try f.resolveInst(extra.struct_operand);
......@@ -4987,8 +4986,7 @@ fn airStructFieldPtrIndex(f: *Function, inst: Air.Inst.Index, index: u8) !CValue
49874986
49884987 if (f.liveness.isUnused(inst)) {
49894988 try reap(f, inst, &.{ty_op.operand});
4990 // TODO this @as is needed because of a stage1 bug
4991 return @as(CValue, CValue.none);
4989 return .none;
49924990 }
49934991
49944992 const struct_ptr = try f.resolveInst(ty_op.operand);
src/codegen/llvm.zig+8-8
......@@ -1392,8 +1392,9 @@ pub const Object = struct {
13921392 const dir_path = file.pkg.root_src_directory.path orelse ".";
13931393 const sub_file_path_z = try gpa.dupeZ(u8, std.fs.path.basename(file.sub_file_path));
13941394 defer gpa.free(sub_file_path_z);
1395 const stage1_workaround = std.fs.path.dirname(file.sub_file_path) orelse "";
1396 const dir_path_z = try std.fs.path.joinZ(gpa, &.{ dir_path, stage1_workaround });
1395 const dir_path_z = try std.fs.path.joinZ(gpa, &.{
1396 dir_path, std.fs.path.dirname(file.sub_file_path) orelse "",
1397 });
13971398 defer gpa.free(dir_path_z);
13981399 const di_file = o.di_builder.?.createFile(sub_file_path_z, dir_path_z);
13991400 gop.value_ptr.* = di_file.toNode();
......@@ -6107,12 +6108,11 @@ pub const FuncGen = struct {
61076108 }
61086109
61096110 fn airAssembly(self: *FuncGen, inst: Air.Inst.Index) !?*llvm.Value {
6110 // Eventually, the Zig compiler needs to be reworked to have inline assembly go
6111 // through the same parsing code regardless of backend, and have LLVM-flavored
6112 // inline assembly be *output* from that assembler.
6113 // We don't have such an assembler implemented yet though. For now, this
6114 // implementation feeds the inline assembly code directly to LLVM, same
6115 // as stage1.
6111 // Eventually, the Zig compiler needs to be reworked to have inline
6112 // assembly go through the same parsing code regardless of backend, and
6113 // have LLVM-flavored inline assembly be *output* from that assembler.
6114 // We don't have such an assembler implemented yet though. For now,
6115 // this implementation feeds the inline assembly code directly to LLVM.
61166116
61176117 const ty_pl = self.air.instructions.items(.data)[inst].ty_pl;
61186118 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 {
333333}
334334
335335test "SPIR-V Section emit() - no operands" {
336 if (@import("builtin").zig_backend == .stage1) return error.SkipZigTest;
337
338336 var section = Section{};
339337 defer section.deinit(std.testing.allocator);
340338
......@@ -344,8 +342,6 @@ test "SPIR-V Section emit() - no operands" {
344342}
345343
346344test "SPIR-V Section emit() - simple" {
347 if (@import("builtin").zig_backend == .stage1) return error.SkipZigTest;
348
349345 var section = Section{};
350346 defer section.deinit(std.testing.allocator);
351347
......@@ -362,8 +358,6 @@ test "SPIR-V Section emit() - simple" {
362358}
363359
364360test "SPIR-V Section emit() - string" {
365 if (@import("builtin").zig_backend == .stage1) return error.SkipZigTest;
366
367361 var section = Section{};
368362 defer section.deinit(std.testing.allocator);
369363
......@@ -389,8 +383,6 @@ test "SPIR-V Section emit() - string" {
389383}
390384
391385test "SPIR-V Section emit()- extended mask" {
392 if (@import("builtin").zig_backend == .stage1) return error.SkipZigTest;
393
394386 var section = Section{};
395387 defer section.deinit(std.testing.allocator);
396388
......@@ -415,8 +407,6 @@ test "SPIR-V Section emit()- extended mask" {
415407}
416408
417409test "SPIR-V Section emit() - extended union" {
418 if (@import("builtin").zig_backend == .stage1) return error.SkipZigTest;
419
420410 var section = Section{};
421411 defer section.deinit(std.testing.allocator);
422412
src/main.zig+2-6
......@@ -3289,15 +3289,11 @@ fn parseCrossTargetOrReportFatalError(
32893289 fatal("unknown CPU feature: '{s}'", .{diags.unknown_feature_name.?});
32903290 },
32913291 error.UnknownObjectFormat => {
3292 {
3292 help: {
32933293 var help_text = std.ArrayList(u8).init(allocator);
32943294 defer help_text.deinit();
32953295 inline for (@typeInfo(std.Target.ObjectFormat).Enum.fields) |field| {
3296 help_text.writer().print(" {s}\n", .{field.name}) catch
3297 // TODO change this back to `break :help`
3298 // this working around a stage1 bug.
3299 //break :help;
3300 @panic("out of memory");
3296 help_text.writer().print(" {s}\n", .{field.name}) catch break :help;
33013297 }
33023298 std.log.info("available object formats:\n{s}", .{help_text.items});
33033299 }
src/target.zig+2-2
......@@ -523,13 +523,13 @@ pub const AtomicPtrAlignmentDiagnostics = struct {
523523/// If ABI alignment of `ty` is OK for atomic operations, returns 0.
524524/// Otherwise returns the alignment required on a pointer for the target
525525/// to perform atomic operations.
526// TODO this function does not take into account CPU features, which can affect
527// this value. Audit this!
526528pub fn atomicPtrAlignment(
527529 target: std.Target,
528530 ty: Type,
529531 diags: *AtomicPtrAlignmentDiagnostics,
530532) 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!
533533 const max_atomic_bits: u16 = switch (target.cpu.arch) {
534534 .avr,
535535 .msp430,
src/translate_c.zig-3
......@@ -1,6 +1,3 @@
1//! This is the userland implementation of translate-c which is used by both stage1
2//! and stage2.
3
41const std = @import("std");
52const testing = std.testing;
63const assert = std.debug.assert;
src/type.zig+4-6
......@@ -1554,10 +1554,10 @@ pub const Type = extern union {
15541554 ) @TypeOf(writer).Error!void {
15551555 _ = options;
15561556 comptime assert(unused_format_string.len == 0);
1557 if (@import("builtin").zig_backend != .stage1) {
1558 // This is disabled to work around a stage2 bug where this function recursively
1559 // causes more generic function instantiations resulting in an infinite loop
1560 // in the compiler.
1557 if (true) {
1558 // This is disabled to work around a bug where this function
1559 // recursively causes more generic function instantiations
1560 // resulting in an infinite loop in the compiler.
15611561 try writer.writeAll("[TODO fix internal compiler bug regarding dump]");
15621562 return;
15631563 }
......@@ -6551,9 +6551,7 @@ pub const Type = extern union {
65516551 else => {},
65526552 }
65536553 } else {
6554 // TODO stage1 type inference bug
65556554 const T = Type.Tag;
6556
65576555 const type_payload = try arena.create(Type.Payload.ElemType);
65586556 type_payload.* = .{
65596557 .base = .{
src/zig_llvm.h-2
......@@ -337,7 +337,6 @@ ZIG_EXTERN_C void ZigLLVMParseCommandLineOptions(size_t argc, const char *const
337337
338338// synchronize with llvm/include/ADT/Triple.h::ArchType
339339// synchronize with std.Target.Cpu.Arch
340// synchronize with src/stage1/target.cpp::arch_list
341340// synchronize with codegen/llvm/bindings.zig::ArchType
342341enum ZigLLVM_ArchType {
343342 ZigLLVM_UnknownArch,
......@@ -428,7 +427,6 @@ enum ZigLLVM_VendorType {
428427// synchronize with llvm/include/ADT/Triple.h::OsType
429428// synchronize with std.Target.Os.Tag
430429// synchronize with codegen/llvm/bindings.zig::OsType
431// synchronize with src/stage1/target.cpp::os_list
432430enum ZigLLVM_OSType {
433431 ZigLLVM_UnknownOS,
434432