diff --git a/lib/std/atomic/Atomic.zig b/lib/std/atomic/Atomic.zig index 6d5a0fe4fcad1353ea84c2d406f63679ed59dee0..850075d4cb62494227aeec8e7ec397c92991c157 100644 --- a/lib/std/atomic/Atomic.zig +++ b/lib/std/atomic/Atomic.zig @@ -214,8 +214,8 @@ pub fn Atomic(comptime T: type) type { inline fn bitRmw(self: *Self, comptime op: BitRmwOp, bit: Bit, comptime ordering: Ordering) u1 { // x86 supports dedicated bitwise instructions if (comptime builtin.target.cpu.arch.isX86() and @sizeOf(T) >= 2 and @sizeOf(T) <= 8) { - // TODO: stage2 currently doesn't like the inline asm this function emits. - if (builtin.zig_backend == .stage1) { + // TODO: this causes std lib test failures when enabled + if (false) { return x86BitRmw(self, op, bit, ordering); } } diff --git a/lib/std/base64.zig b/lib/std/base64.zig index 523a891f4d6bcaa68256760e3a88e360b27a55e2..0eeb30abbcdba16841f68b03ef2ad02878c24050 100644 --- a/lib/std/base64.zig +++ b/lib/std/base64.zig @@ -9,7 +9,7 @@ pub const Error = error{ NoSpaceLeft, }; -const decoderWithIgnoreProto = std.meta.FnPtr(fn (ignore: []const u8) Base64DecoderWithIgnore); +const decoderWithIgnoreProto = *const fn (ignore: []const u8) Base64DecoderWithIgnore; /// Base64 codecs pub const Codecs = struct { diff --git a/lib/std/build.zig b/lib/std/build.zig index 73487d8ea9ab850861728a868c28d4a6f94aba88..40a20d6b2d3008334bc2a83227892f3cacc93a60 100644 --- a/lib/std/build.zig +++ b/lib/std/build.zig @@ -3293,8 +3293,7 @@ pub const LibExeObjStep = struct { while (try it.next()) |entry| { // The compiler can put these files into the same directory, but we don't // want to copy them over. - if (mem.eql(u8, entry.name, "stage1.id") or - mem.eql(u8, entry.name, "llvm-ar.id") or + if (mem.eql(u8, entry.name, "llvm-ar.id") or mem.eql(u8, entry.name, "libs.txt") or mem.eql(u8, entry.name, "builtin.zig") or mem.eql(u8, entry.name, "zld.id") or @@ -3607,7 +3606,7 @@ pub const Step = struct { loop_flag: bool, done_flag: bool, - const MakeFn = std.meta.FnPtr(fn (self: *Step) anyerror!void); + const MakeFn = *const fn (self: *Step) anyerror!void; pub const Id = enum { top_level, diff --git a/lib/std/build/WriteFileStep.zig b/lib/std/build/WriteFileStep.zig index 79b5f9386fa27827ee8c494a5a2926e062e11ad8..e608f1bd9ca6ca2c1089f6c4c285f66cff45c793 100644 --- a/lib/std/build/WriteFileStep.zig +++ b/lib/std/build/WriteFileStep.zig @@ -62,9 +62,9 @@ fn make(step: *Step) !void { // If, for example, a hard-coded path was used as the location to put WriteFileStep // files, then two WriteFileSteps executing in parallel might clobber each other. - // TODO port the cache system from stage1 to zig std lib. Until then we use blake2b - // directly and construct the path, and no "cache hit" detection happens; the files - // are always written. + // TODO port the cache system from the compiler to zig std lib. Until then + // we use blake2b directly and construct the path, and no "cache hit" + // detection happens; the files are always written. var hash = std.crypto.hash.blake2.Blake2b384.init(.{}); // Random bytes to make WriteFileStep unique. Refresh this with diff --git a/lib/std/builtin.zig b/lib/std/builtin.zig index 8c8d0b37b7dfe282d2576b8c1602899c4305f44f..fac5819b381b65d44dac3e9b0a1276251f3cb0eb 100644 --- a/lib/std/builtin.zig +++ b/lib/std/builtin.zig @@ -698,8 +698,9 @@ pub const CompilerBackend = enum(u64) { /// in which case this value is appropriate. Be cool and make sure your /// code supports `other` Zig compilers! other = 0, - /// The original Zig compiler created in 2015 by Andrew Kelley. - /// Implemented in C++. Uses LLVM. + /// The original Zig compiler created in 2015 by Andrew Kelley. Implemented + /// in C++. Used LLVM. Deleted from the ZSF ziglang/zig codebase on + /// December 6th, 2022. stage1 = 1, /// The reference implementation self-hosted compiler of Zig, using the /// LLVM backend. @@ -738,7 +739,7 @@ pub const CompilerBackend = enum(u64) { /// therefore must be kept in sync with the compiler implementation. pub const TestFn = struct { name: []const u8, - func: std.meta.FnPtr(fn () anyerror!void), + func: *const fn () anyerror!void, async_frame_size: ?usize, }; @@ -760,8 +761,8 @@ else pub fn default_panic(msg: []const u8, error_return_trace: ?*StackTrace, ret_addr: ?usize) noreturn { @setCold(true); - // Until self-hosted catches up with stage1 language features, we have a simpler - // default panic function: + // For backends that cannot handle the language features depended on by the + // default panic handler, we have a simpler panic handler: if (builtin.zig_backend == .stage2_c or builtin.zig_backend == .stage2_wasm or builtin.zig_backend == .stage2_arm or diff --git a/lib/std/c.zig b/lib/std/c.zig index a9c70a598efbbfc5f78aa28e84b5c604b9d4907a..5f03f1c61902a191de87b49f0dcbdfec4a872d34 100644 --- a/lib/std/c.zig +++ b/lib/std/c.zig @@ -241,8 +241,12 @@ pub extern "c" fn utimes(path: [*:0]const u8, times: *[2]c.timeval) c_int; pub extern "c" fn utimensat(dirfd: c.fd_t, pathname: [*:0]const u8, times: *[2]c.timespec, flags: u32) c_int; pub extern "c" fn futimens(fd: c.fd_t, times: *const [2]c.timespec) c_int; -const PThreadStartFn = std.meta.FnPtr(fn (?*anyopaque) callconv(.C) ?*anyopaque); -pub extern "c" fn pthread_create(noalias newthread: *pthread_t, noalias attr: ?*const c.pthread_attr_t, start_routine: PThreadStartFn, noalias arg: ?*anyopaque) c.E; +pub extern "c" fn pthread_create( + noalias newthread: *pthread_t, + noalias attr: ?*const c.pthread_attr_t, + start_routine: *const fn (?*anyopaque) callconv(.C) ?*anyopaque, + noalias arg: ?*anyopaque, +) c.E; pub extern "c" fn pthread_attr_init(attr: *c.pthread_attr_t) c.E; pub extern "c" fn pthread_attr_setstack(attr: *c.pthread_attr_t, stackaddr: *anyopaque, stacksize: usize) c.E; pub 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; pub extern "c" fn pthread_self() pthread_t; pub extern "c" fn pthread_join(thread: pthread_t, arg_return: ?*?*anyopaque) c.E; pub extern "c" fn pthread_detach(thread: pthread_t) c.E; -const PThreadForkFn = std.meta.FnPtr(fn () callconv(.C) void); pub extern "c" fn pthread_atfork( - prepare: ?PThreadForkFn, - parent: ?PThreadForkFn, - child: ?PThreadForkFn, + prepare: ?*const fn () callconv(.C) void, + parent: ?*const fn () callconv(.C) void, + child: ?*const fn () callconv(.C) void, ) c_int; -const PThreadKeyCreateFn = std.meta.FnPtr(fn (value: *anyopaque) callconv(.C) void); -pub extern "c" fn pthread_key_create(key: *c.pthread_key_t, destructor: ?PThreadKeyCreateFn) c.E; +pub extern "c" fn pthread_key_create( + key: *c.pthread_key_t, + destructor: ?*const fn (value: *anyopaque) callconv(.C) void, +) c.E; pub extern "c" fn pthread_key_delete(key: c.pthread_key_t) c.E; pub extern "c" fn pthread_getspecific(key: c.pthread_key_t) ?*anyopaque; pub extern "c" fn pthread_setspecific(key: c.pthread_key_t, value: ?*anyopaque) c_int; diff --git a/lib/std/c/darwin.zig b/lib/std/c/darwin.zig index 9c455141f603bfc8876aab9a14866a9eef9f6b68..5c0338af80a7ad0712af6c1c30386d04e6f07714 100644 --- a/lib/std/c/darwin.zig +++ b/lib/std/c/darwin.zig @@ -918,8 +918,8 @@ pub const siginfo_t = extern struct { /// Renamed from `sigaction` to `Sigaction` to avoid conflict with function name. pub const Sigaction = extern struct { - pub const handler_fn = std.meta.FnPtr(fn (c_int) align(1) callconv(.C) void); - pub const sigaction_fn = std.meta.FnPtr(fn (c_int, *const siginfo_t, ?*const anyopaque) callconv(.C) void); + pub const handler_fn = *const fn (c_int) align(1) callconv(.C) void; + pub const sigaction_fn = *const fn (c_int, *const siginfo_t, ?*const anyopaque) callconv(.C) void; handler: extern union { handler: ?handler_fn, diff --git a/lib/std/c/dragonfly.zig b/lib/std/c/dragonfly.zig index 8c6ecb653f538f49519843a5e852c2d8534fcd16..2410310fc71004f7747dc88644ec2637d4a07777 100644 --- a/lib/std/c/dragonfly.zig +++ b/lib/std/c/dragonfly.zig @@ -13,7 +13,7 @@ pub extern "c" fn sigaltstack(ss: ?*stack_t, old_ss: ?*stack_t) c_int; pub extern "c" fn getrandom(buf_ptr: [*]u8, buf_len: usize, flags: c_uint) isize; pub extern "c" fn pipe2(fds: *[2]fd_t, flags: u32) c_int; -pub const dl_iterate_phdr_callback = std.meta.FnPtr(fn (info: *dl_phdr_info, size: usize, data: ?*anyopaque) callconv(.C) c_int); +pub const dl_iterate_phdr_callback = *const fn (info: *dl_phdr_info, size: usize, data: ?*anyopaque) callconv(.C) c_int; pub extern "c" fn dl_iterate_phdr(callback: dl_iterate_phdr_callback, data: ?*anyopaque) c_int; pub extern "c" fn lwp_gettid() c_int; @@ -681,8 +681,8 @@ pub const empty_sigset = sigset_t{ .__bits = [_]c_uint{0} ** _SIG_WORDS }; pub const sig_atomic_t = c_int; pub const Sigaction = extern struct { - pub const handler_fn = std.meta.FnPtr(fn (c_int) align(1) callconv(.C) void); - pub const sigaction_fn = std.meta.FnPtr(fn (c_int, *const siginfo_t, ?*const anyopaque) callconv(.C) void); + pub const handler_fn = *const fn (c_int) align(1) callconv(.C) void; + pub const sigaction_fn = *const fn (c_int, *const siginfo_t, ?*const anyopaque) callconv(.C) void; /// signal handler handler: extern union { diff --git a/lib/std/c/freebsd.zig b/lib/std/c/freebsd.zig index 3afe4e28ad10507198216d24a2fa175c7e28defb..c4bd4a44a7a9f3d2bf6434ca8318aaa696ea8d0c 100644 --- a/lib/std/c/freebsd.zig +++ b/lib/std/c/freebsd.zig @@ -37,7 +37,7 @@ pub extern "c" fn sendfile( flags: u32, ) c_int; -pub const dl_iterate_phdr_callback = std.meta.FnPtr(fn (info: *dl_phdr_info, size: usize, data: ?*anyopaque) callconv(.C) c_int); +pub const dl_iterate_phdr_callback = *const fn (info: *dl_phdr_info, size: usize, data: ?*anyopaque) callconv(.C) c_int; pub extern "c" fn dl_iterate_phdr(callback: dl_iterate_phdr_callback, data: ?*anyopaque) c_int; pub const pthread_mutex_t = extern struct { @@ -1197,8 +1197,8 @@ const NSIG = 32; /// Renamed from `sigaction` to `Sigaction` to avoid conflict with the syscall. pub const Sigaction = extern struct { - pub const handler_fn = std.meta.FnPtr(fn (c_int) align(1) callconv(.C) void); - pub const sigaction_fn = std.meta.FnPtr(fn (c_int, *const siginfo_t, ?*const anyopaque) callconv(.C) void); + pub const handler_fn = *const fn (c_int) align(1) callconv(.C) void; + pub const sigaction_fn = *const fn (c_int, *const siginfo_t, ?*const anyopaque) callconv(.C) void; /// signal handler handler: extern union { diff --git a/lib/std/c/haiku.zig b/lib/std/c/haiku.zig index 82f0c92c51ab419ed047280869bc70daab87c44a..86b9f25902cb092df1d2485d4b25bc5160cd4741 100644 --- a/lib/std/c/haiku.zig +++ b/lib/std/c/haiku.zig @@ -742,7 +742,7 @@ const NSIG = 32; /// Renamed from `sigaction` to `Sigaction` to avoid conflict with the syscall. pub const Sigaction = extern struct { - pub const handler_fn = std.meta.FnPtr(fn (i32) align(1) callconv(.C) void); + pub const handler_fn = *const fn (i32) align(1) callconv(.C) void; /// signal handler __sigaction_u: extern union { diff --git a/lib/std/c/linux.zig b/lib/std/c/linux.zig index 8f551381ddd9a9f0f485c62844aec21c031ca8ea..cfdf5dfc457747ef7cd38d13ec4bb6df154d1e56 100644 --- a/lib/std/c/linux.zig +++ b/lib/std/c/linux.zig @@ -263,7 +263,7 @@ pub extern "c" fn inotify_rm_watch(fd: fd_t, wd: c_int) c_int; /// See std.elf for constants for this pub extern "c" fn getauxval(__type: c_ulong) c_ulong; -pub const dl_iterate_phdr_callback = std.meta.FnPtr(fn (info: *dl_phdr_info, size: usize, data: ?*anyopaque) callconv(.C) c_int); +pub const dl_iterate_phdr_callback = *const fn (info: *dl_phdr_info, size: usize, data: ?*anyopaque) callconv(.C) c_int; pub extern "c" fn dl_iterate_phdr(callback: dl_iterate_phdr_callback, data: ?*anyopaque) c_int; diff --git a/lib/std/c/netbsd.zig b/lib/std/c/netbsd.zig index 81eb56ef381a5b0fd6270845443d8a3d59f22df2..d9bf925c17ca7a07fb2332d84ddad71bf5495b96 100644 --- a/lib/std/c/netbsd.zig +++ b/lib/std/c/netbsd.zig @@ -9,7 +9,7 @@ const rusage = std.c.rusage; extern "c" fn __errno() *c_int; pub const _errno = __errno; -pub const dl_iterate_phdr_callback = std.meta.FnPtr(fn (info: *dl_phdr_info, size: usize, data: ?*anyopaque) callconv(.C) c_int); +pub const dl_iterate_phdr_callback = *const fn (info: *dl_phdr_info, size: usize, data: ?*anyopaque) callconv(.C) c_int; pub extern "c" fn dl_iterate_phdr(callback: dl_iterate_phdr_callback, data: ?*anyopaque) c_int; pub extern "c" fn _lwp_self() lwpid_t; @@ -971,8 +971,8 @@ pub const SIG = struct { /// Renamed from `sigaction` to `Sigaction` to avoid conflict with the syscall. pub const Sigaction = extern struct { - pub const handler_fn = std.meta.FnPtr(fn (c_int) align(1) callconv(.C) void); - pub const sigaction_fn = std.meta.FnPtr(fn (c_int, *const siginfo_t, ?*const anyopaque) callconv(.C) void); + pub const handler_fn = *const fn (c_int) align(1) callconv(.C) void; + pub const sigaction_fn = *const fn (c_int, *const siginfo_t, ?*const anyopaque) callconv(.C) void; /// signal handler handler: extern union { diff --git a/lib/std/c/openbsd.zig b/lib/std/c/openbsd.zig index 1c2076866bfb1fd73748f715b69a37297d35d4f0..83aed68483f7e7a6ec600bb70a5afdff23d48fd7 100644 --- a/lib/std/c/openbsd.zig +++ b/lib/std/c/openbsd.zig @@ -7,7 +7,7 @@ const iovec_const = std.os.iovec_const; extern "c" fn __errno() *c_int; pub const _errno = __errno; -pub const dl_iterate_phdr_callback = std.meta.FnPtr(fn (info: *dl_phdr_info, size: usize, data: ?*anyopaque) callconv(.C) c_int); +pub const dl_iterate_phdr_callback = *const fn (info: *dl_phdr_info, size: usize, data: ?*anyopaque) callconv(.C) c_int; pub extern "c" fn dl_iterate_phdr(callback: dl_iterate_phdr_callback, data: ?*anyopaque) c_int; pub extern "c" fn arc4random_buf(buf: [*]u8, len: usize) void; @@ -1026,8 +1026,8 @@ pub const SIG = struct { /// Renamed from `sigaction` to `Sigaction` to avoid conflict with the syscall. pub const Sigaction = extern struct { - pub const handler_fn = std.meta.FnPtr(fn (c_int) align(1) callconv(.C) void); - pub const sigaction_fn = std.meta.FnPtr(fn (c_int, *const siginfo_t, ?*const anyopaque) callconv(.C) void); + pub const handler_fn = *const fn (c_int) align(1) callconv(.C) void; + pub const sigaction_fn = *const fn (c_int, *const siginfo_t, ?*const anyopaque) callconv(.C) void; /// signal handler handler: extern union { diff --git a/lib/std/c/solaris.zig b/lib/std/c/solaris.zig index 26244b01c9b2070a1217dd5cba921c5af863e453..cbeeb5fb429a4d7e576ddf12219ea692b305a14e 100644 --- a/lib/std/c/solaris.zig +++ b/lib/std/c/solaris.zig @@ -8,7 +8,7 @@ const timezone = std.c.timezone; extern "c" fn ___errno() *c_int; pub const _errno = ___errno; -pub const dl_iterate_phdr_callback = std.meta.FnPtr(fn (info: *dl_phdr_info, size: usize, data: ?*anyopaque) callconv(.C) c_int); +pub const dl_iterate_phdr_callback = *const fn (info: *dl_phdr_info, size: usize, data: ?*anyopaque) callconv(.C) c_int; pub extern "c" fn dl_iterate_phdr(callback: dl_iterate_phdr_callback, data: ?*anyopaque) c_int; pub extern "c" fn getdents(fd: c_int, buf_ptr: [*]u8, nbytes: usize) usize; @@ -952,8 +952,8 @@ pub const SIG = struct { /// Renamed from `sigaction` to `Sigaction` to avoid conflict with the syscall. pub const Sigaction = extern struct { - pub const handler_fn = std.meta.FnPtr(fn (c_int) align(1) callconv(.C) void); - pub const sigaction_fn = std.meta.FnPtr(fn (c_int, *const siginfo_t, ?*const anyopaque) callconv(.C) void); + pub const handler_fn = *const fn (c_int) align(1) callconv(.C) void; + pub const sigaction_fn = *const fn (c_int, *const siginfo_t, ?*const anyopaque) callconv(.C) void; /// signal options flags: c_uint, diff --git a/lib/std/compress/deflate/compressor.zig b/lib/std/compress/deflate/compressor.zig index 32ecbdb3d877d0d52458d8fc3675d07aa8d12bbf..653c270f54691c4a82a169622b18d49c39b13a1d 100644 --- a/lib/std/compress/deflate/compressor.zig +++ b/lib/std/compress/deflate/compressor.zig @@ -254,7 +254,7 @@ pub fn Compressor(comptime WriterType: anytype) type { // Inner writer wrapped in a HuffmanBitWriter hm_bw: hm_bw.HuffmanBitWriter(WriterType) = undefined, - bulk_hasher: std.meta.FnPtr(fn ([]u8, []u32) u32), + bulk_hasher: *const fn ([]u8, []u32) u32, sync: bool, // requesting flush best_speed_enc: *fast.DeflateFast, // Encoder for best_speed diff --git a/lib/std/compress/deflate/compressor_test.zig b/lib/std/compress/deflate/compressor_test.zig index 4f8efd0d6e79c8ddda7568ed14940f551cff8c06..51f459cd65790ad6ec0c6dfabf26b872cae5f50b 100644 --- a/lib/std/compress/deflate/compressor_test.zig +++ b/lib/std/compress/deflate/compressor_test.zig @@ -133,7 +133,8 @@ fn testToFromWithLevelAndLimit(level: deflate.Compression, input: []const u8, li try expect(read == input.len); try expect(mem.eql(u8, input, decompressed)); - if (builtin.zig_backend == .stage1) { + if (false) { + // TODO: this test has regressed try testSync(level, input); } } diff --git a/lib/std/compress/deflate/decompressor.zig b/lib/std/compress/deflate/decompressor.zig index 37f45f1272c5e1660915f82c3df8c21aaa47771d..c8d8e07bbcda169fe6e5428c266a6ba6fae2eaf1 100644 --- a/lib/std/compress/deflate/decompressor.zig +++ b/lib/std/compress/deflate/decompressor.zig @@ -334,7 +334,7 @@ pub fn Decompressor(comptime ReaderType: type) type { // Next step in the decompression, // and decompression state. - step: std.meta.FnPtr(fn (*Self) Error!void), + step: *const fn (*Self) Error!void, step_state: DecompressorState, final: bool, err: ?Error, @@ -479,12 +479,6 @@ pub fn Decompressor(comptime ReaderType: type) type { } pub fn close(self: *Self) ?Error { - if (@import("builtin").zig_backend == .stage1) { - if (self.err == Error.EndOfStreamWithNoError) { - return null; - } - return self.err; - } if (self.err == @as(?Error, error.EndOfStreamWithNoError)) { return null; } diff --git a/lib/std/dwarf.zig b/lib/std/dwarf.zig index c307cdb733a3f47b20715fc256afdcde45e9915d..a6f38db4372856a56a47d95525dbf99baa711767 100644 --- a/lib/std/dwarf.zig +++ b/lib/std/dwarf.zig @@ -638,7 +638,7 @@ fn parseFormValue(allocator: mem.Allocator, in_stream: anytype, form_id: u64, en FORM.line_strp => FormValue{ .LineStrPtr = try readAddress(in_stream, endian, is_64) }, FORM.indirect => { const child_form_id = try nosuspend leb.readULEB128(u64, in_stream); - if (builtin.zig_backend != .stage1) { + if (true) { return parseFormValue(allocator, in_stream, child_form_id, endian, is_64); } const F = @TypeOf(async parseFormValue(allocator, in_stream, child_form_id, endian, is_64)); diff --git a/lib/std/event/batch.zig b/lib/std/event/batch.zig index ba50d4bee5ab13d0ec48c382c70e9d85b0270e7b..f5e3d393d40f17ad7db4a96576c3d8436d768a13 100644 --- a/lib/std/event/batch.zig +++ b/lib/std/event/batch.zig @@ -109,7 +109,7 @@ pub fn Batch( } test "std.event.Batch" { - if (@import("builtin").zig_backend != .stage1) return error.SkipZigTest; + if (true) return error.SkipZigTest; var count: usize = 0; var batch = Batch(void, 2, .auto_async).init(); batch.add(&async sleepALittle(&count)); diff --git a/lib/std/event/loop.zig b/lib/std/event/loop.zig index 7350a06607c97bcd5694375ab586c06cb58d73d6..78ecb8c600fbd22de1b657aa32c4a4bfa2d3ea27 100644 --- a/lib/std/event/loop.zig +++ b/lib/std/event/loop.zig @@ -1469,7 +1469,7 @@ pub const Loop = struct { .Cancelled => continue, } if (overlapped) |o| break o; - } else unreachable; // TODO else unreachable should not be necessary + }; const resume_node = @fieldParentPtr(ResumeNode, "overlapped", overlapped); const handle = resume_node.handle; const resume_node_id = resume_node.id; diff --git a/lib/std/fmt.zig b/lib/std/fmt.zig index ac7f88ca9decde78aca05b217271b2198b804be3..ae97b76124c6133266696440fe597c8f45d83371 100644 --- a/lib/std/fmt.zig +++ b/lib/std/fmt.zig @@ -2209,7 +2209,7 @@ test "pointer" { try expectFmt("pointer: i32@deadbeef\n", "pointer: {}\n", .{value}); try expectFmt("pointer: i32@deadbeef\n", "pointer: {*}\n", .{value}); } - const FnPtr = if (builtin.zig_backend == .stage1) fn () void else *align(1) const fn () void; + const FnPtr = *align(1) const fn () void; { const value = @intToPtr(FnPtr, 0xdeadbeef); try expectFmt("pointer: fn() void@deadbeef\n", "pointer: {}\n", .{value}); @@ -2266,10 +2266,6 @@ test "struct" { } test "enum" { - if (builtin.zig_backend == .stage1) { - // stage1 starts the typename with 'std' which might also be desireable for stage2 - return error.SkipZigTest; - } const Enum = enum { One, Two, @@ -2285,10 +2281,6 @@ test "enum" { } test "non-exhaustive enum" { - if (builtin.zig_backend == .stage1) { - // stage1 fails to return fully qualified namespaces. - return error.SkipZigTest; - } const Enum = enum(u16) { One = 0x000f, Two = 0xbeef, @@ -2462,10 +2454,6 @@ test "custom" { } test "struct" { - if (builtin.zig_backend == .stage1) { - // stage1 fails to return fully qualified namespaces. - return error.SkipZigTest; - } const S = struct { a: u32, b: anyerror, @@ -2484,10 +2472,6 @@ test "struct" { } test "union" { - if (builtin.zig_backend == .stage1) { - // stage1 fails to return fully qualified namespaces. - return error.SkipZigTest; - } const TU = union(enum) { float: f32, int: u32, @@ -2518,10 +2502,6 @@ test "union" { } test "enum" { - if (builtin.zig_backend == .stage1) { - // stage1 fails to return fully qualified namespaces. - return error.SkipZigTest; - } const E = enum { One, Two, @@ -2534,10 +2514,6 @@ test "enum" { } test "struct.self-referential" { - if (builtin.zig_backend == .stage1) { - // stage1 fails to return fully qualified namespaces. - return error.SkipZigTest; - } const S = struct { const SelfType = @This(); a: ?*SelfType, @@ -2552,10 +2528,6 @@ test "struct.self-referential" { } test "struct.zero-size" { - if (builtin.zig_backend == .stage1) { - // stage1 fails to return fully qualified namespaces. - return error.SkipZigTest; - } const A = struct { fn foo() void {} }; @@ -2633,10 +2605,6 @@ test "formatFloatValue with comptime_float" { } test "formatType max_depth" { - if (builtin.zig_backend == .stage1) { - // stage1 fails to return fully qualified namespaces. - return error.SkipZigTest; - } const Vec2 = struct { const SelfType = @This(); x: f32, @@ -2724,12 +2692,6 @@ test "vector" { return error.SkipZigTest; } - if (builtin.zig_backend == .stage1) { - // Regressed in LLVM 14: - // https://github.com/llvm/llvm-project/issues/55522 - return error.SkipZigTest; - } - const vbool: @Vector(4, bool) = [_]bool{ true, false, true, false }; const vi64: @Vector(4, i64) = [_]i64{ -2, -1, 0, 1 }; const vu64: @Vector(4, u64) = [_]u64{ 1000, 2000, 3000, 4000 }; diff --git a/lib/std/fmt/parse_float.zig b/lib/std/fmt/parse_float.zig index 2f30c30f237bd74875f172bec8f0f28071d65b7b..427ac727c9fb3e5801e002903c313ee63a309e9a 100644 --- a/lib/std/fmt/parse_float.zig +++ b/lib/std/fmt/parse_float.zig @@ -70,9 +70,7 @@ test "fmt.parseFloat" { } test "fmt.parseFloat nan and inf" { - if ((builtin.zig_backend == .stage1 or builtin.zig_backend == .stage2_llvm) and - builtin.cpu.arch == .aarch64) - { + if (builtin.zig_backend == .stage2_llvm and builtin.cpu.arch == .aarch64) { // https://github.com/ziglang/zig/issues/12027 return error.SkipZigTest; } diff --git a/lib/std/json.zig b/lib/std/json.zig index 5a40278e52c20ca5593b3e6818e8004648f7aacb..17fc13b0dc2f8434736070d14c4d9719aabb9ee4 100644 --- a/lib/std/json.zig +++ b/lib/std/json.zig @@ -2373,10 +2373,7 @@ pub fn stringifyAlloc(allocator: std.mem.Allocator, value: anytype, options: Str } test { - if (builtin.zig_backend != .stage1) { - // https://github.com/ziglang/zig/issues/8442 - _ = @import("json/test.zig"); - } + _ = @import("json/test.zig"); _ = @import("json/write_stream.zig"); } diff --git a/lib/std/leb128.zig b/lib/std/leb128.zig index 8e3a007849c578c067b6c3d1451d5d5ffb98db96..188f9d219af570a39a60ad1daf5b0c522d75e364 100644 --- a/lib/std/leb128.zig +++ b/lib/std/leb128.zig @@ -347,9 +347,7 @@ fn test_write_leb128(value: anytype) !void { } test "serialize unsigned LEB128" { - if ((builtin.zig_backend == .stage1 or builtin.zig_backend == .stage2_llvm) and - builtin.cpu.arch == .riscv64) - { + if (builtin.zig_backend == .stage2_llvm and builtin.cpu.arch == .riscv64) { // https://github.com/ziglang/zig/issues/12031 return error.SkipZigTest; } @@ -368,9 +366,7 @@ test "serialize unsigned LEB128" { } test "serialize signed LEB128" { - if ((builtin.zig_backend == .stage1 or builtin.zig_backend == .stage2_llvm) and - builtin.cpu.arch == .riscv64) - { + if (builtin.zig_backend == .stage2_llvm and builtin.cpu.arch == .riscv64) { // https://github.com/ziglang/zig/issues/12031 return error.SkipZigTest; } diff --git a/lib/std/math.zig b/lib/std/math.zig index 804fc87e95002c24081c5d00a8d93fd886eda904..fdc82257090ee2dc2bba8e0776d84de34e9739c1 100644 --- a/lib/std/math.zig +++ b/lib/std/math.zig @@ -528,9 +528,7 @@ pub fn shl(comptime T: type, a: T, shift_amt: anytype) T { } test "shl" { - if ((builtin.zig_backend == .stage1 or builtin.zig_backend == .stage2_llvm) and - builtin.cpu.arch == .aarch64) - { + if (builtin.zig_backend == .stage2_llvm and builtin.cpu.arch == .aarch64) { // https://github.com/ziglang/zig/issues/12012 return error.SkipZigTest; } @@ -574,9 +572,7 @@ pub fn shr(comptime T: type, a: T, shift_amt: anytype) T { } test "shr" { - if ((builtin.zig_backend == .stage1 or builtin.zig_backend == .stage2_llvm) and - builtin.cpu.arch == .aarch64) - { + if (builtin.zig_backend == .stage2_llvm and builtin.cpu.arch == .aarch64) { // https://github.com/ziglang/zig/issues/12012 return error.SkipZigTest; } @@ -621,9 +617,7 @@ pub fn rotr(comptime T: type, x: T, r: anytype) T { } test "rotr" { - if ((builtin.zig_backend == .stage1 or builtin.zig_backend == .stage2_llvm) and - builtin.cpu.arch == .aarch64) - { + if (builtin.zig_backend == .stage2_llvm and builtin.cpu.arch == .aarch64) { // https://github.com/ziglang/zig/issues/12012 return error.SkipZigTest; } @@ -667,9 +661,7 @@ pub fn rotl(comptime T: type, x: T, r: anytype) T { } test "rotl" { - if ((builtin.zig_backend == .stage1 or builtin.zig_backend == .stage2_llvm) and - builtin.cpu.arch == .aarch64) - { + if (builtin.zig_backend == .stage2_llvm and builtin.cpu.arch == .aarch64) { // https://github.com/ziglang/zig/issues/12012 return error.SkipZigTest; } @@ -1695,7 +1687,7 @@ fn testSign() !void { } test "sign" { - if (builtin.zig_backend == .stage1 or builtin.zig_backend == .stage2_llvm) { + if (builtin.zig_backend == .stage2_llvm) { // https://github.com/ziglang/zig/issues/12012 return error.SkipZigTest; } diff --git a/lib/std/mem.zig b/lib/std/mem.zig index 0956ddfb25e9fd68c07b388d6db79aecf926b7c5..16ee56b74f52c278291ff3784ef8d243e227906b 100644 --- a/lib/std/mem.zig +++ b/lib/std/mem.zig @@ -322,7 +322,7 @@ pub fn zeroes(comptime T: type) T { } test "zeroes" { - if (builtin.zig_backend == .stage1 or builtin.zig_backend == .stage2_llvm) { + if (builtin.zig_backend == .stage2_llvm) { // Regressed in LLVM 14: // https://github.com/llvm/llvm-project/issues/55522 return error.SkipZigTest; @@ -3187,8 +3187,6 @@ pub fn asBytes(ptr: anytype) AsBytesReturnType(@TypeOf(ptr)) { } test "asBytes" { - if (builtin.zig_backend == .stage1) return error.SkipZigTest; - const deadbeef = @as(u32, 0xDEADBEEF); const deadbeef_bytes = switch (native_endian) { .Big => "\xDE\xAD\xBE\xEF", @@ -3282,8 +3280,6 @@ pub fn bytesAsValue(comptime T: type, bytes: anytype) BytesAsValueReturnType(T, } test "bytesAsValue" { - if (builtin.zig_backend == .stage1) return error.SkipZigTest; - const deadbeef = @as(u32, 0xDEADBEEF); const deadbeef_bytes = switch (native_endian) { .Big => "\xDE\xAD\xBE\xEF", @@ -3485,8 +3481,6 @@ test "sliceAsBytes with sentinel slice" { } test "sliceAsBytes packed struct at runtime and comptime" { - if (builtin.zig_backend == .stage1) return error.SkipZigTest; - const Foo = packed struct { a: u4, b: u4, diff --git a/lib/std/mem/Allocator.zig b/lib/std/mem/Allocator.zig index 060d42c74afb178e3ad0db57a322d5ae9ab66bf3..3e8d5461f6e5d05a897c3634aa333430b8cc7042 100644 --- a/lib/std/mem/Allocator.zig +++ b/lib/std/mem/Allocator.zig @@ -20,7 +20,7 @@ pub const VTable = struct { /// `ret_addr` is optionally provided as the first return address of the /// allocation call stack. If the value is `0` it means no return address /// has been provided. - alloc: std.meta.FnPtr(fn (ctx: *anyopaque, len: usize, ptr_align: u8, ret_addr: usize) ?[*]u8), + alloc: *const fn (ctx: *anyopaque, len: usize, ptr_align: u8, ret_addr: usize) ?[*]u8, /// Attempt to expand or shrink memory in place. `buf.len` must equal the /// length requested from the most recent successful call to `alloc` or @@ -37,7 +37,7 @@ pub const VTable = struct { /// `ret_addr` is optionally provided as the first return address of the /// allocation call stack. If the value is `0` it means no return address /// has been provided. - resize: std.meta.FnPtr(fn (ctx: *anyopaque, buf: []u8, buf_align: u8, new_len: usize, ret_addr: usize) bool), + resize: *const fn (ctx: *anyopaque, buf: []u8, buf_align: u8, new_len: usize, ret_addr: usize) bool, /// Free and invalidate a buffer. /// @@ -50,7 +50,7 @@ pub const VTable = struct { /// `ret_addr` is optionally provided as the first return address of the /// allocation call stack. If the value is `0` it means no return address /// has been provided. - free: std.meta.FnPtr(fn (ctx: *anyopaque, buf: []u8, buf_align: u8, ret_addr: usize) void), + free: *const fn (ctx: *anyopaque, buf: []u8, buf_align: u8, ret_addr: usize) void, }; pub fn noResize( diff --git a/lib/std/meta.zig b/lib/std/meta.zig index cdfb16806fcdf2d07239d2dcfe6f057ccaf6b595..b2fd10107b8389f79c8a622f8785237e2d73e0bb 100644 --- a/lib/std/meta.zig +++ b/lib/std/meta.zig @@ -361,11 +361,7 @@ pub fn assumeSentinel(p: anytype, comptime sentinel_val: Elem(@TypeOf(p))) Senti const ReturnType = Sentinel(T, sentinel_val); switch (@typeInfo(T)) { .Pointer => |info| switch (info.size) { - .Slice => if (@import("builtin").zig_backend == .stage1) - return @bitCast(ReturnType, p) - else - return @ptrCast(ReturnType, p), - .Many, .One => return @ptrCast(ReturnType, p), + .Slice, .Many, .One => return @ptrCast(ReturnType, p), .C => {}, }, .Optional => |info| switch (@typeInfo(info.child)) { @@ -658,8 +654,6 @@ pub fn FieldEnum(comptime T: type) type { const field_infos = fields(T); if (field_infos.len == 0) { - // TODO simplify when stage1 is removed - if (@import("builtin").zig_backend == .stage1) @compileError("stage1 doesn't allow empty enums"); return @Type(.{ .Enum = .{ .layout = .Auto, @@ -742,9 +736,7 @@ fn expectEqualEnum(expected: anytype, actual: @TypeOf(expected)) !void { } test "std.meta.FieldEnum" { - if (comptime @import("builtin").zig_backend != .stage1) { - try expectEqualEnum(enum {}, FieldEnum(struct {})); - } + try expectEqualEnum(enum {}, FieldEnum(struct {})); try expectEqualEnum(enum { a }, FieldEnum(struct { a: u8 })); try expectEqualEnum(enum { a, b, c }, FieldEnum(struct { a: u8, b: void, c: f32 })); try expectEqualEnum(enum { a, b, c }, FieldEnum(union { a: u8, b: void, c: f32 })); @@ -1239,27 +1231,3 @@ test "isError" { try std.testing.expect(isError(math.absInt(@as(i8, -128)))); try std.testing.expect(!isError(math.absInt(@as(i8, -127)))); } - -/// This function returns a function pointer for a given function signature. -/// It's a helper to make code compatible to both stage1 and stage2. -/// -/// **WARNING:** This function is deprecated and will be removed together with stage1. -pub fn FnPtr(comptime Fn: type) type { - return if (@import("builtin").zig_backend != .stage1) - *const Fn - else - Fn; -} - -test "FnPtr" { - var func: FnPtr(fn () i64) = undefined; - - // verify that we can perform runtime exchange - // and not have a function body in stage2: - - func = std.time.timestamp; - _ = func(); - - func = std.time.milliTimestamp; - _ = func(); -} diff --git a/lib/std/multi_array_list.zig b/lib/std/multi_array_list.zig index f0b4dac1069c48feae8ba4c3fd64452d6e31d1c1..e05b87c0be7859a338d267db4ceefdb30a73c4b3 100644 --- a/lib/std/multi_array_list.zig +++ b/lib/std/multi_array_list.zig @@ -90,13 +90,12 @@ pub fn MultiArrayList(comptime S: type) type { }; } const Sort = struct { - fn lessThan(trash: *i32, lhs: Data, rhs: Data) bool { - _ = trash; + fn lessThan(context: void, lhs: Data, rhs: Data) bool { + _ = context; return lhs.alignment > rhs.alignment; } }; - var trash: i32 = undefined; // workaround for stage1 compiler bug - std.sort.sort(Data, &data, &trash, Sort.lessThan); + std.sort.sort(Data, &data, {}, Sort.lessThan); var sizes_bytes: [fields.len]usize = undefined; var field_indexes: [fields.len]usize = undefined; for (data) |elem, i| { diff --git a/lib/std/os.zig b/lib/std/os.zig index fc021be954e3e44279f9e678aa670464acf5512e..f13ee03a967df2899aed1b935dd12975f5d07332 100644 --- a/lib/std/os.zig +++ b/lib/std/os.zig @@ -3621,7 +3621,7 @@ pub fn accept( else => |err| return unexpectedErrno(err), } } - } else unreachable; + }; if (!have_accept4) { try setSockFlags(accepted_sock, flags); @@ -5360,7 +5360,7 @@ pub fn toPosixPath(file_path: []const u8) ![MAX_PATH_BYTES - 1:0]u8 { /// if this happens the fix is to add the error code to the corresponding /// switch expression, possibly introduce a new error in the error set, and /// send a patch to Zig. -pub const unexpected_error_tracing = (builtin.zig_backend == .stage1 or builtin.zig_backend == .stage2_llvm) and builtin.mode == .Debug; +pub const unexpected_error_tracing = builtin.zig_backend == .stage2_llvm and builtin.mode == .Debug; pub const UnexpectedError = error{ /// The Operating System returned an undocumented error code. diff --git a/lib/std/os/linux.zig b/lib/std/os/linux.zig index f7da87ed5f333ead04cb2b4c512d21887f476ddd..a001af709c36563a533509ed91f79d61c9a850a1 100644 --- a/lib/std/os/linux.zig +++ b/lib/std/os/linux.zig @@ -936,16 +936,10 @@ pub fn flock(fd: fd_t, operation: i32) usize { return syscall2(.flock, @bitCast(usize, @as(isize, fd)), @bitCast(usize, @as(isize, operation))); } -var vdso_clock_gettime = if (builtin.zig_backend == .stage1) - @ptrCast(?*const anyopaque, init_vdso_clock_gettime) -else - @ptrCast(?*const anyopaque, &init_vdso_clock_gettime); +var vdso_clock_gettime = @ptrCast(?*const anyopaque, &init_vdso_clock_gettime); // We must follow the C calling convention when we call into the VDSO -const vdso_clock_gettime_ty = if (builtin.zig_backend == .stage1) - fn (i32, *timespec) callconv(.C) usize -else - *align(1) const fn (i32, *timespec) callconv(.C) usize; +const vdso_clock_gettime_ty = *align(1) const fn (i32, *timespec) callconv(.C) usize; pub fn clock_gettime(clk_id: i32, tp: *timespec) usize { if (@hasDecl(VDSO, "CGT_SYM")) { @@ -1151,8 +1145,8 @@ pub fn sigaction(sig: u6, noalias act: ?*const Sigaction, noalias oact: ?*Sigact const mask_size = @sizeOf(@TypeOf(ksa.mask)); if (act) |new| { - const restore_rt_ptr = if (builtin.zig_backend == .stage1) restore_rt else &restore_rt; - const restore_ptr = if (builtin.zig_backend == .stage1) restore else &restore; + const restore_rt_ptr = &restore_rt; + const restore_ptr = &restore; const restorer_fn = if ((new.flags & SA.SIGINFO) != 0) restore_rt_ptr else restore_ptr; ksa = k_sigaction{ .handler = new.handler.handler, @@ -3145,8 +3139,8 @@ pub const all_mask: sigset_t = [_]u32{0xffffffff} ** @typeInfo(sigset_t).Array.l pub const app_mask: sigset_t = [2]u32{ 0xfffffffc, 0x7fffffff } ++ [_]u32{0xffffffff} ** 30; const k_sigaction_funcs = struct { - const handler = ?std.meta.FnPtr(fn (c_int) align(1) callconv(.C) void); - const restorer = std.meta.FnPtr(fn () callconv(.C) void); + const handler = ?*const fn (c_int) align(1) callconv(.C) void; + const restorer = *const fn () callconv(.C) void; }; pub const k_sigaction = switch (native_arch) { @@ -3172,8 +3166,8 @@ pub const k_sigaction = switch (native_arch) { /// Renamed from `sigaction` to `Sigaction` to avoid conflict with the syscall. pub const Sigaction = extern struct { - pub const handler_fn = std.meta.FnPtr(fn (c_int) align(1) callconv(.C) void); - pub const sigaction_fn = std.meta.FnPtr(fn (c_int, *const siginfo_t, ?*const anyopaque) callconv(.C) void); + pub const handler_fn = *const fn (c_int) align(1) callconv(.C) void; + pub const sigaction_fn = *const fn (c_int, *const siginfo_t, ?*const anyopaque) callconv(.C) void; handler: extern union { handler: ?handler_fn, @@ -3181,7 +3175,7 @@ pub const Sigaction = extern struct { }, mask: sigset_t, flags: c_uint, - restorer: ?std.meta.FnPtr(fn () callconv(.C) void) = null, + restorer: ?*const fn () callconv(.C) void = null, }; pub const empty_sigset = [_]u32{0} ** @typeInfo(sigset_t).Array.len; @@ -3314,25 +3308,12 @@ pub const epoll_data = extern union { u64: u64, }; -pub const epoll_event = switch (builtin.zig_backend) { - // stage1 crashes with the align(4) field so we have this workaround - .stage1 => switch (native_arch) { - .x86_64 => packed struct { - events: u32, - data: epoll_data, - }, - else => extern struct { - events: u32, - data: epoll_data, - }, - }, - else => extern struct { - events: u32, - data: epoll_data align(switch (native_arch) { - .x86_64 => 4, - else => @alignOf(epoll_data), - }), - }, +pub const epoll_event = extern struct { + events: u32, + data: epoll_data align(switch (native_arch) { + .x86_64 => 4, + else => @alignOf(epoll_data), + }), }; pub const VFS_CAP_REVISION_MASK = 0xFF000000; diff --git a/lib/std/os/linux/arm-eabi.zig b/lib/std/os/linux/arm-eabi.zig index 31327ac892cc62208f762983dec99309539f22ba..92d0fcfb440b71aa510f82dfb8a3906c9c777b17 100644 --- a/lib/std/os/linux/arm-eabi.zig +++ b/lib/std/os/linux/arm-eabi.zig @@ -98,7 +98,7 @@ pub fn syscall6( ); } -const CloneFn = std.meta.FnPtr(fn (arg: usize) callconv(.C) u8); +const CloneFn = *const fn (arg: usize) callconv(.C) u8; /// This matches the libc clone function. pub extern fn clone(func: CloneFn, stack: usize, flags: u32, arg: usize, ptid: *i32, tls: usize, ctid: *i32) usize; diff --git a/lib/std/os/linux/arm64.zig b/lib/std/os/linux/arm64.zig index c3b9f09028e8a5bed25a08bf71a6a4e6dbc9b560..9f91960791508e538760312957cce765708e671d 100644 --- a/lib/std/os/linux/arm64.zig +++ b/lib/std/os/linux/arm64.zig @@ -98,7 +98,7 @@ pub fn syscall6( ); } -const CloneFn = std.meta.FnPtr(fn (arg: usize) callconv(.C) u8); +const CloneFn = *const fn (arg: usize) callconv(.C) u8; /// This matches the libc clone function. pub extern fn clone(func: CloneFn, stack: usize, flags: u32, arg: usize, ptid: *i32, tls: usize, ctid: *i32) usize; diff --git a/lib/std/os/linux/mips.zig b/lib/std/os/linux/mips.zig index 2e4c4fb87b6ef4a2c2767a52d72f2339c24bce3c..66d204dfe132fa0f848d852100933ca3e2ef6694 100644 --- a/lib/std/os/linux/mips.zig +++ b/lib/std/os/linux/mips.zig @@ -190,7 +190,7 @@ pub fn syscall7( ); } -const CloneFn = std.meta.FnPtr(fn (arg: usize) callconv(.C) u8); +const CloneFn = *const fn (arg: usize) callconv(.C) u8; /// This matches the libc clone function. pub extern fn clone(func: CloneFn, stack: usize, flags: u32, arg: usize, ptid: *i32, tls: usize, ctid: *i32) usize; diff --git a/lib/std/os/linux/powerpc.zig b/lib/std/os/linux/powerpc.zig index bd6507fb08ac25457e385cf5aa9b205bcb06adc1..6d2d408adf90fa9202c4f21c4f5139ed4400c03e 100644 --- a/lib/std/os/linux/powerpc.zig +++ b/lib/std/os/linux/powerpc.zig @@ -126,7 +126,7 @@ pub fn syscall6( ); } -const CloneFn = std.meta.FnPtr(fn (arg: usize) callconv(.C) u8); +const CloneFn = *const fn (arg: usize) callconv(.C) u8; /// This matches the libc clone function. pub extern fn clone(func: CloneFn, stack: usize, flags: usize, arg: usize, ptid: *i32, tls: usize, ctid: *i32) usize; diff --git a/lib/std/os/linux/powerpc64.zig b/lib/std/os/linux/powerpc64.zig index 5cac4d961c742b155ceb5fc0e867cb63bfa033b7..ab0da460d8fe7b99948d291a95ef289fd1d28a1e 100644 --- a/lib/std/os/linux/powerpc64.zig +++ b/lib/std/os/linux/powerpc64.zig @@ -126,7 +126,7 @@ pub fn syscall6( ); } -const CloneFn = std.meta.FnPtr(fn (arg: usize) callconv(.C) u8); +const CloneFn = *const fn (arg: usize) callconv(.C) u8; /// This matches the libc clone function. pub extern fn clone(func: CloneFn, stack: usize, flags: usize, arg: usize, ptid: *i32, tls: usize, ctid: *i32) usize; diff --git a/lib/std/os/linux/riscv64.zig b/lib/std/os/linux/riscv64.zig index d3325f5cfbc0ba7c18e2eec6dbb6836eeec4771f..627bb8498ec2cffcf5ad4a72b4a89f30f55afdc2 100644 --- a/lib/std/os/linux/riscv64.zig +++ b/lib/std/os/linux/riscv64.zig @@ -95,7 +95,7 @@ pub fn syscall6( ); } -const CloneFn = std.meta.FnPtr(fn (arg: usize) callconv(.C) u8); +const CloneFn = *const fn (arg: usize) callconv(.C) u8; pub extern fn clone(func: CloneFn, stack: usize, flags: u32, arg: usize, ptid: *i32, tls: usize, ctid: *i32) usize; diff --git a/lib/std/os/linux/sparc64.zig b/lib/std/os/linux/sparc64.zig index 948511cbe4a554871faccf42883b4589eba72286..ca1256cb2ee72afadf1d106549071642046f1938 100644 --- a/lib/std/os/linux/sparc64.zig +++ b/lib/std/os/linux/sparc64.zig @@ -178,7 +178,7 @@ pub fn syscall6( ); } -const CloneFn = std.meta.FnPtr(fn (arg: usize) callconv(.C) u8); +const CloneFn = *const fn (arg: usize) callconv(.C) u8; /// This matches the libc clone function. pub extern fn clone(func: CloneFn, stack: usize, flags: usize, arg: usize, ptid: *i32, tls: usize, ctid: *i32) usize; diff --git a/lib/std/os/linux/x86.zig b/lib/std/os/linux/x86.zig index 93570025191aecfecc5989b4a094e008963af259..6ad3c9fa31f65cc08fd0317a66e1f27818e00e2f 100644 --- a/lib/std/os/linux/x86.zig +++ b/lib/std/os/linux/x86.zig @@ -118,7 +118,7 @@ pub fn socketcall(call: usize, args: [*]usize) usize { ); } -const CloneFn = std.meta.FnPtr(fn (arg: usize) callconv(.C) u8); +const CloneFn = *const fn (arg: usize) callconv(.C) u8; /// This matches the libc clone function. pub extern fn clone(func: CloneFn, stack: usize, flags: u32, arg: usize, ptid: *i32, tls: usize, ctid: *i32) usize; diff --git a/lib/std/os/linux/x86_64.zig b/lib/std/os/linux/x86_64.zig index 90aae99082fa7f208bc8343657731a3f8d33e736..bc1bccf53fc067b532e6a2b6b81454ab21fc7ea6 100644 --- a/lib/std/os/linux/x86_64.zig +++ b/lib/std/os/linux/x86_64.zig @@ -100,7 +100,7 @@ pub fn syscall6( ); } -const CloneFn = std.meta.FnPtr(fn (arg: usize) callconv(.C) u8); +const CloneFn = *const fn (arg: usize) callconv(.C) u8; /// This matches the libc clone function. pub extern fn clone(func: CloneFn, stack: usize, flags: usize, arg: usize, ptid: *i32, tls: usize, ctid: *i32) usize; diff --git a/lib/std/os/test.zig b/lib/std/os/test.zig index 44d0e0c808914881330ae963d6b6aa99a8941463..1745466ba2b469d8467948a14cf4d8611cd829a1 100644 --- a/lib/std/os/test.zig +++ b/lib/std/os/test.zig @@ -785,10 +785,8 @@ test "sigaction" { } }; - const actual_handler = if (builtin.zig_backend == .stage1) S.handler else &S.handler; - var sa = os.Sigaction{ - .handler = .{ .sigaction = actual_handler }, + .handler = .{ .sigaction = &S.handler }, .mask = os.empty_sigset, .flags = os.SA.SIGINFO | os.SA.RESETHAND, }; @@ -799,7 +797,7 @@ test "sigaction" { // Check that we can read it back correctly. try os.sigaction(os.SIG.USR1, null, &old_sa); - try testing.expectEqual(actual_handler, old_sa.handler.sigaction.?); + try testing.expectEqual(&S.handler, old_sa.handler.sigaction.?); try testing.expect((old_sa.flags & os.SA.SIGINFO) != 0); // Invoke the handler. diff --git a/lib/std/os/uefi/protocols/absolute_pointer_protocol.zig b/lib/std/os/uefi/protocols/absolute_pointer_protocol.zig index d68132c8f01719672d4f7e41ebc33c8e5bcf5baf..ecf44eb26c93c8cf0a4936a3a16e7366972a1533 100644 --- a/lib/std/os/uefi/protocols/absolute_pointer_protocol.zig +++ b/lib/std/os/uefi/protocols/absolute_pointer_protocol.zig @@ -6,8 +6,8 @@ const Status = uefi.Status; /// Protocol for touchscreens pub const AbsolutePointerProtocol = extern struct { - _reset: std.meta.FnPtr(fn (*const AbsolutePointerProtocol, bool) callconv(.C) Status), - _get_state: std.meta.FnPtr(fn (*const AbsolutePointerProtocol, *AbsolutePointerState) callconv(.C) Status), + _reset: *const fn (*const AbsolutePointerProtocol, bool) callconv(.C) Status, + _get_state: *const fn (*const AbsolutePointerProtocol, *AbsolutePointerState) callconv(.C) Status, wait_for_input: Event, mode: *AbsolutePointerMode, diff --git a/lib/std/os/uefi/protocols/block_io_protocol.zig b/lib/std/os/uefi/protocols/block_io_protocol.zig index 7a6a7fc8c669b29d8acaf534e4299f247672c7cb..ce5069d19f09632a76a290f9c43f2eba5f0f43de 100644 --- a/lib/std/os/uefi/protocols/block_io_protocol.zig +++ b/lib/std/os/uefi/protocols/block_io_protocol.zig @@ -44,10 +44,10 @@ pub const BlockIoProtocol = extern struct { revision: u64, media: *EfiBlockMedia, - _reset: std.meta.FnPtr(fn (*BlockIoProtocol, extended_verification: bool) callconv(.C) Status), - _read_blocks: std.meta.FnPtr(fn (*BlockIoProtocol, media_id: u32, lba: u64, buffer_size: usize, buf: [*]u8) callconv(.C) Status), - _write_blocks: std.meta.FnPtr(fn (*BlockIoProtocol, media_id: u32, lba: u64, buffer_size: usize, buf: [*]u8) callconv(.C) Status), - _flush_blocks: std.meta.FnPtr(fn (*BlockIoProtocol) callconv(.C) Status), + _reset: *const fn (*BlockIoProtocol, extended_verification: bool) callconv(.C) Status, + _read_blocks: *const fn (*BlockIoProtocol, media_id: u32, lba: u64, buffer_size: usize, buf: [*]u8) callconv(.C) Status, + _write_blocks: *const fn (*BlockIoProtocol, media_id: u32, lba: u64, buffer_size: usize, buf: [*]u8) callconv(.C) Status, + _flush_blocks: *const fn (*BlockIoProtocol) callconv(.C) Status, /// Resets the block device hardware. pub fn reset(self: *Self, extended_verification: bool) Status { diff --git a/lib/std/os/uefi/protocols/edid_override_protocol.zig b/lib/std/os/uefi/protocols/edid_override_protocol.zig index 6e2fe3d832c423b01aedde1d83ca7895ad154736..bbae0563cc37f32f8c9591f27a318166e1835c75 100644 --- a/lib/std/os/uefi/protocols/edid_override_protocol.zig +++ b/lib/std/os/uefi/protocols/edid_override_protocol.zig @@ -6,7 +6,7 @@ const Status = uefi.Status; /// Override EDID information pub const EdidOverrideProtocol = extern struct { - _get_edid: std.meta.FnPtr(fn (*const EdidOverrideProtocol, Handle, *EdidOverrideProtocolAttributes, *usize, *?[*]u8) callconv(.C) Status), + _get_edid: *const fn (*const EdidOverrideProtocol, Handle, *EdidOverrideProtocolAttributes, *usize, *?[*]u8) callconv(.C) Status, /// Returns policy information and potentially a replacement EDID for the specified video output device. pub fn getEdid( diff --git a/lib/std/os/uefi/protocols/file_protocol.zig b/lib/std/os/uefi/protocols/file_protocol.zig index aa419093bf9287188d9d224f889678ef51ece2ee..729d4020b4d0a3e8ed870dca7951d3aa4f2ac16a 100644 --- a/lib/std/os/uefi/protocols/file_protocol.zig +++ b/lib/std/os/uefi/protocols/file_protocol.zig @@ -7,16 +7,16 @@ const Status = uefi.Status; pub const FileProtocol = extern struct { revision: u64, - _open: std.meta.FnPtr(fn (*const FileProtocol, **const FileProtocol, [*:0]const u16, u64, u64) callconv(.C) Status), - _close: std.meta.FnPtr(fn (*const FileProtocol) callconv(.C) Status), - _delete: std.meta.FnPtr(fn (*const FileProtocol) callconv(.C) Status), - _read: std.meta.FnPtr(fn (*const FileProtocol, *usize, [*]u8) callconv(.C) Status), - _write: std.meta.FnPtr(fn (*const FileProtocol, *usize, [*]const u8) callconv(.C) Status), - _get_position: std.meta.FnPtr(fn (*const FileProtocol, *u64) callconv(.C) Status), - _set_position: std.meta.FnPtr(fn (*const FileProtocol, u64) callconv(.C) Status), - _get_info: std.meta.FnPtr(fn (*const FileProtocol, *align(8) const Guid, *const usize, [*]u8) callconv(.C) Status), - _set_info: std.meta.FnPtr(fn (*const FileProtocol, *align(8) const Guid, usize, [*]const u8) callconv(.C) Status), - _flush: std.meta.FnPtr(fn (*const FileProtocol) callconv(.C) Status), + _open: *const fn (*const FileProtocol, **const FileProtocol, [*:0]const u16, u64, u64) callconv(.C) Status, + _close: *const fn (*const FileProtocol) callconv(.C) Status, + _delete: *const fn (*const FileProtocol) callconv(.C) Status, + _read: *const fn (*const FileProtocol, *usize, [*]u8) callconv(.C) Status, + _write: *const fn (*const FileProtocol, *usize, [*]const u8) callconv(.C) Status, + _get_position: *const fn (*const FileProtocol, *u64) callconv(.C) Status, + _set_position: *const fn (*const FileProtocol, u64) callconv(.C) Status, + _get_info: *const fn (*const FileProtocol, *align(8) const Guid, *const usize, [*]u8) callconv(.C) Status, + _set_info: *const fn (*const FileProtocol, *align(8) const Guid, usize, [*]const u8) callconv(.C) Status, + _flush: *const fn (*const FileProtocol) callconv(.C) Status, pub const SeekError = error{SeekError}; pub const GetSeekPosError = error{GetSeekPosError}; diff --git a/lib/std/os/uefi/protocols/graphics_output_protocol.zig b/lib/std/os/uefi/protocols/graphics_output_protocol.zig index d5f8541b4c3622860322a62e6cbdce68555e7ed5..3b1cb1f417dd4baf34e32fb486a859dc50912ae5 100644 --- a/lib/std/os/uefi/protocols/graphics_output_protocol.zig +++ b/lib/std/os/uefi/protocols/graphics_output_protocol.zig @@ -5,9 +5,9 @@ const Status = uefi.Status; /// Graphics output pub const GraphicsOutputProtocol = extern struct { - _query_mode: std.meta.FnPtr(fn (*const GraphicsOutputProtocol, u32, *usize, **GraphicsOutputModeInformation) callconv(.C) Status), - _set_mode: std.meta.FnPtr(fn (*const GraphicsOutputProtocol, u32) callconv(.C) Status), - _blt: std.meta.FnPtr(fn (*const GraphicsOutputProtocol, ?[*]GraphicsOutputBltPixel, GraphicsOutputBltOperation, usize, usize, usize, usize, usize, usize, usize) callconv(.C) Status), + _query_mode: *const fn (*const GraphicsOutputProtocol, u32, *usize, **GraphicsOutputModeInformation) callconv(.C) Status, + _set_mode: *const fn (*const GraphicsOutputProtocol, u32) callconv(.C) Status, + _blt: *const fn (*const GraphicsOutputProtocol, ?[*]GraphicsOutputBltPixel, GraphicsOutputBltOperation, usize, usize, usize, usize, usize, usize, usize) callconv(.C) Status, mode: *GraphicsOutputProtocolMode, /// Returns information for an available graphics mode that the graphics device and the set of active video output devices supports. diff --git a/lib/std/os/uefi/protocols/hii_database_protocol.zig b/lib/std/os/uefi/protocols/hii_database_protocol.zig index f7a979c5d110a7b6b967f9ae28f804b26fc003bc..7538d6afd14a13e86cc173ea6005b8e4e5d0d786 100644 --- a/lib/std/os/uefi/protocols/hii_database_protocol.zig +++ b/lib/std/os/uefi/protocols/hii_database_protocol.zig @@ -7,10 +7,10 @@ const hii = uefi.protocols.hii; /// Database manager for HII-related data structures. pub const HIIDatabaseProtocol = extern struct { _new_package_list: Status, // TODO - _remove_package_list: std.meta.FnPtr(fn (*const HIIDatabaseProtocol, hii.HIIHandle) callconv(.C) Status), - _update_package_list: std.meta.FnPtr(fn (*const HIIDatabaseProtocol, hii.HIIHandle, *const hii.HIIPackageList) callconv(.C) Status), - _list_package_lists: std.meta.FnPtr(fn (*const HIIDatabaseProtocol, u8, ?*const Guid, *usize, [*]hii.HIIHandle) callconv(.C) Status), - _export_package_lists: std.meta.FnPtr(fn (*const HIIDatabaseProtocol, ?hii.HIIHandle, *usize, *hii.HIIPackageList) callconv(.C) Status), + _remove_package_list: *const fn (*const HIIDatabaseProtocol, hii.HIIHandle) callconv(.C) Status, + _update_package_list: *const fn (*const HIIDatabaseProtocol, hii.HIIHandle, *const hii.HIIPackageList) callconv(.C) Status, + _list_package_lists: *const fn (*const HIIDatabaseProtocol, u8, ?*const Guid, *usize, [*]hii.HIIHandle) callconv(.C) Status, + _export_package_lists: *const fn (*const HIIDatabaseProtocol, ?hii.HIIHandle, *usize, *hii.HIIPackageList) callconv(.C) Status, _register_package_notify: Status, // TODO _unregister_package_notify: Status, // TODO _find_keyboard_layouts: Status, // TODO diff --git a/lib/std/os/uefi/protocols/hii_popup_protocol.zig b/lib/std/os/uefi/protocols/hii_popup_protocol.zig index 57c33f39280666a0dbea3062796c2e7f3c4d0f73..d73af9d8eb1ebf9041e0e54a38924c78d80ae620 100644 --- a/lib/std/os/uefi/protocols/hii_popup_protocol.zig +++ b/lib/std/os/uefi/protocols/hii_popup_protocol.zig @@ -7,7 +7,7 @@ const hii = uefi.protocols.hii; /// Display a popup window pub const HIIPopupProtocol = extern struct { revision: u64, - _create_popup: std.meta.FnPtr(fn (*const HIIPopupProtocol, HIIPopupStyle, HIIPopupType, hii.HIIHandle, u16, ?*HIIPopupSelection) callconv(.C) Status), + _create_popup: *const fn (*const HIIPopupProtocol, HIIPopupStyle, HIIPopupType, hii.HIIHandle, u16, ?*HIIPopupSelection) callconv(.C) Status, /// Displays a popup window. pub fn createPopup(self: *const HIIPopupProtocol, style: HIIPopupStyle, popup_type: HIIPopupType, handle: hii.HIIHandle, msg: u16, user_selection: ?*HIIPopupSelection) Status { diff --git a/lib/std/os/uefi/protocols/ip6_config_protocol.zig b/lib/std/os/uefi/protocols/ip6_config_protocol.zig index 67a273c79d926e81ce7528769b1aedc63862e776..a4f370e406e8cdd9a2e833b677543e67484d9b22 100644 --- a/lib/std/os/uefi/protocols/ip6_config_protocol.zig +++ b/lib/std/os/uefi/protocols/ip6_config_protocol.zig @@ -5,10 +5,10 @@ const Event = uefi.Event; const Status = uefi.Status; pub const Ip6ConfigProtocol = extern struct { - _set_data: std.meta.FnPtr(fn (*const Ip6ConfigProtocol, Ip6ConfigDataType, usize, *const anyopaque) callconv(.C) Status), - _get_data: std.meta.FnPtr(fn (*const Ip6ConfigProtocol, Ip6ConfigDataType, *usize, ?*const anyopaque) callconv(.C) Status), - _register_data_notify: std.meta.FnPtr(fn (*const Ip6ConfigProtocol, Ip6ConfigDataType, Event) callconv(.C) Status), - _unregister_data_notify: std.meta.FnPtr(fn (*const Ip6ConfigProtocol, Ip6ConfigDataType, Event) callconv(.C) Status), + _set_data: *const fn (*const Ip6ConfigProtocol, Ip6ConfigDataType, usize, *const anyopaque) callconv(.C) Status, + _get_data: *const fn (*const Ip6ConfigProtocol, Ip6ConfigDataType, *usize, ?*const anyopaque) callconv(.C) Status, + _register_data_notify: *const fn (*const Ip6ConfigProtocol, Ip6ConfigDataType, Event) callconv(.C) Status, + _unregister_data_notify: *const fn (*const Ip6ConfigProtocol, Ip6ConfigDataType, Event) callconv(.C) Status, pub fn setData(self: *const Ip6ConfigProtocol, data_type: Ip6ConfigDataType, data_size: usize, data: *const anyopaque) Status { return self._set_data(self, data_type, data_size, data); diff --git a/lib/std/os/uefi/protocols/ip6_protocol.zig b/lib/std/os/uefi/protocols/ip6_protocol.zig index e950632db0964af64d84b8d947e14d57df4eeebe..4b106c7d9703aef15b54625c0a1cca2992059105 100644 --- a/lib/std/os/uefi/protocols/ip6_protocol.zig +++ b/lib/std/os/uefi/protocols/ip6_protocol.zig @@ -8,15 +8,15 @@ const ManagedNetworkConfigData = uefi.protocols.ManagedNetworkConfigData; const SimpleNetworkMode = uefi.protocols.SimpleNetworkMode; pub const Ip6Protocol = extern struct { - _get_mode_data: std.meta.FnPtr(fn (*const Ip6Protocol, ?*Ip6ModeData, ?*ManagedNetworkConfigData, ?*SimpleNetworkMode) callconv(.C) Status), - _configure: std.meta.FnPtr(fn (*const Ip6Protocol, ?*const Ip6ConfigData) callconv(.C) Status), - _groups: std.meta.FnPtr(fn (*const Ip6Protocol, bool, ?*const Ip6Address) callconv(.C) Status), - _routes: std.meta.FnPtr(fn (*const Ip6Protocol, bool, ?*const Ip6Address, u8, ?*const Ip6Address) callconv(.C) Status), - _neighbors: std.meta.FnPtr(fn (*const Ip6Protocol, bool, *const Ip6Address, ?*const MacAddress, u32, bool) callconv(.C) Status), - _transmit: std.meta.FnPtr(fn (*const Ip6Protocol, *Ip6CompletionToken) callconv(.C) Status), - _receive: std.meta.FnPtr(fn (*const Ip6Protocol, *Ip6CompletionToken) callconv(.C) Status), - _cancel: std.meta.FnPtr(fn (*const Ip6Protocol, ?*Ip6CompletionToken) callconv(.C) Status), - _poll: std.meta.FnPtr(fn (*const Ip6Protocol) callconv(.C) Status), + _get_mode_data: *const fn (*const Ip6Protocol, ?*Ip6ModeData, ?*ManagedNetworkConfigData, ?*SimpleNetworkMode) callconv(.C) Status, + _configure: *const fn (*const Ip6Protocol, ?*const Ip6ConfigData) callconv(.C) Status, + _groups: *const fn (*const Ip6Protocol, bool, ?*const Ip6Address) callconv(.C) Status, + _routes: *const fn (*const Ip6Protocol, bool, ?*const Ip6Address, u8, ?*const Ip6Address) callconv(.C) Status, + _neighbors: *const fn (*const Ip6Protocol, bool, *const Ip6Address, ?*const MacAddress, u32, bool) callconv(.C) Status, + _transmit: *const fn (*const Ip6Protocol, *Ip6CompletionToken) callconv(.C) Status, + _receive: *const fn (*const Ip6Protocol, *Ip6CompletionToken) callconv(.C) Status, + _cancel: *const fn (*const Ip6Protocol, ?*Ip6CompletionToken) callconv(.C) Status, + _poll: *const fn (*const Ip6Protocol) callconv(.C) Status, /// Gets the current operational settings for this instance of the EFI IPv6 Protocol driver. pub fn getModeData(self: *const Ip6Protocol, ip6_mode_data: ?*Ip6ModeData, mnp_config_data: ?*ManagedNetworkConfigData, snp_mode_data: ?*SimpleNetworkMode) Status { diff --git a/lib/std/os/uefi/protocols/ip6_service_binding_protocol.zig b/lib/std/os/uefi/protocols/ip6_service_binding_protocol.zig index a5c17636b10c072579a63242ed4db4c33f241d5e..fc56249c550406935b4b62ed5e9772fc96427dab 100644 --- a/lib/std/os/uefi/protocols/ip6_service_binding_protocol.zig +++ b/lib/std/os/uefi/protocols/ip6_service_binding_protocol.zig @@ -5,8 +5,8 @@ const Guid = uefi.Guid; const Status = uefi.Status; pub const Ip6ServiceBindingProtocol = extern struct { - _create_child: std.meta.FnPtr(fn (*const Ip6ServiceBindingProtocol, *?Handle) callconv(.C) Status), - _destroy_child: std.meta.FnPtr(fn (*const Ip6ServiceBindingProtocol, Handle) callconv(.C) Status), + _create_child: *const fn (*const Ip6ServiceBindingProtocol, *?Handle) callconv(.C) Status, + _destroy_child: *const fn (*const Ip6ServiceBindingProtocol, Handle) callconv(.C) Status, pub fn createChild(self: *const Ip6ServiceBindingProtocol, handle: *?Handle) Status { return self._create_child(self, handle); diff --git a/lib/std/os/uefi/protocols/loaded_image_protocol.zig b/lib/std/os/uefi/protocols/loaded_image_protocol.zig index 9a3fea797e197ae3484c057b9289583fba034747..97dfe138b847cafe41de9e43883ee6deb26b3074 100644 --- a/lib/std/os/uefi/protocols/loaded_image_protocol.zig +++ b/lib/std/os/uefi/protocols/loaded_image_protocol.zig @@ -20,7 +20,7 @@ pub const LoadedImageProtocol = extern struct { image_size: u64, image_code_type: MemoryType, image_data_type: MemoryType, - _unload: std.meta.FnPtr(fn (*const LoadedImageProtocol, Handle) callconv(.C) Status), + _unload: *const fn (*const LoadedImageProtocol, Handle) callconv(.C) Status, /// Unloads an image from memory. pub fn unload(self: *const LoadedImageProtocol, handle: Handle) Status { diff --git a/lib/std/os/uefi/protocols/managed_network_protocol.zig b/lib/std/os/uefi/protocols/managed_network_protocol.zig index 3f35f03b50077de4898c59a49f7fc5ec9582725b..aff9febd17bc32113ce939aa40b0d3711edce7b3 100644 --- a/lib/std/os/uefi/protocols/managed_network_protocol.zig +++ b/lib/std/os/uefi/protocols/managed_network_protocol.zig @@ -8,14 +8,14 @@ const SimpleNetworkMode = uefi.protocols.SimpleNetworkMode; const MacAddress = uefi.protocols.MacAddress; pub const ManagedNetworkProtocol = extern struct { - _get_mode_data: std.meta.FnPtr(fn (*const ManagedNetworkProtocol, ?*ManagedNetworkConfigData, ?*SimpleNetworkMode) callconv(.C) Status), - _configure: std.meta.FnPtr(fn (*const ManagedNetworkProtocol, ?*const ManagedNetworkConfigData) callconv(.C) Status), - _mcast_ip_to_mac: std.meta.FnPtr(fn (*const ManagedNetworkProtocol, bool, *const anyopaque, *MacAddress) callconv(.C) Status), - _groups: std.meta.FnPtr(fn (*const ManagedNetworkProtocol, bool, ?*const MacAddress) callconv(.C) Status), - _transmit: std.meta.FnPtr(fn (*const ManagedNetworkProtocol, *const ManagedNetworkCompletionToken) callconv(.C) Status), - _receive: std.meta.FnPtr(fn (*const ManagedNetworkProtocol, *const ManagedNetworkCompletionToken) callconv(.C) Status), - _cancel: std.meta.FnPtr(fn (*const ManagedNetworkProtocol, ?*const ManagedNetworkCompletionToken) callconv(.C) Status), - _poll: std.meta.FnPtr(fn (*const ManagedNetworkProtocol) callconv(.C) Status), + _get_mode_data: *const fn (*const ManagedNetworkProtocol, ?*ManagedNetworkConfigData, ?*SimpleNetworkMode) callconv(.C) Status, + _configure: *const fn (*const ManagedNetworkProtocol, ?*const ManagedNetworkConfigData) callconv(.C) Status, + _mcast_ip_to_mac: *const fn (*const ManagedNetworkProtocol, bool, *const anyopaque, *MacAddress) callconv(.C) Status, + _groups: *const fn (*const ManagedNetworkProtocol, bool, ?*const MacAddress) callconv(.C) Status, + _transmit: *const fn (*const ManagedNetworkProtocol, *const ManagedNetworkCompletionToken) callconv(.C) Status, + _receive: *const fn (*const ManagedNetworkProtocol, *const ManagedNetworkCompletionToken) callconv(.C) Status, + _cancel: *const fn (*const ManagedNetworkProtocol, ?*const ManagedNetworkCompletionToken) callconv(.C) Status, + _poll: *const fn (*const ManagedNetworkProtocol) callconv(.C) Status, /// Returns the operational parameters for the current MNP child driver. /// May also support returning the underlying SNP driver mode data. diff --git a/lib/std/os/uefi/protocols/managed_network_service_binding_protocol.zig b/lib/std/os/uefi/protocols/managed_network_service_binding_protocol.zig index 2e7df993b2f86df4b4fa4e40ab60368d294bf893..79c3add0d00f2f4fe5f94443e0011abc89a55747 100644 --- a/lib/std/os/uefi/protocols/managed_network_service_binding_protocol.zig +++ b/lib/std/os/uefi/protocols/managed_network_service_binding_protocol.zig @@ -5,8 +5,8 @@ const Guid = uefi.Guid; const Status = uefi.Status; pub const ManagedNetworkServiceBindingProtocol = extern struct { - _create_child: std.meta.FnPtr(fn (*const ManagedNetworkServiceBindingProtocol, *?Handle) callconv(.C) Status), - _destroy_child: std.meta.FnPtr(fn (*const ManagedNetworkServiceBindingProtocol, Handle) callconv(.C) Status), + _create_child: *const fn (*const ManagedNetworkServiceBindingProtocol, *?Handle) callconv(.C) Status, + _destroy_child: *const fn (*const ManagedNetworkServiceBindingProtocol, Handle) callconv(.C) Status, pub fn createChild(self: *const ManagedNetworkServiceBindingProtocol, handle: *?Handle) Status { return self._create_child(self, handle); diff --git a/lib/std/os/uefi/protocols/rng_protocol.zig b/lib/std/os/uefi/protocols/rng_protocol.zig index 50fc1afce90afdc2fe87e63dedc53016f4cffc01..20e32353a79cb0f844e02d9bb730511335d6942c 100644 --- a/lib/std/os/uefi/protocols/rng_protocol.zig +++ b/lib/std/os/uefi/protocols/rng_protocol.zig @@ -5,8 +5,8 @@ const Status = uefi.Status; /// Random Number Generator protocol pub const RNGProtocol = extern struct { - _get_info: std.meta.FnPtr(fn (*const RNGProtocol, *usize, [*]align(8) Guid) callconv(.C) Status), - _get_rng: std.meta.FnPtr(fn (*const RNGProtocol, ?*align(8) const Guid, usize, [*]u8) callconv(.C) Status), + _get_info: *const fn (*const RNGProtocol, *usize, [*]align(8) Guid) callconv(.C) Status, + _get_rng: *const fn (*const RNGProtocol, ?*align(8) const Guid, usize, [*]u8) callconv(.C) Status, /// Returns information about the random number generation implementation. pub fn getInfo(self: *const RNGProtocol, list_size: *usize, list: [*]align(8) Guid) Status { diff --git a/lib/std/os/uefi/protocols/simple_file_system_protocol.zig b/lib/std/os/uefi/protocols/simple_file_system_protocol.zig index d580c78bd5d73ae886505a0995ad05392333bb4f..cce24069f6f84ceef997369d973625ab52a8a4b1 100644 --- a/lib/std/os/uefi/protocols/simple_file_system_protocol.zig +++ b/lib/std/os/uefi/protocols/simple_file_system_protocol.zig @@ -6,7 +6,7 @@ const Status = uefi.Status; pub const SimpleFileSystemProtocol = extern struct { revision: u64, - _open_volume: std.meta.FnPtr(fn (*const SimpleFileSystemProtocol, **const FileProtocol) callconv(.C) Status), + _open_volume: *const fn (*const SimpleFileSystemProtocol, **const FileProtocol) callconv(.C) Status, pub fn openVolume(self: *const SimpleFileSystemProtocol, root: **const FileProtocol) Status { return self._open_volume(self, root); diff --git a/lib/std/os/uefi/protocols/simple_network_protocol.zig b/lib/std/os/uefi/protocols/simple_network_protocol.zig index a96fe952e82c94d96c3435350a808a67c3adda32..2a38267ff8bcdec0df65d256b7b926f14246ffe2 100644 --- a/lib/std/os/uefi/protocols/simple_network_protocol.zig +++ b/lib/std/os/uefi/protocols/simple_network_protocol.zig @@ -6,19 +6,19 @@ const Status = uefi.Status; pub const SimpleNetworkProtocol = extern struct { revision: u64, - _start: std.meta.FnPtr(fn (*const SimpleNetworkProtocol) callconv(.C) Status), - _stop: std.meta.FnPtr(fn (*const SimpleNetworkProtocol) callconv(.C) Status), - _initialize: std.meta.FnPtr(fn (*const SimpleNetworkProtocol, usize, usize) callconv(.C) Status), - _reset: std.meta.FnPtr(fn (*const SimpleNetworkProtocol, bool) callconv(.C) Status), - _shutdown: std.meta.FnPtr(fn (*const SimpleNetworkProtocol) callconv(.C) Status), - _receive_filters: std.meta.FnPtr(fn (*const SimpleNetworkProtocol, SimpleNetworkReceiveFilter, SimpleNetworkReceiveFilter, bool, usize, ?[*]const MacAddress) callconv(.C) Status), - _station_address: std.meta.FnPtr(fn (*const SimpleNetworkProtocol, bool, ?*const MacAddress) callconv(.C) Status), - _statistics: std.meta.FnPtr(fn (*const SimpleNetworkProtocol, bool, ?*usize, ?*NetworkStatistics) callconv(.C) Status), - _mcast_ip_to_mac: std.meta.FnPtr(fn (*const SimpleNetworkProtocol, bool, *const anyopaque, *MacAddress) callconv(.C) Status), - _nvdata: std.meta.FnPtr(fn (*const SimpleNetworkProtocol, bool, usize, usize, [*]u8) callconv(.C) Status), - _get_status: std.meta.FnPtr(fn (*const SimpleNetworkProtocol, *SimpleNetworkInterruptStatus, ?*?[*]u8) callconv(.C) Status), - _transmit: std.meta.FnPtr(fn (*const SimpleNetworkProtocol, usize, usize, [*]const u8, ?*const MacAddress, ?*const MacAddress, ?*const u16) callconv(.C) Status), - _receive: std.meta.FnPtr(fn (*const SimpleNetworkProtocol, ?*usize, *usize, [*]u8, ?*MacAddress, ?*MacAddress, ?*u16) callconv(.C) Status), + _start: *const fn (*const SimpleNetworkProtocol) callconv(.C) Status, + _stop: *const fn (*const SimpleNetworkProtocol) callconv(.C) Status, + _initialize: *const fn (*const SimpleNetworkProtocol, usize, usize) callconv(.C) Status, + _reset: *const fn (*const SimpleNetworkProtocol, bool) callconv(.C) Status, + _shutdown: *const fn (*const SimpleNetworkProtocol) callconv(.C) Status, + _receive_filters: *const fn (*const SimpleNetworkProtocol, SimpleNetworkReceiveFilter, SimpleNetworkReceiveFilter, bool, usize, ?[*]const MacAddress) callconv(.C) Status, + _station_address: *const fn (*const SimpleNetworkProtocol, bool, ?*const MacAddress) callconv(.C) Status, + _statistics: *const fn (*const SimpleNetworkProtocol, bool, ?*usize, ?*NetworkStatistics) callconv(.C) Status, + _mcast_ip_to_mac: *const fn (*const SimpleNetworkProtocol, bool, *const anyopaque, *MacAddress) callconv(.C) Status, + _nvdata: *const fn (*const SimpleNetworkProtocol, bool, usize, usize, [*]u8) callconv(.C) Status, + _get_status: *const fn (*const SimpleNetworkProtocol, *SimpleNetworkInterruptStatus, ?*?[*]u8) callconv(.C) Status, + _transmit: *const fn (*const SimpleNetworkProtocol, usize, usize, [*]const u8, ?*const MacAddress, ?*const MacAddress, ?*const u16) callconv(.C) Status, + _receive: *const fn (*const SimpleNetworkProtocol, ?*usize, *usize, [*]u8, ?*MacAddress, ?*MacAddress, ?*u16) callconv(.C) Status, wait_for_packet: Event, mode: *SimpleNetworkMode, diff --git a/lib/std/os/uefi/protocols/simple_pointer_protocol.zig b/lib/std/os/uefi/protocols/simple_pointer_protocol.zig index 2aa9677345e2cee134d407399b16eb499923f1fb..1f29ba88eb345460d13a4f0e3da05bd7bcbfd510 100644 --- a/lib/std/os/uefi/protocols/simple_pointer_protocol.zig +++ b/lib/std/os/uefi/protocols/simple_pointer_protocol.zig @@ -6,8 +6,8 @@ const Status = uefi.Status; /// Protocol for mice pub const SimplePointerProtocol = struct { - _reset: std.meta.FnPtr(fn (*const SimplePointerProtocol, bool) callconv(.C) Status), - _get_state: std.meta.FnPtr(fn (*const SimplePointerProtocol, *SimplePointerState) callconv(.C) Status), + _reset: *const fn (*const SimplePointerProtocol, bool) callconv(.C) Status, + _get_state: *const fn (*const SimplePointerProtocol, *SimplePointerState) callconv(.C) Status, wait_for_input: Event, mode: *SimplePointerMode, diff --git a/lib/std/os/uefi/protocols/simple_text_input_ex_protocol.zig b/lib/std/os/uefi/protocols/simple_text_input_ex_protocol.zig index 7f07a84e107bba2d19cc65f8cf327f3ce69d4585..fbcd7338995f840b3eea5bd97b0d6d3c8cf35604 100644 --- a/lib/std/os/uefi/protocols/simple_text_input_ex_protocol.zig +++ b/lib/std/os/uefi/protocols/simple_text_input_ex_protocol.zig @@ -6,12 +6,12 @@ const Status = uefi.Status; /// Character input devices, e.g. Keyboard pub const SimpleTextInputExProtocol = extern struct { - _reset: std.meta.FnPtr(fn (*const SimpleTextInputExProtocol, bool) callconv(.C) Status), - _read_key_stroke_ex: std.meta.FnPtr(fn (*const SimpleTextInputExProtocol, *KeyData) callconv(.C) Status), + _reset: *const fn (*const SimpleTextInputExProtocol, bool) callconv(.C) Status, + _read_key_stroke_ex: *const fn (*const SimpleTextInputExProtocol, *KeyData) callconv(.C) Status, wait_for_key_ex: Event, - _set_state: std.meta.FnPtr(fn (*const SimpleTextInputExProtocol, *const u8) callconv(.C) Status), - _register_key_notify: std.meta.FnPtr(fn (*const SimpleTextInputExProtocol, *const KeyData, std.meta.FnPtr(fn (*const KeyData) callconv(.C) usize), **anyopaque) callconv(.C) Status), - _unregister_key_notify: std.meta.FnPtr(fn (*const SimpleTextInputExProtocol, *const anyopaque) callconv(.C) Status), + _set_state: *const fn (*const SimpleTextInputExProtocol, *const u8) callconv(.C) Status, + _register_key_notify: *const fn (*const SimpleTextInputExProtocol, *const KeyData, *const fn (*const KeyData) callconv(.C) usize, **anyopaque) callconv(.C) Status, + _unregister_key_notify: *const fn (*const SimpleTextInputExProtocol, *const anyopaque) callconv(.C) Status, /// Resets the input device hardware. pub fn reset(self: *const SimpleTextInputExProtocol, verify: bool) Status { @@ -29,7 +29,7 @@ pub const SimpleTextInputExProtocol = extern struct { } /// Register a notification function for a particular keystroke for the input device. - pub fn registerKeyNotify(self: *const SimpleTextInputExProtocol, key_data: *const KeyData, notify: std.meta.FnPtr(fn (*const KeyData) callconv(.C) usize), handle: **anyopaque) Status { + pub fn registerKeyNotify(self: *const SimpleTextInputExProtocol, key_data: *const KeyData, notify: *const fn (*const KeyData) callconv(.C) usize, handle: **anyopaque) Status { return self._register_key_notify(self, key_data, notify, handle); } diff --git a/lib/std/os/uefi/protocols/simple_text_input_protocol.zig b/lib/std/os/uefi/protocols/simple_text_input_protocol.zig index a183469cd8a961b2063ae685375fd3d22e2f1bd5..72c33c48a997241611f534d8dec3353b5f870518 100644 --- a/lib/std/os/uefi/protocols/simple_text_input_protocol.zig +++ b/lib/std/os/uefi/protocols/simple_text_input_protocol.zig @@ -7,8 +7,8 @@ const Status = uefi.Status; /// Character input devices, e.g. Keyboard pub const SimpleTextInputProtocol = extern struct { - _reset: std.meta.FnPtr(fn (*const SimpleTextInputProtocol, bool) callconv(.C) Status), - _read_key_stroke: std.meta.FnPtr(fn (*const SimpleTextInputProtocol, *InputKey) callconv(.C) Status), + _reset: *const fn (*const SimpleTextInputProtocol, bool) callconv(.C) Status, + _read_key_stroke: *const fn (*const SimpleTextInputProtocol, *InputKey) callconv(.C) Status, wait_for_key: Event, /// Resets the input device hardware. diff --git a/lib/std/os/uefi/protocols/simple_text_output_protocol.zig b/lib/std/os/uefi/protocols/simple_text_output_protocol.zig index 9fe2338ee8eca1b190c68cab6f49233f712af59d..47eb9a6741c29c468474e715d513b2c0eafb1e58 100644 --- a/lib/std/os/uefi/protocols/simple_text_output_protocol.zig +++ b/lib/std/os/uefi/protocols/simple_text_output_protocol.zig @@ -5,15 +5,15 @@ const Status = uefi.Status; /// Character output devices pub const SimpleTextOutputProtocol = extern struct { - _reset: std.meta.FnPtr(fn (*const SimpleTextOutputProtocol, bool) callconv(.C) Status), - _output_string: std.meta.FnPtr(fn (*const SimpleTextOutputProtocol, [*:0]const u16) callconv(.C) Status), - _test_string: std.meta.FnPtr(fn (*const SimpleTextOutputProtocol, [*:0]const u16) callconv(.C) Status), - _query_mode: std.meta.FnPtr(fn (*const SimpleTextOutputProtocol, usize, *usize, *usize) callconv(.C) Status), - _set_mode: std.meta.FnPtr(fn (*const SimpleTextOutputProtocol, usize) callconv(.C) Status), - _set_attribute: std.meta.FnPtr(fn (*const SimpleTextOutputProtocol, usize) callconv(.C) Status), - _clear_screen: std.meta.FnPtr(fn (*const SimpleTextOutputProtocol) callconv(.C) Status), - _set_cursor_position: std.meta.FnPtr(fn (*const SimpleTextOutputProtocol, usize, usize) callconv(.C) Status), - _enable_cursor: std.meta.FnPtr(fn (*const SimpleTextOutputProtocol, bool) callconv(.C) Status), + _reset: *const fn (*const SimpleTextOutputProtocol, bool) callconv(.C) Status, + _output_string: *const fn (*const SimpleTextOutputProtocol, [*:0]const u16) callconv(.C) Status, + _test_string: *const fn (*const SimpleTextOutputProtocol, [*:0]const u16) callconv(.C) Status, + _query_mode: *const fn (*const SimpleTextOutputProtocol, usize, *usize, *usize) callconv(.C) Status, + _set_mode: *const fn (*const SimpleTextOutputProtocol, usize) callconv(.C) Status, + _set_attribute: *const fn (*const SimpleTextOutputProtocol, usize) callconv(.C) Status, + _clear_screen: *const fn (*const SimpleTextOutputProtocol) callconv(.C) Status, + _set_cursor_position: *const fn (*const SimpleTextOutputProtocol, usize, usize) callconv(.C) Status, + _enable_cursor: *const fn (*const SimpleTextOutputProtocol, bool) callconv(.C) Status, mode: *SimpleTextOutputMode, /// Resets the text output device hardware. diff --git a/lib/std/os/uefi/protocols/udp6_protocol.zig b/lib/std/os/uefi/protocols/udp6_protocol.zig index 72d0a7212477c2111bb4cd1ee7901f8b3454d39f..96a1d4c3182b53f90efccf880d0602c5e741585b 100644 --- a/lib/std/os/uefi/protocols/udp6_protocol.zig +++ b/lib/std/os/uefi/protocols/udp6_protocol.zig @@ -10,13 +10,13 @@ const ManagedNetworkConfigData = uefi.protocols.ManagedNetworkConfigData; const SimpleNetworkMode = uefi.protocols.SimpleNetworkMode; pub const Udp6Protocol = extern struct { - _get_mode_data: std.meta.FnPtr(fn (*const Udp6Protocol, ?*Udp6ConfigData, ?*Ip6ModeData, ?*ManagedNetworkConfigData, ?*SimpleNetworkMode) callconv(.C) Status), - _configure: std.meta.FnPtr(fn (*const Udp6Protocol, ?*const Udp6ConfigData) callconv(.C) Status), - _groups: std.meta.FnPtr(fn (*const Udp6Protocol, bool, ?*const Ip6Address) callconv(.C) Status), - _transmit: std.meta.FnPtr(fn (*const Udp6Protocol, *Udp6CompletionToken) callconv(.C) Status), - _receive: std.meta.FnPtr(fn (*const Udp6Protocol, *Udp6CompletionToken) callconv(.C) Status), - _cancel: std.meta.FnPtr(fn (*const Udp6Protocol, ?*Udp6CompletionToken) callconv(.C) Status), - _poll: std.meta.FnPtr(fn (*const Udp6Protocol) callconv(.C) Status), + _get_mode_data: *const fn (*const Udp6Protocol, ?*Udp6ConfigData, ?*Ip6ModeData, ?*ManagedNetworkConfigData, ?*SimpleNetworkMode) callconv(.C) Status, + _configure: *const fn (*const Udp6Protocol, ?*const Udp6ConfigData) callconv(.C) Status, + _groups: *const fn (*const Udp6Protocol, bool, ?*const Ip6Address) callconv(.C) Status, + _transmit: *const fn (*const Udp6Protocol, *Udp6CompletionToken) callconv(.C) Status, + _receive: *const fn (*const Udp6Protocol, *Udp6CompletionToken) callconv(.C) Status, + _cancel: *const fn (*const Udp6Protocol, ?*Udp6CompletionToken) callconv(.C) Status, + _poll: *const fn (*const Udp6Protocol) callconv(.C) Status, pub fn getModeData(self: *const Udp6Protocol, udp6_config_data: ?*Udp6ConfigData, ip6_mode_data: ?*Ip6ModeData, mnp_config_data: ?*ManagedNetworkConfigData, snp_mode_data: ?*SimpleNetworkMode) Status { return self._get_mode_data(self, udp6_config_data, ip6_mode_data, mnp_config_data, snp_mode_data); diff --git a/lib/std/os/uefi/protocols/udp6_service_binding_protocol.zig b/lib/std/os/uefi/protocols/udp6_service_binding_protocol.zig index 7dbee9ecb04d8cf946f3c72dd959598d9bd39d96..9886ecca19fd348b36b961da9f2eefa6a0ce18ae 100644 --- a/lib/std/os/uefi/protocols/udp6_service_binding_protocol.zig +++ b/lib/std/os/uefi/protocols/udp6_service_binding_protocol.zig @@ -5,8 +5,8 @@ const Guid = uefi.Guid; const Status = uefi.Status; pub const Udp6ServiceBindingProtocol = extern struct { - _create_child: std.meta.FnPtr(fn (*const Udp6ServiceBindingProtocol, *?Handle) callconv(.C) Status), - _destroy_child: std.meta.FnPtr(fn (*const Udp6ServiceBindingProtocol, Handle) callconv(.C) Status), + _create_child: *const fn (*const Udp6ServiceBindingProtocol, *?Handle) callconv(.C) Status, + _destroy_child: *const fn (*const Udp6ServiceBindingProtocol, Handle) callconv(.C) Status, pub fn createChild(self: *const Udp6ServiceBindingProtocol, handle: *?Handle) Status { return self._create_child(self, handle); diff --git a/lib/std/os/uefi/tables/boot_services.zig b/lib/std/os/uefi/tables/boot_services.zig index 80c5ea50fc0d7774a0a2fde222f26e8353b27769..c87cf89e491a3cc14fef3525be8fd61533820e2a 100644 --- a/lib/std/os/uefi/tables/boot_services.zig +++ b/lib/std/os/uefi/tables/boot_services.zig @@ -22,138 +22,138 @@ pub const BootServices = extern struct { hdr: TableHeader, /// Raises a task's priority level and returns its previous level. - raiseTpl: std.meta.FnPtr(fn (new_tpl: usize) callconv(.C) usize), + raiseTpl: *const fn (new_tpl: usize) callconv(.C) usize, /// Restores a task's priority level to its previous value. - restoreTpl: std.meta.FnPtr(fn (old_tpl: usize) callconv(.C) void), + restoreTpl: *const fn (old_tpl: usize) callconv(.C) void, /// Allocates memory pages from the system. - allocatePages: std.meta.FnPtr(fn (alloc_type: AllocateType, mem_type: MemoryType, pages: usize, memory: *[*]align(4096) u8) callconv(.C) Status), + allocatePages: *const fn (alloc_type: AllocateType, mem_type: MemoryType, pages: usize, memory: *[*]align(4096) u8) callconv(.C) Status, /// Frees memory pages. - freePages: std.meta.FnPtr(fn (memory: [*]align(4096) u8, pages: usize) callconv(.C) Status), + freePages: *const fn (memory: [*]align(4096) u8, pages: usize) callconv(.C) Status, /// Returns the current memory map. - getMemoryMap: std.meta.FnPtr(fn (mmap_size: *usize, mmap: ?[*]MemoryDescriptor, mapKey: *usize, descriptor_size: *usize, descriptor_version: *u32) callconv(.C) Status), + getMemoryMap: *const fn (mmap_size: *usize, mmap: ?[*]MemoryDescriptor, mapKey: *usize, descriptor_size: *usize, descriptor_version: *u32) callconv(.C) Status, /// Allocates pool memory. - allocatePool: std.meta.FnPtr(fn (pool_type: MemoryType, size: usize, buffer: *[*]align(8) u8) callconv(.C) Status), + allocatePool: *const fn (pool_type: MemoryType, size: usize, buffer: *[*]align(8) u8) callconv(.C) Status, /// Returns pool memory to the system. - freePool: std.meta.FnPtr(fn (buffer: [*]align(8) u8) callconv(.C) Status), + freePool: *const fn (buffer: [*]align(8) u8) callconv(.C) Status, /// Creates an event. - 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), + 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, /// Sets the type of timer and the trigger time for a timer event. - setTimer: std.meta.FnPtr(fn (event: Event, type: TimerDelay, triggerTime: u64) callconv(.C) Status), + setTimer: *const fn (event: Event, type: TimerDelay, triggerTime: u64) callconv(.C) Status, /// Stops execution until an event is signaled. - waitForEvent: std.meta.FnPtr(fn (event_len: usize, events: [*]const Event, index: *usize) callconv(.C) Status), + waitForEvent: *const fn (event_len: usize, events: [*]const Event, index: *usize) callconv(.C) Status, /// Signals an event. - signalEvent: std.meta.FnPtr(fn (event: Event) callconv(.C) Status), + signalEvent: *const fn (event: Event) callconv(.C) Status, /// Closes an event. - closeEvent: std.meta.FnPtr(fn (event: Event) callconv(.C) Status), + closeEvent: *const fn (event: Event) callconv(.C) Status, /// Checks whether an event is in the signaled state. - checkEvent: std.meta.FnPtr(fn (event: Event) callconv(.C) Status), + checkEvent: *const fn (event: Event) callconv(.C) Status, /// Installs a protocol interface on a device handle. If the handle does not exist, it is created /// and added to the list of handles in the system. installMultipleProtocolInterfaces() /// performs more error checking than installProtocolInterface(), so its use is recommended over this. - installProtocolInterface: std.meta.FnPtr(fn (handle: Handle, protocol: *align(8) const Guid, interface_type: EfiInterfaceType, interface: *anyopaque) callconv(.C) Status), + installProtocolInterface: *const fn (handle: Handle, protocol: *align(8) const Guid, interface_type: EfiInterfaceType, interface: *anyopaque) callconv(.C) Status, /// Reinstalls a protocol interface on a device handle - reinstallProtocolInterface: std.meta.FnPtr(fn (handle: Handle, protocol: *align(8) const Guid, old_interface: *anyopaque, new_interface: *anyopaque) callconv(.C) Status), + reinstallProtocolInterface: *const fn (handle: Handle, protocol: *align(8) const Guid, old_interface: *anyopaque, new_interface: *anyopaque) callconv(.C) Status, /// Removes a protocol interface from a device handle. Usage of /// uninstallMultipleProtocolInterfaces is recommended over this. - uninstallProtocolInterface: std.meta.FnPtr(fn (handle: Handle, protocol: *align(8) const Guid, interface: *anyopaque) callconv(.C) Status), + uninstallProtocolInterface: *const fn (handle: Handle, protocol: *align(8) const Guid, interface: *anyopaque) callconv(.C) Status, /// Queries a handle to determine if it supports a specified protocol. - handleProtocol: std.meta.FnPtr(fn (handle: Handle, protocol: *align(8) const Guid, interface: *?*anyopaque) callconv(.C) Status), + handleProtocol: *const fn (handle: Handle, protocol: *align(8) const Guid, interface: *?*anyopaque) callconv(.C) Status, reserved: *anyopaque, /// Creates an event that is to be signaled whenever an interface is installed for a specified protocol. - registerProtocolNotify: std.meta.FnPtr(fn (protocol: *align(8) const Guid, event: Event, registration: **anyopaque) callconv(.C) Status), + registerProtocolNotify: *const fn (protocol: *align(8) const Guid, event: Event, registration: **anyopaque) callconv(.C) Status, /// Returns an array of handles that support a specified protocol. - locateHandle: std.meta.FnPtr(fn (search_type: LocateSearchType, protocol: ?*align(8) const Guid, search_key: ?*const anyopaque, bufferSize: *usize, buffer: [*]Handle) callconv(.C) Status), + locateHandle: *const fn (search_type: LocateSearchType, protocol: ?*align(8) const Guid, search_key: ?*const anyopaque, bufferSize: *usize, buffer: [*]Handle) callconv(.C) Status, /// Locates the handle to a device on the device path that supports the specified protocol - locateDevicePath: std.meta.FnPtr(fn (protocols: *align(8) const Guid, device_path: **const DevicePathProtocol, device: *?Handle) callconv(.C) Status), + locateDevicePath: *const fn (protocols: *align(8) const Guid, device_path: **const DevicePathProtocol, device: *?Handle) callconv(.C) Status, /// Adds, updates, or removes a configuration table entry from the EFI System Table. - installConfigurationTable: std.meta.FnPtr(fn (guid: *align(8) const Guid, table: ?*anyopaque) callconv(.C) Status), + installConfigurationTable: *const fn (guid: *align(8) const Guid, table: ?*anyopaque) callconv(.C) Status, /// Loads an EFI image into memory. - 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), + 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, /// Transfers control to a loaded image's entry point. - startImage: std.meta.FnPtr(fn (image_handle: Handle, exit_data_size: ?*usize, exit_data: ?*[*]u16) callconv(.C) Status), + startImage: *const fn (image_handle: Handle, exit_data_size: ?*usize, exit_data: ?*[*]u16) callconv(.C) Status, /// Terminates a loaded EFI image and returns control to boot services. - exit: std.meta.FnPtr(fn (image_handle: Handle, exit_status: Status, exit_data_size: usize, exit_data: ?*const anyopaque) callconv(.C) Status), + exit: *const fn (image_handle: Handle, exit_status: Status, exit_data_size: usize, exit_data: ?*const anyopaque) callconv(.C) Status, /// Unloads an image. - unloadImage: std.meta.FnPtr(fn (image_handle: Handle) callconv(.C) Status), + unloadImage: *const fn (image_handle: Handle) callconv(.C) Status, /// Terminates all boot services. - exitBootServices: std.meta.FnPtr(fn (image_handle: Handle, map_key: usize) callconv(.C) Status), + exitBootServices: *const fn (image_handle: Handle, map_key: usize) callconv(.C) Status, /// Returns a monotonically increasing count for the platform. - getNextMonotonicCount: std.meta.FnPtr(fn (count: *u64) callconv(.C) Status), + getNextMonotonicCount: *const fn (count: *u64) callconv(.C) Status, /// Induces a fine-grained stall. - stall: std.meta.FnPtr(fn (microseconds: usize) callconv(.C) Status), + stall: *const fn (microseconds: usize) callconv(.C) Status, /// Sets the system's watchdog timer. - setWatchdogTimer: std.meta.FnPtr(fn (timeout: usize, watchdogCode: u64, data_size: usize, watchdog_data: ?[*]const u16) callconv(.C) Status), + setWatchdogTimer: *const fn (timeout: usize, watchdogCode: u64, data_size: usize, watchdog_data: ?[*]const u16) callconv(.C) Status, /// Connects one or more drives to a controller. - connectController: std.meta.FnPtr(fn (controller_handle: Handle, driver_image_handle: ?Handle, remaining_device_path: ?*DevicePathProtocol, recursive: bool) callconv(.C) Status), + connectController: *const fn (controller_handle: Handle, driver_image_handle: ?Handle, remaining_device_path: ?*DevicePathProtocol, recursive: bool) callconv(.C) Status, // Disconnects one or more drivers from a controller - disconnectController: std.meta.FnPtr(fn (controller_handle: Handle, driver_image_handle: ?Handle, child_handle: ?Handle) callconv(.C) Status), + disconnectController: *const fn (controller_handle: Handle, driver_image_handle: ?Handle, child_handle: ?Handle) callconv(.C) Status, /// Queries a handle to determine if it supports a specified protocol. - 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), + openProtocol: *const fn (handle: Handle, protocol: *align(8) const Guid, interface: *?*anyopaque, agent_handle: ?Handle, controller_handle: ?Handle, attributes: OpenProtocolAttributes) callconv(.C) Status, /// Closes a protocol on a handle that was opened using openProtocol(). - closeProtocol: std.meta.FnPtr(fn (handle: Handle, protocol: *align(8) const Guid, agentHandle: Handle, controller_handle: ?Handle) callconv(.C) Status), + closeProtocol: *const fn (handle: Handle, protocol: *align(8) const Guid, agentHandle: Handle, controller_handle: ?Handle) callconv(.C) Status, /// Retrieves the list of agents that currently have a protocol interface opened. - openProtocolInformation: std.meta.FnPtr(fn (handle: Handle, protocol: *align(8) const Guid, entry_buffer: *[*]ProtocolInformationEntry, entry_count: *usize) callconv(.C) Status), + openProtocolInformation: *const fn (handle: Handle, protocol: *align(8) const Guid, entry_buffer: *[*]ProtocolInformationEntry, entry_count: *usize) callconv(.C) Status, /// Retrieves the list of protocol interface GUIDs that are installed on a handle in a buffer allocated from pool. - protocolsPerHandle: std.meta.FnPtr(fn (handle: Handle, protocol_buffer: *[*]*align(8) const Guid, protocol_buffer_count: *usize) callconv(.C) Status), + protocolsPerHandle: *const fn (handle: Handle, protocol_buffer: *[*]*align(8) const Guid, protocol_buffer_count: *usize) callconv(.C) Status, /// Returns an array of handles that support the requested protocol in a buffer allocated from pool. - 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), + locateHandleBuffer: *const fn (search_type: LocateSearchType, protocol: ?*align(8) const Guid, search_key: ?*const anyopaque, num_handles: *usize, buffer: *[*]Handle) callconv(.C) Status, /// Returns the first protocol instance that matches the given protocol. - locateProtocol: std.meta.FnPtr(fn (protocol: *align(8) const Guid, registration: ?*const anyopaque, interface: *?*anyopaque) callconv(.C) Status), + locateProtocol: *const fn (protocol: *align(8) const Guid, registration: ?*const anyopaque, interface: *?*anyopaque) callconv(.C) Status, /// Installs one or more protocol interfaces into the boot services environment - installMultipleProtocolInterfaces: std.meta.FnPtr(fn (handle: *Handle, ...) callconv(.C) Status), + installMultipleProtocolInterfaces: *const fn (handle: *Handle, ...) callconv(.C) Status, /// Removes one or more protocol interfaces into the boot services environment - uninstallMultipleProtocolInterfaces: std.meta.FnPtr(fn (handle: *Handle, ...) callconv(.C) Status), + uninstallMultipleProtocolInterfaces: *const fn (handle: *Handle, ...) callconv(.C) Status, /// Computes and returns a 32-bit CRC for a data buffer. - calculateCrc32: std.meta.FnPtr(fn (data: [*]const u8, data_size: usize, *u32) callconv(.C) Status), + calculateCrc32: *const fn (data: [*]const u8, data_size: usize, *u32) callconv(.C) Status, /// Copies the contents of one buffer to another buffer - copyMem: std.meta.FnPtr(fn (dest: [*]u8, src: [*]const u8, len: usize) callconv(.C) void), + copyMem: *const fn (dest: [*]u8, src: [*]const u8, len: usize) callconv(.C) void, /// Fills a buffer with a specified value - setMem: std.meta.FnPtr(fn (buffer: [*]u8, size: usize, value: u8) callconv(.C) void), + setMem: *const fn (buffer: [*]u8, size: usize, value: u8) callconv(.C) void, /// Creates an event in a group. - 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), + 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, /// Opens a protocol with a structure as the loaded image for a UEFI application pub fn openProtocolSt(self: *BootServices, comptime protocol: type, handle: Handle) !*protocol { @@ -191,7 +191,7 @@ pub const BootServices = extern struct { pub const tpl_high_level: usize = 31; }; -pub const EfiEventNotify = std.meta.FnPtr(fn (event: Event, ctx: *anyopaque) callconv(.C) void); +pub const EfiEventNotify = *const fn (event: Event, ctx: *anyopaque) callconv(.C) void; pub const TimerDelay = enum(u32) { TimerCancel, diff --git a/lib/std/os/uefi/tables/runtime_services.zig b/lib/std/os/uefi/tables/runtime_services.zig index 86c7860ff36812676170704946b0ab23a6d1ec41..da155e378e97fd5ac2dca48d1bd9f2b8b9c41b69 100644 --- a/lib/std/os/uefi/tables/runtime_services.zig +++ b/lib/std/os/uefi/tables/runtime_services.zig @@ -19,50 +19,50 @@ pub const RuntimeServices = extern struct { hdr: TableHeader, /// Returns the current time and date information, and the time-keeping capabilities of the hardware platform. - getTime: std.meta.FnPtr(fn (time: *uefi.Time, capabilities: ?*TimeCapabilities) callconv(.C) Status), + getTime: *const fn (time: *uefi.Time, capabilities: ?*TimeCapabilities) callconv(.C) Status, /// Sets the current local time and date information - setTime: std.meta.FnPtr(fn (time: *uefi.Time) callconv(.C) Status), + setTime: *const fn (time: *uefi.Time) callconv(.C) Status, /// Returns the current wakeup alarm clock setting - getWakeupTime: std.meta.FnPtr(fn (enabled: *bool, pending: *bool, time: *uefi.Time) callconv(.C) Status), + getWakeupTime: *const fn (enabled: *bool, pending: *bool, time: *uefi.Time) callconv(.C) Status, /// Sets the system wakeup alarm clock time - setWakeupTime: std.meta.FnPtr(fn (enable: *bool, time: ?*uefi.Time) callconv(.C) Status), + setWakeupTime: *const fn (enable: *bool, time: ?*uefi.Time) callconv(.C) Status, /// Changes the runtime addressing mode of EFI firmware from physical to virtual. - setVirtualAddressMap: std.meta.FnPtr(fn (mmap_size: usize, descriptor_size: usize, descriptor_version: u32, virtual_map: [*]MemoryDescriptor) callconv(.C) Status), + setVirtualAddressMap: *const fn (mmap_size: usize, descriptor_size: usize, descriptor_version: u32, virtual_map: [*]MemoryDescriptor) callconv(.C) Status, /// Determines the new virtual address that is to be used on subsequent memory accesses. - convertPointer: std.meta.FnPtr(fn (debug_disposition: usize, address: **anyopaque) callconv(.C) Status), + convertPointer: *const fn (debug_disposition: usize, address: **anyopaque) callconv(.C) Status, /// Returns the value of a variable. - 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), + getVariable: *const fn (var_name: [*:0]const u16, vendor_guid: *align(8) const Guid, attributes: ?*u32, data_size: *usize, data: ?*anyopaque) callconv(.C) Status, /// Enumerates the current variable names. - getNextVariableName: std.meta.FnPtr(fn (var_name_size: *usize, var_name: [*:0]u16, vendor_guid: *align(8) Guid) callconv(.C) Status), + getNextVariableName: *const fn (var_name_size: *usize, var_name: [*:0]u16, vendor_guid: *align(8) Guid) callconv(.C) Status, /// Sets the value of a variable. - 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), + setVariable: *const fn (var_name: [*:0]const u16, vendor_guid: *align(8) const Guid, attributes: u32, data_size: usize, data: *anyopaque) callconv(.C) Status, /// Return the next high 32 bits of the platform's monotonic counter - getNextHighMonotonicCount: std.meta.FnPtr(fn (high_count: *u32) callconv(.C) Status), + getNextHighMonotonicCount: *const fn (high_count: *u32) callconv(.C) Status, /// Resets the entire platform. - resetSystem: std.meta.FnPtr(fn (reset_type: ResetType, reset_status: Status, data_size: usize, reset_data: ?*const anyopaque) callconv(.C) noreturn), + resetSystem: *const fn (reset_type: ResetType, reset_status: Status, data_size: usize, reset_data: ?*const anyopaque) callconv(.C) noreturn, /// Passes capsules to the firmware with both virtual and physical mapping. /// Depending on the intended consumption, the firmware may process the capsule immediately. /// If the payload should persist across a system reset, the reset value returned from /// `queryCapsuleCapabilities` must be passed into resetSystem and will cause the capsule /// to be processed by the firmware as part of the reset process. - updateCapsule: std.meta.FnPtr(fn (capsule_header_array: **CapsuleHeader, capsule_count: usize, scatter_gather_list: EfiPhysicalAddress) callconv(.C) Status), + updateCapsule: *const fn (capsule_header_array: **CapsuleHeader, capsule_count: usize, scatter_gather_list: EfiPhysicalAddress) callconv(.C) Status, /// Returns if the capsule can be supported via `updateCapsule` - queryCapsuleCapabilities: std.meta.FnPtr(fn (capsule_header_array: **CapsuleHeader, capsule_count: usize, maximum_capsule_size: *usize, resetType: ResetType) callconv(.C) Status), + queryCapsuleCapabilities: *const fn (capsule_header_array: **CapsuleHeader, capsule_count: usize, maximum_capsule_size: *usize, resetType: ResetType) callconv(.C) Status, /// Returns information about the EFI variables - queryVariableInfo: std.meta.FnPtr(fn (attributes: *u32, maximum_variable_storage_size: *u64, remaining_variable_storage_size: *u64, maximum_variable_size: *u64) callconv(.C) Status), + queryVariableInfo: *const fn (attributes: *u32, maximum_variable_storage_size: *u64, remaining_variable_storage_size: *u64, maximum_variable_size: *u64) callconv(.C) Status, pub const signature: u64 = 0x56524553544e5552; }; diff --git a/lib/std/os/windows.zig b/lib/std/os/windows.zig index d864f85b8d67e46beb11efa7fcd1fd10954bb94a..f4c0a8a1e8dd767489e7aea3431119aca913909b 100644 --- a/lib/std/os/windows.zig +++ b/lib/std/os/windows.zig @@ -2696,7 +2696,7 @@ pub const MEM_RESERVE_PLACEHOLDERS = 0x2; pub const MEM_DECOMMIT = 0x4000; pub const MEM_RELEASE = 0x8000; -pub const PTHREAD_START_ROUTINE = std.meta.FnPtr(fn (LPVOID) callconv(.C) DWORD); +pub const PTHREAD_START_ROUTINE = *const fn (LPVOID) callconv(.C) DWORD; pub const LPTHREAD_START_ROUTINE = PTHREAD_START_ROUTINE; pub const WIN32_FIND_DATAW = extern struct { @@ -2869,7 +2869,7 @@ pub const IMAGE_TLS_DIRECTORY = extern struct { pub const IMAGE_TLS_DIRECTORY64 = IMAGE_TLS_DIRECTORY; pub const IMAGE_TLS_DIRECTORY32 = IMAGE_TLS_DIRECTORY; -pub const PIMAGE_TLS_CALLBACK = ?std.meta.FnPtr(fn (PVOID, DWORD, PVOID) callconv(.C) void); +pub const PIMAGE_TLS_CALLBACK = ?*const fn (PVOID, DWORD, PVOID) callconv(.C) void; pub const PROV_RSA_FULL = 1; @@ -2922,14 +2922,14 @@ pub const RTL_QUERY_REGISTRY_TABLE = extern struct { DefaultLength: ULONG, }; -pub const RTL_QUERY_REGISTRY_ROUTINE = ?std.meta.FnPtr(fn ( +pub const RTL_QUERY_REGISTRY_ROUTINE = ?*const fn ( PWSTR, ULONG, ?*anyopaque, ULONG, ?*anyopaque, ?*anyopaque, -) callconv(WINAPI) NTSTATUS); +) callconv(WINAPI) NTSTATUS; /// Path is a full path pub const RTL_REGISTRY_ABSOLUTE = 0; @@ -3026,7 +3026,7 @@ pub const FILE_ACTION_MODIFIED = 0x00000003; pub const FILE_ACTION_RENAMED_OLD_NAME = 0x00000004; pub const FILE_ACTION_RENAMED_NEW_NAME = 0x00000005; -pub const LPOVERLAPPED_COMPLETION_ROUTINE = ?std.meta.FnPtr(fn (DWORD, DWORD, *OVERLAPPED) callconv(.C) void); +pub const LPOVERLAPPED_COMPLETION_ROUTINE = ?*const fn (DWORD, DWORD, *OVERLAPPED) callconv(.C) void; pub const FILE_NOTIFY_CHANGE_CREATION = 64; pub const FILE_NOTIFY_CHANGE_SIZE = 8; @@ -3079,7 +3079,7 @@ pub const RTL_CRITICAL_SECTION = extern struct { pub const CRITICAL_SECTION = RTL_CRITICAL_SECTION; pub const INIT_ONCE = RTL_RUN_ONCE; pub const INIT_ONCE_STATIC_INIT = RTL_RUN_ONCE_INIT; -pub const INIT_ONCE_FN = std.meta.FnPtr(fn (InitOnce: *INIT_ONCE, Parameter: ?*anyopaque, Context: ?*anyopaque) callconv(.C) BOOL); +pub const INIT_ONCE_FN = *const fn (InitOnce: *INIT_ONCE, Parameter: ?*anyopaque, Context: ?*anyopaque) callconv(.C) BOOL; pub const RTL_RUN_ONCE = extern struct { Ptr: ?*anyopaque, @@ -3382,7 +3382,7 @@ pub const EXCEPTION_POINTERS = extern struct { ContextRecord: *std.os.windows.CONTEXT, }; -pub const VECTORED_EXCEPTION_HANDLER = std.meta.FnPtr(fn (ExceptionInfo: *EXCEPTION_POINTERS) callconv(WINAPI) c_long); +pub const VECTORED_EXCEPTION_HANDLER = *const fn (ExceptionInfo: *EXCEPTION_POINTERS) callconv(WINAPI) c_long; pub const OBJECT_ATTRIBUTES = extern struct { Length: ULONG, @@ -3658,7 +3658,7 @@ pub const RTL_DRIVE_LETTER_CURDIR = extern struct { DosPath: UNICODE_STRING, }; -pub const PPS_POST_PROCESS_INIT_ROUTINE = ?std.meta.FnPtr(fn () callconv(.C) void); +pub const PPS_POST_PROCESS_INIT_ROUTINE = ?*const fn () callconv(.C) void; pub const FILE_BOTH_DIR_INFORMATION = extern struct { NextEntryOffset: ULONG, @@ -3678,7 +3678,7 @@ pub const FILE_BOTH_DIR_INFORMATION = extern struct { }; pub const FILE_BOTH_DIRECTORY_INFORMATION = FILE_BOTH_DIR_INFORMATION; -pub const IO_APC_ROUTINE = std.meta.FnPtr(fn (PVOID, *IO_STATUS_BLOCK, ULONG) callconv(.C) void); +pub const IO_APC_ROUTINE = *const fn (PVOID, *IO_STATUS_BLOCK, ULONG) callconv(.C) void; pub const CURDIR = extern struct { DosPath: UNICODE_STRING, @@ -3750,8 +3750,8 @@ pub const ENUM_PAGE_FILE_INFORMATION = extern struct { PeakUsage: SIZE_T, }; -pub const PENUM_PAGE_FILE_CALLBACKW = ?std.meta.FnPtr(fn (?LPVOID, *ENUM_PAGE_FILE_INFORMATION, LPCWSTR) callconv(.C) BOOL); -pub const PENUM_PAGE_FILE_CALLBACKA = ?std.meta.FnPtr(fn (?LPVOID, *ENUM_PAGE_FILE_INFORMATION, LPCSTR) callconv(.C) BOOL); +pub const PENUM_PAGE_FILE_CALLBACKW = ?*const fn (?LPVOID, *ENUM_PAGE_FILE_INFORMATION, LPCWSTR) callconv(.C) BOOL; +pub const PENUM_PAGE_FILE_CALLBACKA = ?*const fn (?LPVOID, *ENUM_PAGE_FILE_INFORMATION, LPCSTR) callconv(.C) BOOL; pub const PSAPI_WS_WATCH_INFORMATION_EX = extern struct { BasicInfo: PSAPI_WS_WATCH_INFORMATION, @@ -3851,7 +3851,7 @@ pub const CTRL_CLOSE_EVENT: DWORD = 2; pub const CTRL_LOGOFF_EVENT: DWORD = 5; pub const CTRL_SHUTDOWN_EVENT: DWORD = 6; -pub const HANDLER_ROUTINE = std.meta.FnPtr(fn (dwCtrlType: DWORD) callconv(WINAPI) BOOL); +pub const HANDLER_ROUTINE = *const fn (dwCtrlType: DWORD) callconv(WINAPI) BOOL; /// Processor feature enumeration. pub const PF = enum(DWORD) { diff --git a/lib/std/os/windows/user32.zig b/lib/std/os/windows/user32.zig index 16dfef996e48225aecd0b8a8c37939b58c8c6a54..b771d01e06d6b23dc19adb8991568bb4f6e8ef00 100644 --- a/lib/std/os/windows/user32.zig +++ b/lib/std/os/windows/user32.zig @@ -39,7 +39,7 @@ fn selectSymbol(comptime function_static: anytype, function_dynamic: @TypeOf(fun // === Messages === -pub const WNDPROC = std.meta.FnPtr(fn (hwnd: HWND, uMsg: UINT, wParam: WPARAM, lParam: LPARAM) callconv(WINAPI) LRESULT); +pub const WNDPROC = *const fn (hwnd: HWND, uMsg: UINT, wParam: WPARAM, lParam: LPARAM) callconv(WINAPI) LRESULT; pub const MSG = extern struct { hWnd: ?HWND, @@ -1056,7 +1056,7 @@ pub fn getMessageA(lpMsg: *MSG, hWnd: ?HWND, wMsgFilterMin: u32, wMsgFilterMax: } pub extern "user32" fn GetMessageW(lpMsg: *MSG, hWnd: ?HWND, wMsgFilterMin: UINT, wMsgFilterMax: UINT) callconv(WINAPI) BOOL; -pub var pfnGetMessageW: std.meta.FnPtr(@TypeOf(GetMessageW)) = undefined; +pub var pfnGetMessageW: *const @TypeOf(GetMessageW) = undefined; pub fn getMessageW(lpMsg: *MSG, hWnd: ?HWND, wMsgFilterMin: u32, wMsgFilterMax: u32) !void { const function = selectSymbol(GetMessageW, pfnGetMessageW, .win2k); @@ -1087,7 +1087,7 @@ pub fn peekMessageA(lpMsg: *MSG, hWnd: ?HWND, wMsgFilterMin: u32, wMsgFilterMax: } pub extern "user32" fn PeekMessageW(lpMsg: *MSG, hWnd: ?HWND, wMsgFilterMin: UINT, wMsgFilterMax: UINT, wRemoveMsg: UINT) callconv(WINAPI) BOOL; -pub var pfnPeekMessageW: std.meta.FnPtr(@TypeOf(PeekMessageW)) = undefined; +pub var pfnPeekMessageW: *const @TypeOf(PeekMessageW) = undefined; pub fn peekMessageW(lpMsg: *MSG, hWnd: ?HWND, wMsgFilterMin: u32, wMsgFilterMax: u32, wRemoveMsg: u32) !bool { const function = selectSymbol(PeekMessageW, pfnPeekMessageW, .win2k); @@ -1112,7 +1112,7 @@ pub fn dispatchMessageA(lpMsg: *const MSG) LRESULT { } pub extern "user32" fn DispatchMessageW(lpMsg: *const MSG) callconv(WINAPI) LRESULT; -pub var pfnDispatchMessageW: std.meta.FnPtr(@TypeOf(DispatchMessageW)) = undefined; +pub var pfnDispatchMessageW: *const @TypeOf(DispatchMessageW) = undefined; pub fn dispatchMessageW(lpMsg: *const MSG) LRESULT { const function = selectSymbol(DispatchMessageW, pfnDispatchMessageW, .win2k); return function(lpMsg); @@ -1129,7 +1129,7 @@ pub fn defWindowProcA(hWnd: HWND, Msg: UINT, wParam: WPARAM, lParam: LPARAM) LRE } pub extern "user32" fn DefWindowProcW(hWnd: HWND, Msg: UINT, wParam: WPARAM, lParam: LPARAM) callconv(WINAPI) LRESULT; -pub var pfnDefWindowProcW: std.meta.FnPtr(@TypeOf(DefWindowProcW)) = undefined; +pub var pfnDefWindowProcW: *const @TypeOf(DefWindowProcW) = undefined; pub fn defWindowProcW(hWnd: HWND, Msg: UINT, wParam: WPARAM, lParam: LPARAM) LRESULT { const function = selectSymbol(DefWindowProcW, pfnDefWindowProcW, .win2k); return function(hWnd, Msg, wParam, lParam); @@ -1191,7 +1191,7 @@ pub fn registerClassExA(window_class: *const WNDCLASSEXA) !ATOM { } pub extern "user32" fn RegisterClassExW(*const WNDCLASSEXW) callconv(WINAPI) ATOM; -pub var pfnRegisterClassExW: std.meta.FnPtr(@TypeOf(RegisterClassExW)) = undefined; +pub var pfnRegisterClassExW: *const @TypeOf(RegisterClassExW) = undefined; pub fn registerClassExW(window_class: *const WNDCLASSEXW) !ATOM { const function = selectSymbol(RegisterClassExW, pfnRegisterClassExW, .win2k); const atom = function(window_class); @@ -1215,7 +1215,7 @@ pub fn unregisterClassA(lpClassName: [*:0]const u8, hInstance: HINSTANCE) !void } pub extern "user32" fn UnregisterClassW(lpClassName: [*:0]const u16, hInstance: HINSTANCE) callconv(WINAPI) BOOL; -pub var pfnUnregisterClassW: std.meta.FnPtr(@TypeOf(UnregisterClassW)) = undefined; +pub var pfnUnregisterClassW: *const @TypeOf(UnregisterClassW) = undefined; pub fn unregisterClassW(lpClassName: [*:0]const u16, hInstance: HINSTANCE) !void { const function = selectSymbol(UnregisterClassW, pfnUnregisterClassW, .win2k); if (function(lpClassName, hInstance) == 0) { @@ -1292,7 +1292,7 @@ pub fn createWindowExA(dwExStyle: u32, lpClassName: [*:0]const u8, lpWindowName: } pub 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; -pub var pfnCreateWindowExW: std.meta.FnPtr(@TypeOf(CreateWindowExW)) = undefined; +pub var pfnCreateWindowExW: *const @TypeOf(CreateWindowExW) = undefined; pub 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 { const function = selectSymbol(CreateWindowExW, pfnCreateWindowExW, .win2k); 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 { } pub extern "user32" fn GetWindowLongW(hWnd: HWND, nIndex: i32) callconv(WINAPI) LONG; -pub var pfnGetWindowLongW: std.meta.FnPtr(@TypeOf(GetWindowLongW)) = undefined; +pub var pfnGetWindowLongW: *const @TypeOf(GetWindowLongW) = undefined; pub fn getWindowLongW(hWnd: HWND, nIndex: i32) !i32 { const function = selectSymbol(GetWindowLongW, pfnGetWindowLongW, .win2k); @@ -1415,7 +1415,7 @@ pub fn getWindowLongPtrA(hWnd: HWND, nIndex: i32) !isize { } pub extern "user32" fn GetWindowLongPtrW(hWnd: HWND, nIndex: i32) callconv(WINAPI) LONG_PTR; -pub var pfnGetWindowLongPtrW: std.meta.FnPtr(@TypeOf(GetWindowLongPtrW)) = undefined; +pub var pfnGetWindowLongPtrW: *const @TypeOf(GetWindowLongPtrW) = undefined; pub fn getWindowLongPtrW(hWnd: HWND, nIndex: i32) !isize { if (@sizeOf(LONG_PTR) == 4) return getWindowLongW(hWnd, nIndex); const function = selectSymbol(GetWindowLongPtrW, pfnGetWindowLongPtrW, .win2k); @@ -1449,7 +1449,7 @@ pub fn setWindowLongA(hWnd: HWND, nIndex: i32, dwNewLong: i32) !i32 { } pub extern "user32" fn SetWindowLongW(hWnd: HWND, nIndex: i32, dwNewLong: LONG) callconv(WINAPI) LONG; -pub var pfnSetWindowLongW: std.meta.FnPtr(@TypeOf(SetWindowLongW)) = undefined; +pub var pfnSetWindowLongW: *const @TypeOf(SetWindowLongW) = undefined; pub fn setWindowLongW(hWnd: HWND, nIndex: i32, dwNewLong: i32) !i32 { const function = selectSymbol(SetWindowLongW, pfnSetWindowLongW, .win2k); @@ -1484,7 +1484,7 @@ pub fn setWindowLongPtrA(hWnd: HWND, nIndex: i32, dwNewLong: isize) !isize { } pub extern "user32" fn SetWindowLongPtrW(hWnd: HWND, nIndex: i32, dwNewLong: LONG_PTR) callconv(WINAPI) LONG_PTR; -pub var pfnSetWindowLongPtrW: std.meta.FnPtr(@TypeOf(SetWindowLongPtrW)) = undefined; +pub var pfnSetWindowLongPtrW: *const @TypeOf(SetWindowLongPtrW) = undefined; pub fn setWindowLongPtrW(hWnd: HWND, nIndex: i32, dwNewLong: isize) !isize { if (@sizeOf(LONG_PTR) == 4) return setWindowLongW(hWnd, nIndex, dwNewLong); const function = selectSymbol(SetWindowLongPtrW, pfnSetWindowLongPtrW, .win2k); @@ -1580,7 +1580,7 @@ pub fn messageBoxA(hWnd: ?HWND, lpText: [*:0]const u8, lpCaption: [*:0]const u8, } pub extern "user32" fn MessageBoxW(hWnd: ?HWND, lpText: [*:0]const u16, lpCaption: ?[*:0]const u16, uType: UINT) callconv(WINAPI) i32; -pub var pfnMessageBoxW: std.meta.FnPtr(@TypeOf(MessageBoxW)) = undefined; +pub var pfnMessageBoxW: *const @TypeOf(MessageBoxW) = undefined; pub fn messageBoxW(hWnd: ?HWND, lpText: [*:0]const u16, lpCaption: [*:0]const u16, uType: u32) !i32 { const function = selectSymbol(MessageBoxW, pfnMessageBoxW, .win2k); const value = function(hWnd, lpText, lpCaption, uType); diff --git a/lib/std/os/windows/ws2_32.zig b/lib/std/os/windows/ws2_32.zig index 42707398bf4db97b150d077a22e1dca7986fe6ea..3c94493a85dd59b556a334b2a4dc0219dd5db35b 100644 --- a/lib/std/os/windows/ws2_32.zig +++ b/lib/std/os/windows/ws2_32.zig @@ -942,7 +942,7 @@ pub const UDP_NOCHECKSUM = 1; pub const UDP_CHECKSUM_COVERAGE = 20; pub const GAI_STRERROR_BUFFER_SIZE = 1024; -pub const LPCONDITIONPROC = std.meta.FnPtr(fn ( +pub const LPCONDITIONPROC = *const fn ( lpCallerId: *WSABUF, lpCallerData: *WSABUF, lpSQOS: *QOS, @@ -951,14 +951,14 @@ pub const LPCONDITIONPROC = std.meta.FnPtr(fn ( lpCalleeData: *WSABUF, g: *u32, dwCallbackData: usize, -) callconv(WINAPI) i32); +) callconv(WINAPI) i32; -pub const LPWSAOVERLAPPED_COMPLETION_ROUTINE = std.meta.FnPtr(fn ( +pub const LPWSAOVERLAPPED_COMPLETION_ROUTINE = *const fn ( dwError: u32, cbTransferred: u32, lpOverlapped: *OVERLAPPED, dwFlags: u32, -) callconv(WINAPI) void); +) callconv(WINAPI) void; pub const FLOWSPEC = extern struct { TokenRate: u32, @@ -1173,7 +1173,7 @@ pub const TRANSMIT_FILE_BUFFERS = extern struct { TailLength: u32, }; -pub const LPFN_TRANSMITFILE = std.meta.FnPtr(fn ( +pub const LPFN_TRANSMITFILE = *const fn ( hSocket: SOCKET, hFile: HANDLE, nNumberOfBytesToWrite: u32, @@ -1181,9 +1181,9 @@ pub const LPFN_TRANSMITFILE = std.meta.FnPtr(fn ( lpOverlapped: ?*OVERLAPPED, lpTransmitBuffers: ?*TRANSMIT_FILE_BUFFERS, dwReserved: u32, -) callconv(WINAPI) BOOL); +) callconv(WINAPI) BOOL; -pub const LPFN_ACCEPTEX = std.meta.FnPtr(fn ( +pub const LPFN_ACCEPTEX = *const fn ( sListenSocket: SOCKET, sAcceptSocket: SOCKET, lpOutputBuffer: *anyopaque, @@ -1192,9 +1192,9 @@ pub const LPFN_ACCEPTEX = std.meta.FnPtr(fn ( dwRemoteAddressLength: u32, lpdwBytesReceived: *u32, lpOverlapped: *OVERLAPPED, -) callconv(WINAPI) BOOL); +) callconv(WINAPI) BOOL; -pub const LPFN_GETACCEPTEXSOCKADDRS = std.meta.FnPtr(fn ( +pub const LPFN_GETACCEPTEXSOCKADDRS = *const fn ( lpOutputBuffer: *anyopaque, dwReceiveDataLength: u32, dwLocalAddressLength: u32, @@ -1203,29 +1203,29 @@ pub const LPFN_GETACCEPTEXSOCKADDRS = std.meta.FnPtr(fn ( LocalSockaddrLength: *i32, RemoteSockaddr: **sockaddr, RemoteSockaddrLength: *i32, -) callconv(WINAPI) void); +) callconv(WINAPI) void; -pub const LPFN_WSASENDMSG = std.meta.FnPtr(fn ( +pub const LPFN_WSASENDMSG = *const fn ( s: SOCKET, lpMsg: *const std.x.os.Socket.Message, dwFlags: u32, lpNumberOfBytesSent: ?*u32, lpOverlapped: ?*OVERLAPPED, lpCompletionRoutine: ?LPWSAOVERLAPPED_COMPLETION_ROUTINE, -) callconv(WINAPI) i32); +) callconv(WINAPI) i32; -pub const LPFN_WSARECVMSG = std.meta.FnPtr(fn ( +pub const LPFN_WSARECVMSG = *const fn ( s: SOCKET, lpMsg: *std.x.os.Socket.Message, lpdwNumberOfBytesRecv: ?*u32, lpOverlapped: ?*OVERLAPPED, lpCompletionRoutine: ?LPWSAOVERLAPPED_COMPLETION_ROUTINE, -) callconv(WINAPI) i32); +) callconv(WINAPI) i32; -pub const LPSERVICE_CALLBACK_PROC = std.meta.FnPtr(fn ( +pub const LPSERVICE_CALLBACK_PROC = *const fn ( lParam: LPARAM, hAsyncTaskHandle: HANDLE, -) callconv(WINAPI) void); +) callconv(WINAPI) void; pub const SERVICE_ASYNC_INFO = extern struct { lpServiceCallbackProc: LPSERVICE_CALLBACK_PROC, @@ -1233,11 +1233,11 @@ pub const SERVICE_ASYNC_INFO = extern struct { hAsyncTaskHandle: HANDLE, }; -pub const LPLOOKUPSERVICE_COMPLETION_ROUTINE = std.meta.FnPtr(fn ( +pub const LPLOOKUPSERVICE_COMPLETION_ROUTINE = *const fn ( dwError: u32, dwBytes: u32, lpOverlapped: *OVERLAPPED, -) callconv(WINAPI) void); +) callconv(WINAPI) void; pub const fd_set = extern struct { fd_count: u32, diff --git a/lib/std/packed_int_array.zig b/lib/std/packed_int_array.zig index 902e3ee19c914e6a45da63c5a57d41151f653ce9..c2129381a502f9697f2fc08e07f2b4b143335e37 100644 --- a/lib/std/packed_int_array.zig +++ b/lib/std/packed_int_array.zig @@ -338,12 +338,12 @@ pub fn PackedIntSliceEndian(comptime Int: type, comptime endian: Endian) type { }; } -const we_are_testing_this_with_stage1_which_leaks_comptime_memory = true; - test "PackedIntArray" { // TODO @setEvalBranchQuota generates panics in wasm32. Investigate. if (builtin.target.cpu.arch == .wasm32) return error.SkipZigTest; - if (we_are_testing_this_with_stage1_which_leaks_comptime_memory) return error.SkipZigTest; + + // TODO: enable this test + if (true) return error.SkipZigTest; @setEvalBranchQuota(10000); const max_bits = 256; @@ -405,7 +405,9 @@ test "PackedIntArray initAllTo" { test "PackedIntSlice" { // TODO @setEvalBranchQuota generates panics in wasm32. Investigate. if (builtin.target.cpu.arch == .wasm32) return error.SkipZigTest; - if (we_are_testing_this_with_stage1_which_leaks_comptime_memory) return error.SkipZigTest; + + // TODO enable this test + if (true) return error.SkipZigTest; @setEvalBranchQuota(10000); const max_bits = 256; @@ -444,7 +446,9 @@ test "PackedIntSlice" { } test "PackedIntSlice of PackedInt(Array/Slice)" { - if (we_are_testing_this_with_stage1_which_leaks_comptime_memory) return error.SkipZigTest; + // TODO enable this test + if (true) return error.SkipZigTest; + const max_bits = 16; const int_count = 19; diff --git a/lib/std/rand.zig b/lib/std/rand.zig index a3b46364cc8b2b14fca8f0468d47dd5337ed2add..914419b8630e5fbdf45c429eb1ecaf1919342ffa 100644 --- a/lib/std/rand.zig +++ b/lib/std/rand.zig @@ -30,7 +30,7 @@ pub const RomuTrio = @import("rand/RomuTrio.zig"); pub const Random = struct { ptr: *anyopaque, - fillFn: std.meta.FnPtr(fn (ptr: *anyopaque, buf: []u8) void), + fillFn: *const fn (ptr: *anyopaque, buf: []u8) void, pub fn init(pointer: anytype, comptime fillFn: fn (ptr: @TypeOf(pointer), buf: []u8) void) Random { const Ptr = @TypeOf(pointer); diff --git a/lib/std/segmented_list.zig b/lib/std/segmented_list.zig index 7ec29fe8d67d92fa359169c6cbc9b1de5b53f20c..5e01316572e8f41e74711b6dfd8f703693aadbad 100644 --- a/lib/std/segmented_list.zig +++ b/lib/std/segmented_list.zig @@ -412,7 +412,7 @@ pub fn SegmentedList(comptime T: type, comptime prealloc_item_count: usize) type } test "SegmentedList basic usage" { - if (@import("builtin").zig_backend == .stage1) { + if (false) { // https://github.com/ziglang/zig/issues/11787 try testSegmentedList(0); } diff --git a/lib/std/simd.zig b/lib/std/simd.zig index ead0869d664067b5716522548b53de890881dae4..95de3cc11cabcce120fe0092c1f8438921fa666e 100644 --- a/lib/std/simd.zig +++ b/lib/std/simd.zig @@ -191,9 +191,7 @@ pub fn extract( } test "vector patterns" { - if ((builtin.zig_backend == .stage1 or builtin.zig_backend == .stage2_llvm) and - builtin.cpu.arch == .aarch64) - { + if (builtin.zig_backend == .stage2_llvm and builtin.cpu.arch == .aarch64) { // https://github.com/ziglang/zig/issues/12012 return error.SkipZigTest; } @@ -419,7 +417,7 @@ test "vector prefix scan" { return error.SkipZigTest; } - if (builtin.zig_backend == .stage1 or builtin.zig_backend == .stage2_llvm) { + if (builtin.zig_backend == .stage2_llvm) { // Regressed in LLVM 14: // https://github.com/llvm/llvm-project/issues/55522 return error.SkipZigTest; diff --git a/lib/std/unicode.zig b/lib/std/unicode.zig index dac9256a605a2f9c17afaa7b1787dc92f4d565a0..7ac641e948dec1d09fc682a52f295c5ad82f9399 100644 --- a/lib/std/unicode.zig +++ b/lib/std/unicode.zig @@ -354,9 +354,7 @@ fn testUtf16CountCodepoints() !void { test "utf16 count codepoints" { try testUtf16CountCodepoints(); - // TODO stage1 error: out of bounds slice - if (@import("builtin").zig_backend != .stage1) - comptime try testUtf16CountCodepoints(); + comptime try testUtf16CountCodepoints(); } test "utf8 encode" { diff --git a/lib/std/zig/Ast.zig b/lib/std/zig/Ast.zig index 0966978ab8fc21a4c52d490d9814caacddd48dda..159b4dbb3acd69e4179375c775fe80e6394c13b6 100644 --- a/lib/std/zig/Ast.zig +++ b/lib/std/zig/Ast.zig @@ -2009,8 +2009,6 @@ fn fullStructInit(tree: Ast, info: full.StructInit.Components) full.StructInit { fn fullPtrType(tree: Ast, info: full.PtrType.Components) full.PtrType { const token_tags = tree.tokens.items(.tag); - // TODO: looks like stage1 isn't quite smart enough to handle enum - // literals in some places here const Size = std.builtin.Type.Pointer.Size; const size: Size = switch (token_tags[info.main_token]) { .asterisk, diff --git a/lib/std/zig/c_translation.zig b/lib/std/zig/c_translation.zig index ed78d4c4d680ee9c659bb5362eb3a0c06aee5710..aa9d59dae9b9354234bb4b322ff05436eccb53ed 100644 --- a/lib/std/zig/c_translation.zig +++ b/lib/std/zig/c_translation.zig @@ -9,19 +9,13 @@ pub fn cast(comptime DestType: type, target: anytype) DestType { // this function should behave like transCCast in translate-c, except it's for macros const SourceType = @TypeOf(target); switch (@typeInfo(DestType)) { - .Fn => if (builtin.zig_backend == .stage1) - return castToPtr(DestType, SourceType, target) - else - return castToPtr(*const DestType, SourceType, target), + .Fn => return castToPtr(*const DestType, SourceType, target), .Pointer => return castToPtr(DestType, SourceType, target), .Optional => |dest_opt| { if (@typeInfo(dest_opt.child) == .Pointer) { return castToPtr(DestType, SourceType, target); } else if (@typeInfo(dest_opt.child) == .Fn) { - if (builtin.zig_backend == .stage1) - return castToPtr(DestType, SourceType, target) - else - return castToPtr(?*const dest_opt.child, SourceType, target); + return castToPtr(?*const dest_opt.child, SourceType, target); } }, .Int => { @@ -149,7 +143,7 @@ test "cast" { try testing.expect(cast(?*anyopaque, -1) == @intToPtr(?*anyopaque, @bitCast(usize, @as(isize, -1)))); try testing.expect(cast(?*anyopaque, foo) == @intToPtr(?*anyopaque, @bitCast(usize, @as(isize, -1)))); - const FnPtr = ?if (builtin.zig_backend == .stage1) fn (*anyopaque) void else *align(1) const fn (*anyopaque) void; + const FnPtr = ?*align(1) const fn (*anyopaque) void; try testing.expect(cast(FnPtr, 0) == @intToPtr(FnPtr, @as(usize, 0))); try testing.expect(cast(FnPtr, foo) == @intToPtr(FnPtr, @bitCast(usize, @as(isize, -1)))); } @@ -160,12 +154,6 @@ pub fn sizeof(target: anytype) usize { switch (@typeInfo(T)) { .Float, .Int, .Struct, .Union, .Array, .Bool, .Vector => return @sizeOf(T), .Fn => { - if (builtin.zig_backend == .stage1) { - // sizeof(main) returns 1, sizeof(&main) returns pointer size. - // We cannot distinguish those types in Zig, so use pointer size. - return @sizeOf(T); - } - // sizeof(main) in C returns 1 return 1; }, @@ -263,9 +251,7 @@ test "sizeof" { try testing.expect(sizeof(*const *const [4:0]u8) == ptr_size); try testing.expect(sizeof(*const [4]u8) == ptr_size); - if (builtin.zig_backend == .stage1) { - try testing.expect(sizeof(sizeof) == @sizeOf(@TypeOf(sizeof))); - } else if (false) { // TODO + if (false) { // TODO try testing.expect(sizeof(&sizeof) == @sizeOf(@TypeOf(&sizeof))); try testing.expect(sizeof(sizeof) == 1); } diff --git a/lib/std/zig/render.zig b/lib/std/zig/render.zig index 160ec13f0c1cc05accfba4342c08b484e29f03db..0c54b3c751361badedc8fbaddb2fbd5d8da4c39f 100644 --- a/lib/std/zig/render.zig +++ b/lib/std/zig/render.zig @@ -2211,7 +2211,7 @@ fn renderAsm( }, else => unreachable, } - } else unreachable; // TODO shouldn't need this on while(true) + } } fn renderCall( diff --git a/lib/std/zig/string_literal.zig b/lib/std/zig/string_literal.zig index 22b8f68fa7cf457be731d29485010848fd71ee00..4859c379a081f36ba87718f79799b4c6e180e9b1 100644 --- a/lib/std/zig/string_literal.zig +++ b/lib/std/zig/string_literal.zig @@ -266,7 +266,7 @@ pub fn parseWrite(writer: anytype, bytes: []const u8) error{OutOfMemory}!Result index += 1; }, } - } else unreachable; // TODO should not need else unreachable on while(true) + } } /// Higher level API. Does not return extra info about parse errors. diff --git a/src/Compilation.zig b/src/Compilation.zig index f568753feab62ec793b10c762086f19c24c253bf..7f6314bbb04c1cb5338736273625109bee76c3e7 100644 --- a/src/Compilation.zig +++ b/src/Compilation.zig @@ -5431,11 +5431,6 @@ pub fn build_crt_file( }); errdefer comp.gpa.free(basename); - // TODO: This is extracted into a local variable to work around a stage1 miscompilation. - const emit_bin = Compilation.EmitLoc{ - .directory = null, // Put it in the cache directory. - .basename = basename, - }; const sub_compilation = try Compilation.create(comp.gpa, .{ .local_cache_directory = comp.global_cache_directory, .global_cache_directory = comp.global_cache_directory, @@ -5447,7 +5442,10 @@ pub fn build_crt_file( .output_mode = output_mode, .thread_pool = comp.thread_pool, .libc_installation = comp.bin_file.options.libc_installation, - .emit_bin = emit_bin, + .emit_bin = .{ + .directory = null, // Put it in the cache directory. + .basename = basename, + }, .optimize_mode = comp.compilerRtOptMode(), .want_sanitize_c = false, .want_stack_check = false, @@ -5492,15 +5490,16 @@ pub fn build_crt_file( }); } -pub fn stage1AddLinkLib(comp: *Compilation, lib_name: []const u8) !void { +pub fn addLinkLib(comp: *Compilation, lib_name: []const u8) !void { // Avoid deadlocking on building import libs such as kernel32.lib - // This can happen when the user uses `build-exe foo.obj -lkernel32` and then - // when we create a sub-Compilation for zig libc, it also tries to build kernel32.lib. + // This can happen when the user uses `build-exe foo.obj -lkernel32` and + // then when we create a sub-Compilation for zig libc, it also tries to + // build kernel32.lib. if (comp.bin_file.options.skip_linker_dependencies) return; - // This happens when an `extern "foo"` function is referenced by the stage1 backend. - // If we haven't seen this library yet and we're targeting Windows, we need to queue up - // a work item to produce the DLL import library for this. + // This happens when an `extern "foo"` function is referenced. + // If we haven't seen this library yet and we're targeting Windows, we need + // to queue up a work item to produce the DLL import library for this. const gop = try comp.bin_file.options.system_libs.getOrPut(comp.gpa, lib_name); if (!gop.found_existing and comp.getTarget().os.tag == .windows) { try comp.work_queue.writeItem(.{ diff --git a/src/Module.zig b/src/Module.zig index 68d0ac8af51f3bca81a8834057d71fd6220ba2e2..074e25470c168574c099173cc008f556281edff1 100644 --- a/src/Module.zig +++ b/src/Module.zig @@ -71,7 +71,7 @@ import_table: std.StringArrayHashMapUnmanaged(*File) = .{}, /// Keys are fully resolved file paths. This table owns the keys and values. embed_table: std.StringHashMapUnmanaged(*EmbedFile) = .{}, -/// This is a temporary addition to stage2 in order to match stage1 behavior, +/// This is a temporary addition to stage2 in order to match legacy behavior, /// however the end-game once the lang spec is settled will be to use a global /// InternPool for comptime memoized objects, making this behavior consistent across all types, /// 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 export_list.deinit(gpa); } +// TODO https://github.com/ziglang/zig/issues/8643 const data_has_safety_tag = @sizeOf(Zir.Inst.Data) != 8; -// TODO This is taking advantage of matching stage1 debug union layout. -// We need a better language feature for initializing a union with -// a runtime-known tag. -const Stage1DataLayout = extern struct { +const HackDataLayout = extern struct { data: [8]u8 align(@alignOf(Zir.Inst.Data)), safety_tag: u8, }; comptime { if (data_has_safety_tag) { - assert(@sizeOf(Stage1DataLayout) == @sizeOf(Zir.Inst.Data)); + assert(@sizeOf(HackDataLayout) == @sizeOf(Zir.Inst.Data)); } } @@ -3695,7 +3693,7 @@ pub fn astGenFile(mod: *Module, file: *File) !void { const tags = zir.instructions.items(.tag); for (zir.instructions.items(.data)) |*data, i| { const union_tag = Zir.Inst.Tag.data_tags[@enumToInt(tags[i])]; - const as_struct = @ptrCast(*Stage1DataLayout, data); + const as_struct = @ptrCast(*HackDataLayout, data); as_struct.* = .{ .safety_tag = @enumToInt(union_tag), .data = safety_buffer[i], @@ -3881,7 +3879,7 @@ pub fn astGenFile(mod: *Module, file: *File) !void { if (data_has_safety_tag) { // The `Data` union has a safety tag but in the file format we store it without. for (file.zir.instructions.items(.data)) |*data, i| { - const as_struct = @ptrCast(*const Stage1DataLayout, data); + const as_struct = @ptrCast(*const HackDataLayout, data); safety_buffer[i] = as_struct.data; } } diff --git a/src/Sema.zig b/src/Sema.zig index ecabd7b65edf3193e3e0c6d8ee4ee6427a9acb41..68348ac161cfa02fbbdf595494431447c8d885be 100644 --- a/src/Sema.zig +++ b/src/Sema.zig @@ -1359,7 +1359,7 @@ fn analyzeBodyInner( break check_block.runtime_index; } check_block = check_block.parent.?; - } else unreachable; + }; if (@enumToInt(target_runtime_index) < @enumToInt(block.runtime_index)) { const runtime_src = block.runtime_cond orelse block.runtime_loop.?; @@ -1733,7 +1733,7 @@ fn analyzeBodyInner( break always_noreturn; map.putAssumeCapacity(inst, air_inst); i += 1; - } else unreachable; + }; // balance out dbg_block_begins in case of early noreturn const noreturn_inst = block.instructions.popOrNull(); @@ -3478,7 +3478,7 @@ fn zirMakePtrConst(sema: *Sema, block: *Block, inst: Zir.Inst.Index) CompileErro .store => break candidate, else => break :ct, } - } else unreachable; // TODO shouldn't need this + }; while (true) { if (search_index == 0) break :ct; @@ -3704,7 +3704,7 @@ fn zirResolveInferredAlloc(sema: *Sema, block: *Block, inst: Zir.Inst.Index) Com .store => break candidate, else => break :ct, } - } else unreachable; // TODO shouldn't need this + }; const bitcast_inst = while (true) { if (search_index == 0) break :ct; @@ -3716,7 +3716,7 @@ fn zirResolveInferredAlloc(sema: *Sema, block: *Block, inst: Zir.Inst.Index) Com .bitcast => break candidate, else => break :ct, } - } else unreachable; // TODO shouldn't need this + }; const const_inst = while (true) { if (search_index == 0) break :ct; @@ -3728,7 +3728,7 @@ fn zirResolveInferredAlloc(sema: *Sema, block: *Block, inst: Zir.Inst.Index) Com .constant => break candidate, else => break :ct, } - } else unreachable; // TODO shouldn't need this + }; const store_op = air_datas[store_inst].bin_op; const store_val = (try sema.resolveMaybeUndefVal(store_op.rhs)) orelse break :ct; @@ -8307,7 +8307,7 @@ fn handleExternLibName( .{ lib_name, lib_name }, ); } - comp.stage1AddLinkLib(lib_name) catch |err| { + comp.addLinkLib(lib_name) catch |err| { return sema.fail(block, src_loc, "unable to add link lib '{s}': {s}", .{ lib_name, @errorName(err), }); @@ -8401,15 +8401,11 @@ fn funcCommon( } } - // These locals are pulled out from the init expression below to work around - // a stage1 compiler bug. // In the case of generic calling convention, or generic alignment, we use // default values which are only meaningful for the generic function, *not* // the instantiation, which can depend on comptime parameters. // Related proposal: https://github.com/ziglang/zig/issues/11834 - const cc_workaround = cc orelse .Unspecified; - const align_workaround = alignment orelse 0; - + const cc_resolved = cc orelse .Unspecified; const param_types = try sema.arena.alloc(Type, block.params.items.len); const comptime_params = try sema.arena.alloc(bool, block.params.items.len); for (block.params.items) |param, i| { @@ -8421,7 +8417,7 @@ fn funcCommon( comptime_params, i, &is_generic, - cc_workaround, + cc_resolved, has_body, ) catch |err| switch (err) { error.NeededSourceLocation => { @@ -8433,7 +8429,7 @@ fn funcCommon( comptime_params, i, &is_generic, - cc_workaround, + cc_resolved, has_body, ); return error.AnalysisFail; @@ -8481,10 +8477,10 @@ fn funcCommon( }; return sema.failWithOwnedErrorMsg(msg); } - if (!Type.fnCallingConventionAllowsZigTypes(cc_workaround) and !try sema.validateExternType(return_type, .ret_ty)) { + if (!Type.fnCallingConventionAllowsZigTypes(cc_resolved) and !try sema.validateExternType(return_type, .ret_ty)) { const msg = msg: { const msg = try sema.errMsg(block, ret_ty_src, "return type '{}' not allowed in function with calling convention '{s}'", .{ - return_type.fmt(sema.mod), @tagName(cc_workaround), + return_type.fmt(sema.mod), @tagName(cc_resolved), }); errdefer msg.destroy(sema.gpa); @@ -8533,7 +8529,7 @@ fn funcCommon( } const arch = sema.mod.getTarget().cpu.arch; - if (switch (cc_workaround) { + if (switch (cc_resolved) { .Unspecified, .C, .Naked, .Async, .Inline => null, .Interrupt => switch (arch) { .x86, .x86_64, .avr, .msp430 => null, @@ -8569,13 +8565,13 @@ fn funcCommon( }, }) |allowed_platform| { return sema.fail(block, cc_src, "callconv '{s}' is only available on {s}, not {s}", .{ - @tagName(cc_workaround), + @tagName(cc_resolved), allowed_platform, @tagName(arch), }); } - if (cc_workaround == .Inline and is_noinline) { + if (cc_resolved == .Inline and is_noinline) { return sema.fail(block, cc_src, "'noinline' function cannot have callconv 'Inline'", .{}); } if (is_generic and sema.no_partial_func_ty) return error.GenericPoison; @@ -8593,9 +8589,9 @@ fn funcCommon( .param_types = param_types, .comptime_params = comptime_params.ptr, .return_type = return_type, - .cc = cc_workaround, + .cc = cc_resolved, .cc_is_generic = cc == null, - .alignment = align_workaround, + .alignment = alignment orelse 0, .align_is_generic = alignment == null, .section_is_generic = section == .generic, .addrspace_is_generic = address_space == null, @@ -14964,7 +14960,7 @@ fn zirClosureGet( break tv; } scope = scope.parent.?; - } else unreachable; + }; if (tv.val.tag() == .unreachable_value and !block.is_typeof and sema.func == null) { const msg = msg: { @@ -19107,8 +19103,6 @@ fn zirPtrCast(sema: *Sema, block: *Block, inst: Zir.Inst.Index) CompileError!Air const operand_elem_size = operand_elem_ty.abiSize(target); const dest_elem_size = dest_elem_ty.abiSize(target); if (operand_elem_size != dest_elem_size) { - // note that this is not implemented in stage1 so we should probably wait - // until that codebase is replaced before implementing this in stage2. return sema.fail(block, dest_ty_src, "TODO: implement @ptrCast between slices changing the length", .{}); } } diff --git a/src/ThreadPool.zig b/src/ThreadPool.zig index 7115adbddd0a7e225ad6ff250b89452b8bb2b924..980bacf94ff023b0938aab507732867efb5cfe92 100644 --- a/src/ThreadPool.zig +++ b/src/ThreadPool.zig @@ -15,10 +15,7 @@ const Runnable = struct { runFn: RunProto, }; -const RunProto = switch (builtin.zig_backend) { - .stage1 => fn (*Runnable) void, - else => *const fn (*Runnable) void, -}; +const RunProto = *const fn (*Runnable) void; pub fn init(pool: *ThreadPool, allocator: std.mem.Allocator) !void { pool.* = .{ diff --git a/src/clang.zig b/src/clang.zig index d3eacbfec449b2a43b8fd53ed7acf95a9d6ab181..36b9c71a87326b47928d5cb2f868ad57fc7dc5ca 100644 --- a/src/clang.zig +++ b/src/clang.zig @@ -161,12 +161,11 @@ pub const ASTUnit = opaque { extern fn ZigClangASTUnit_getSourceManager(*ASTUnit) *SourceManager; pub const visitLocalTopLevelDecls = ZigClangASTUnit_visitLocalTopLevelDecls; - extern fn ZigClangASTUnit_visitLocalTopLevelDecls(*ASTUnit, context: ?*anyopaque, Fn: ?VisitorFn) bool; - - const VisitorFn = if (@import("builtin").zig_backend == .stage1) - fn (?*anyopaque, *const Decl) callconv(.C) bool - else - *const fn (?*anyopaque, *const Decl) callconv(.C) bool; + extern fn ZigClangASTUnit_visitLocalTopLevelDecls( + *ASTUnit, + context: ?*anyopaque, + Fn: ?*const fn (?*anyopaque, *const Decl) callconv(.C) bool, + ) bool; pub const getLocalPreprocessingEntities_begin = ZigClangASTUnit_getLocalPreprocessingEntities_begin; extern fn ZigClangASTUnit_getLocalPreprocessingEntities_begin(*ASTUnit) PreprocessingRecord.iterator; diff --git a/src/codegen.zig b/src/codegen.zig index 2261ba3b94c732f3cbae0d640df63d75826e859b..985fa8d6c5e7e054ab0d38843543f84fa8ef120f 100644 --- a/src/codegen.zig +++ b/src/codegen.zig @@ -98,54 +98,13 @@ pub fn generateFunction( .aarch64_be, .aarch64_32, => return @import("arch/aarch64/CodeGen.zig").generate(bin_file, src_loc, func, air, liveness, code, debug_output), - //.arc => return Function(.arc).generate(bin_file, src_loc, func, air, liveness, code, debug_output), - //.avr => return Function(.avr).generate(bin_file, src_loc, func, air, liveness, code, debug_output), - //.bpfel => return Function(.bpfel).generate(bin_file, src_loc, func, air, liveness, code, debug_output), - //.bpfeb => return Function(.bpfeb).generate(bin_file, src_loc, func, air, liveness, code, debug_output), - //.hexagon => return Function(.hexagon).generate(bin_file, src_loc, func, air, liveness, code, debug_output), - //.mips => return Function(.mips).generate(bin_file, src_loc, func, air, liveness, code, debug_output), - //.mipsel => return Function(.mipsel).generate(bin_file, src_loc, func, air, liveness, code, debug_output), - //.mips64 => return Function(.mips64).generate(bin_file, src_loc, func, air, liveness, code, debug_output), - //.mips64el => return Function(.mips64el).generate(bin_file, src_loc, func, air, liveness, code, debug_output), - //.msp430 => return Function(.msp430).generate(bin_file, src_loc, func, air, liveness, code, debug_output), - //.powerpc => return Function(.powerpc).generate(bin_file, src_loc, func, air, liveness, code, debug_output), - //.powerpc64 => return Function(.powerpc64).generate(bin_file, src_loc, func, air, liveness, code, debug_output), - //.powerpc64le => return Function(.powerpc64le).generate(bin_file, src_loc, func, air, liveness, code, debug_output), - //.r600 => return Function(.r600).generate(bin_file, src_loc, func, air, liveness, code, debug_output), - //.amdgcn => return Function(.amdgcn).generate(bin_file, src_loc, func, air, liveness, code, debug_output), - //.riscv32 => return Function(.riscv32).generate(bin_file, src_loc, func, air, liveness, code, debug_output), .riscv64 => return @import("arch/riscv64/CodeGen.zig").generate(bin_file, src_loc, func, air, liveness, code, debug_output), - //.sparc => return Function(.sparc).generate(bin_file, src_loc, func, air, liveness, code, debug_output), .sparc64 => return @import("arch/sparc64/CodeGen.zig").generate(bin_file, src_loc, func, air, liveness, code, debug_output), - //.sparcel => return Function(.sparcel).generate(bin_file, src_loc, func, air, liveness, code, debug_output), - //.s390x => return Function(.s390x).generate(bin_file, src_loc, func, air, liveness, code, debug_output), - //.tce => return Function(.tce).generate(bin_file, src_loc, func, air, liveness, code, debug_output), - //.tcele => return Function(.tcele).generate(bin_file, src_loc, func, air, liveness, code, debug_output), - //.thumb => return Function(.thumb).generate(bin_file, src_loc, func, air, liveness, code, debug_output), - //.thumbeb => return Function(.thumbeb).generate(bin_file, src_loc, func, air, liveness, code, debug_output), - //.x86 => return Function(.x86).generate(bin_file, src_loc, func, air, liveness, code, debug_output), .x86_64 => return @import("arch/x86_64/CodeGen.zig").generate(bin_file, src_loc, func, air, liveness, code, debug_output), - //.xcore => return Function(.xcore).generate(bin_file, src_loc, func, air, liveness, code, debug_output), - //.nvptx => return Function(.nvptx).generate(bin_file, src_loc, func, air, liveness, code, debug_output), - //.nvptx64 => return Function(.nvptx64).generate(bin_file, src_loc, func, air, liveness, code, debug_output), - //.le32 => return Function(.le32).generate(bin_file, src_loc, func, air, liveness, code, debug_output), - //.le64 => return Function(.le64).generate(bin_file, src_loc, func, air, liveness, code, debug_output), - //.amdil => return Function(.amdil).generate(bin_file, src_loc, func, air, liveness, code, debug_output), - //.amdil64 => return Function(.amdil64).generate(bin_file, src_loc, func, air, liveness, code, debug_output), - //.hsail => return Function(.hsail).generate(bin_file, src_loc, func, air, liveness, code, debug_output), - //.hsail64 => return Function(.hsail64).generate(bin_file, src_loc, func, air, liveness, code, debug_output), - //.spir => return Function(.spir).generate(bin_file, src_loc, func, air, liveness, code, debug_output), - //.spir64 => return Function(.spir64).generate(bin_file, src_loc, func, air, liveness, code, debug_output), - //.kalimba => return Function(.kalimba).generate(bin_file, src_loc, func, air, liveness, code, debug_output), - //.shave => return Function(.shave).generate(bin_file, src_loc, func, air, liveness, code, debug_output), - //.lanai => return Function(.lanai).generate(bin_file, src_loc, func, air, liveness, code, debug_output), - //.renderscript32 => return Function(.renderscript32).generate(bin_file, src_loc, func, air, liveness, code, debug_output), - //.renderscript64 => return Function(.renderscript64).generate(bin_file, src_loc, func, air, liveness, code, debug_output), - //.ve => return Function(.ve).generate(bin_file, src_loc, func, air, liveness, code, debug_output), .wasm32, .wasm64, => return @import("arch/wasm/CodeGen.zig").generate(bin_file, src_loc, func, air, liveness, code, debug_output), - 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."), + else => unreachable, } } diff --git a/src/codegen/c.zig b/src/codegen/c.zig index 0c2822739c1e8c9e6ed202161e75686bc4ffd37a..1fd9539730715e8acb7a5c7d39c455a8621d69ee 100644 --- a/src/codegen/c.zig +++ b/src/codegen/c.zig @@ -4972,8 +4972,7 @@ fn airStructFieldPtr(f: *Function, inst: Air.Inst.Index) !CValue { if (f.liveness.isUnused(inst)) { try reap(f, inst, &.{extra.struct_operand}); - // TODO this @as is needed because of a stage1 bug - return @as(CValue, CValue.none); + return .none; } const struct_ptr = try f.resolveInst(extra.struct_operand); @@ -4987,8 +4986,7 @@ fn airStructFieldPtrIndex(f: *Function, inst: Air.Inst.Index, index: u8) !CValue if (f.liveness.isUnused(inst)) { try reap(f, inst, &.{ty_op.operand}); - // TODO this @as is needed because of a stage1 bug - return @as(CValue, CValue.none); + return .none; } const struct_ptr = try f.resolveInst(ty_op.operand); diff --git a/src/codegen/llvm.zig b/src/codegen/llvm.zig index 29d074ea1c1ca540ec249ee56114a22d66db8d8f..79c253949ae2ef295d152c84fea189e0772ea8d6 100644 --- a/src/codegen/llvm.zig +++ b/src/codegen/llvm.zig @@ -1392,8 +1392,9 @@ pub const Object = struct { const dir_path = file.pkg.root_src_directory.path orelse "."; const sub_file_path_z = try gpa.dupeZ(u8, std.fs.path.basename(file.sub_file_path)); defer gpa.free(sub_file_path_z); - const stage1_workaround = std.fs.path.dirname(file.sub_file_path) orelse ""; - const dir_path_z = try std.fs.path.joinZ(gpa, &.{ dir_path, stage1_workaround }); + const dir_path_z = try std.fs.path.joinZ(gpa, &.{ + dir_path, std.fs.path.dirname(file.sub_file_path) orelse "", + }); defer gpa.free(dir_path_z); const di_file = o.di_builder.?.createFile(sub_file_path_z, dir_path_z); gop.value_ptr.* = di_file.toNode(); @@ -6107,12 +6108,11 @@ pub const FuncGen = struct { } fn airAssembly(self: *FuncGen, inst: Air.Inst.Index) !?*llvm.Value { - // Eventually, the Zig compiler needs to be reworked to have inline assembly go - // through the same parsing code regardless of backend, and have LLVM-flavored - // inline assembly be *output* from that assembler. - // We don't have such an assembler implemented yet though. For now, this - // implementation feeds the inline assembly code directly to LLVM, same - // as stage1. + // Eventually, the Zig compiler needs to be reworked to have inline + // assembly go through the same parsing code regardless of backend, and + // have LLVM-flavored inline assembly be *output* from that assembler. + // We don't have such an assembler implemented yet though. For now, + // this implementation feeds the inline assembly code directly to LLVM. const ty_pl = self.air.instructions.items(.data)[inst].ty_pl; const extra = self.air.extraData(Air.Asm, ty_pl.payload); diff --git a/src/codegen/spirv/Section.zig b/src/codegen/spirv/Section.zig index 6484272943c5144cca97a137d3e522112e856ff4..768525028e36a8709b8bf64a751495e5f15cbc2d 100644 --- a/src/codegen/spirv/Section.zig +++ b/src/codegen/spirv/Section.zig @@ -333,8 +333,6 @@ fn extendedUnionSize(comptime Operand: type, operand: Operand) usize { } test "SPIR-V Section emit() - no operands" { - if (@import("builtin").zig_backend == .stage1) return error.SkipZigTest; - var section = Section{}; defer section.deinit(std.testing.allocator); @@ -344,8 +342,6 @@ test "SPIR-V Section emit() - no operands" { } test "SPIR-V Section emit() - simple" { - if (@import("builtin").zig_backend == .stage1) return error.SkipZigTest; - var section = Section{}; defer section.deinit(std.testing.allocator); @@ -362,8 +358,6 @@ test "SPIR-V Section emit() - simple" { } test "SPIR-V Section emit() - string" { - if (@import("builtin").zig_backend == .stage1) return error.SkipZigTest; - var section = Section{}; defer section.deinit(std.testing.allocator); @@ -389,8 +383,6 @@ test "SPIR-V Section emit() - string" { } test "SPIR-V Section emit()- extended mask" { - if (@import("builtin").zig_backend == .stage1) return error.SkipZigTest; - var section = Section{}; defer section.deinit(std.testing.allocator); @@ -415,8 +407,6 @@ test "SPIR-V Section emit()- extended mask" { } test "SPIR-V Section emit() - extended union" { - if (@import("builtin").zig_backend == .stage1) return error.SkipZigTest; - var section = Section{}; defer section.deinit(std.testing.allocator); diff --git a/src/main.zig b/src/main.zig index 7004576f4657acdb5da696af8f153ab23c7fdd00..089d806885210bc814e923a92d0ee5d7ba8a6efb 100644 --- a/src/main.zig +++ b/src/main.zig @@ -3289,15 +3289,11 @@ fn parseCrossTargetOrReportFatalError( fatal("unknown CPU feature: '{s}'", .{diags.unknown_feature_name.?}); }, error.UnknownObjectFormat => { - { + help: { var help_text = std.ArrayList(u8).init(allocator); defer help_text.deinit(); inline for (@typeInfo(std.Target.ObjectFormat).Enum.fields) |field| { - help_text.writer().print(" {s}\n", .{field.name}) catch - // TODO change this back to `break :help` - // this working around a stage1 bug. - //break :help; - @panic("out of memory"); + help_text.writer().print(" {s}\n", .{field.name}) catch break :help; } std.log.info("available object formats:\n{s}", .{help_text.items}); } diff --git a/src/print_air.zig b/src/print_air.zig index 86ba81e110f4e18235ddb87d56f87c38af08eed7..671f781e5ed72661f095178898e65eb0c69af878 100644 --- a/src/print_air.zig +++ b/src/print_air.zig @@ -848,7 +848,7 @@ const Writer = struct { if ((bits >> 31) != 0) break :blk false; extra_index += 1; tomb_op_index += 31; - } else unreachable; + } }; return w.writeInstRef(s, operand, dies); } diff --git a/src/target.zig b/src/target.zig index f118a47724057fa1febbcb74b2a34f865030fa23..836791a1d1d7c69655d056b39ed58f2399ed12f4 100644 --- a/src/target.zig +++ b/src/target.zig @@ -523,13 +523,13 @@ pub const AtomicPtrAlignmentDiagnostics = struct { /// If ABI alignment of `ty` is OK for atomic operations, returns 0. /// Otherwise returns the alignment required on a pointer for the target /// to perform atomic operations. +// TODO this function does not take into account CPU features, which can affect +// this value. Audit this! pub fn atomicPtrAlignment( target: std.Target, ty: Type, diags: *AtomicPtrAlignmentDiagnostics, ) AtomicPtrAlignmentError!u32 { - // TODO this was ported from stage1 but it does not take into account CPU features, - // which can affect this value. Audit this! const max_atomic_bits: u16 = switch (target.cpu.arch) { .avr, .msp430, diff --git a/src/translate_c.zig b/src/translate_c.zig index d4b2e0c709fc75c067c529865201c3fe3784513d..b324504a54e0a2bacf85c07582a006a57966319a 100644 --- a/src/translate_c.zig +++ b/src/translate_c.zig @@ -1,6 +1,3 @@ -//! This is the userland implementation of translate-c which is used by both stage1 -//! and stage2. - const std = @import("std"); const testing = std.testing; const assert = std.debug.assert; @@ -523,7 +520,7 @@ fn declVisitorNamesOnly(c: *Context, decl: *const clang.Decl) Error!void { child_ty = macroqualified_ty.getModifiedType().getTypePtr(); }, else => return, - } else unreachable; + }; const result = try c.unnamed_typedefs.getOrPut(c.gpa, addr); if (result.found_existing) { @@ -629,7 +626,7 @@ fn visitFnDecl(c: *Context, fn_decl: *const clang.FunctionDecl) Error!void { }, else => break fn_type, } - } else unreachable; + }; const fn_ty = @ptrCast(*const clang.FunctionType, fn_type); const return_qt = fn_ty.getReturnType(); diff --git a/src/type.zig b/src/type.zig index d36bd285f8d46329f8ddcb9b6718f29adcb917de..f587bdc490ceb89407689d1f825b5f7e777efdde 100644 --- a/src/type.zig +++ b/src/type.zig @@ -1554,10 +1554,10 @@ pub const Type = extern union { ) @TypeOf(writer).Error!void { _ = options; comptime assert(unused_format_string.len == 0); - if (@import("builtin").zig_backend != .stage1) { - // This is disabled to work around a stage2 bug where this function recursively - // causes more generic function instantiations resulting in an infinite loop - // in the compiler. + if (true) { + // This is disabled to work around a bug where this function + // recursively causes more generic function instantiations + // resulting in an infinite loop in the compiler. try writer.writeAll("[TODO fix internal compiler bug regarding dump]"); return; } @@ -6551,9 +6551,7 @@ pub const Type = extern union { else => {}, } } else { - // TODO stage1 type inference bug const T = Type.Tag; - const type_payload = try arena.create(Type.Payload.ElemType); type_payload.* = .{ .base = .{ diff --git a/src/zig_llvm.h b/src/zig_llvm.h index 2829801a4611494672713592ab118c0cf110c643..7f9bd0a1619d30239a1ab92c3b9675d8c1bdb987 100644 --- a/src/zig_llvm.h +++ b/src/zig_llvm.h @@ -337,7 +337,6 @@ ZIG_EXTERN_C void ZigLLVMParseCommandLineOptions(size_t argc, const char *const // synchronize with llvm/include/ADT/Triple.h::ArchType // synchronize with std.Target.Cpu.Arch -// synchronize with src/stage1/target.cpp::arch_list // synchronize with codegen/llvm/bindings.zig::ArchType enum ZigLLVM_ArchType { ZigLLVM_UnknownArch, @@ -428,7 +427,6 @@ enum ZigLLVM_VendorType { // synchronize with llvm/include/ADT/Triple.h::OsType // synchronize with std.Target.Os.Tag // synchronize with codegen/llvm/bindings.zig::OsType -// synchronize with src/stage1/target.cpp::os_list enum ZigLLVM_OSType { ZigLLVM_UnknownOS, diff --git a/test/behavior.zig b/test/behavior.zig index 3b6eb9c6ef0ec884a59f5639c68e986d965a1887..d301fa328ffb37d581d5134d0d3b06f935a82b16 100644 --- a/test/behavior.zig +++ b/test/behavior.zig @@ -94,6 +94,8 @@ test { _ = @import("behavior/bugs/12551.zig"); _ = @import("behavior/bugs/12644.zig"); _ = @import("behavior/bugs/12680.zig"); + _ = @import("behavior/bugs/12723.zig"); + _ = @import("behavior/bugs/12776.zig"); _ = @import("behavior/bugs/12786.zig"); _ = @import("behavior/bugs/12794.zig"); _ = @import("behavior/bugs/12801-1.zig"); @@ -112,8 +114,8 @@ test { _ = @import("behavior/bugs/13069.zig"); _ = @import("behavior/bugs/13112.zig"); _ = @import("behavior/bugs/13128.zig"); - _ = @import("behavior/bugs/13164.zig"); _ = @import("behavior/bugs/13159.zig"); + _ = @import("behavior/bugs/13164.zig"); _ = @import("behavior/bugs/13171.zig"); _ = @import("behavior/bugs/13285.zig"); _ = @import("behavior/bugs/13435.zig"); @@ -126,7 +128,9 @@ test { _ = @import("behavior/cast_int.zig"); _ = @import("behavior/comptime_memory.zig"); _ = @import("behavior/const_slice_child.zig"); + _ = @import("behavior/decltest.zig"); _ = @import("behavior/defer.zig"); + _ = @import("behavior/empty_union.zig"); _ = @import("behavior/enum.zig"); _ = @import("behavior/error.zig"); _ = @import("behavior/eval.zig"); @@ -142,6 +146,7 @@ test { _ = @import("behavior/if.zig"); _ = @import("behavior/import.zig"); _ = @import("behavior/incomplete_struct_param_tld.zig"); + _ = @import("behavior/inline_switch.zig"); _ = @import("behavior/int128.zig"); _ = @import("behavior/int_div.zig"); _ = @import("behavior/inttoptr.zig"); @@ -154,6 +159,8 @@ test { _ = @import("behavior/namespace_depends_on_compile_var.zig"); _ = @import("behavior/null.zig"); _ = @import("behavior/optional.zig"); + _ = @import("behavior/packed-struct.zig"); + _ = @import("behavior/packed_struct_explicit_backing_int.zig"); _ = @import("behavior/pointers.zig"); _ = @import("behavior/popcount.zig"); _ = @import("behavior/prefetch.zig"); @@ -169,7 +176,6 @@ test { _ = @import("behavior/slice_sentinel_comptime.zig"); _ = @import("behavior/src.zig"); _ = @import("behavior/struct.zig"); - _ = @import("behavior/packed-struct.zig"); _ = @import("behavior/struct_contains_null_ptr_itself.zig"); _ = @import("behavior/struct_contains_slice_of_itself.zig"); _ = @import("behavior/switch.zig"); @@ -180,6 +186,7 @@ test { _ = @import("behavior/truncate.zig"); _ = @import("behavior/try.zig"); _ = @import("behavior/tuple.zig"); + _ = @import("behavior/tuple_declarations.zig"); _ = @import("behavior/type.zig"); _ = @import("behavior/type_info.zig"); _ = @import("behavior/typename.zig"); @@ -198,16 +205,6 @@ test { _ = @import("behavior/wasm.zig"); } - if (builtin.zig_backend != .stage1) { - _ = @import("behavior/decltest.zig"); - _ = @import("behavior/packed_struct_explicit_backing_int.zig"); - _ = @import("behavior/empty_union.zig"); - _ = @import("behavior/inline_switch.zig"); - _ = @import("behavior/tuple_declarations.zig"); - _ = @import("behavior/bugs/12723.zig"); - _ = @import("behavior/bugs/12776.zig"); - } - if (builtin.os.tag != .wasi) { _ = @import("behavior/asm.zig"); } diff --git a/test/behavior/align.zig b/test/behavior/align.zig index 884b6d23c9d46df29695658b124a41a1f48f9491..fde3f9addf4d999d53973dbac6fe26a2aac3a79c 100644 --- a/test/behavior/align.zig +++ b/test/behavior/align.zig @@ -16,7 +16,6 @@ test "global variable alignment" { } test "slicing array of length 1 can not assume runtime index is always zero" { - if (builtin.zig_backend == .stage1) return error.SkipZigTest; if (builtin.zig_backend == .stage2_wasm) return error.SkipZigTest; // TODO if (builtin.zig_backend == .stage2_aarch64) return error.SkipZigTest; // TODO @@ -61,10 +60,6 @@ test "alignment of struct with pointer has same alignment as usize" { } test "alignment and size of structs with 128-bit fields" { - if (builtin.zig_backend == .stage1) { - // stage1 gets the wrong answer for a lot of targets - return error.SkipZigTest; - } if (builtin.zig_backend == .stage2_arm) return error.SkipZigTest; // TODO if (builtin.zig_backend == .stage2_aarch64) return error.SkipZigTest; // TODO @@ -313,7 +308,6 @@ test "function alignment" { } test "implicitly decreasing fn alignment" { - if (builtin.zig_backend == .stage1) return error.SkipZigTest; if (builtin.zig_backend == .stage2_aarch64) return error.SkipZigTest; if (builtin.zig_backend == .stage2_arm) return error.SkipZigTest; @@ -337,7 +331,6 @@ fn alignedBig() align(16) i32 { test "@alignCast functions" { if (builtin.zig_backend == .stage2_aarch64) return error.SkipZigTest; - if (builtin.zig_backend == .stage1) return error.SkipZigTest; if (builtin.zig_backend == .stage2_arm) return error.SkipZigTest; // function alignment is a compile error on wasm32/wasm64 @@ -380,8 +373,6 @@ test "function align expression depends on generic parameter" { } test "function callconv expression depends on generic parameter" { - if (builtin.zig_backend == .stage1) return error.SkipZigTest; - const S = struct { fn doTheTest() !void { try expect(foobar(.C, 1) == 2); @@ -435,8 +426,6 @@ fn testIndex2(ptr: [*]align(4) u8, index: usize, comptime T: type) !void { } test "alignment of function with c calling convention" { - if (builtin.zig_backend == .stage1) return error.SkipZigTest; - var runtime_nothing = ¬hing; const casted1 = @ptrCast(*const u8, runtime_nothing); const casted2 = @ptrCast(*const fn () callconv(.C) void, casted1); @@ -495,7 +484,7 @@ test "struct field explicit alignment" { } test "align(@alignOf(T)) T does not force resolution of T" { - if (builtin.zig_backend != .stage1) return error.SkipZigTest; + if (true) return error.SkipZigTest; // TODO const S = struct { const A = struct { @@ -519,7 +508,6 @@ test "align(@alignOf(T)) T does not force resolution of T" { } test "align(N) on functions" { - if (builtin.zig_backend == .stage1) return error.SkipZigTest; if (builtin.zig_backend == .stage2_aarch64) return error.SkipZigTest; // TODO if (builtin.zig_backend == .stage2_arm) return error.SkipZigTest; // TODO if (builtin.zig_backend == .stage2_sparc64) return error.SkipZigTest; // TODO @@ -557,8 +545,6 @@ test "@alignCast null" { } test "alignment of slice element" { - if (builtin.zig_backend == .stage1) return error.SkipZigTest; - const a: []align(1024) const u8 = undefined; try expect(@TypeOf(&a[0]) == *align(1024) const u8); } diff --git a/test/behavior/array.zig b/test/behavior/array.zig index f1dcb3b95d234ca549224f1c2770d24e4c73532e..843782800a05fb55196f7cc5073dd3f2f657fb8c 100644 --- a/test/behavior/array.zig +++ b/test/behavior/array.zig @@ -102,12 +102,6 @@ test "array len field" { } test "array with sentinels" { - if (builtin.zig_backend == .stage1) { - // Stage1 test coverage disabled at runtime because of - // https://github.com/ziglang/zig/issues/4372 - return error.SkipZigTest; - } - if (builtin.zig_backend == .stage2_aarch64) return error.SkipZigTest; const S = struct { diff --git a/test/behavior/async_fn.zig b/test/behavior/async_fn.zig index 88398cca87f6bfbe01211b02fdc6ecbc2ddac60f..fe095e99a3fb975e1e80746c16cfb717f75f0543 100644 --- a/test/behavior/async_fn.zig +++ b/test/behavior/async_fn.zig @@ -8,7 +8,7 @@ const expectError = std.testing.expectError; var global_x: i32 = 1; test "simple coroutine suspend and resume" { - if (builtin.zig_backend != .stage1) return error.SkipZigTest; // TODO + if (true) return error.SkipZigTest; // TODO if (builtin.os.tag == .wasi) return error.SkipZigTest; // TODO var frame = async simpleAsyncFn(); @@ -31,7 +31,7 @@ fn simpleAsyncFn() void { var global_y: i32 = 1; test "pass parameter to coroutine" { - if (builtin.zig_backend != .stage1) return error.SkipZigTest; // TODO + if (true) return error.SkipZigTest; // TODO if (builtin.os.tag == .wasi) return error.SkipZigTest; // TODO var p = async simpleAsyncFnWithArg(2); @@ -46,7 +46,7 @@ fn simpleAsyncFnWithArg(delta: i32) void { } test "suspend at end of function" { - if (builtin.zig_backend != .stage1) return error.SkipZigTest; // TODO + if (true) return error.SkipZigTest; // TODO if (builtin.os.tag == .wasi) return error.SkipZigTest; // TODO const S = struct { @@ -68,7 +68,7 @@ test "suspend at end of function" { } test "local variable in async function" { - if (builtin.zig_backend != .stage1) return error.SkipZigTest; // TODO + if (true) return error.SkipZigTest; // TODO if (builtin.os.tag == .wasi) return error.SkipZigTest; // TODO const S = struct { @@ -100,7 +100,7 @@ test "local variable in async function" { } test "calling an inferred async function" { - if (builtin.zig_backend != .stage1) return error.SkipZigTest; // TODO + if (true) return error.SkipZigTest; // TODO if (builtin.os.tag == .wasi) return error.SkipZigTest; // TODO const S = struct { @@ -127,7 +127,7 @@ test "calling an inferred async function" { } test "@frameSize" { - if (builtin.zig_backend != .stage1) return error.SkipZigTest; // TODO + if (true) return error.SkipZigTest; // TODO if (builtin.os.tag == .wasi) return error.SkipZigTest; // TODO if (builtin.target.cpu.arch == .thumb or builtin.target.cpu.arch == .thumbeb) @@ -161,7 +161,7 @@ test "@frameSize" { } test "coroutine suspend, resume" { - if (builtin.zig_backend != .stage1) return error.SkipZigTest; // TODO + if (true) return error.SkipZigTest; // TODO if (builtin.os.tag == .wasi) return error.SkipZigTest; // TODO const S = struct { @@ -205,7 +205,7 @@ test "coroutine suspend, resume" { } test "coroutine suspend with block" { - if (builtin.zig_backend != .stage1) return error.SkipZigTest; // TODO + if (true) return error.SkipZigTest; // TODO if (builtin.os.tag == .wasi) return error.SkipZigTest; // TODO const p = async testSuspendBlock(); @@ -234,7 +234,7 @@ var await_a_promise: anyframe = undefined; var await_final_result: i32 = 0; test "coroutine await" { - if (builtin.zig_backend != .stage1) return error.SkipZigTest; // TODO + if (true) return error.SkipZigTest; // TODO if (builtin.os.tag == .wasi) return error.SkipZigTest; // TODO await_seq('a'); @@ -274,7 +274,7 @@ fn await_seq(c: u8) void { var early_final_result: i32 = 0; test "coroutine await early return" { - if (builtin.zig_backend != .stage1) return error.SkipZigTest; // TODO + if (true) return error.SkipZigTest; // TODO if (builtin.os.tag == .wasi) return error.SkipZigTest; // TODO early_seq('a'); @@ -305,7 +305,7 @@ fn early_seq(c: u8) void { } test "async function with dot syntax" { - if (builtin.zig_backend != .stage1) return error.SkipZigTest; // TODO + if (true) return error.SkipZigTest; // TODO if (builtin.os.tag == .wasi) return error.SkipZigTest; // TODO const S = struct { @@ -321,7 +321,7 @@ test "async function with dot syntax" { } test "async fn pointer in a struct field" { - if (builtin.zig_backend != .stage1) return error.SkipZigTest; // TODO + if (true) return error.SkipZigTest; // TODO if (builtin.os.tag == .wasi) return error.SkipZigTest; // TODO var data: i32 = 1; @@ -349,7 +349,7 @@ fn simpleAsyncFn2(y: *i32) callconv(.Async) void { } test "@asyncCall with return type" { - if (builtin.zig_backend != .stage1) return error.SkipZigTest; // TODO + if (true) return error.SkipZigTest; // TODO if (builtin.os.tag == .wasi) return error.SkipZigTest; // TODO const Foo = struct { @@ -376,7 +376,7 @@ test "@asyncCall with return type" { } test "async fn with inferred error set" { - if (builtin.zig_backend != .stage1) return error.SkipZigTest; // TODO + if (true) return error.SkipZigTest; // TODO if (builtin.os.tag == .wasi) return error.SkipZigTest; // TODO const S = struct { @@ -409,7 +409,7 @@ test "async fn with inferred error set" { } test "error return trace across suspend points - early return" { - if (builtin.zig_backend != .stage1) return error.SkipZigTest; // TODO + if (true) return error.SkipZigTest; // TODO if (builtin.os.tag == .wasi) return error.SkipZigTest; // TODO const p = nonFailing(); @@ -419,7 +419,7 @@ test "error return trace across suspend points - early return" { } test "error return trace across suspend points - async return" { - if (builtin.zig_backend != .stage1) return error.SkipZigTest; // TODO + if (true) return error.SkipZigTest; // TODO if (builtin.os.tag == .wasi) return error.SkipZigTest; // TODO const p = nonFailing(); @@ -452,7 +452,7 @@ fn printTrace(p: anyframe->(anyerror!void)) callconv(.Async) void { } test "break from suspend" { - if (builtin.zig_backend != .stage1) return error.SkipZigTest; // TODO + if (true) return error.SkipZigTest; // TODO if (builtin.os.tag == .wasi) return error.SkipZigTest; // TODO var my_result: i32 = 1; @@ -470,7 +470,7 @@ fn testBreakFromSuspend(my_result: *i32) callconv(.Async) void { } test "heap allocated async function frame" { - if (builtin.zig_backend != .stage1) return error.SkipZigTest; // TODO + if (true) return error.SkipZigTest; // TODO if (builtin.os.tag == .wasi) return error.SkipZigTest; // TODO const S = struct { @@ -497,7 +497,7 @@ test "heap allocated async function frame" { } test "async function call return value" { - if (builtin.zig_backend != .stage1) return error.SkipZigTest; // TODO + if (true) return error.SkipZigTest; // TODO if (builtin.os.tag == .wasi) return error.SkipZigTest; // TODO const S = struct { @@ -541,7 +541,7 @@ test "async function call return value" { } test "suspension points inside branching control flow" { - if (builtin.zig_backend != .stage1) return error.SkipZigTest; // TODO + if (true) return error.SkipZigTest; // TODO if (builtin.os.tag == .wasi) return error.SkipZigTest; // TODO const S = struct { @@ -570,7 +570,7 @@ test "suspension points inside branching control flow" { } test "call async function which has struct return type" { - if (builtin.zig_backend != .stage1) return error.SkipZigTest; // TODO + if (true) return error.SkipZigTest; // TODO if (builtin.os.tag == .wasi) return error.SkipZigTest; // TODO const S = struct { @@ -606,7 +606,7 @@ test "call async function which has struct return type" { } test "pass string literal to async function" { - if (builtin.zig_backend != .stage1) return error.SkipZigTest; // TODO + if (true) return error.SkipZigTest; // TODO if (builtin.os.tag == .wasi) return error.SkipZigTest; // TODO const S = struct { @@ -630,7 +630,7 @@ test "pass string literal to async function" { } test "await inside an errdefer" { - if (builtin.zig_backend != .stage1) return error.SkipZigTest; // TODO + if (true) return error.SkipZigTest; // TODO if (builtin.os.tag == .wasi) return error.SkipZigTest; // TODO const S = struct { @@ -656,7 +656,7 @@ test "await inside an errdefer" { } test "try in an async function with error union and non-zero-bit payload" { - if (builtin.zig_backend != .stage1) return error.SkipZigTest; // TODO + if (true) return error.SkipZigTest; // TODO if (builtin.os.tag == .wasi) return error.SkipZigTest; // TODO const S = struct { @@ -689,7 +689,7 @@ test "try in an async function with error union and non-zero-bit payload" { } test "returning a const error from async function" { - if (builtin.zig_backend != .stage1) return error.SkipZigTest; // TODO + if (true) return error.SkipZigTest; // TODO if (builtin.os.tag == .wasi) return error.SkipZigTest; // TODO const S = struct { @@ -723,7 +723,7 @@ test "returning a const error from async function" { } test "async/await typical usage" { - if (builtin.zig_backend != .stage1) return error.SkipZigTest; // TODO + if (true) return error.SkipZigTest; // TODO if (builtin.os.tag == .wasi) return error.SkipZigTest; // TODO inline for ([_]bool{ false, true }) |b1| { @@ -821,7 +821,7 @@ fn testAsyncAwaitTypicalUsage( } test "alignment of local variables in async functions" { - if (builtin.zig_backend != .stage1) return error.SkipZigTest; // TODO + if (true) return error.SkipZigTest; // TODO if (builtin.os.tag == .wasi) return error.SkipZigTest; // TODO const S = struct { @@ -836,7 +836,7 @@ test "alignment of local variables in async functions" { } test "no reason to resolve frame still works" { - if (builtin.zig_backend != .stage1) return error.SkipZigTest; // TODO + if (true) return error.SkipZigTest; // TODO if (builtin.os.tag == .wasi) return error.SkipZigTest; // TODO _ = async simpleNothing(); @@ -847,7 +847,7 @@ fn simpleNothing() void { } test "async call a generic function" { - if (builtin.zig_backend != .stage1) return error.SkipZigTest; // TODO + if (true) return error.SkipZigTest; // TODO if (builtin.os.tag == .wasi) return error.SkipZigTest; // TODO const S = struct { @@ -870,7 +870,7 @@ test "async call a generic function" { } test "return from suspend block" { - if (builtin.zig_backend != .stage1) return error.SkipZigTest; // TODO + if (true) return error.SkipZigTest; // TODO if (builtin.os.tag == .wasi) return error.SkipZigTest; // TODO const S = struct { @@ -887,7 +887,7 @@ test "return from suspend block" { } test "struct parameter to async function is copied to the frame" { - if (builtin.zig_backend != .stage1) return error.SkipZigTest; // TODO + if (true) return error.SkipZigTest; // TODO if (builtin.os.tag == .wasi) return error.SkipZigTest; // TODO const S = struct { @@ -934,7 +934,7 @@ test "struct parameter to async function is copied to the frame" { } test "cast fn to async fn when it is inferred to be async" { - if (builtin.zig_backend != .stage1) return error.SkipZigTest; // TODO + if (true) return error.SkipZigTest; // TODO if (builtin.os.tag == .wasi) return error.SkipZigTest; // TODO const S = struct { @@ -965,7 +965,7 @@ test "cast fn to async fn when it is inferred to be async" { } test "cast fn to async fn when it is inferred to be async, awaited directly" { - if (builtin.zig_backend != .stage1) return error.SkipZigTest; // TODO + if (true) return error.SkipZigTest; // TODO if (builtin.os.tag == .wasi) return error.SkipZigTest; // TODO const S = struct { @@ -995,7 +995,7 @@ test "cast fn to async fn when it is inferred to be async, awaited directly" { } test "await does not force async if callee is blocking" { - if (builtin.zig_backend != .stage1) return error.SkipZigTest; // TODO + if (true) return error.SkipZigTest; // TODO if (builtin.os.tag == .wasi) return error.SkipZigTest; // TODO const S = struct { @@ -1008,7 +1008,7 @@ test "await does not force async if callee is blocking" { } test "recursive async function" { - if (builtin.zig_backend != .stage1) return error.SkipZigTest; // TODO + if (true) return error.SkipZigTest; // TODO if (builtin.os.tag == .wasi) return error.SkipZigTest; // TODO try expect(recursiveAsyncFunctionTest(false).doTheTest() == 55); @@ -1073,7 +1073,7 @@ fn recursiveAsyncFunctionTest(comptime suspending_implementation: bool) type { } test "@asyncCall with comptime-known function, but not awaited directly" { - if (builtin.zig_backend != .stage1) return error.SkipZigTest; // TODO + if (true) return error.SkipZigTest; // TODO if (builtin.os.tag == .wasi) return error.SkipZigTest; // TODO const S = struct { @@ -1105,7 +1105,7 @@ test "@asyncCall with comptime-known function, but not awaited directly" { } test "@asyncCall with actual frame instead of byte buffer" { - if (builtin.zig_backend != .stage1) return error.SkipZigTest; // TODO + if (true) return error.SkipZigTest; // TODO if (builtin.os.tag == .wasi) return error.SkipZigTest; // TODO const S = struct { @@ -1122,7 +1122,7 @@ test "@asyncCall with actual frame instead of byte buffer" { } test "@asyncCall using the result location inside the frame" { - if (builtin.zig_backend != .stage1) return error.SkipZigTest; // TODO + if (true) return error.SkipZigTest; // TODO if (builtin.os.tag == .wasi) return error.SkipZigTest; // TODO const S = struct { @@ -1152,7 +1152,7 @@ test "@asyncCall using the result location inside the frame" { } test "@TypeOf an async function call of generic fn with error union type" { - if (builtin.zig_backend != .stage1) return error.SkipZigTest; // TODO + if (true) return error.SkipZigTest; // TODO if (builtin.os.tag == .wasi) return error.SkipZigTest; // TODO const S = struct { @@ -1166,7 +1166,7 @@ test "@TypeOf an async function call of generic fn with error union type" { } test "using @TypeOf on a generic function call" { - if (builtin.zig_backend != .stage1) return error.SkipZigTest; // TODO + if (true) return error.SkipZigTest; // TODO if (builtin.os.tag == .wasi) return error.SkipZigTest; // TODO const S = struct { @@ -1194,7 +1194,7 @@ test "using @TypeOf on a generic function call" { } test "recursive call of await @asyncCall with struct return type" { - if (builtin.zig_backend != .stage1) return error.SkipZigTest; // TODO + if (true) return error.SkipZigTest; // TODO if (builtin.os.tag == .wasi) return error.SkipZigTest; // TODO const S = struct { @@ -1233,7 +1233,7 @@ test "recursive call of await @asyncCall with struct return type" { } test "nosuspend function call" { - if (builtin.zig_backend != .stage1) return error.SkipZigTest; // TODO + if (true) return error.SkipZigTest; // TODO if (builtin.os.tag == .wasi) return error.SkipZigTest; // TODO const S = struct { @@ -1252,7 +1252,7 @@ test "nosuspend function call" { } test "await used in expression and awaiting fn with no suspend but async calling convention" { - if (builtin.zig_backend != .stage1) return error.SkipZigTest; // TODO + if (true) return error.SkipZigTest; // TODO if (builtin.os.tag == .wasi) return error.SkipZigTest; // TODO const S = struct { @@ -1271,7 +1271,7 @@ test "await used in expression and awaiting fn with no suspend but async calling } test "await used in expression after a fn call" { - if (builtin.zig_backend != .stage1) return error.SkipZigTest; // TODO + if (true) return error.SkipZigTest; // TODO if (builtin.os.tag == .wasi) return error.SkipZigTest; // TODO const S = struct { @@ -1292,7 +1292,7 @@ test "await used in expression after a fn call" { } test "async fn call used in expression after a fn call" { - if (builtin.zig_backend != .stage1) return error.SkipZigTest; // TODO + if (true) return error.SkipZigTest; // TODO if (builtin.os.tag == .wasi) return error.SkipZigTest; // TODO const S = struct { @@ -1312,7 +1312,7 @@ test "async fn call used in expression after a fn call" { } test "suspend in for loop" { - if (builtin.zig_backend != .stage1) return error.SkipZigTest; // TODO + if (true) return error.SkipZigTest; // TODO if (builtin.os.tag == .wasi) return error.SkipZigTest; // TODO const S = struct { @@ -1341,7 +1341,7 @@ test "suspend in for loop" { } test "suspend in while loop" { - if (builtin.zig_backend != .stage1) return error.SkipZigTest; // TODO + if (true) return error.SkipZigTest; // TODO if (builtin.os.tag == .wasi) return error.SkipZigTest; // TODO const S = struct { @@ -1381,7 +1381,7 @@ test "suspend in while loop" { } test "correctly spill when returning the error union result of another async fn" { - if (builtin.zig_backend != .stage1) return error.SkipZigTest; // TODO + if (true) return error.SkipZigTest; // TODO if (builtin.os.tag == .wasi) return error.SkipZigTest; // TODO const S = struct { @@ -1407,7 +1407,7 @@ test "correctly spill when returning the error union result of another async fn" } test "spill target expr in a for loop" { - if (builtin.zig_backend != .stage1) return error.SkipZigTest; // TODO + if (true) return error.SkipZigTest; // TODO if (builtin.os.tag == .wasi) return error.SkipZigTest; // TODO const S = struct { @@ -1441,7 +1441,7 @@ test "spill target expr in a for loop" { } test "spill target expr in a for loop, with a var decl in the loop body" { - if (builtin.zig_backend != .stage1) return error.SkipZigTest; // TODO + if (true) return error.SkipZigTest; // TODO if (builtin.os.tag == .wasi) return error.SkipZigTest; // TODO const S = struct { @@ -1480,7 +1480,7 @@ test "spill target expr in a for loop, with a var decl in the loop body" { } test "async call with @call" { - if (builtin.zig_backend != .stage1) return error.SkipZigTest; // TODO + if (true) return error.SkipZigTest; // TODO if (builtin.os.tag == .wasi) return error.SkipZigTest; // TODO const S = struct { @@ -1505,7 +1505,7 @@ test "async call with @call" { } test "async function passed 0-bit arg after non-0-bit arg" { - if (builtin.zig_backend != .stage1) return error.SkipZigTest; // TODO + if (true) return error.SkipZigTest; // TODO if (builtin.os.tag == .wasi) return error.SkipZigTest; // TODO const S = struct { @@ -1529,7 +1529,7 @@ test "async function passed 0-bit arg after non-0-bit arg" { } test "async function passed align(16) arg after align(8) arg" { - if (builtin.zig_backend != .stage1) return error.SkipZigTest; // TODO + if (true) return error.SkipZigTest; // TODO if (builtin.os.tag == .wasi) return error.SkipZigTest; // TODO const S = struct { @@ -1554,7 +1554,7 @@ test "async function passed align(16) arg after align(8) arg" { } test "async function call resolves target fn frame, comptime func" { - if (builtin.zig_backend != .stage1) return error.SkipZigTest; // TODO + if (true) return error.SkipZigTest; // TODO if (builtin.os.tag == .wasi) return error.SkipZigTest; // TODO const S = struct { @@ -1579,7 +1579,7 @@ test "async function call resolves target fn frame, comptime func" { } test "async function call resolves target fn frame, runtime func" { - if (builtin.zig_backend != .stage1) return error.SkipZigTest; // TODO + if (true) return error.SkipZigTest; // TODO if (builtin.os.tag == .wasi) return error.SkipZigTest; // TODO const S = struct { @@ -1605,7 +1605,7 @@ test "async function call resolves target fn frame, runtime func" { } test "properly spill optional payload capture value" { - if (builtin.zig_backend != .stage1) return error.SkipZigTest; // TODO + if (true) return error.SkipZigTest; // TODO if (builtin.os.tag == .wasi) return error.SkipZigTest; // TODO const S = struct { @@ -1632,7 +1632,7 @@ test "properly spill optional payload capture value" { } test "handle defer interfering with return value spill" { - if (builtin.zig_backend != .stage1) return error.SkipZigTest; // TODO + if (true) return error.SkipZigTest; // TODO if (builtin.os.tag == .wasi) return error.SkipZigTest; // TODO const S = struct { @@ -1675,7 +1675,7 @@ test "handle defer interfering with return value spill" { } test "take address of temporary async frame" { - if (builtin.zig_backend != .stage1) return error.SkipZigTest; // TODO + if (true) return error.SkipZigTest; // TODO if (builtin.os.tag == .wasi) return error.SkipZigTest; // TODO const S = struct { @@ -1707,7 +1707,7 @@ test "take address of temporary async frame" { } test "nosuspend await" { - if (builtin.zig_backend != .stage1) return error.SkipZigTest; // TODO + if (true) return error.SkipZigTest; // TODO if (builtin.os.tag == .wasi) return error.SkipZigTest; // TODO const S = struct { @@ -1731,7 +1731,7 @@ test "nosuspend await" { } test "nosuspend on function calls" { - if (builtin.zig_backend != .stage1) return error.SkipZigTest; // TODO + if (true) return error.SkipZigTest; // TODO if (builtin.os.tag == .wasi) return error.SkipZigTest; // TODO const S0 = struct { @@ -1750,7 +1750,7 @@ test "nosuspend on function calls" { } test "nosuspend on async function calls" { - if (builtin.zig_backend != .stage1) return error.SkipZigTest; // TODO + if (true) return error.SkipZigTest; // TODO if (builtin.os.tag == .wasi) return error.SkipZigTest; // TODO const S0 = struct { @@ -1771,7 +1771,7 @@ test "nosuspend on async function calls" { } // test "resume nosuspend async function calls" { -// if (builtin.zig_backend != .stage1) return error.SkipZigTest; // if (builtin.os.tag == .wasi) return error.SkipZigTest; // TODO +// if (true) return error.SkipZigTest; // if (builtin.os.tag == .wasi) return error.SkipZigTest; // TODO // const S0 = struct { // b: i32 = 42, // }; @@ -1794,7 +1794,7 @@ test "nosuspend on async function calls" { // } test "nosuspend resume async function calls" { - if (builtin.zig_backend != .stage1) return error.SkipZigTest; // TODO + if (true) return error.SkipZigTest; // TODO if (builtin.os.tag == .wasi) return error.SkipZigTest; // TODO const S0 = struct { @@ -1819,7 +1819,7 @@ test "nosuspend resume async function calls" { } test "avoid forcing frame alignment resolution implicit cast to *anyopaque" { - if (builtin.zig_backend != .stage1) return error.SkipZigTest; // TODO + if (true) return error.SkipZigTest; // TODO if (builtin.os.tag == .wasi) return error.SkipZigTest; // TODO const S = struct { @@ -1838,7 +1838,7 @@ test "avoid forcing frame alignment resolution implicit cast to *anyopaque" { } test "@asyncCall with pass-by-value arguments" { - if (builtin.zig_backend != .stage1) return error.SkipZigTest; // TODO + if (true) return error.SkipZigTest; // TODO if (builtin.os.tag == .wasi) return error.SkipZigTest; // TODO const F0: u64 = 0xbeefbeefbeefbeef; @@ -1874,7 +1874,7 @@ test "@asyncCall with pass-by-value arguments" { } test "@asyncCall with arguments having non-standard alignment" { - if (builtin.zig_backend != .stage1) return error.SkipZigTest; // TODO + if (true) return error.SkipZigTest; // TODO if (builtin.os.tag == .wasi) return error.SkipZigTest; // TODO const F0: u64 = 0xbeefbeef; diff --git a/test/behavior/atomics.zig b/test/behavior/atomics.zig index 1fca1f6ea2052ff204d41878043a1be54d0af5e2..094be62bc7142ff80d90ba28b8bb88c3262a8892 100644 --- a/test/behavior/atomics.zig +++ b/test/behavior/atomics.zig @@ -151,9 +151,7 @@ test "cmpxchg on a global variable" { if (builtin.zig_backend == .stage2_sparc64) return error.SkipZigTest; // TODO if (builtin.zig_backend == .stage2_arm) return error.SkipZigTest; // TODO - if ((builtin.zig_backend == .stage1 or builtin.zig_backend == .stage2_llvm) and - builtin.cpu.arch == .aarch64) - { + if (builtin.zig_backend == .stage2_llvm and builtin.cpu.arch == .aarch64) { // https://github.com/ziglang/zig/issues/10627 return error.SkipZigTest; } @@ -220,8 +218,8 @@ test "atomicrmw with floats" { if (builtin.zig_backend == .stage2_sparc64) return error.SkipZigTest; // TODO if (builtin.zig_backend == .stage2_arm) return error.SkipZigTest; // TODO - if ((builtin.zig_backend == .stage1 or builtin.zig_backend == .stage2_llvm or - builtin.zig_backend == .stage2_c) and builtin.cpu.arch == .aarch64) + if ((builtin.zig_backend == .stage2_llvm or builtin.zig_backend == .stage2_c) and + builtin.cpu.arch == .aarch64) { // https://github.com/ziglang/zig/issues/10627 return error.SkipZigTest; diff --git a/test/behavior/await_struct.zig b/test/behavior/await_struct.zig index 8e1cae11355e8fb1526bd5de374be65b1cd5e4f5..bc1420f96a75cd543c32fa3688f1e11aad19ff24 100644 --- a/test/behavior/await_struct.zig +++ b/test/behavior/await_struct.zig @@ -10,7 +10,7 @@ var await_a_promise: anyframe = undefined; var await_final_result = Foo{ .x = 0 }; test "coroutine await struct" { - if (builtin.zig_backend != .stage1) return error.SkipZigTest; // TODO + if (true) return error.SkipZigTest; // TODO await_seq('a'); var p = async await_amain(); diff --git a/test/behavior/basic.zig b/test/behavior/basic.zig index 80df087920d1e69acfe96452f35aed56b0aba3df..d5f7d92d9d93f0733c9a6b0dfa5f8b7ea3e0f06c 100644 --- a/test/behavior/basic.zig +++ b/test/behavior/basic.zig @@ -198,11 +198,6 @@ const OpaqueA = opaque {}; const OpaqueB = opaque {}; test "opaque types" { - if (builtin.zig_backend == .stage1) { - // stage1 gets the type names wrong - return error.SkipZigTest; - } - if (builtin.zig_backend == .stage2_aarch64) return error.SkipZigTest; // TODO try expect(*OpaqueA != *OpaqueB); @@ -290,7 +285,6 @@ fn fB() []const u8 { test "call function pointer in struct" { if (builtin.zig_backend == .stage2_aarch64) return error.SkipZigTest; - if (builtin.zig_backend == .stage1) return error.SkipZigTest; try expect(mem.eql(u8, f3(true), "a")); try expect(mem.eql(u8, f3(false), "b")); @@ -329,7 +323,6 @@ fn copy(src: *const u64, dst: *u64) void { } test "call result of if else expression" { - if (builtin.zig_backend == .stage1) return error.SkipZigTest; // stage1 has different function pointers if (builtin.zig_backend == .stage2_aarch64) return error.SkipZigTest; if (builtin.zig_backend == .stage2_arm) return error.SkipZigTest; if (builtin.zig_backend == .stage2_x86_64) return error.SkipZigTest; @@ -573,22 +566,16 @@ fn emptyFn() void {} const addr1 = @ptrCast(*const u8, &emptyFn); test "comptime cast fn to ptr" { - if (builtin.zig_backend == .stage1) return error.SkipZigTest; - const addr2 = @ptrCast(*const u8, &emptyFn); comptime try expect(addr1 == addr2); } test "equality compare fn ptrs" { - if (builtin.zig_backend == .stage1) return error.SkipZigTest; - var a = &emptyFn; try expect(a == a); } test "self reference through fn ptr field" { - if (builtin.zig_backend == .stage1) return error.SkipZigTest; - const S = struct { const A = struct { f: *const fn (A) u8, @@ -783,10 +770,6 @@ test "auto created variables have correct alignment" { } test "extern variable with non-pointer opaque type" { - if (builtin.zig_backend == .stage1) { - // Regressed with LLVM 14 - return error.SkipZigTest; - } if (builtin.zig_backend == .stage2_wasm) return error.SkipZigTest; // TODO if (builtin.zig_backend == .stage2_x86_64) return error.SkipZigTest; // TODO if (builtin.zig_backend == .stage2_aarch64) return error.SkipZigTest; // TODO @@ -963,7 +946,7 @@ test "array type comes from generic function" { } test "generic function uses return type of other generic function" { - if (builtin.zig_backend != .stage1) { + if (true) { // This test has been failing sporadically on the CI. // It's not enough to verify that it works locally; we need to diagnose why // it fails on the CI sometimes before turning it back on. @@ -1067,7 +1050,6 @@ test "inline call of function with a switch inside the return statement" { } test "namespace lookup ignores decl causing the lookup" { - if (builtin.zig_backend == .stage1) return error.SkipZigTest; if (builtin.zig_backend == .stage2_wasm) return error.SkipZigTest; // TODO if (builtin.zig_backend == .stage2_x86_64) return error.SkipZigTest; // TODO if (builtin.zig_backend == .stage2_aarch64) return error.SkipZigTest; // TODO diff --git a/test/behavior/bitcast.zig b/test/behavior/bitcast.zig index 8b180f6d0b9bf972cb8c0907775ccb41e74b047c..94e74c3ddf26ca6f513650bbd49b6b8195b87f38 100644 --- a/test/behavior/bitcast.zig +++ b/test/behavior/bitcast.zig @@ -155,10 +155,6 @@ test "bitcast generates a temporary value" { } test "@bitCast packed structs at runtime and comptime" { - if (builtin.zig_backend == .stage1) { - // stage1 gets the wrong answer for a lot of targets - return error.SkipZigTest; - } if (builtin.zig_backend == .stage2_x86_64) return error.SkipZigTest; if (builtin.zig_backend == .stage2_aarch64) return error.SkipZigTest; if (builtin.zig_backend == .stage2_arm) return error.SkipZigTest; @@ -323,7 +319,6 @@ test "@bitCast packed struct of floats" { } test "comptime @bitCast packed struct to int and back" { - if (builtin.zig_backend == .stage1) return error.SkipZigTest; if (builtin.zig_backend == .stage2_wasm) return error.SkipZigTest; if (builtin.zig_backend == .stage2_c) return error.SkipZigTest; if (builtin.zig_backend == .stage2_x86_64) return error.SkipZigTest; @@ -377,8 +372,7 @@ test "comptime bitcast with fields following f80" { } test "bitcast vector to integer and back" { - if (builtin.zig_backend != .stage1) return error.SkipZigTest; // TODO: https://github.com/ziglang/zig/issues/13220 - if (builtin.zig_backend == .stage1) return error.SkipZigTest; // stage1 gets the comptime cast wrong + if (true) return error.SkipZigTest; // TODO: https://github.com/ziglang/zig/issues/13220 const arr: [16]bool = [_]bool{ true, false } ++ [_]bool{true} ** 14; var x = @splat(16, true); diff --git a/test/behavior/bitreverse.zig b/test/behavior/bitreverse.zig index d834f09cae4a50e349ee9046db7ff3877b1eca06..4691781e00862ca474a9bf1443ba16d75360567a 100644 --- a/test/behavior/bitreverse.zig +++ b/test/behavior/bitreverse.zig @@ -5,8 +5,6 @@ const minInt = std.math.minInt; test "@bitReverse large exotic integer" { if (builtin.zig_backend == .stage2_wasm) return error.SkipZigTest; - // Currently failing on stage1 for big-endian targets - if (builtin.zig_backend == .stage1) return error.SkipZigTest; try expect(@bitReverse(@as(u95, 0x123456789abcdef111213141)) == 0x4146424447bd9eac8f351624); } @@ -96,7 +94,6 @@ fn vector8() !void { } test "bitReverse vectors u8" { - if (builtin.zig_backend == .stage1) return error.SkipZigTest; if (builtin.zig_backend == .stage2_wasm) return error.SkipZigTest; if (builtin.zig_backend == .stage2_c) return error.SkipZigTest; if (builtin.zig_backend == .stage2_x86_64) return error.SkipZigTest; @@ -115,7 +112,6 @@ fn vector16() !void { } test "bitReverse vectors u16" { - if (builtin.zig_backend == .stage1) return error.SkipZigTest; if (builtin.zig_backend == .stage2_wasm) return error.SkipZigTest; if (builtin.zig_backend == .stage2_c) return error.SkipZigTest; if (builtin.zig_backend == .stage2_x86_64) return error.SkipZigTest; @@ -134,7 +130,6 @@ fn vector24() !void { } test "bitReverse vectors u24" { - if (builtin.zig_backend == .stage1) return error.SkipZigTest; if (builtin.zig_backend == .stage2_wasm) return error.SkipZigTest; if (builtin.zig_backend == .stage2_c) return error.SkipZigTest; if (builtin.zig_backend == .stage2_x86_64) return error.SkipZigTest; @@ -153,7 +148,6 @@ fn vector0() !void { } test "bitReverse vectors u0" { - if (builtin.zig_backend == .stage1) return error.SkipZigTest; if (builtin.zig_backend == .stage2_wasm) return error.SkipZigTest; if (builtin.zig_backend == .stage2_x86_64) return error.SkipZigTest; diff --git a/test/behavior/bugs/10147.zig b/test/behavior/bugs/10147.zig index 221120bb730101df57801f8f2414aa2b9319f24e..48cfe983dec486d281024ffc5704c30912e0ad3b 100644 --- a/test/behavior/bugs/10147.zig +++ b/test/behavior/bugs/10147.zig @@ -1,8 +1,7 @@ const builtin = @import("builtin"); const std = @import("std"); -test "uses correct LLVM builtin" { - if (builtin.zig_backend == .stage1) return error.SkipZigTest; +test "test calling @clz on both vector and scalar inputs" { if (builtin.zig_backend == .stage2_wasm) return error.SkipZigTest; // TODO if (builtin.zig_backend == .stage2_x86_64) return error.SkipZigTest; // TODO if (builtin.zig_backend == .stage2_aarch64) return error.SkipZigTest; // TODO @@ -11,8 +10,6 @@ test "uses correct LLVM builtin" { var x: u32 = 0x1; var y: @Vector(4, u32) = [_]u32{ 0x1, 0x1, 0x1, 0x1 }; - // The stage1 compiler used to call the same builtin function for both - // scalar and vector inputs, causing the LLVM module verification to fail. var a = @clz(x); var b = @clz(y); try std.testing.expectEqual(@as(u6, 31), a); diff --git a/test/behavior/bugs/11159.zig b/test/behavior/bugs/11159.zig index 035ea103d91c5a43b03b48c24d63cddbcf1c9d8a..352491fefc0404065debfa9c16b5c3fa0cbf50ae 100644 --- a/test/behavior/bugs/11159.zig +++ b/test/behavior/bugs/11159.zig @@ -8,8 +8,6 @@ test { } test { - if (builtin.zig_backend == .stage1) return error.SkipZigTest; // TODO - const S = struct { comptime x: i32 = 0, comptime y: u32 = 0, diff --git a/test/behavior/bugs/11162.zig b/test/behavior/bugs/11162.zig index 7a512463e2bf2f23d2ec493b63e2175b99c98a64..6b4cef78e7be685e98f93fff58eae223c483acab 100644 --- a/test/behavior/bugs/11162.zig +++ b/test/behavior/bugs/11162.zig @@ -2,9 +2,8 @@ const std = @import("std"); const builtin = @import("builtin"); const expect = std.testing.expect; -test "aggregate initializers should allow initializing comptime fields, verifying equality (stage2 only)" { - if (builtin.zig_backend == .stage1) return error.SkipZigTest; // TODO - if (builtin.zig_backend != .stage1) return error.SkipZigTest; // TODO +test "aggregate initializers should allow initializing comptime fields, verifying equality" { + if (true) return error.SkipZigTest; // TODO var x: u32 = 15; const T = @TypeOf(.{ @as(i32, -1234), @as(u32, 5678), x }); diff --git a/test/behavior/bugs/11227.zig b/test/behavior/bugs/11227.zig index 2699b5424733e720afb55293e12a651117efe8b0..b65a64c69c3d52110fe1812b382829b51c3d3aed 100644 --- a/test/behavior/bugs/11227.zig +++ b/test/behavior/bugs/11227.zig @@ -6,8 +6,6 @@ fn foo() u32 { } const bar = foo; test "pointer to alias behaves same as pointer to function" { - if (builtin.zig_backend == .stage1) return error.SkipZigTest; // stage1 has different function pointers - var a = &bar; try std.testing.expect(foo() == a()); } diff --git a/test/behavior/bugs/11816.zig b/test/behavior/bugs/11816.zig index 5b6c9bd31962d6c397e6d2f375d1966709bd6d9b..639212e098e3fa9eccf9be8e3731ec1541975b56 100644 --- a/test/behavior/bugs/11816.zig +++ b/test/behavior/bugs/11816.zig @@ -3,7 +3,6 @@ const builtin = @import("builtin"); test { if (builtin.zig_backend == .stage2_aarch64) return error.SkipZigTest; // TODO - if (builtin.zig_backend == .stage1) return error.SkipZigTest; var x: u32 = 3; const val: usize = while (true) switch (x) { diff --git a/test/behavior/bugs/12486.zig b/test/behavior/bugs/12486.zig index 1c7f09406c0c7e7881f2e6144b8503ac06a17e28..f0d357efd1a6f77cdd70155bd03c48e9995244c6 100644 --- a/test/behavior/bugs/12486.zig +++ b/test/behavior/bugs/12486.zig @@ -23,8 +23,6 @@ const ErrStruct = struct { }; test { - if (@import("builtin").zig_backend == .stage1) return error.SkipZigTest; - _ = OptEnum{ .opt_enum = .{ .EnumVariant = 1, diff --git a/test/behavior/bugs/12723.zig b/test/behavior/bugs/12723.zig index 6768444545cb8c801c0f1304927d4e67463d95f8..81e276218a1ff212799cf2cf31da97db29e71890 100644 --- a/test/behavior/bugs/12723.zig +++ b/test/behavior/bugs/12723.zig @@ -1,8 +1,5 @@ const expect = @import("std").testing.expect; -// This test causes a compile error on stage1 regardless of whether -// the body of the test is comptime-gated or not. To workaround this, -// we gate the inclusion of the test file. test "Non-exhaustive enum backed by comptime_int" { const E = enum(comptime_int) { a, b, c, _ }; comptime var e: E = .a; diff --git a/test/behavior/bugs/1277.zig b/test/behavior/bugs/1277.zig index 595a8273f8a81a1a203b7e6a657e0c98430e35e7..e8ebd48881f962c2746403571c3bad90f673aa1d 100644 --- a/test/behavior/bugs/1277.zig +++ b/test/behavior/bugs/1277.zig @@ -12,7 +12,6 @@ fn f() i32 { } test "don't emit an LLVM global for a const function when it's in an optional in a struct" { - if (builtin.zig_backend == .stage1) return error.SkipZigTest; // stage1 has different function pointers if (builtin.zig_backend == .stage2_aarch64) return error.SkipZigTest; // TODO if (builtin.zig_backend == .stage2_arm) return error.SkipZigTest; // TODO if (builtin.zig_backend == .stage2_x86_64) return error.SkipZigTest; // TODO diff --git a/test/behavior/bugs/12801-1.zig b/test/behavior/bugs/12801-1.zig index b1f565e47fee69e952d2b3e9c3e45ea283519ccb..ff94382d1fcb3d5b3826072a23cb3a9e1c430bd2 100644 --- a/test/behavior/bugs/12801-1.zig +++ b/test/behavior/bugs/12801-1.zig @@ -8,7 +8,6 @@ fn capacity_() u64 { test { if (builtin.zig_backend == .stage2_arm) return error.SkipZigTest; // TODO - if (builtin.zig_backend == .stage1) return error.SkipZigTest; try std.testing.expect((@This(){}).capacity() == 64); } diff --git a/test/behavior/bugs/12801-2.zig b/test/behavior/bugs/12801-2.zig index 298e4f96c16ec430974e7d42e8eb9434e5706896..f98fcfbcff131e483f2efc8f68aa4a11b5fb37e8 100644 --- a/test/behavior/bugs/12801-2.zig +++ b/test/behavior/bugs/12801-2.zig @@ -14,7 +14,6 @@ const Auto = struct { } }; test { - if (builtin.zig_backend == .stage1) return error.SkipZigTest; if (builtin.zig_backend == .stage2_arm) return error.SkipZigTest; // TODO if (builtin.zig_backend == .stage2_aarch64) return error.SkipZigTest; // TODO if (builtin.zig_backend == .stage2_x86_64) return error.SkipZigTest; // TODO diff --git a/test/behavior/bugs/12885.zig b/test/behavior/bugs/12885.zig index f1cc8f94b3e18f9c9e347696d03473f3746fe353..2a802efd04eb07e17393b4aca155336ac4869719 100644 --- a/test/behavior/bugs/12885.zig +++ b/test/behavior/bugs/12885.zig @@ -11,8 +11,6 @@ const Foo = @Type(.{ .ErrorSet = &info.args, }); test "ErrorSet comptime_field_ptr" { - if (@import("builtin").zig_backend == .stage1) return error.SkipZigTest; - try expect(Foo == error{bar}); } diff --git a/test/behavior/bugs/12891.zig b/test/behavior/bugs/12891.zig index 6fa4966c4afcdccf8f4f74334386cc7a1e0b02d1..e55878370551a4d54fb1ff50f869816219b63b70 100644 --- a/test/behavior/bugs/12891.zig +++ b/test/behavior/bugs/12891.zig @@ -7,8 +7,6 @@ test "issue12891" { try std.testing.expect(i < f); } test "nan" { - if (builtin.zig_backend == .stage1) return error.SkipZigTest; // TODO - const f = comptime std.math.nan(f64); var i: usize = 0; try std.testing.expect(!(f < i)); diff --git a/test/behavior/bugs/12911.zig b/test/behavior/bugs/12911.zig index 13e2dc19e486cbc4fe4f9d8c75495546006b56e4..acd725fbeb94189d9a1f83c424ec518deb507671 100644 --- a/test/behavior/bugs/12911.zig +++ b/test/behavior/bugs/12911.zig @@ -5,7 +5,5 @@ const Thing = struct { array: [1]Item, }; test { - if (builtin.zig_backend == .stage1) return error.SkipZigTest; - _ = Thing{ .array = undefined }; } diff --git a/test/behavior/bugs/1310.zig b/test/behavior/bugs/1310.zig index 9d93dacca269f75c38116fa35d4b533e53cffd48..876ab7943156306cff6120aed80fb1c3bf24ab3d 100644 --- a/test/behavior/bugs/1310.zig +++ b/test/behavior/bugs/1310.zig @@ -22,7 +22,6 @@ fn agent_callback(_vm: [*]VM, options: [*]u8) callconv(.C) i32 { return 11; } -test "fixed" { - if (builtin.zig_backend == .stage1) return error.SkipZigTest; +test { try expect(agent_callback(undefined, undefined) == 11); } diff --git a/test/behavior/bugs/2006.zig b/test/behavior/bugs/2006.zig index ff759f2846d93399347306df03d4f7ef36c04754..fbbdc1e3b77efcea835df40eaf4aa18726385be0 100644 --- a/test/behavior/bugs/2006.zig +++ b/test/behavior/bugs/2006.zig @@ -9,12 +9,5 @@ test "bug 2006" { var a: S = undefined; a = S{ .p = undefined }; try expect(@sizeOf(S) != 0); - if (@import("builtin").zig_backend != .stage1) { - // It is an accepted proposal to make `@sizeOf` for pointers independent - // of whether the element type is zero bits. - // This language change has not been implemented in stage1. - try expect(@sizeOf(*void) == @sizeOf(*i32)); - } else { - try expect(@sizeOf(*void) == 0); - } + try expect(@sizeOf(*void) == @sizeOf(*i32)); } diff --git a/test/behavior/bugs/3112.zig b/test/behavior/bugs/3112.zig index 91432325fd4df1faa7f13538646a7042dcf4e970..64e089bc36d8c06159a7a818492b05b9950f5167 100644 --- a/test/behavior/bugs/3112.zig +++ b/test/behavior/bugs/3112.zig @@ -13,7 +13,6 @@ fn prev(p: ?State) void { test "zig test crash" { if (builtin.zig_backend == .stage2_aarch64) return error.SkipZigTest; - if (builtin.zig_backend == .stage1) return error.SkipZigTest; if (builtin.zig_backend == .stage2_arm) return error.SkipZigTest; var global: State = undefined; global.enter = prev; diff --git a/test/behavior/bugs/3779.zig b/test/behavior/bugs/3779.zig index dc906442a621baec6b435c0d56af3a1e6fdf1ea9..1f55a32038177ffc6fab3568d16329f7d7f4c90d 100644 --- a/test/behavior/bugs/3779.zig +++ b/test/behavior/bugs/3779.zig @@ -6,7 +6,6 @@ const tag_name = @tagName(TestEnum.TestEnumValue); const ptr_tag_name: [*:0]const u8 = tag_name; test "@tagName() returns a string literal" { - if (builtin.zig_backend == .stage1) return error.SkipZigTest; // stage1 gets the type wrong if (builtin.zig_backend == .stage2_aarch64) return error.SkipZigTest; // TODO try std.testing.expect(*const [13:0]u8 == @TypeOf(tag_name)); @@ -19,7 +18,6 @@ const error_name = @errorName(TestError.TestErrorCode); const ptr_error_name: [*:0]const u8 = error_name; test "@errorName() returns a string literal" { - if (builtin.zig_backend == .stage1) return error.SkipZigTest; // stage1 gets the type wrong if (builtin.zig_backend == .stage2_aarch64) return error.SkipZigTest; // TODO try std.testing.expect(*const [13:0]u8 == @TypeOf(error_name)); @@ -32,7 +30,6 @@ const type_name = @typeName(TestType); const ptr_type_name: [*:0]const u8 = type_name; test "@typeName() returns a string literal" { - if (builtin.zig_backend == .stage1) return error.SkipZigTest; // stage1 gets the type wrong if (builtin.zig_backend == .stage2_aarch64) return error.SkipZigTest; // TODO try std.testing.expect(*const [type_name.len:0]u8 == @TypeOf(type_name)); diff --git a/test/behavior/bugs/6850.zig b/test/behavior/bugs/6850.zig index 7bab4d347af13377302f5152c13e72aa88743fde..6dafd524c5b1fee737b115807882ca6d32c4b412 100644 --- a/test/behavior/bugs/6850.zig +++ b/test/behavior/bugs/6850.zig @@ -8,11 +8,5 @@ test "lazy sizeof comparison with zero" { } fn hasNoBits(comptime T: type) bool { - if (@import("builtin").zig_backend != .stage1) { - // It is an accepted proposal to make `@sizeOf` for pointers independent - // of whether the element type is zero bits. - // This language change has not been implemented in stage1. - return @sizeOf(T) == @sizeOf(*i32); - } - return @sizeOf(T) == 0; + return @sizeOf(T) == @sizeOf(*i32); } diff --git a/test/behavior/bugs/920.zig b/test/behavior/bugs/920.zig index 36895c7282786613ee013900e759c47e16b12bd0..526ca0f7e61fc0893ab176a37362a4da1cdb0f98 100644 --- a/test/behavior/bugs/920.zig +++ b/test/behavior/bugs/920.zig @@ -2,23 +2,14 @@ const builtin = @import("builtin"); const std = @import("std"); const Random = std.rand.Random; -const zeroCaseFn = switch (builtin.zig_backend) { - .stage1 => fn (*Random, f64) f64, - else => *const fn (*Random, f64) f64, -}; -const pdfFn = switch (builtin.zig_backend) { - .stage1 => fn (f64) f64, - else => *const fn (f64) f64, -}; - const ZigTable = struct { r: f64, x: [257]f64, f: [257]f64, - pdf: pdfFn, + pdf: *const fn (f64) f64, is_symmetric: bool, - zero_case: zeroCaseFn, + zero_case: *const fn (*Random, f64) f64, }; fn ZigTableGen(comptime is_symmetric: bool, comptime r: f64, comptime v: f64, comptime f: fn (f64) f64, comptime f_inv: fn (f64) f64, comptime zero_case: fn (*Random, f64) f64) ZigTable { diff --git a/test/behavior/byteswap.zig b/test/behavior/byteswap.zig index 8de75a572c07248f6aa984e2e1cf671f408c8e65..831cb2e7a2654e192f4ca549bc05268c5ca7cdd1 100644 --- a/test/behavior/byteswap.zig +++ b/test/behavior/byteswap.zig @@ -3,7 +3,6 @@ const builtin = @import("builtin"); const expect = std.testing.expect; test "@byteSwap integers" { - if (builtin.zig_backend == .stage1) return error.SkipZigTest; if (builtin.zig_backend == .stage2_wasm) return error.SkipZigTest; if (builtin.zig_backend == .stage2_x86_64) return error.SkipZigTest; if (builtin.zig_backend == .stage2_arm) return error.SkipZigTest; @@ -62,7 +61,6 @@ fn vector8() !void { } test "@byteSwap vectors u8" { - if (builtin.zig_backend == .stage1) return error.SkipZigTest; if (builtin.zig_backend == .stage2_wasm) return error.SkipZigTest; if (builtin.zig_backend == .stage2_c) return error.SkipZigTest; if (builtin.zig_backend == .stage2_x86_64) return error.SkipZigTest; @@ -81,7 +79,6 @@ fn vector16() !void { } test "@byteSwap vectors u16" { - if (builtin.zig_backend == .stage1) return error.SkipZigTest; if (builtin.zig_backend == .stage2_wasm) return error.SkipZigTest; if (builtin.zig_backend == .stage2_c) return error.SkipZigTest; if (builtin.zig_backend == .stage2_x86_64) return error.SkipZigTest; @@ -100,7 +97,6 @@ fn vector24() !void { } test "@byteSwap vectors u24" { - if (builtin.zig_backend == .stage1) return error.SkipZigTest; if (builtin.zig_backend == .stage2_wasm) return error.SkipZigTest; if (builtin.zig_backend == .stage2_c) return error.SkipZigTest; if (builtin.zig_backend == .stage2_x86_64) return error.SkipZigTest; @@ -119,7 +115,6 @@ fn vector0() !void { } test "@byteSwap vectors u0" { - if (builtin.zig_backend == .stage1) return error.SkipZigTest; if (builtin.zig_backend == .stage2_wasm) return error.SkipZigTest; if (builtin.zig_backend == .stage2_x86_64) return error.SkipZigTest; diff --git a/test/behavior/call.zig b/test/behavior/call.zig index 0414e1d5756d62f044a3ded77b1021ed7f277c24..7b3035b3220cb9efa9a31b20e41e9c0b7fe26207 100644 --- a/test/behavior/call.zig +++ b/test/behavior/call.zig @@ -45,10 +45,7 @@ test "basic invocations" { } { // call of non comptime-known function - var alias_foo = switch (builtin.zig_backend) { - .stage1 => foo, - else => &foo, - }; + var alias_foo = &foo; try expect(@call(.{ .modifier = .no_async }, alias_foo, .{}) == 1234); try expect(@call(.{ .modifier = .never_tail }, alias_foo, .{}) == 1234); try expect(@call(.{ .modifier = .never_inline }, alias_foo, .{}) == 1234); @@ -71,7 +68,9 @@ test "tuple parameters" { try expect(@call(.{}, add, .{ 12, b }) == 46); try expect(@call(.{}, add, .{ a, b }) == 46); try expect(@call(.{}, add, .{ 12, 34 }) == 46); - if (builtin.zig_backend == .stage1) comptime try expect(@call(.{}, add, .{ 12, 34 }) == 46); // TODO + if (false) { + comptime try expect(@call(.{}, add, .{ 12, 34 }) == 46); // TODO + } try expect(comptime @call(.{}, add, .{ 12, 34 }) == 46); { const separate_args0 = .{ a, b }; @@ -246,8 +245,6 @@ test "function call with 40 arguments" { } test "arguments to comptime parameters generated in comptime blocks" { - if (builtin.zig_backend == .stage1) return error.SkipZigTest; - const S = struct { fn fortyTwo() i32 { return 42; @@ -261,7 +258,6 @@ test "arguments to comptime parameters generated in comptime blocks" { } test "forced tail call" { - if (builtin.zig_backend == .stage1) return error.SkipZigTest; if (builtin.zig_backend == .stage2_aarch64) return error.SkipZigTest; // TODO if (builtin.zig_backend == .stage2_arm) return error.SkipZigTest; // TODO if (builtin.zig_backend == .stage2_c) return error.SkipZigTest; // TODO @@ -294,7 +290,6 @@ test "forced tail call" { } test "inline call preserves tail call" { - if (builtin.zig_backend == .stage1) return error.SkipZigTest; if (builtin.zig_backend == .stage2_aarch64) return error.SkipZigTest; // TODO if (builtin.zig_backend == .stage2_arm) return error.SkipZigTest; // TODO if (builtin.zig_backend == .stage2_c) return error.SkipZigTest; // TODO @@ -329,7 +324,6 @@ test "inline call preserves tail call" { } test "inline call doesn't re-evaluate non generic struct" { - if (builtin.zig_backend == .stage1) return error.SkipZigTest; if (builtin.zig_backend == .stage2_aarch64) return error.SkipZigTest; // TODO if (builtin.zig_backend == .stage2_arm) return error.SkipZigTest; // TODO if (builtin.zig_backend == .stage2_x86_64) return error.SkipZigTest; // TODO diff --git a/test/behavior/cast.zig b/test/behavior/cast.zig index bf35fd069c7cd46fbc9605c3f093f17f4cfa45a4..16d4b511cf0b149079e965516a6ed0d0127a6d52 100644 --- a/test/behavior/cast.zig +++ b/test/behavior/cast.zig @@ -113,8 +113,6 @@ test "@intToFloat" { } test "@intToFloat(f80)" { - if (builtin.zig_backend == .stage1) return error.SkipZigTest; - if (builtin.zig_backend == .stage2_aarch64) return error.SkipZigTest; // TODO if (builtin.zig_backend == .stage2_x86_64) return error.SkipZigTest; // TODO if (builtin.zig_backend == .stage2_arm) return error.SkipZigTest; // TODO @@ -699,11 +697,6 @@ test "peer type resolution: error set supersets" { } test "peer type resolution: disjoint error sets" { - if (builtin.zig_backend == .stage1) { - // stage1 gets the order of the error names wrong after merging the sets. - return error.SkipZigTest; - } - if (builtin.zig_backend == .stage2_x86_64) return error.SkipZigTest; // TODO if (builtin.zig_backend == .stage2_arm) return error.SkipZigTest; // TODO if (builtin.zig_backend == .stage2_aarch64) return error.SkipZigTest; // TODO @@ -733,11 +726,6 @@ test "peer type resolution: disjoint error sets" { } test "peer type resolution: error union and error set" { - if (builtin.zig_backend == .stage1) { - // stage1 gets the order of the error names wrong after merging the sets. - return error.SkipZigTest; - } - if (builtin.zig_backend == .stage2_x86_64) return error.SkipZigTest; // TODO if (builtin.zig_backend == .stage2_arm) return error.SkipZigTest; // TODO if (builtin.zig_backend == .stage2_aarch64) return error.SkipZigTest; // TODO @@ -1080,7 +1068,6 @@ fn incrementVoidPtrArray(array: ?*anyopaque, len: usize) void { } test "compile time int to ptr of function" { - if (builtin.zig_backend == .stage1) return error.SkipZigTest; if (builtin.zig_backend == .stage2_x86_64) return error.SkipZigTest; // TODO try foobar(FUNCTION_CONSTANT); @@ -1421,8 +1408,6 @@ test "floatToInt to zero-bit int" { } test "peer type resolution of function pointer and function body" { - if (builtin.zig_backend == .stage1) return error.SkipZigTest; - const T = fn () u32; const a: T = undefined; const b: *const T = undefined; diff --git a/test/behavior/comptime_memory.zig b/test/behavior/comptime_memory.zig index f9c0073d34a3e9e7d267e01ecf96e6de3cbbb414..e08dad68f0d3d5b363bb7d223e834767c266ec8a 100644 --- a/test/behavior/comptime_memory.zig +++ b/test/behavior/comptime_memory.zig @@ -4,8 +4,6 @@ const testing = @import("std").testing; const ptr_size = @sizeOf(usize); test "type pun signed and unsigned as single pointer" { - if (builtin.zig_backend == .stage1) return error.SkipZigTest; - comptime { var x: u32 = 0; const y = @ptrCast(*i32, &x); @@ -15,8 +13,6 @@ test "type pun signed and unsigned as single pointer" { } test "type pun signed and unsigned as many pointer" { - if (builtin.zig_backend == .stage1) return error.SkipZigTest; - comptime { var x: u32 = 0; const y = @ptrCast([*]i32, &x); @@ -26,8 +22,6 @@ test "type pun signed and unsigned as many pointer" { } test "type pun signed and unsigned as array pointer" { - if (builtin.zig_backend == .stage1) return error.SkipZigTest; - comptime { var x: u32 = 0; const y = @ptrCast(*[1]i32, &x); @@ -37,8 +31,7 @@ test "type pun signed and unsigned as array pointer" { } test "type pun signed and unsigned as offset many pointer" { - if (builtin.zig_backend == .stage1) return error.SkipZigTest; - if (builtin.zig_backend != .stage1) { + if (true) { // TODO https://github.com/ziglang/zig/issues/9646 return error.SkipZigTest; } @@ -53,8 +46,7 @@ test "type pun signed and unsigned as offset many pointer" { } test "type pun signed and unsigned as array pointer" { - if (builtin.zig_backend == .stage1) return error.SkipZigTest; - if (builtin.zig_backend != .stage1) { + if (true) { // TODO https://github.com/ziglang/zig/issues/9646 return error.SkipZigTest; } @@ -69,8 +61,6 @@ test "type pun signed and unsigned as array pointer" { } test "type pun value and struct" { - if (builtin.zig_backend == .stage1) return error.SkipZigTest; - comptime { const StructOfU32 = extern struct { x: u32 }; var inst: StructOfU32 = .{ .x = 0 }; @@ -85,7 +75,6 @@ fn bigToNativeEndian(comptime T: type, v: T) T { return if (endian == .Big) v else @byteSwap(v); } test "type pun endianness" { - if (builtin.zig_backend == .stage1) return error.SkipZigTest; if (builtin.zig_backend == .stage2_aarch64) return error.SkipZigTest; // TODO comptime { @@ -179,8 +168,7 @@ fn doTypePunBitsTest(as_bits: *Bits) !void { } test "type pun bits" { - if (builtin.zig_backend == .stage1) return error.SkipZigTest; - if (builtin.zig_backend != .stage1) { + if (true) { // TODO https://github.com/ziglang/zig/issues/9646 return error.SkipZigTest; } @@ -197,8 +185,7 @@ const imports = struct { // Make sure lazy values work on their own, before getting into more complex tests test "basic pointer preservation" { - if (builtin.zig_backend == .stage1) return error.SkipZigTest; - if (builtin.zig_backend != .stage1) { + if (true) { // TODO https://github.com/ziglang/zig/issues/9646 return error.SkipZigTest; } @@ -211,8 +198,7 @@ test "basic pointer preservation" { } test "byte copy preserves linker value" { - if (builtin.zig_backend == .stage1) return error.SkipZigTest; - if (builtin.zig_backend != .stage1) { + if (true) { // TODO https://github.com/ziglang/zig/issues/9646 return error.SkipZigTest; } @@ -235,8 +221,7 @@ test "byte copy preserves linker value" { } test "unordered byte copy preserves linker value" { - if (builtin.zig_backend == .stage1) return error.SkipZigTest; - if (builtin.zig_backend != .stage1) { + if (true) { // TODO https://github.com/ziglang/zig/issues/9646 return error.SkipZigTest; } @@ -260,8 +245,7 @@ test "unordered byte copy preserves linker value" { } test "shuffle chunks of linker value" { - if (builtin.zig_backend == .stage1) return error.SkipZigTest; - if (builtin.zig_backend != .stage1) { + if (true) { // TODO https://github.com/ziglang/zig/issues/9646 return error.SkipZigTest; } @@ -279,8 +263,7 @@ test "shuffle chunks of linker value" { } test "dance on linker values" { - if (builtin.zig_backend == .stage1) return error.SkipZigTest; - if (builtin.zig_backend != .stage1) { + if (true) { // TODO https://github.com/ziglang/zig/issues/9646 return error.SkipZigTest; } @@ -311,8 +294,7 @@ test "dance on linker values" { } test "offset array ptr by element size" { - if (builtin.zig_backend == .stage1) return error.SkipZigTest; - if (builtin.zig_backend != .stage1) { + if (true) { // TODO https://github.com/ziglang/zig/issues/9646 return error.SkipZigTest; } @@ -339,8 +321,7 @@ test "offset array ptr by element size" { } test "offset instance by field size" { - if (builtin.zig_backend == .stage1) return error.SkipZigTest; - if (builtin.zig_backend != .stage1) { + if (true) { // TODO https://github.com/ziglang/zig/issues/9646 return error.SkipZigTest; } @@ -365,8 +346,7 @@ test "offset instance by field size" { } test "offset field ptr by enclosing array element size" { - if (builtin.zig_backend == .stage1) return error.SkipZigTest; - if (builtin.zig_backend != .stage1) { + if (true) { // TODO https://github.com/ziglang/zig/issues/9646 return error.SkipZigTest; } @@ -395,7 +375,6 @@ test "offset field ptr by enclosing array element size" { } test "accessing reinterpreted memory of parent object" { - if (builtin.zig_backend == .stage1) return error.SkipZigTest; if (builtin.zig_backend == .stage2_aarch64) return error.SkipZigTest; // TODO const S = extern struct { a: f32, diff --git a/test/behavior/error.zig b/test/behavior/error.zig index 25feb101bcf78f0b27d9783823731e4ef6dba9b0..430a2e19507fb46cb7ecc92a711f426d4cb609dd 100644 --- a/test/behavior/error.zig +++ b/test/behavior/error.zig @@ -151,7 +151,6 @@ test "fn returning empty error set can be passed as fn returning any error" { } test "fn returning empty error set can be passed as fn returning any error - pointer" { - if (builtin.zig_backend == .stage1) return error.SkipZigTest; if (builtin.zig_backend == .stage2_x86_64) return error.SkipZigTest; // TODO if (builtin.zig_backend == .stage2_aarch64) return error.SkipZigTest; // TODO @@ -465,11 +464,6 @@ test "nested catch" { } test "function pointer with return type that is error union with payload which is pointer of parent struct" { - if (builtin.zig_backend == .stage1) { - // stage1 has wrong function pointer semantics - return error.SkipZigTest; - } - if (builtin.zig_backend == .stage2_x86_64) return error.SkipZigTest; // TODO if (builtin.zig_backend == .stage2_aarch64) return error.SkipZigTest; // TODO @@ -582,9 +576,6 @@ pub fn testBuiltinErrorName(err: anyerror) [:0]const u8 { } test "error set equality" { - // This tests using stage2 logic (#11022) - if (builtin.zig_backend == .stage1) return error.SkipZigTest; - const a = error{One}; const b = error{One}; @@ -752,7 +743,6 @@ const NoReturn = struct { }; test "error union of noreturn used with if" { - if (builtin.zig_backend == .stage1) return error.SkipZigTest; if (builtin.zig_backend == .stage2_aarch64) return error.SkipZigTest; // TODO if (builtin.zig_backend == .stage2_arm) return error.SkipZigTest; // TODO if (builtin.zig_backend == .stage2_wasm) return error.SkipZigTest; // TODO @@ -767,7 +757,6 @@ test "error union of noreturn used with if" { } test "error union of noreturn used with try" { - if (builtin.zig_backend == .stage1) return error.SkipZigTest; if (builtin.zig_backend == .stage2_aarch64) return error.SkipZigTest; // TODO if (builtin.zig_backend == .stage2_arm) return error.SkipZigTest; // TODO if (builtin.zig_backend == .stage2_wasm) return error.SkipZigTest; // TODO @@ -779,7 +768,6 @@ test "error union of noreturn used with try" { } test "error union of noreturn used with catch" { - if (builtin.zig_backend == .stage1) return error.SkipZigTest; if (builtin.zig_backend == .stage2_aarch64) return error.SkipZigTest; // TODO if (builtin.zig_backend == .stage2_arm) return error.SkipZigTest; // TODO if (builtin.zig_backend == .stage2_wasm) return error.SkipZigTest; // TODO @@ -807,7 +795,6 @@ test "alignment of wrapping an error union payload" { } test "compare error union and error set" { - if (builtin.zig_backend == .stage1) return error.SkipZigTest; if (builtin.zig_backend == .stage2_aarch64) return error.SkipZigTest; var a: anyerror = error.Foo; @@ -857,8 +844,6 @@ test "error from comptime string" { } test "field access of anyerror results in smaller error set" { - if (builtin.zig_backend == .stage1) return error.SkipZigTest; - const E1 = @TypeOf(error.Foo); try expect(@TypeOf(E1.Foo) == E1); const E2 = error{ A, B, C }; diff --git a/test/behavior/eval.zig b/test/behavior/eval.zig index 145be9dedef78d366240d5b2f662ce5fdca600be..74ab913ae10f8e4d5fa47d0d484dd28800bb66c0 100644 --- a/test/behavior/eval.zig +++ b/test/behavior/eval.zig @@ -606,15 +606,16 @@ fn assertEqualPtrs(ptr1: *const u8, ptr2: *const u8) !void { // This one is still up for debate in the language specification. // Application code should not rely on this behavior until it is solidified. -// Currently, stage1 has special case code to make this pass for string literals -// but it does not work if the values are constructed with comptime code, or if +// Historically, stage1 had special case code to make this pass for string literals +// but it did not work if the values are constructed with comptime code, or if // arrays of non-u8 elements are used instead. // The official language specification might not make this guarantee. However, if // it does make this guarantee, it will make it consistently for all types, not -// only string literals. This is why stage2 currently has a string table for -// string literals, to match stage1 and pass this test, however the end-game once -// the lang spec issue is settled would be to use a global InternPool for comptime -// memoized objects, making this behavior consistent across all types. +// only string literals. This is why Zig currently has a string table for +// string literals, to match legacy stage1 behavior and pass this test, however +// the end-game once the lang spec issue is settled would be to use a global +// InternPool for comptime memoized objects, making this behavior consistent +// across all types. test "string literal used as comptime slice is memoized" { const a = "link"; const b = "link"; @@ -742,7 +743,6 @@ fn scalar(x: u32) u32 { } test "array concatenation peer resolves element types - value" { - if (builtin.zig_backend == .stage1) return error.SkipZigTest; if (builtin.zig_backend == .stage2_arm) return error.SkipZigTest; if (builtin.zig_backend == .stage2_aarch64) return error.SkipZigTest; @@ -758,7 +758,6 @@ test "array concatenation peer resolves element types - value" { } test "array concatenation peer resolves element types - pointer" { - if (builtin.zig_backend == .stage1) return error.SkipZigTest; if (builtin.zig_backend == .stage2_arm) return error.SkipZigTest; if (builtin.zig_backend == .stage2_aarch64) return error.SkipZigTest; @@ -774,7 +773,6 @@ test "array concatenation peer resolves element types - pointer" { } test "array concatenation sets the sentinel - value" { - if (builtin.zig_backend == .stage1) return error.SkipZigTest; if (builtin.zig_backend == .stage2_wasm) return error.SkipZigTest; if (builtin.zig_backend == .stage2_x86_64) return error.SkipZigTest; if (builtin.zig_backend == .stage2_arm) return error.SkipZigTest; @@ -794,7 +792,6 @@ test "array concatenation sets the sentinel - value" { } test "array concatenation sets the sentinel - pointer" { - if (builtin.zig_backend == .stage1) return error.SkipZigTest; if (builtin.zig_backend == .stage2_aarch64) return error.SkipZigTest; var a = [2]u3{ 1, 7 }; @@ -811,7 +808,6 @@ test "array concatenation sets the sentinel - pointer" { } test "array multiplication sets the sentinel - value" { - if (builtin.zig_backend == .stage1) return error.SkipZigTest; if (builtin.zig_backend == .stage2_wasm) return error.SkipZigTest; if (builtin.zig_backend == .stage2_x86_64) return error.SkipZigTest; if (builtin.zig_backend == .stage2_arm) return error.SkipZigTest; @@ -829,7 +825,6 @@ test "array multiplication sets the sentinel - value" { } test "array multiplication sets the sentinel - pointer" { - if (builtin.zig_backend == .stage1) return error.SkipZigTest; if (builtin.zig_backend == .stage2_arm) return error.SkipZigTest; if (builtin.zig_backend == .stage2_aarch64) return error.SkipZigTest; @@ -894,8 +889,6 @@ test "const type-annotated local initialized with function call has correct type } test "comptime pointer load through elem_ptr" { - if (builtin.zig_backend == .stage1) return error.SkipZigTest; // stage1 fails this test - const S = struct { x: usize, }; @@ -1038,7 +1031,6 @@ test "comptime break operand passing through runtime condition converted to runt } test "comptime break operand passing through runtime switch converted to runtime break" { - if (builtin.zig_backend == .stage1) return error.SkipZigTest; if (builtin.zig_backend == .stage2_aarch64) return error.SkipZigTest; // TODO const S = struct { @@ -1294,8 +1286,6 @@ test "repeated value is correctly expanded" { } test "value in if block is comptime-known" { - if (builtin.zig_backend == .stage1) return error.SkipZigTest; - const first = blk: { const s = if (false) "a" else "b"; break :blk "foo" ++ s; @@ -1330,8 +1320,6 @@ test "lazy value is resolved as slice operand" { } test "break from inline loop depends on runtime condition" { - if (builtin.zig_backend == .stage1) return error.SkipZigTest; - const S = struct { fn foo(a: u8) bool { return a == 4; @@ -1405,7 +1393,7 @@ test "length of global array is determinable at comptime" { test "continue nested inline for loop" { // TODO: https://github.com/ziglang/zig/issues/13175 - if (builtin.zig_backend != .stage1) return error.SkipZigTest; + if (true) return error.SkipZigTest; var a: u8 = 0; loop: inline for ([_]u8{ 1, 2 }) |x| { @@ -1422,7 +1410,7 @@ test "continue nested inline for loop" { test "continue nested inline for loop in named block expr" { // TODO: https://github.com/ziglang/zig/issues/13175 - if (builtin.zig_backend != .stage1) return error.SkipZigTest; + if (true) return error.SkipZigTest; var a: u8 = 0; loop: inline for ([_]u8{ 1, 2 }) |x| { diff --git a/test/behavior/floatop.zig b/test/behavior/floatop.zig index 80b3c0bc74f29624eb4ec6230c9668fbe3ee00d9..74a99723e80c8288d81fd03fe597020fe07f15c5 100644 --- a/test/behavior/floatop.zig +++ b/test/behavior/floatop.zig @@ -114,7 +114,7 @@ fn testSqrt() !void { try expect(math.approxEqAbs(f32, @sqrt(@as(f32, 1.1)), 1.0488088481701516, epsilon)); try expect(math.approxEqAbs(f32, @sqrt(@as(f32, 2.0)), 1.4142135623730950, epsilon)); - if (builtin.zig_backend == .stage1) { + if (false) { if (has_f80_rt) { // TODO https://github.com/ziglang/zig/issues/10875 if (builtin.os.tag != .freebsd) { @@ -181,10 +181,6 @@ test "more @sqrt f16 tests" { } test "@sin" { - if (builtin.zig_backend == .stage1) { - // stage1 emits an incorrect compile error for `@as(ty, std.math.pi / 2)` - return error.SkipZigTest; - } if (builtin.zig_backend == .stage2_wasm) return error.SkipZigTest; // TODO if (builtin.zig_backend == .stage2_x86_64) return error.SkipZigTest; // TODO if (builtin.zig_backend == .stage2_arm) return error.SkipZigTest; // TODO @@ -205,7 +201,6 @@ fn testSin() !void { } test "@sin with vectors" { - if (builtin.zig_backend == .stage1) return error.SkipZigTest; if (builtin.zig_backend == .stage2_wasm) return error.SkipZigTest; // TODO if (builtin.zig_backend == .stage2_c) return error.SkipZigTest; // TODO if (builtin.zig_backend == .stage2_x86_64) return error.SkipZigTest; // TODO @@ -226,10 +221,6 @@ fn testSinWithVectors() !void { } test "@cos" { - if (builtin.zig_backend == .stage1) { - // stage1 emits an incorrect compile error for `@as(ty, std.math.pi / 2)` - return error.SkipZigTest; - } if (builtin.zig_backend == .stage2_wasm) return error.SkipZigTest; // TODO if (builtin.zig_backend == .stage2_x86_64) return error.SkipZigTest; // TODO if (builtin.zig_backend == .stage2_arm) return error.SkipZigTest; // TODO @@ -250,7 +241,6 @@ fn testCos() !void { } test "@cos with vectors" { - if (builtin.zig_backend == .stage1) return error.SkipZigTest; if (builtin.zig_backend == .stage2_wasm) return error.SkipZigTest; // TODO if (builtin.zig_backend == .stage2_c) return error.SkipZigTest; // TODO if (builtin.zig_backend == .stage2_x86_64) return error.SkipZigTest; // TODO @@ -781,7 +771,6 @@ test "f128 at compile time is lossy" { } test "comptime fixed-width float zero divided by zero produces NaN" { - if (builtin.zig_backend == .stage1) return error.SkipZigTest; if (builtin.zig_backend == .stage2_wasm) return error.SkipZigTest; // TODO if (builtin.zig_backend == .stage2_x86_64) return error.SkipZigTest; // TODO if (builtin.zig_backend == .stage2_arm) return error.SkipZigTest; // TODO @@ -793,7 +782,6 @@ test "comptime fixed-width float zero divided by zero produces NaN" { } test "comptime fixed-width float non-zero divided by zero produces signed Inf" { - if (builtin.zig_backend == .stage1) return error.SkipZigTest; if (builtin.zig_backend == .stage2_wasm) return error.SkipZigTest; // TODO if (builtin.zig_backend == .stage2_x86_64) return error.SkipZigTest; // TODO if (builtin.zig_backend == .stage2_arm) return error.SkipZigTest; // TODO @@ -810,8 +798,6 @@ test "comptime fixed-width float non-zero divided by zero produces signed Inf" { } test "comptime_float zero divided by zero produces zero" { - if (builtin.zig_backend == .stage1) return error.SkipZigTest; - try expect((0.0 / 0.0) == 0.0); } diff --git a/test/behavior/fn.zig b/test/behavior/fn.zig index bb1dd2a0f6b5e93cd79093f3b85a929daafb0a9d..3da17e06796ef36173414eb3a183fd4bd94a613f 100644 --- a/test/behavior/fn.zig +++ b/test/behavior/fn.zig @@ -68,8 +68,6 @@ fn outer(y: u32) *const fn (u32) u32 { } test "return inner function which references comptime variable of outer function" { - if (builtin.zig_backend == .stage1) return error.SkipZigTest; - var func = outer(10); try expect(func(3) == 7); } @@ -97,7 +95,6 @@ test "discard the result of a function that returns a struct" { } test "inline function call that calls optional function pointer, return pointer at callsite interacts correctly with callsite return type" { - if (builtin.zig_backend == .stage1) return error.SkipZigTest; if (builtin.zig_backend == .stage2_x86_64) return error.SkipZigTest; if (builtin.zig_backend == .stage2_arm) return error.SkipZigTest; if (builtin.zig_backend == .stage2_aarch64) return error.SkipZigTest; @@ -145,7 +142,6 @@ fn fnWithUnreachable() noreturn { } test "extern struct with stdcallcc fn pointer" { - if (builtin.zig_backend == .stage1) return error.SkipZigTest; if (builtin.zig_backend == .stage2_arm) return error.SkipZigTest; if (builtin.zig_backend == .stage2_aarch64) return error.SkipZigTest; @@ -293,11 +289,6 @@ fn acceptsString(foo: []u8) void { } test "function pointers" { - if (builtin.zig_backend == .stage1) { - // stage1 has wrong semantics for function pointers - return error.SkipZigTest; - } - if (builtin.zig_backend == .stage2_x86_64) return error.SkipZigTest; // TODO if (builtin.zig_backend == .stage2_aarch64) return error.SkipZigTest; // TODO if (builtin.zig_backend == .stage2_arm) return error.SkipZigTest; // TODO @@ -415,7 +406,6 @@ test "import passed byref to function in return type" { } test "implicit cast function to function ptr" { - if (builtin.zig_backend == .stage1) return error.SkipZigTest; if (builtin.zig_backend == .stage2_arm) return error.SkipZigTest; // TODO if (builtin.zig_backend == .stage2_aarch64) return error.SkipZigTest; // TODO if (builtin.zig_backend == .stage2_wasm) return error.SkipZigTest; // TODO diff --git a/test/behavior/generics.zig b/test/behavior/generics.zig index 0d704d96804a089d0c0008c3eba6d446e33f507b..79cbe9fda2b63c1ecd9f5c6c74bc5b45c3b58aa6 100644 --- a/test/behavior/generics.zig +++ b/test/behavior/generics.zig @@ -21,8 +21,8 @@ test "simple generic fn" { try expect(max(i32, 3, -1) == 3); try expect(max(u8, 1, 100) == 100); - if (builtin.zig_backend == .stage1) { - // TODO: stage2 is incorrectly emitting the following: + if (false) { + // TODO: zig is incorrectly emitting the following: // error: cast of value 1.23e-01 to type 'f32' loses information try expect(max(f32, 0.123, 0.456) == 0.456); } @@ -342,8 +342,6 @@ test "generic instantiation of tagged union with only one field" { } test "nested generic function" { - if (builtin.zig_backend == .stage1) return error.SkipZigTest; - const S = struct { fn foo(comptime T: type, callback: *const fn (user_data: T) anyerror!void, data: T) anyerror!void { try callback(data); diff --git a/test/behavior/int128.zig b/test/behavior/int128.zig index ceb63290cd5133940ff754ed27a215e193a1cad6..84c69ba499eaee8700633fa3b451e64120b5e785 100644 --- a/test/behavior/int128.zig +++ b/test/behavior/int128.zig @@ -29,8 +29,8 @@ test "undefined 128 bit int" { @setRuntimeSafety(true); - // TODO implement @setRuntimeSafety in stage2 - if (builtin.zig_backend != .stage1 and builtin.mode != .Debug and builtin.mode != .ReleaseSafe) { + // TODO implement @setRuntimeSafety + if (builtin.mode != .Debug and builtin.mode != .ReleaseSafe) { return error.SkipZigTest; } diff --git a/test/behavior/inttoptr.zig b/test/behavior/inttoptr.zig index d5f4503b038ca707be6057a5af379cd1465c2b82..d51f5c34f14b68b9019a898f507c7a299fc85fea 100644 --- a/test/behavior/inttoptr.zig +++ b/test/behavior/inttoptr.zig @@ -1,8 +1,6 @@ const builtin = @import("builtin"); test "casting integer address to function pointer" { - if (builtin.zig_backend == .stage1) return error.SkipZigTest; - addressToFunction(); comptime addressToFunction(); } diff --git a/test/behavior/math.zig b/test/behavior/math.zig index 1c5d2564087f6806fdf23623a420ce1043c8dfae..e07a252a4e20736b978ef6df39ceb8ad4e189033 100644 --- a/test/behavior/math.zig +++ b/test/behavior/math.zig @@ -94,7 +94,6 @@ fn testOneClz(comptime T: type, x: T) u32 { } test "@clz vectors" { - if (builtin.zig_backend == .stage1) return error.SkipZigTest; if (builtin.zig_backend == .stage2_wasm) return error.SkipZigTest; // TODO if (builtin.zig_backend == .stage2_x86_64) return error.SkipZigTest; // TODO if (builtin.zig_backend == .stage2_aarch64) return error.SkipZigTest; // TODO @@ -156,7 +155,6 @@ fn testOneCtz(comptime T: type, x: T) u32 { } test "@ctz vectors" { - if (builtin.zig_backend == .stage1) return error.SkipZigTest; if (builtin.zig_backend == .stage2_wasm) return error.SkipZigTest; // TODO if (builtin.zig_backend == .stage2_x86_64) return error.SkipZigTest; // TODO if (builtin.zig_backend == .stage2_aarch64) return error.SkipZigTest; // TODO @@ -971,8 +969,6 @@ test "overflow arithmetic with u0 values" { } test "allow signed integer division/remainder when values are comptime-known and positive or exact" { - if (builtin.zig_backend == .stage1) return error.SkipZigTest; - try expect(5 / 3 == 1); try expect(-5 / -3 == 1); try expect(-6 / 3 == -2); @@ -1009,14 +1005,8 @@ test "quad hex float literal parsing accurate" { try expect(@bitCast(u128, f) == 0x40042eab345678439abcdefea5678234); } { - // TODO: modify stage1/parse_f128.c to use round-to-even - if (builtin.zig_backend == .stage1) { - var f: f128 = 0x1.edcb34a235253948765432134674fp-1; - try expect(@bitCast(u128, f) == 0x3ffeedcb34a235253948765432134674); // round-down - } else { - var f: f128 = 0x1.edcb34a235253948765432134674fp-1; - try expect(@bitCast(u128, f) == 0x3ffeedcb34a235253948765432134675); // round-to-even - } + var f: f128 = 0x1.edcb34a235253948765432134674fp-1; + try expect(@bitCast(u128, f) == 0x3ffeedcb34a235253948765432134675); // round-to-even } { var f: f128 = 0x1.353e45674d89abacc3a2ebf3ff4ffp-50; @@ -1270,7 +1260,8 @@ test "@sqrt" { try testSqrt(f16, 13.0); comptime try testSqrt(f16, 13.0); - if (builtin.zig_backend == .stage1) { + // TODO: make this pass + if (false) { const x = 14.0; const y = x * x; const z = @sqrt(y); diff --git a/test/behavior/member_func.zig b/test/behavior/member_func.zig index 61280a6b11674cb536056ae591788a1f5a3526da..6c01868aea30fe40fb37888c4c96f8fb6ac60374 100644 --- a/test/behavior/member_func.zig +++ b/test/behavior/member_func.zig @@ -27,7 +27,6 @@ const HasFuncs = struct { }; test "standard field calls" { - if (builtin.zig_backend == .stage1) return error.SkipZigTest; if (builtin.zig_backend == .stage2_x86_64) return error.SkipZigTest; if (builtin.zig_backend == .stage2_arm) return error.SkipZigTest; if (builtin.zig_backend == .stage2_aarch64) return error.SkipZigTest; @@ -71,7 +70,6 @@ test "standard field calls" { } test "@field field calls" { - if (builtin.zig_backend == .stage1) return error.SkipZigTest; if (builtin.zig_backend == .stage2_x86_64) return error.SkipZigTest; if (builtin.zig_backend == .stage2_arm) return error.SkipZigTest; if (builtin.zig_backend == .stage2_aarch64) return error.SkipZigTest; diff --git a/test/behavior/muladd.zig b/test/behavior/muladd.zig index 9dfab2ad855e967b0bf6b6ed0b41fbc98a155132..7bfa57d97819ada65e2878365198cb346678ddf5 100644 --- a/test/behavior/muladd.zig +++ b/test/behavior/muladd.zig @@ -47,7 +47,6 @@ test "@mulAdd f80" { if (builtin.zig_backend == .stage2_x86_64) return error.SkipZigTest; // TODO if (builtin.zig_backend == .stage2_arm) return error.SkipZigTest; // TODO if (builtin.zig_backend == .stage2_aarch64) return error.SkipZigTest; // TODO - if (builtin.zig_backend == .stage1) return error.SkipZigTest; if (builtin.zig_backend == .stage2_llvm and builtin.os.tag == .windows) return error.SkipZigTest; // https://github.com/ziglang/zig/issues/12602 comptime try testMulAdd80(); @@ -91,7 +90,6 @@ fn vector16() !void { } test "vector f16" { - if (builtin.zig_backend == .stage1) return error.SkipZigTest; if (builtin.zig_backend == .stage2_c) return error.SkipZigTest; // TODO if (builtin.zig_backend == .stage2_wasm) return error.SkipZigTest; // TODO if (builtin.zig_backend == .stage2_x86_64) return error.SkipZigTest; // TODO @@ -115,7 +113,6 @@ fn vector32() !void { } test "vector f32" { - if (builtin.zig_backend == .stage1) return error.SkipZigTest; if (builtin.zig_backend == .stage2_c) return error.SkipZigTest; // TODO if (builtin.zig_backend == .stage2_wasm) return error.SkipZigTest; // TODO if (builtin.zig_backend == .stage2_x86_64) return error.SkipZigTest; // TODO @@ -139,7 +136,6 @@ fn vector64() !void { } test "vector f64" { - if (builtin.zig_backend == .stage1) return error.SkipZigTest; if (builtin.zig_backend == .stage2_c) return error.SkipZigTest; // TODO if (builtin.zig_backend == .stage2_wasm) return error.SkipZigTest; // TODO if (builtin.zig_backend == .stage2_x86_64) return error.SkipZigTest; // TODO @@ -162,7 +158,6 @@ fn vector80() !void { } test "vector f80" { - if (builtin.zig_backend == .stage1) return error.SkipZigTest; if (builtin.zig_backend == .stage2_c) return error.SkipZigTest; // TODO if (builtin.zig_backend == .stage2_wasm) return error.SkipZigTest; // TODO if (builtin.zig_backend == .stage2_x86_64) return error.SkipZigTest; // TODO @@ -187,7 +182,6 @@ fn vector128() !void { } test "vector f128" { - if (builtin.zig_backend == .stage1) return error.SkipZigTest; if (builtin.zig_backend == .stage2_c) return error.SkipZigTest; // TODO if (builtin.zig_backend == .stage2_wasm) return error.SkipZigTest; // TODO if (builtin.zig_backend == .stage2_x86_64) return error.SkipZigTest; // TODO diff --git a/test/behavior/optional.zig b/test/behavior/optional.zig index 014d7e117dfa0ab8929c9c2bf32a0c66dea03c2e..175cac52efbf45e5a5408975f605186ca2578e54 100644 --- a/test/behavior/optional.zig +++ b/test/behavior/optional.zig @@ -377,8 +377,6 @@ const NoReturn = struct { }; test "optional of noreturn used with if" { - if (builtin.zig_backend == .stage1) return error.SkipZigTest; - NoReturn.a = 64; if (NoReturn.loop()) |_| { @compileError("bad"); @@ -388,8 +386,6 @@ test "optional of noreturn used with if" { } test "optional of noreturn used with orelse" { - if (builtin.zig_backend == .stage1) return error.SkipZigTest; - NoReturn.a = 64; const val = NoReturn.testOrelse(); try expect(val == 123); @@ -419,7 +415,6 @@ test "alignment of wrapping an optional payload" { } test "Optional slice size is optimized" { - if (builtin.zig_backend == .stage1) return error.SkipZigTest; if (builtin.zig_backend == .stage2_aarch64) return error.SkipZigTest; if (builtin.zig_backend == .stage2_arm) return error.SkipZigTest; if (builtin.zig_backend == .stage2_x86_64) return error.SkipZigTest; diff --git a/test/behavior/packed-struct.zig b/test/behavior/packed-struct.zig index cbf66005d1d16b09c2fc9644c2d992b8b03c9d75..1ab44c2b11ded744e508f2cd80bdb2be9cfa266a 100644 --- a/test/behavior/packed-struct.zig +++ b/test/behavior/packed-struct.zig @@ -5,38 +5,7 @@ const expect = std.testing.expect; const expectEqual = std.testing.expectEqual; const native_endian = builtin.cpu.arch.endian(); -test "correct size of packed structs" { - // Stage2 has different packed struct semantics. - if (builtin.zig_backend != .stage1) return error.SkipZigTest; - const T1 = packed struct { one: u8, three: [3]u8 }; - - try expectEqual(4, @sizeOf(T1)); - try expectEqual(4 * 8, @bitSizeOf(T1)); - - const T2 = packed struct { three: [3]u8, one: u8 }; - - try expectEqual(4, @sizeOf(T2)); - try expectEqual(4 * 8, @bitSizeOf(T2)); - - const T3 = packed struct { _1: u1, x: u7, _: u24 }; - - try expectEqual(4, @sizeOf(T3)); - try expectEqual(4 * 8, @bitSizeOf(T3)); - - const T4 = packed struct { _1: u1, x: u7, _2: u8, _3: u16 }; - - try expectEqual(4, @sizeOf(T4)); - try expectEqual(4 * 8, @bitSizeOf(T4)); - - const T5 = packed struct { _1: u1, x: u7, _2: u16, _3: u8 }; - - try expectEqual(4, @sizeOf(T5)); - try expectEqual(4 * 8, @bitSizeOf(T5)); -} - test "flags in packed structs" { - if (builtin.zig_backend == .stage1) return error.SkipZigTest; - const Flags1 = packed struct { // first 8 bits b0_0: u1, @@ -121,8 +90,6 @@ test "flags in packed structs" { } test "consistent size of packed structs" { - if (builtin.zig_backend == .stage1) return error.SkipZigTest; - const TxData1 = packed struct { data: u8, _23: u23, full: bool = false }; const TxData2 = packed struct { data: u9, _22: u22, full: bool = false }; @@ -149,7 +116,6 @@ test "consistent size of packed structs" { } test "correct sizeOf and offsets in packed structs" { - if (builtin.zig_backend == .stage1) return error.SkipZigTest; if (builtin.zig_backend == .stage2_x86_64) return error.SkipZigTest; // TODO if (builtin.zig_backend == .stage2_aarch64) return error.SkipZigTest; // TODO if (builtin.zig_backend == .stage2_arm) return error.SkipZigTest; // TODO @@ -218,7 +184,6 @@ test "correct sizeOf and offsets in packed structs" { } test "nested packed structs" { - if (builtin.zig_backend == .stage1) return error.SkipZigTest; if (builtin.zig_backend == .stage2_x86_64) return error.SkipZigTest; // TODO if (builtin.zig_backend == .stage2_aarch64) return error.SkipZigTest; // TODO if (builtin.zig_backend == .stage2_arm) return error.SkipZigTest; // TODO @@ -285,7 +250,6 @@ test "regular in irregular packed struct" { } test "byte-aligned field pointer offsets" { - if (builtin.zig_backend == .stage1) return error.SkipZigTest; if (builtin.zig_backend == .stage2_x86_64) return error.SkipZigTest; if (builtin.zig_backend == .stage2_aarch64) return error.SkipZigTest; if (builtin.zig_backend == .stage2_arm) return error.SkipZigTest; @@ -387,7 +351,6 @@ test "byte-aligned field pointer offsets" { } test "load pointer from packed struct" { - if (builtin.zig_backend == .stage1) return error.SkipZigTest; if (builtin.zig_backend == .stage2_x86_64) return error.SkipZigTest; if (builtin.zig_backend == .stage2_aarch64) return error.SkipZigTest; if (builtin.zig_backend == .stage2_arm) return error.SkipZigTest; @@ -571,7 +534,6 @@ test "runtime init of unnamed packed struct type" { } test "packed struct passed to callconv(.C) function" { - if (builtin.zig_backend == .stage1) return error.SkipZigTest; if (builtin.zig_backend == .stage2_aarch64) return error.SkipZigTest; if (builtin.zig_backend == .stage2_arm) return error.SkipZigTest; if (builtin.zig_backend == .stage2_x86_64) return error.SkipZigTest; diff --git a/test/behavior/packed_struct_explicit_backing_int.zig b/test/behavior/packed_struct_explicit_backing_int.zig index daed41a626d51634f46760ade7e7da92a54e8cc4..f103c9567d0cbdecd8a160963709bc8e7e7e2300 100644 --- a/test/behavior/packed_struct_explicit_backing_int.zig +++ b/test/behavior/packed_struct_explicit_backing_int.zig @@ -5,7 +5,6 @@ const expectEqual = std.testing.expectEqual; const native_endian = builtin.cpu.arch.endian(); test "packed struct explicit backing integer" { - assert(builtin.zig_backend != .stage1); if (builtin.zig_backend == .stage2_wasm) return error.SkipZigTest; // TODO if (builtin.zig_backend == .stage2_x86_64) return error.SkipZigTest; // TODO if (builtin.zig_backend == .stage2_aarch64) return error.SkipZigTest; // TODO diff --git a/test/behavior/pointers.zig b/test/behavior/pointers.zig index 43e62fdc9360b31a2acddccae4b283a309f47b7d..2cd580aced4e5ba2cbf454698bb216a732d14ede 100644 --- a/test/behavior/pointers.zig +++ b/test/behavior/pointers.zig @@ -135,9 +135,6 @@ test "peer type resolution with C pointers" { } test "peer type resolution with C pointer and const pointer" { - // stage1 incorrectly resolves to [*]u8 - if (builtin.zig_backend == .stage1) return error.SkipZigTest; - var ptr_c: [*c]u8 = undefined; const ptr_const: u8 = undefined; try expect(@TypeOf(ptr_c, &ptr_const) == [*c]const u8); diff --git a/test/behavior/popcount.zig b/test/behavior/popcount.zig index e0618146922fc0bc274f87e697e4755aa948cd0c..376ed02c10fa54c87de61d2fca31381b029b0cbd 100644 --- a/test/behavior/popcount.zig +++ b/test/behavior/popcount.zig @@ -65,7 +65,6 @@ fn testPopCountIntegers() !void { } test "@popCount vectors" { - if (builtin.zig_backend == .stage1) return error.SkipZigTest; if (builtin.zig_backend == .stage2_c) return error.SkipZigTest; // TODO if (builtin.zig_backend == .stage2_wasm) return error.SkipZigTest; // TODO if (builtin.zig_backend == .stage2_x86_64) return error.SkipZigTest; // TODO diff --git a/test/behavior/ptrcast.zig b/test/behavior/ptrcast.zig index 256a64c67b4c2bf35d447ea71ea087cf69ebc24c..b615e110f87be6078d0c1d4c4f4341a756159679 100644 --- a/test/behavior/ptrcast.zig +++ b/test/behavior/ptrcast.zig @@ -20,7 +20,6 @@ fn testReinterpretBytesAsInteger() !void { } test "reinterpret an array over multiple elements, with no well-defined layout" { - if (builtin.zig_backend == .stage1) return error.SkipZigTest; if (builtin.zig_backend == .stage2_x86_64) return error.SkipZigTest; // TODO if (builtin.zig_backend == .stage2_arm) return error.SkipZigTest; // TODO if (builtin.zig_backend == .stage2_aarch64) return error.SkipZigTest; // TODO @@ -77,8 +76,6 @@ fn testReinterpretBytesAsExternStruct() !void { } test "reinterpret bytes of an extern struct (with under-aligned fields) into another" { - if (builtin.zig_backend == .stage1) return error.SkipZigTest; - try testReinterpretExternStructAsExternStruct(); comptime try testReinterpretExternStructAsExternStruct(); } @@ -101,8 +98,6 @@ fn testReinterpretExternStructAsExternStruct() !void { } test "reinterpret bytes of an extern struct into another" { - if (builtin.zig_backend == .stage1) return error.SkipZigTest; - try testReinterpretOverAlignedExternStructAsExternStruct(); comptime try testReinterpretOverAlignedExternStructAsExternStruct(); } @@ -127,7 +122,6 @@ fn testReinterpretOverAlignedExternStructAsExternStruct() !void { } test "lower reinterpreted comptime field ptr (with under-aligned fields)" { - if (builtin.zig_backend == .stage1) return error.SkipZigTest; if (builtin.zig_backend == .stage2_arm) return error.SkipZigTest; // TODO if (builtin.zig_backend == .stage2_aarch64) return error.SkipZigTest; // TODO if (builtin.zig_backend == .stage2_x86_64) return error.SkipZigTest; // TODO @@ -151,7 +145,6 @@ test "lower reinterpreted comptime field ptr (with under-aligned fields)" { } test "lower reinterpreted comptime field ptr" { - if (builtin.zig_backend == .stage1) return error.SkipZigTest; if (builtin.zig_backend == .stage2_arm) return error.SkipZigTest; // TODO if (builtin.zig_backend == .stage2_aarch64) return error.SkipZigTest; // TODO if (builtin.zig_backend == .stage2_x86_64) return error.SkipZigTest; // TODO diff --git a/test/behavior/saturating_arithmetic.zig b/test/behavior/saturating_arithmetic.zig index 6dff9a9112faa8fbf6e90bf78e03c0adf1c61d09..0102a7066102e5eb9593806756598518e89f7b09 100644 --- a/test/behavior/saturating_arithmetic.zig +++ b/test/behavior/saturating_arithmetic.zig @@ -149,10 +149,6 @@ test "saturating multiplication" { if (builtin.zig_backend == .stage2_aarch64) return error.SkipZigTest; // TODO if (builtin.zig_backend == .stage2_arm) return error.SkipZigTest; // TODO - if (builtin.zig_backend == .stage1 and builtin.cpu.arch == .wasm32) { - // https://github.com/ziglang/zig/issues/9660 - return error.SkipZigTest; - } if (builtin.zig_backend == .stage2_llvm and builtin.cpu.arch == .wasm32) { // https://github.com/ziglang/zig/issues/9660 return error.SkipZigTest; diff --git a/test/behavior/select.zig b/test/behavior/select.zig index f731ded09e10f127983848cc7bff60ef7ba019cb..2d76f6c14d487fa23f626be88e5dbd71980af768 100644 --- a/test/behavior/select.zig +++ b/test/behavior/select.zig @@ -32,7 +32,6 @@ fn selectVectors() !void { } test "@select arrays" { - if (builtin.zig_backend == .stage1) return error.SkipZigTest; // TODO if (builtin.zig_backend == .stage2_c) return error.SkipZigTest; // TODO if (builtin.zig_backend == .stage2_wasm) return error.SkipZigTest; // TODO if (builtin.zig_backend == .stage2_x86_64) return error.SkipZigTest; // TODO diff --git a/test/behavior/shuffle.zig b/test/behavior/shuffle.zig index 6c084b64d809070def15d75f513219ecb9382a4d..b1c4a3c841aa89f8fa0dfc001e1c9ae552c441a4 100644 --- a/test/behavior/shuffle.zig +++ b/test/behavior/shuffle.zig @@ -71,7 +71,7 @@ test "@shuffle bool 2" { if (builtin.zig_backend == .stage2_arm) return error.SkipZigTest; // TODO if (builtin.zig_backend == .stage2_c) return error.SkipZigTest; // TODO - if (builtin.zig_backend == .stage1 or builtin.zig_backend == .stage2_llvm) { + if (builtin.zig_backend == .stage2_llvm) { // https://github.com/ziglang/zig/issues/3246 return error.SkipZigTest; } diff --git a/test/behavior/sizeof_and_typeof.zig b/test/behavior/sizeof_and_typeof.zig index 6f27d414d2e8a8928eb808f34cf34e5c2e34c863..0cfaa9dcab7c5a9d57a7861e3e01863b22e0e1f9 100644 --- a/test/behavior/sizeof_and_typeof.zig +++ b/test/behavior/sizeof_and_typeof.zig @@ -101,52 +101,6 @@ test "@offsetOf" { try expect(@ptrToInt(&a.i) - @ptrToInt(&a) == @offsetOf(A, "i")); } -test "@offsetOf packed struct, array length not power of 2 or multiple of native pointer width in bytes" { - // Stage2 has different packed struct semantics. - if (builtin.zig_backend != .stage1) return error.SkipZigTest; - const p3a_len = 3; - const P3 = packed struct { - a: [p3a_len]u8, - b: usize, - }; - try std.testing.expect(0 == @offsetOf(P3, "a")); - try std.testing.expect(p3a_len == @offsetOf(P3, "b")); - - const p5a_len = 5; - const P5 = packed struct { - a: [p5a_len]u8, - b: usize, - }; - try std.testing.expect(0 == @offsetOf(P5, "a")); - try std.testing.expect(p5a_len == @offsetOf(P5, "b")); - - const p6a_len = 6; - const P6 = packed struct { - a: [p6a_len]u8, - b: usize, - }; - try std.testing.expect(0 == @offsetOf(P6, "a")); - try std.testing.expect(p6a_len == @offsetOf(P6, "b")); - - const p7a_len = 7; - const P7 = packed struct { - a: [p7a_len]u8, - b: usize, - }; - try std.testing.expect(0 == @offsetOf(P7, "a")); - try std.testing.expect(p7a_len == @offsetOf(P7, "b")); - - const p9a_len = 9; - const P9 = packed struct { - a: [p9a_len]u8, - b: usize, - }; - try std.testing.expect(0 == @offsetOf(P9, "a")); - try std.testing.expect(p9a_len == @offsetOf(P9, "b")); - - // 10, 11, 12, 13, 14, 15, 17, 18, 19, 20, 21, 22, 23, 25 etc. are further cases -} - test "@bitOffsetOf" { // Packed structs have fixed memory layout try expect(@bitOffsetOf(P, "a") == 0); @@ -211,8 +165,6 @@ test "branching logic inside @TypeOf" { } test "@bitSizeOf" { - if (builtin.zig_backend == .stage1) return error.SkipZigTest; - try expect(@bitSizeOf(u2) == 2); try expect(@bitSizeOf(u8) == @sizeOf(u8) * 8); try expect(@bitSizeOf(struct { @@ -224,11 +176,6 @@ test "@bitSizeOf" { } test "@sizeOf comparison against zero" { - if (builtin.zig_backend == .stage1) { - // stage1 gets the wrong answer for size of pointers to zero bit types - return error.SkipZigTest; - } - const S0 = struct { f: *@This(), }; diff --git a/test/behavior/slice.zig b/test/behavior/slice.zig index 8d2c484b5f6e4957dbd1944804c960b63af820fa..88ccd2a10caba09957f1a2c3fa965880d386d1e8 100644 --- a/test/behavior/slice.zig +++ b/test/behavior/slice.zig @@ -182,7 +182,6 @@ test "slicing zero length array" { const x = @intToPtr([*]i32, 0x1000)[0..0x500]; const y = x[0x100..]; test "compile time slice of pointer to hard coded address" { - if (builtin.zig_backend == .stage1) return error.SkipZigTest; if (builtin.zig_backend == .stage2_x86_64) return error.SkipZigTest; try expect(@ptrToInt(x) == 0x1000); @@ -444,10 +443,7 @@ test "slice syntax resulting in pointer-to-array" { var array: [2]u8 = [2]u8{ 1, 2 }; var slice: ?[]u8 = &array; comptime try expect(@TypeOf(&array, slice) == ?[]u8); - if (builtin.zig_backend != .stage1) { - // stage1 is not passing this case - comptime try expect(@TypeOf(slice, &array) == ?[]u8); - } + comptime try expect(@TypeOf(slice, &array) == ?[]u8); comptime try expect(@TypeOf(slice.?[0..2]) == *[2]u8); } @@ -479,13 +475,7 @@ test "slice pointer-to-array null terminated" { var slice: [:0]u8 = &array; try expect(@TypeOf(slice[1..3]) == *[2]u8); try expect(@TypeOf(slice[1..3 :4]) == *[2:4]u8); - - if (builtin.zig_backend == .stage1) { - try expect(@TypeOf(slice[1..]) == [:0]u8); - } else { - // stage2 gives a more accurate, correct answer - try expect(@TypeOf(slice[1..]) == *[4:0]u8); - } + try expect(@TypeOf(slice[1..]) == *[4:0]u8); } var array = [5:0]u8{ 1, 2, 3, 4, 5 }; @@ -509,12 +499,7 @@ test "slice pointer-to-array zero length" { var array = [0:0]u8{}; var src_slice: [:0]u8 = &array; var slice = src_slice[0..0]; - if (builtin.zig_backend == .stage1) { - try expect(@TypeOf(slice) == *[0]u8); - } else { - // stage2 gives a more accurate, correct answer - try expect(@TypeOf(slice) == *[0:0]u8); - } + try expect(@TypeOf(slice) == *[0:0]u8); } } @@ -573,16 +558,11 @@ test "array concat of slices gives ptr to array" { var b: []const u8 = "asdf"; const c = a ++ b; try expect(std.mem.eql(u8, c, "aoeuasdf")); - if (builtin.zig_backend != .stage1) { - // spec change: array concat now returns pointer-to-array for slices - try expect(@TypeOf(c) == *const [8]u8); - } + try expect(@TypeOf(c) == *const [8]u8); } } test "array mult of slice gives ptr to array" { - if (builtin.zig_backend == .stage1) return error.SkipZigTest; // Stage 1 does not support multiplying slices - comptime { var a: []const u8 = "aoeu"; const c = a ** 2; @@ -626,8 +606,6 @@ test "slice sentinel access at comptime" { } test "slicing array with sentinel as end index" { - // Doesn't work in stage1 - if (builtin.zig_backend == .stage1) return error.SkipZigTest; if (builtin.zig_backend == .stage2_aarch64) return error.SkipZigTest; const S = struct { @@ -645,8 +623,6 @@ test "slicing array with sentinel as end index" { } test "slicing slice with sentinel as end index" { - // Doesn't work in stage1 - if (builtin.zig_backend == .stage1) return error.SkipZigTest; if (builtin.zig_backend == .stage2_aarch64) return error.SkipZigTest; const S = struct { diff --git a/test/behavior/struct.zig b/test/behavior/struct.zig index 78eb820daaffaf5c099b19c075b64ffd805b7ab3..cd4300c8d441bfef3d342f9bdc02c2acaa3d7e7d 100644 --- a/test/behavior/struct.zig +++ b/test/behavior/struct.zig @@ -419,11 +419,8 @@ test "packed struct 24bits" { if (builtin.zig_backend == .stage2_sparc64) return error.SkipZigTest; // TODO comptime { - // stage1 gets the wrong answer for sizeof - if (builtin.zig_backend != .stage1) { - std.debug.assert(@sizeOf(Foo24Bits) == @sizeOf(u24)); - std.debug.assert(@sizeOf(Foo96Bits) == @sizeOf(u96)); - } + std.debug.assert(@sizeOf(Foo24Bits) == @sizeOf(u24)); + std.debug.assert(@sizeOf(Foo96Bits) == @sizeOf(u96)); } var value = Foo96Bits{ @@ -497,10 +494,6 @@ const Bitfields = packed struct { }; test "packed struct fields are ordered from LSB to MSB" { - if (builtin.zig_backend == .stage1) { - // stage1 gets the wrong answer for a lot of targets - return error.SkipZigTest; - } if (builtin.zig_backend == .stage2_aarch64) return error.SkipZigTest; // TODO if (builtin.zig_backend == .stage2_arm) return error.SkipZigTest; // TODO if (builtin.zig_backend == .stage2_x86_64) return error.SkipZigTest; // TODO @@ -640,7 +633,6 @@ test "default struct initialization fields" { } test "packed array 24bits" { - if (builtin.zig_backend == .stage1) return error.SkipZigTest; if (builtin.zig_backend == .stage2_x86_64) return error.SkipZigTest; if (builtin.zig_backend == .stage2_arm) return error.SkipZigTest; if (builtin.zig_backend == .stage2_aarch64) return error.SkipZigTest; @@ -698,25 +690,6 @@ const FooArray24Bits = packed struct { c: u16, }; -test "aligned array of packed struct" { - // Stage2 has different packed struct semantics. - if (builtin.zig_backend != .stage1) return error.SkipZigTest; - if (builtin.zig_backend == .stage2_sparc64) return error.SkipZigTest; // TODO - - comptime { - try expect(@sizeOf(FooStructAligned) == 2); - try expect(@sizeOf(FooArrayOfAligned) == 2 * 2); - } - - var bytes = [_]u8{0xbb} ** @sizeOf(FooArrayOfAligned); - const ptr = &std.mem.bytesAsSlice(FooArrayOfAligned, bytes[0..])[0]; - - try expect(ptr.a[0].a == 0xbb); - try expect(ptr.a[0].b == 0xbb); - try expect(ptr.a[1].a == 0xbb); - try expect(ptr.a[1].b == 0xbb); -} - const FooStructAligned = packed struct { a: u8, b: u8, @@ -1150,7 +1123,6 @@ test "for loop over pointers to struct, getting field from struct pointer" { } test "anon init through error unions and optionals" { - if (builtin.zig_backend == .stage1) return error.SkipZigTest; if (builtin.zig_backend == .stage2_x86_64) return error.SkipZigTest; // TODO if (builtin.zig_backend == .stage2_aarch64) return error.SkipZigTest; // TODO if (builtin.zig_backend == .stage2_arm) return error.SkipZigTest; // TODO @@ -1178,7 +1150,6 @@ test "anon init through error unions and optionals" { } test "anon init through optional" { - if (builtin.zig_backend == .stage1) return error.SkipZigTest; if (builtin.zig_backend == .stage2_x86_64) return error.SkipZigTest; // TODO if (builtin.zig_backend == .stage2_aarch64) return error.SkipZigTest; // TODO if (builtin.zig_backend == .stage2_arm) return error.SkipZigTest; // TODO @@ -1199,7 +1170,6 @@ test "anon init through optional" { } test "anon init through error union" { - if (builtin.zig_backend == .stage1) return error.SkipZigTest; if (builtin.zig_backend == .stage2_x86_64) return error.SkipZigTest; // TODO if (builtin.zig_backend == .stage2_aarch64) return error.SkipZigTest; // TODO if (builtin.zig_backend == .stage2_arm) return error.SkipZigTest; // TODO @@ -1220,7 +1190,6 @@ test "anon init through error union" { } test "typed init through error unions and optionals" { - if (builtin.zig_backend == .stage1) return error.SkipZigTest; if (builtin.zig_backend == .stage2_x86_64) return error.SkipZigTest; // TODO if (builtin.zig_backend == .stage2_aarch64) return error.SkipZigTest; // TODO if (builtin.zig_backend == .stage2_arm) return error.SkipZigTest; // TODO @@ -1283,10 +1252,6 @@ test "loading a struct pointer perfoms a copy" { } test "packed struct aggregate init" { - if (builtin.zig_backend == .stage1) { - // stage1 fails this test on mips - return error.SkipZigTest; - } if (builtin.zig_backend == .stage2_x86_64) return error.SkipZigTest; // TODO if (builtin.zig_backend == .stage2_aarch64) return error.SkipZigTest; // TODO if (builtin.zig_backend == .stage2_arm) return error.SkipZigTest; // TODO @@ -1328,8 +1293,6 @@ test "packed struct field access via pointer" { } test "store to comptime field" { - if (builtin.zig_backend == .stage1) return error.SkipZigTest; - { const S = struct { comptime a: [2]u32 = [2]u32{ 1, 2 }, @@ -1364,7 +1327,6 @@ test "struct field init value is size of the struct" { } test "under-aligned struct field" { - if (builtin.zig_backend == .stage1) return error.SkipZigTest; if (builtin.zig_backend == .stage2_c) return error.SkipZigTest; // TODO if (builtin.zig_backend == .stage2_x86_64) return error.SkipZigTest; // TODO if (builtin.zig_backend == .stage2_aarch64) return error.SkipZigTest; // TODO diff --git a/test/behavior/truncate.zig b/test/behavior/truncate.zig index 677fcd930f7c972f705d69a3d889ad4d3673c5d2..40f986bc86492ad9b9ca1f7190155f8fbf8171d9 100644 --- a/test/behavior/truncate.zig +++ b/test/behavior/truncate.zig @@ -60,11 +60,6 @@ test "truncate on comptime integer" { } test "truncate on vectors" { - if (builtin.zig_backend == .stage1) { - // stage1 fails the comptime test - return error.SkipZigTest; - } - if (builtin.zig_backend == .stage2_c) return error.SkipZigTest; if (builtin.zig_backend == .stage2_wasm) return error.SkipZigTest; if (builtin.zig_backend == .stage2_x86_64) return error.SkipZigTest; diff --git a/test/behavior/type.zig b/test/behavior/type.zig index 556a8c990dd7f7e2c82f4d94dea7e3708ca5110d..48c1e90812e57177b7ec8c6e2c66b94bf881c71d 100644 --- a/test/behavior/type.zig +++ b/test/behavior/type.zig @@ -229,7 +229,7 @@ test "Type.Vector" { } test "Type.AnyFrame" { - if (builtin.zig_backend != .stage1) { + if (true) { // https://github.com/ziglang/zig/issues/6025 return error.SkipZigTest; } @@ -246,8 +246,6 @@ fn add(a: i32, b: i32) i32 { } test "Type.ErrorSet" { - if (builtin.zig_backend == .stage1) return error.SkipZigTest; - try testing.expect(@Type(.{ .ErrorSet = null }) == anyerror); // error sets don't compare equal so just check if they compile @@ -369,12 +367,7 @@ test "Type.Enum" { try testing.expectEqual(@as(u8, 5), @enumToInt(Foo.b)); const Bar = @Type(.{ .Enum = .{ - // stage2 only has auto layouts - .layout = if (builtin.zig_backend == .stage1) - .Extern - else - .Auto, - + .layout = .Auto, .tag_type = u32, .fields = &.{ .{ .name = "a", .value = 1 }, @@ -501,8 +494,6 @@ test "Type.Union from regular enum" { } test "Type.Fn" { - if (builtin.zig_backend == .stage1) return error.SkipZigTest; - if (true) { // https://github.com/ziglang/zig/issues/12360 return error.SkipZigTest; diff --git a/test/behavior/type_info.zig b/test/behavior/type_info.zig index af1b740834ca0c7413df42ed2e015762ccca3b75..c0aaa2cfa715d938f0e5ede387b86797476ab880 100644 --- a/test/behavior/type_info.zig +++ b/test/behavior/type_info.zig @@ -201,9 +201,6 @@ test "type info: error set single value" { } test "type info: error set merged" { - // #11022 forces ordering of error sets in stage2 - if (builtin.zig_backend == .stage1) return error.SkipZigTest; - if (builtin.zig_backend == .stage2_aarch64) return error.SkipZigTest; if (builtin.zig_backend == .stage2_arm) return error.SkipZigTest; // TODO if (builtin.zig_backend == .stage2_x86_64) return error.SkipZigTest; // TODO @@ -305,8 +302,6 @@ const TestStruct = struct { }; test "type info: packed struct info" { - if (builtin.zig_backend == .stage1) return error.SkipZigTest; - try testPackedStruct(); comptime try testPackedStruct(); } @@ -376,25 +371,21 @@ extern fn typeInfoFoo(a: usize, b: bool, ...) callconv(.C) usize; extern fn typeInfoFooAligned(a: usize, b: bool, ...) align(4) callconv(.C) usize; test "type info: generic function types" { - if (builtin.zig_backend != .stage1) { - // stage1 marks all args/return types as null if the function - // is generic at all. stage2 is more specific. - const G1 = @typeInfo(@TypeOf(generic1)); - try expect(G1.Fn.args.len == 1); - try expect(G1.Fn.args[0].is_generic == true); - try expect(G1.Fn.args[0].arg_type == null); - try expect(G1.Fn.return_type == void); + const G1 = @typeInfo(@TypeOf(generic1)); + try expect(G1.Fn.args.len == 1); + try expect(G1.Fn.args[0].is_generic == true); + try expect(G1.Fn.args[0].arg_type == null); + try expect(G1.Fn.return_type == void); - const G2 = @typeInfo(@TypeOf(generic2)); - try expect(G2.Fn.args.len == 3); - try expect(G2.Fn.args[0].is_generic == false); - try expect(G2.Fn.args[0].arg_type == type); - try expect(G2.Fn.args[1].is_generic == true); - try expect(G2.Fn.args[1].arg_type == null); - try expect(G2.Fn.args[2].is_generic == false); - try expect(G2.Fn.args[2].arg_type == u8); - try expect(G2.Fn.return_type == void); - } + const G2 = @typeInfo(@TypeOf(generic2)); + try expect(G2.Fn.args.len == 3); + try expect(G2.Fn.args[0].is_generic == false); + try expect(G2.Fn.args[0].arg_type == type); + try expect(G2.Fn.args[1].is_generic == true); + try expect(G2.Fn.args[1].arg_type == null); + try expect(G2.Fn.args[2].is_generic == false); + try expect(G2.Fn.args[2].arg_type == u8); + try expect(G2.Fn.return_type == void); const G3 = @typeInfo(@TypeOf(generic3)); try expect(G3.Fn.args.len == 1); @@ -442,7 +433,7 @@ fn testVector() !void { } test "type info: anyframe and anyframe->T" { - if (builtin.zig_backend != .stage1) { + if (true) { // https://github.com/ziglang/zig/issues/6025 return error.SkipZigTest; } @@ -501,7 +492,7 @@ fn add(a: i32, b: i32) i32 { } test "type info for async frames" { - if (builtin.zig_backend != .stage1) { + if (true) { // https://github.com/ziglang/zig/issues/6025 return error.SkipZigTest; } diff --git a/test/behavior/typename.zig b/test/behavior/typename.zig index e6e9390d6a7fd2bb953f6420960bb4a7729f5a5b..6beeb76772540f75a3d58d1353d1d2b4e618903a 100644 --- a/test/behavior/typename.zig +++ b/test/behavior/typename.zig @@ -12,12 +12,6 @@ const expectStringStartsWith = std.testing.expectStringStartsWith; // failures. test "anon fn param" { - if (builtin.zig_backend == .stage1) { - // stage1 uses line/column for the names but we're moving away from that for - // incremental compilation purposes. - return error.SkipZigTest; - } - if (builtin.zig_backend == .stage2_x86_64) return error.SkipZigTest; // TODO if (builtin.zig_backend == .stage2_aarch64) return error.SkipZigTest; // TODO if (builtin.zig_backend == .stage2_arm) return error.SkipZigTest; // TODO @@ -43,12 +37,6 @@ test "anon fn param" { } test "anon field init" { - if (builtin.zig_backend == .stage1) { - // stage1 uses line/column for the names but we're moving away from that for - // incremental compilation purposes. - return error.SkipZigTest; - } - if (builtin.zig_backend == .stage2_x86_64) return error.SkipZigTest; // TODO if (builtin.zig_backend == .stage2_aarch64) return error.SkipZigTest; // TODO if (builtin.zig_backend == .stage2_arm) return error.SkipZigTest; // TODO @@ -84,11 +72,6 @@ test "basic" { } test "top level decl" { - if (builtin.zig_backend == .stage1) { - // stage1 fails to return fully qualified namespaces. - return error.SkipZigTest; - } - if (builtin.zig_backend == .stage2_x86_64) return error.SkipZigTest; // TODO if (builtin.zig_backend == .stage2_aarch64) return error.SkipZigTest; // TODO if (builtin.zig_backend == .stage2_arm) return error.SkipZigTest; // TODO @@ -208,11 +191,6 @@ pub fn expectEqualStringsIgnoreDigits(expected: []const u8, actual: []const u8) } test "local variable" { - if (builtin.zig_backend == .stage1) { - // stage1 fails to return fully qualified namespaces. - return error.SkipZigTest; - } - if (builtin.zig_backend == .stage2_x86_64) return error.SkipZigTest; // TODO if (builtin.zig_backend == .stage2_aarch64) return error.SkipZigTest; // TODO if (builtin.zig_backend == .stage2_arm) return error.SkipZigTest; // TODO @@ -231,7 +209,6 @@ test "local variable" { } test "comptime parameters not converted to anytype in function type" { - if (builtin.zig_backend == .stage1) return error.SkipZigTest; if (builtin.zig_backend == .stage2_x86_64) return error.SkipZigTest; // TODO if (builtin.zig_backend == .stage2_aarch64) return error.SkipZigTest; // TODO if (builtin.zig_backend == .stage2_arm) return error.SkipZigTest; // TODO @@ -241,12 +218,6 @@ test "comptime parameters not converted to anytype in function type" { } test "anon name strategy used in sub expression" { - if (builtin.zig_backend == .stage1) { - // stage1 uses line/column for the names but we're moving away from that for - // incremental compilation purposes. - return error.SkipZigTest; - } - if (builtin.zig_backend == .stage2_x86_64) return error.SkipZigTest; // TODO if (builtin.zig_backend == .stage2_aarch64) return error.SkipZigTest; // TODO if (builtin.zig_backend == .stage2_arm) return error.SkipZigTest; // TODO diff --git a/test/behavior/undefined.zig b/test/behavior/undefined.zig index 945d820a6bd2c6271308c61d6d50e42556d28f6b..4e331e6eff7850641c57ce9e1bc8d571e0aedcf5 100644 --- a/test/behavior/undefined.zig +++ b/test/behavior/undefined.zig @@ -76,10 +76,6 @@ test "assign undefined to struct with method" { } test "type name of undefined" { - if (builtin.zig_backend == .stage1) { - // stage1 gets the type name wrong - return error.SkipZigTest; - } if (builtin.zig_backend == .stage2_aarch64) return error.SkipZigTest; const x = undefined; diff --git a/test/behavior/union.zig b/test/behavior/union.zig index 6e91202776cb0c3da940e2f554527f4d4e916a7b..bdea8db3c1fc62c3a791a402bde012327a037381 100644 --- a/test/behavior/union.zig +++ b/test/behavior/union.zig @@ -221,7 +221,6 @@ test "packed union generates correctly aligned type" { if (builtin.zig_backend == .stage2_x86_64) return error.SkipZigTest; if (builtin.zig_backend == .stage2_arm) return error.SkipZigTest; if (builtin.zig_backend == .stage2_aarch64) return error.SkipZigTest; - if (builtin.zig_backend == .stage1) return error.SkipZigTest; const U = packed union { f1: *const fn () error{TestUnexpectedResult}!void, @@ -1002,7 +1001,6 @@ test "cast from pointer to anonymous struct to pointer to union" { } test "switching on non exhaustive union" { - if (builtin.zig_backend == .stage1) return error.SkipZigTest; if (builtin.zig_backend == .stage2_arm) return error.SkipZigTest; // TODO if (builtin.zig_backend == .stage2_aarch64) return error.SkipZigTest; // TODO @@ -1197,7 +1195,6 @@ test "union tag is set when initiated as a temporary value at runtime" { } test "extern union most-aligned field is smaller" { - if (builtin.zig_backend == .stage1) return error.SkipZigTest; if (builtin.zig_backend == .stage2_x86_64) return error.SkipZigTest; // TODO if (builtin.zig_backend == .stage2_arm) return error.SkipZigTest; // TODO if (builtin.zig_backend == .stage2_aarch64) return error.SkipZigTest; // TODO @@ -1246,7 +1243,6 @@ test "return an extern union from C calling convention" { } test "noreturn field in union" { - if (builtin.zig_backend == .stage1) return error.SkipZigTest; if (builtin.zig_backend == .stage2_aarch64) return error.SkipZigTest; // TODO if (builtin.zig_backend == .stage2_arm) return error.SkipZigTest; // TODO if (builtin.zig_backend == .stage2_x86_64) return error.SkipZigTest; // TODO @@ -1298,7 +1294,6 @@ test "noreturn field in union" { } test "union and enum field order doesn't match" { - if (builtin.zig_backend == .stage1) return error.SkipZigTest; if (builtin.zig_backend == .stage2_aarch64) return error.SkipZigTest; // TODO if (builtin.zig_backend == .stage2_arm) return error.SkipZigTest; // TODO diff --git a/test/behavior/vector.zig b/test/behavior/vector.zig index 2b83ad6e005cdf73bd649dd51ebf0c956f6e65d0..ca38cb7ebcbb8c955a40c1cfbcc4b750796ca377 100644 --- a/test/behavior/vector.zig +++ b/test/behavior/vector.zig @@ -6,12 +6,6 @@ const expect = std.testing.expect; const expectEqual = std.testing.expectEqual; test "implicit cast vector to array - bool" { - if (builtin.zig_backend == .stage1) { - // Regressed in LLVM 14: - // https://github.com/llvm/llvm-project/issues/55522 - return error.SkipZigTest; - } - if (builtin.zig_backend == .stage2_wasm) return error.SkipZigTest; // TODO if (builtin.zig_backend == .stage2_x86_64) return error.SkipZigTest; // TODO if (builtin.zig_backend == .stage2_aarch64) return error.SkipZigTest; // TODO @@ -180,9 +174,7 @@ test "tuple to vector" { if (builtin.zig_backend == .stage2_arm) return error.SkipZigTest; // TODO if (builtin.zig_backend == .stage2_c) return error.SkipZigTest; // TODO - if ((builtin.zig_backend == .stage1 or builtin.zig_backend == .stage2_llvm) and - builtin.cpu.arch == .aarch64) - { + if (builtin.zig_backend == .stage2_llvm and builtin.cpu.arch == .aarch64) { // Regressed with LLVM 14: // https://github.com/ziglang/zig/issues/12012 return error.SkipZigTest; @@ -197,9 +189,7 @@ test "tuple to vector" { } try std.testing.expectEqual(v, Vec3{ 1, 1, 1 }); - if (builtin.zig_backend != .stage1) { - try std.testing.expectEqual(v, .{ 1, 1, 1 }); - } + try std.testing.expectEqual(v, .{ 1, 1, 1 }); } }; try S.doTheTest(); @@ -406,12 +396,6 @@ test "initialize vector which is a struct field" { } test "vector comparison operators" { - if (builtin.zig_backend == .stage1) { - // Regressed in LLVM 14: - // https://github.com/llvm/llvm-project/issues/55522 - return error.SkipZigTest; - } - if (builtin.zig_backend == .stage2_wasm) return error.SkipZigTest; // TODO if (builtin.zig_backend == .stage2_c) return error.SkipZigTest; // TODO if (builtin.zig_backend == .stage2_x86_64) return error.SkipZigTest; // TODO @@ -801,7 +785,6 @@ test "vector reduce operation" { } test "vector @reduce comptime" { - if (builtin.zig_backend == .stage1) return error.SkipZigTest; if (builtin.zig_backend == .stage2_wasm) return error.SkipZigTest; // TODO if (builtin.zig_backend == .stage2_x86_64) return error.SkipZigTest; // TODO if (builtin.zig_backend == .stage2_aarch64) return error.SkipZigTest; // TODO @@ -937,10 +920,6 @@ test "saturating shift-left" { } test "multiplication-assignment operator with an array operand" { - if (builtin.zig_backend == .stage1) { - // stage1 emits a compile error - return error.SkipZigTest; - } if (builtin.zig_backend == .stage2_wasm) return error.SkipZigTest; // TODO if (builtin.zig_backend == .stage2_x86_64) return error.SkipZigTest; // TODO if (builtin.zig_backend == .stage2_aarch64) return error.SkipZigTest; // TODO @@ -961,10 +940,6 @@ test "multiplication-assignment operator with an array operand" { } test "@addWithOverflow" { - if (builtin.zig_backend == .stage1) { - // stage1 doesn't support vector args - return error.SkipZigTest; - } if (builtin.zig_backend == .stage2_wasm) return error.SkipZigTest; // TODO if (builtin.zig_backend == .stage2_x86_64) return error.SkipZigTest; // TODO if (builtin.zig_backend == .stage2_aarch64) return error.SkipZigTest; // TODO @@ -1011,10 +986,6 @@ test "@addWithOverflow" { } test "@subWithOverflow" { - if (builtin.zig_backend == .stage1) { - // stage1 doesn't support vector args - return error.SkipZigTest; - } if (builtin.zig_backend == .stage2_wasm) return error.SkipZigTest; // TODO if (builtin.zig_backend == .stage2_x86_64) return error.SkipZigTest; // TODO if (builtin.zig_backend == .stage2_aarch64) return error.SkipZigTest; // TODO @@ -1045,10 +1016,6 @@ test "@subWithOverflow" { } test "@mulWithOverflow" { - if (builtin.zig_backend == .stage1) { - // stage1 doesn't support vector args - return error.SkipZigTest; - } if (builtin.zig_backend == .stage2_wasm) return error.SkipZigTest; // TODO if (builtin.zig_backend == .stage2_x86_64) return error.SkipZigTest; // TODO if (builtin.zig_backend == .stage2_aarch64) return error.SkipZigTest; // TODO @@ -1069,10 +1036,6 @@ test "@mulWithOverflow" { } test "@shlWithOverflow" { - if (builtin.zig_backend == .stage1) { - // stage1 doesn't support vector args - return error.SkipZigTest; - } if (builtin.zig_backend == .stage2_c) return error.SkipZigTest; // TODO if (builtin.zig_backend == .stage2_wasm) return error.SkipZigTest; // TODO if (builtin.zig_backend == .stage2_x86_64) return error.SkipZigTest; // TODO diff --git a/test/behavior/while.zig b/test/behavior/while.zig index a54563bb8356262f332d1294913a97380d785b5c..2496bf0c38b6934ccdcc068fe0c2dfc9140b7005 100644 --- a/test/behavior/while.zig +++ b/test/behavior/while.zig @@ -364,3 +364,10 @@ test "try terminating an infinite loop" { _ = try Foo.bar(); } else unreachable); } + +test "while loop with comptime true condition needs no else block to return value with break" { + const x = while (true) { + break @as(u32, 69); + }; + try expect(x == 69); +}