diff --git a/lib/compiler_rt/stack_probe.zig b/lib/compiler_rt/stack_probe.zig index c24b927809..09d535bd51 100644 --- a/lib/compiler_rt/stack_probe.zig +++ b/lib/compiler_rt/stack_probe.zig @@ -236,27 +236,27 @@ fn win_probe_stack_adjust_sp() void { pub fn _chkstk() callconv(.Naked) void { @setRuntimeSafety(false); - @call(.{ .modifier = .always_inline }, win_probe_stack_adjust_sp, .{}); + @call(.always_inline, win_probe_stack_adjust_sp, .{}); } pub fn __chkstk() callconv(.Naked) void { @setRuntimeSafety(false); if (comptime arch.isAARCH64()) { - @call(.{ .modifier = .always_inline }, win_probe_stack_only, .{}); + @call(.always_inline, win_probe_stack_only, .{}); } else switch (arch) { - .x86 => @call(.{ .modifier = .always_inline }, win_probe_stack_adjust_sp, .{}), - .x86_64 => @call(.{ .modifier = .always_inline }, win_probe_stack_only, .{}), + .x86 => @call(.always_inline, win_probe_stack_adjust_sp, .{}), + .x86_64 => @call(.always_inline, win_probe_stack_only, .{}), else => unreachable, } } pub fn ___chkstk() callconv(.Naked) void { @setRuntimeSafety(false); - @call(.{ .modifier = .always_inline }, win_probe_stack_adjust_sp, .{}); + @call(.always_inline, win_probe_stack_adjust_sp, .{}); } pub fn __chkstk_ms() callconv(.Naked) void { @setRuntimeSafety(false); - @call(.{ .modifier = .always_inline }, win_probe_stack_only, .{}); + @call(.always_inline, win_probe_stack_only, .{}); } pub fn ___chkstk_ms() callconv(.Naked) void { @setRuntimeSafety(false); - @call(.{ .modifier = .always_inline }, win_probe_stack_only, .{}); + @call(.always_inline, win_probe_stack_only, .{}); } diff --git a/lib/std/Thread.zig b/lib/std/Thread.zig index e2e17a2925..fc4f676a1f 100644 --- a/lib/std/Thread.zig +++ b/lib/std/Thread.zig @@ -387,10 +387,10 @@ fn callFn(comptime f: anytype, args: anytype) switch (Impl) { switch (@typeInfo(@typeInfo(@TypeOf(f)).Fn.return_type.?)) { .NoReturn => { - @call(.{}, f, args); + @call(.auto, f, args); }, .Void => { - @call(.{}, f, args); + @call(.auto, f, args); return default_value; }, .Int => |info| { @@ -398,7 +398,7 @@ fn callFn(comptime f: anytype, args: anytype) switch (Impl) { @compileError(bad_fn_ret); } - const status = @call(.{}, f, args); + const status = @call(.auto, f, args); if (Impl != PosixThreadImpl) { return status; } @@ -411,7 +411,7 @@ fn callFn(comptime f: anytype, args: anytype) switch (Impl) { @compileError(bad_fn_ret); } - @call(.{}, f, args) catch |err| { + @call(.auto, f, args) catch |err| { std.debug.print("error: {s}\n", .{@errorName(err)}); if (@errorReturnTrace()) |trace| { std.debug.dumpStackTrace(trace.*); diff --git a/lib/std/crypto/siphash.zig b/lib/std/crypto/siphash.zig index dff8005b31..e960a3476b 100644 --- a/lib/std/crypto/siphash.zig +++ b/lib/std/crypto/siphash.zig @@ -78,12 +78,10 @@ fn SipHashStateless(comptime T: type, comptime c_rounds: usize, comptime d_round pub fn update(self: *Self, b: []const u8) void { std.debug.assert(b.len % 8 == 0); - const inl = std.builtin.CallOptions{ .modifier = .always_inline }; - var off: usize = 0; while (off < b.len) : (off += 8) { const blob = b[off..][0..8].*; - @call(inl, round, .{ self, blob }); + @call(.always_inline, round, .{ self, blob }); } self.msg_len +%= @truncate(u8, b.len); @@ -105,12 +103,9 @@ fn SipHashStateless(comptime T: type, comptime c_rounds: usize, comptime d_round self.v2 ^= 0xff; } - // TODO this is a workaround, should be able to supply the value without a separate variable - const inl = std.builtin.CallOptions{ .modifier = .always_inline }; - comptime var i: usize = 0; inline while (i < d_rounds) : (i += 1) { - @call(inl, sipRound, .{self}); + @call(.always_inline, sipRound, .{self}); } const b1 = self.v0 ^ self.v1 ^ self.v2 ^ self.v3; @@ -122,7 +117,7 @@ fn SipHashStateless(comptime T: type, comptime c_rounds: usize, comptime d_round comptime var j: usize = 0; inline while (j < d_rounds) : (j += 1) { - @call(inl, sipRound, .{self}); + @call(.always_inline, sipRound, .{self}); } const b2 = self.v0 ^ self.v1 ^ self.v2 ^ self.v3; @@ -133,11 +128,9 @@ fn SipHashStateless(comptime T: type, comptime c_rounds: usize, comptime d_round const m = mem.readIntLittle(u64, b[0..8]); self.v3 ^= m; - // TODO this is a workaround, should be able to supply the value without a separate variable - const inl = std.builtin.CallOptions{ .modifier = .always_inline }; comptime var i: usize = 0; inline while (i < c_rounds) : (i += 1) { - @call(inl, sipRound, .{self}); + @call(.always_inline, sipRound, .{self}); } self.v0 ^= m; @@ -163,8 +156,8 @@ fn SipHashStateless(comptime T: type, comptime c_rounds: usize, comptime d_round pub fn hash(msg: []const u8, key: *const [key_length]u8) T { const aligned_len = msg.len - (msg.len % 8); var c = Self.init(key); - @call(.{ .modifier = .always_inline }, c.update, .{msg[0..aligned_len]}); - return @call(.{ .modifier = .always_inline }, c.final, .{msg[aligned_len..]}); + @call(.always_inline, c.update, .{msg[0..aligned_len]}); + return @call(.always_inline, c.final, .{msg[aligned_len..]}); } }; } diff --git a/lib/std/dynamic_library.zig b/lib/std/dynamic_library.zig index 90fb88c5be..2ab798dcd7 100644 --- a/lib/std/dynamic_library.zig +++ b/lib/std/dynamic_library.zig @@ -381,7 +381,7 @@ pub const DlDynlib = struct { pub fn lookup(self: *DlDynlib, comptime T: type, name: [:0]const u8) ?T { // dlsym (and other dl-functions) secretly take shadow parameter - return address on stack // https://gcc.gnu.org/bugzilla/show_bug.cgi?id=66826 - if (@call(.{ .modifier = .never_tail }, system.dlsym, .{ self.handle, name.ptr })) |symbol| { + if (@call(.never_tail, system.dlsym, .{ self.handle, name.ptr })) |symbol| { return @ptrCast(T, symbol); } else { return null; diff --git a/lib/std/hash/auto_hash.zig b/lib/std/hash/auto_hash.zig index 76cbab8698..aac4b0feaf 100644 --- a/lib/std/hash/auto_hash.zig +++ b/lib/std/hash/auto_hash.zig @@ -66,7 +66,7 @@ pub fn hash(hasher: anytype, key: anytype, comptime strat: HashStrategy) void { const Key = @TypeOf(key); if (strat == .Shallow and comptime meta.trait.hasUniqueRepresentation(Key)) { - @call(.{ .modifier = .always_inline }, hasher.update, .{mem.asBytes(&key)}); + @call(.always_inline, hasher.update, .{mem.asBytes(&key)}); return; } @@ -89,12 +89,12 @@ pub fn hash(hasher: anytype, key: anytype, comptime strat: HashStrategy) void { // TODO Check if the situation is better after #561 is resolved. .Int => { if (comptime meta.trait.hasUniqueRepresentation(Key)) { - @call(.{ .modifier = .always_inline }, hasher.update, .{std.mem.asBytes(&key)}); + @call(.always_inline, hasher.update, .{std.mem.asBytes(&key)}); } else { // Take only the part containing the key value, the remaining // bytes are undefined and must not be hashed! const byte_size = comptime std.math.divCeil(comptime_int, @bitSizeOf(Key), 8) catch unreachable; - @call(.{ .modifier = .always_inline }, hasher.update, .{std.mem.asBytes(&key)[0..byte_size]}); + @call(.always_inline, hasher.update, .{std.mem.asBytes(&key)[0..byte_size]}); } }, @@ -103,7 +103,7 @@ pub fn hash(hasher: anytype, key: anytype, comptime strat: HashStrategy) void { .ErrorSet => hash(hasher, @errorToInt(key), strat), .AnyFrame, .Fn => hash(hasher, @ptrToInt(key), strat), - .Pointer => @call(.{ .modifier = .always_inline }, hashPointer, .{ hasher, key, strat }), + .Pointer => @call(.always_inline, hashPointer, .{ hasher, key, strat }), .Optional => if (key) |k| hash(hasher, k, strat), diff --git a/lib/std/hash/cityhash.zig b/lib/std/hash/cityhash.zig index 7c8e42f105..23b3ce02da 100644 --- a/lib/std/hash/cityhash.zig +++ b/lib/std/hash/cityhash.zig @@ -185,7 +185,7 @@ pub const CityHash64 = struct { } fn hashLen16(u: u64, v: u64) u64 { - return @call(.{ .modifier = .always_inline }, hash128To64, .{ u, v }); + return @call(.always_inline, hash128To64, .{ u, v }); } fn hashLen16Mul(low: u64, high: u64, mul: u64) u64 { @@ -198,7 +198,7 @@ pub const CityHash64 = struct { } fn hash128To64(low: u64, high: u64) u64 { - return @call(.{ .modifier = .always_inline }, hashLen16Mul, .{ low, high, 0x9ddfea08eb382d69 }); + return @call(.always_inline, hashLen16Mul, .{ low, high, 0x9ddfea08eb382d69 }); } fn hashLen0To16(str: []const u8) u64 { @@ -279,7 +279,7 @@ pub const CityHash64 = struct { } fn weakHashLen32WithSeeds(ptr: [*]const u8, a: u64, b: u64) WeakPair { - return @call(.{ .modifier = .always_inline }, weakHashLen32WithSeedsHelper, .{ + return @call(.always_inline, weakHashLen32WithSeedsHelper, .{ fetch64(ptr, 0), fetch64(ptr, 8), fetch64(ptr, 16), @@ -334,7 +334,7 @@ pub const CityHash64 = struct { } pub fn hashWithSeed(str: []const u8, seed: u64) u64 { - return @call(.{ .modifier = .always_inline }, Self.hashWithSeeds, .{ str, k2, seed }); + return @call(.always_inline, Self.hashWithSeeds, .{ str, k2, seed }); } pub fn hashWithSeeds(str: []const u8, seed0: u64, seed1: u64) u64 { diff --git a/lib/std/hash/murmur.zig b/lib/std/hash/murmur.zig index 44b411bb2c..2e1ae4b801 100644 --- a/lib/std/hash/murmur.zig +++ b/lib/std/hash/murmur.zig @@ -9,7 +9,7 @@ pub const Murmur2_32 = struct { const Self = @This(); pub fn hash(str: []const u8) u32 { - return @call(.{ .modifier = .always_inline }, Self.hashWithSeed, .{ str, default_seed }); + return @call(.always_inline, Self.hashWithSeed, .{ str, default_seed }); } pub fn hashWithSeed(str: []const u8, seed: u32) u32 { @@ -45,7 +45,7 @@ pub const Murmur2_32 = struct { } pub fn hashUint32(v: u32) u32 { - return @call(.{ .modifier = .always_inline }, Self.hashUint32WithSeed, .{ v, default_seed }); + return @call(.always_inline, Self.hashUint32WithSeed, .{ v, default_seed }); } pub fn hashUint32WithSeed(v: u32, seed: u32) u32 { @@ -65,7 +65,7 @@ pub const Murmur2_32 = struct { } pub fn hashUint64(v: u64) u32 { - return @call(.{ .modifier = .always_inline }, Self.hashUint64WithSeed, .{ v, default_seed }); + return @call(.always_inline, Self.hashUint64WithSeed, .{ v, default_seed }); } pub fn hashUint64WithSeed(v: u64, seed: u32) u32 { @@ -94,7 +94,7 @@ pub const Murmur2_64 = struct { const Self = @This(); pub fn hash(str: []const u8) u64 { - return @call(.{ .modifier = .always_inline }, Self.hashWithSeed, .{ str, default_seed }); + return @call(.always_inline, Self.hashWithSeed, .{ str, default_seed }); } pub fn hashWithSeed(str: []const u8, seed: u64) u64 { @@ -128,7 +128,7 @@ pub const Murmur2_64 = struct { } pub fn hashUint32(v: u32) u64 { - return @call(.{ .modifier = .always_inline }, Self.hashUint32WithSeed, .{ v, default_seed }); + return @call(.always_inline, Self.hashUint32WithSeed, .{ v, default_seed }); } pub fn hashUint32WithSeed(v: u32, seed: u64) u64 { @@ -145,7 +145,7 @@ pub const Murmur2_64 = struct { } pub fn hashUint64(v: u64) u64 { - return @call(.{ .modifier = .always_inline }, Self.hashUint64WithSeed, .{ v, default_seed }); + return @call(.always_inline, Self.hashUint64WithSeed, .{ v, default_seed }); } pub fn hashUint64WithSeed(v: u64, seed: u64) u64 { @@ -173,7 +173,7 @@ pub const Murmur3_32 = struct { } pub fn hash(str: []const u8) u32 { - return @call(.{ .modifier = .always_inline }, Self.hashWithSeed, .{ str, default_seed }); + return @call(.always_inline, Self.hashWithSeed, .{ str, default_seed }); } pub fn hashWithSeed(str: []const u8, seed: u32) u32 { @@ -221,7 +221,7 @@ pub const Murmur3_32 = struct { } pub fn hashUint32(v: u32) u32 { - return @call(.{ .modifier = .always_inline }, Self.hashUint32WithSeed, .{ v, default_seed }); + return @call(.always_inline, Self.hashUint32WithSeed, .{ v, default_seed }); } pub fn hashUint32WithSeed(v: u32, seed: u32) u32 { @@ -247,7 +247,7 @@ pub const Murmur3_32 = struct { } pub fn hashUint64(v: u64) u32 { - return @call(.{ .modifier = .always_inline }, Self.hashUint64WithSeed, .{ v, default_seed }); + return @call(.always_inline, Self.hashUint64WithSeed, .{ v, default_seed }); } pub fn hashUint64WithSeed(v: u64, seed: u32) u32 { diff --git a/lib/std/hash/wyhash.zig b/lib/std/hash/wyhash.zig index 05340592a9..9dda198a06 100644 --- a/lib/std/hash/wyhash.zig +++ b/lib/std/hash/wyhash.zig @@ -65,7 +65,7 @@ const WyhashStateless = struct { var off: usize = 0; while (off < b.len) : (off += 32) { - @call(.{ .modifier = .always_inline }, self.round, .{b[off .. off + 32]}); + @call(.always_inline, self.round, .{b[off .. off + 32]}); } self.msg_len += b.len; @@ -121,8 +121,8 @@ const WyhashStateless = struct { const aligned_len = input.len - (input.len % 32); var c = WyhashStateless.init(seed); - @call(.{ .modifier = .always_inline }, c.update, .{input[0..aligned_len]}); - return @call(.{ .modifier = .always_inline }, c.final, .{input[aligned_len..]}); + @call(.always_inline, c.update, .{input[0..aligned_len]}); + return @call(.always_inline, c.final, .{input[aligned_len..]}); } }; diff --git a/lib/std/math/big/int.zig b/lib/std/math/big/int.zig index 534e8a570d..25b2ebc0a8 100644 --- a/lib/std/math/big/int.zig +++ b/lib/std/math/big/int.zig @@ -3587,7 +3587,7 @@ fn llshl(r: []Limb, a: []const Limb, shift: usize) void { const dst_i = src_i + limb_shift; const src_digit = a[src_i]; - r[dst_i] = carry | @call(.{ .modifier = .always_inline }, math.shr, .{ + r[dst_i] = carry | @call(.always_inline, math.shr, .{ Limb, src_digit, limb_bits - @intCast(Limb, interior_limb_shift), @@ -3615,7 +3615,7 @@ fn llshr(r: []Limb, a: []const Limb, shift: usize) void { const src_digit = a[src_i]; r[dst_i] = carry | (src_digit >> interior_limb_shift); - carry = @call(.{ .modifier = .always_inline }, math.shl, .{ + carry = @call(.always_inline, math.shl, .{ Limb, src_digit, limb_bits - @intCast(Limb, interior_limb_shift), diff --git a/lib/std/os/linux.zig b/lib/std/os/linux.zig index a001af709c..7f227ffec4 100644 --- a/lib/std/os/linux.zig +++ b/lib/std/os/linux.zig @@ -263,7 +263,7 @@ pub fn fork() usize { /// the compiler is not aware of how vfork affects control flow and you may /// see different results in optimized builds. pub inline fn vfork() usize { - return @call(.{ .modifier = .always_inline }, syscall0, .{.vfork}); + return @call(.always_inline, syscall0, .{.vfork}); } pub fn futimens(fd: i32, times: *const [2]timespec) usize { diff --git a/lib/std/start.zig b/lib/std/start.zig index 8a0febf1a1..b8c74a6373 100644 --- a/lib/std/start.zig +++ b/lib/std/start.zig @@ -229,15 +229,15 @@ fn _DllMainCRTStartup( fn wasm_freestanding_start() callconv(.C) void { // This is marked inline because for some reason LLVM in // release mode fails to inline it, and we want fewer call frames in stack traces. - _ = @call(.{ .modifier = .always_inline }, callMain, .{}); + _ = @call(.always_inline, callMain, .{}); } fn wasi_start() callconv(.C) void { // The function call is marked inline because for some reason LLVM in // release mode fails to inline it, and we want fewer call frames in stack traces. switch (builtin.wasi_exec_model) { - .reactor => _ = @call(.{ .modifier = .always_inline }, callMain, .{}), - .command => std.os.wasi.proc_exit(@call(.{ .modifier = .always_inline }, callMain, .{})), + .reactor => _ = @call(.always_inline, callMain, .{}), + .command => std.os.wasi.proc_exit(@call(.always_inline, callMain, .{})), } } @@ -373,7 +373,7 @@ fn _start() callconv(.Naked) noreturn { } // If LLVM inlines stack variables into _start, they will overwrite // the command line argument data. - @call(.{ .modifier = .never_inline }, posixCallMainAndExit, .{}); + @call(.never_inline, posixCallMainAndExit, .{}); } fn WinStartup() callconv(std.os.windows.WINAPI) noreturn { @@ -459,7 +459,7 @@ fn posixCallMainAndExit() callconv(.C) noreturn { expandStackSize(phdrs); } - std.os.exit(@call(.{ .modifier = .always_inline }, callMainWithArgs, .{ argc, argv, envp })); + std.os.exit(@call(.always_inline, callMainWithArgs, .{ argc, argv, envp })); } fn expandStackSize(phdrs: []elf.Phdr) void { @@ -510,12 +510,12 @@ fn main(c_argc: c_int, c_argv: [*c][*c]u8, c_envp: [*c][*c]u8) callconv(.C) c_in expandStackSize(phdrs); } - return @call(.{ .modifier = .always_inline }, callMainWithArgs, .{ @intCast(usize, c_argc), @ptrCast([*][*:0]u8, c_argv), envp }); + return @call(.always_inline, callMainWithArgs, .{ @intCast(usize, c_argc), @ptrCast([*][*:0]u8, c_argv), envp }); } fn mainWithoutEnv(c_argc: c_int, c_argv: [*c][*c]u8) callconv(.C) c_int { std.os.argv = @ptrCast([*][*:0]u8, c_argv)[0..@intCast(usize, c_argc)]; - return @call(.{ .modifier = .always_inline }, callMain, .{}); + return @call(.always_inline, callMain, .{}); } // General error message for a malformed return type @@ -545,7 +545,7 @@ inline fn initEventLoopAndCallMain() u8 { // This is marked inline because for some reason LLVM in release mode fails to inline it, // and we want fewer call frames in stack traces. - return @call(.{ .modifier = .always_inline }, callMain, .{}); + return @call(.always_inline, callMain, .{}); } // This is marked inline because for some reason LLVM in release mode fails to inline it, @@ -574,7 +574,7 @@ inline fn initEventLoopAndCallWinMain() std.os.windows.INT { // This is marked inline because for some reason LLVM in release mode fails to inline it, // and we want fewer call frames in stack traces. - return @call(.{ .modifier = .always_inline }, call_wWinMain, .{}); + return @call(.always_inline, call_wWinMain, .{}); } fn callMainAsync(loop: *std.event.Loop) callconv(.Async) u8 { diff --git a/lib/std/testing.zig b/lib/std/testing.zig index 3bb3d6e14b..91d7bc48f4 100644 --- a/lib/std/testing.zig +++ b/lib/std/testing.zig @@ -828,7 +828,7 @@ pub fn checkAllAllocationFailures(backing_allocator: std.mem.Allocator, comptime var failing_allocator_inst = std.testing.FailingAllocator.init(backing_allocator, std.math.maxInt(usize)); args.@"0" = failing_allocator_inst.allocator(); - try @call(.{}, test_fn, args); + try @call(.auto, test_fn, args); break :x failing_allocator_inst.index; }; @@ -837,7 +837,7 @@ pub fn checkAllAllocationFailures(backing_allocator: std.mem.Allocator, comptime var failing_allocator_inst = std.testing.FailingAllocator.init(backing_allocator, fail_index); args.@"0" = failing_allocator_inst.allocator(); - if (@call(.{}, test_fn, args)) |_| { + if (@call(.auto, test_fn, args)) |_| { if (failing_allocator_inst.has_induced_failure) { return error.SwallowedOutOfMemoryError; } else { diff --git a/lib/std/unicode/throughput_test.zig b/lib/std/unicode/throughput_test.zig index 5c2dfda768..66014ad48d 100644 --- a/lib/std/unicode/throughput_test.zig +++ b/lib/std/unicode/throughput_test.zig @@ -25,7 +25,7 @@ fn benchmarkCodepointCount(buf: []const u8) !ResultCount { var r: usize = undefined; while (i < N) : (i += 1) { r = try @call( - .{ .modifier = .never_inline }, + .never_inline, std.unicode.utf8CountCodepoints, .{buf}, ); diff --git a/src/ThreadPool.zig b/src/ThreadPool.zig index 980bacf94f..fde5ed27db 100644 --- a/src/ThreadPool.zig +++ b/src/ThreadPool.zig @@ -71,7 +71,7 @@ fn join(pool: *ThreadPool, spawned: usize) void { pub fn spawn(pool: *ThreadPool, comptime func: anytype, args: anytype) !void { if (builtin.single_threaded) { - @call(.{}, func, args); + @call(.auto, func, args); return; } @@ -84,7 +84,7 @@ pub fn spawn(pool: *ThreadPool, comptime func: anytype, args: anytype) !void { fn runFn(runnable: *Runnable) void { const run_node = @fieldParentPtr(RunQueue.Node, "data", runnable); const closure = @fieldParentPtr(@This(), "run_node", run_node); - @call(.{}, func, closure.arguments); + @call(.auto, func, closure.arguments); // The thread pool's allocator is protected by the mutex. const mutex = &closure.pool.mutex; diff --git a/src/crash_report.zig b/src/crash_report.zig index cdb475ec6c..ba08db8266 100644 --- a/src/crash_report.zig +++ b/src/crash_report.zig @@ -549,8 +549,8 @@ const PanicSwitch = struct { // TODO: Tailcall is broken right now, but eventually this should be used // to avoid blowing up the stack. It's ok for now though, there are no // cycles in the state machine so the max stack usage is bounded. - //@call(.{.modifier = .always_tail}, func, args); - @call(.{}, func, args); + //@call(.always_tail, func, args); + @call(.auto, func, args); } fn recover( diff --git a/test/behavior/basic.zig b/test/behavior/basic.zig index e5e28cddb3..43574db06f 100644 --- a/test/behavior/basic.zig +++ b/test/behavior/basic.zig @@ -966,8 +966,8 @@ test "generic function uses return type of other generic function" { fn call( f: anytype, args: anytype, - ) @TypeOf(@call(.{}, f, @as(@TypeOf(args), undefined))) { - return @call(.{}, f, args); + ) @TypeOf(@call(.auto, f, @as(@TypeOf(args), undefined))) { + return @call(.auto, f, args); } fn func(arg: anytype) @TypeOf(arg) { diff --git a/test/behavior/call.zig b/test/behavior/call.zig index efda7fbacb..4d8f22d15f 100644 --- a/test/behavior/call.zig +++ b/test/behavior/call.zig @@ -9,11 +9,11 @@ test "super basic invocations" { return 1234; } }.foo; - try expect(@call(.{}, foo, .{}) == 1234); - comptime try expect(@call(.{ .modifier = .always_inline }, foo, .{}) == 1234); + try expect(@call(.auto, foo, .{}) == 1234); + comptime try expect(@call(.always_inline, foo, .{}) == 1234); { // comptime call without comptime keyword - const result = @call(.{ .modifier = .compile_time }, foo, .{}) == 1234; + const result = @call(.compile_time, foo, .{}) == 1234; comptime try expect(result); } } @@ -31,25 +31,25 @@ test "basic invocations" { return 1234; } }.foo; - try expect(@call(.{}, foo, .{}) == 1234); + try expect(@call(.auto, foo, .{}) == 1234); comptime { // modifiers that allow comptime calls - try expect(@call(.{}, foo, .{}) == 1234); - try expect(@call(.{ .modifier = .no_async }, foo, .{}) == 1234); - try expect(@call(.{ .modifier = .always_tail }, foo, .{}) == 1234); - try expect(@call(.{ .modifier = .always_inline }, foo, .{}) == 1234); + try expect(@call(.auto, foo, .{}) == 1234); + try expect(@call(.no_async, foo, .{}) == 1234); + try expect(@call(.always_tail, foo, .{}) == 1234); + try expect(@call(.always_inline, foo, .{}) == 1234); } { // comptime call without comptime keyword - const result = @call(.{ .modifier = .compile_time }, foo, .{}) == 1234; + const result = @call(.compile_time, foo, .{}) == 1234; comptime try expect(result); } { // call of non comptime-known function 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); + try expect(@call(.no_async, alias_foo, .{}) == 1234); + try expect(@call(.never_tail, alias_foo, .{}) == 1234); + try expect(@call(.never_inline, alias_foo, .{}) == 1234); } } @@ -66,23 +66,23 @@ test "tuple parameters" { }.add; var a: i32 = 12; var b: i32 = 34; - try expect(@call(.{}, add, .{ a, 34 }) == 46); - try expect(@call(.{}, add, .{ 12, b }) == 46); - try expect(@call(.{}, add, .{ a, b }) == 46); - try expect(@call(.{}, add, .{ 12, 34 }) == 46); + try expect(@call(.auto, add, .{ a, 34 }) == 46); + try expect(@call(.auto, add, .{ 12, b }) == 46); + try expect(@call(.auto, add, .{ a, b }) == 46); + try expect(@call(.auto, add, .{ 12, 34 }) == 46); if (false) { - comptime try expect(@call(.{}, add, .{ 12, 34 }) == 46); // TODO + comptime try expect(@call(.auto, add, .{ 12, 34 }) == 46); // TODO } - try expect(comptime @call(.{}, add, .{ 12, 34 }) == 46); + try expect(comptime @call(.auto, add, .{ 12, 34 }) == 46); { const separate_args0 = .{ a, b }; const separate_args1 = .{ a, 34 }; const separate_args2 = .{ 12, 34 }; const separate_args3 = .{ 12, b }; - try expect(@call(.{ .modifier = .always_inline }, add, separate_args0) == 46); - try expect(@call(.{ .modifier = .always_inline }, add, separate_args1) == 46); - try expect(@call(.{ .modifier = .always_inline }, add, separate_args2) == 46); - try expect(@call(.{ .modifier = .always_inline }, add, separate_args3) == 46); + try expect(@call(.always_inline, add, separate_args0) == 46); + try expect(@call(.always_inline, add, separate_args1) == 46); + try expect(@call(.always_inline, add, separate_args2) == 46); + try expect(@call(.always_inline, add, separate_args3) == 46); } } @@ -281,7 +281,7 @@ test "forced tail call" { if (n == 0) return a; if (n == 1) return b; return @call( - .{ .modifier = .always_tail }, + .always_tail, fibonacciTailInternal, .{ n - 1, b, a + b }, ); @@ -322,7 +322,7 @@ test "inline call preserves tail call" { var buf: [max]u16 = undefined; buf[a] = a; a += 1; - return @call(.{ .modifier = .always_tail }, foo, .{}); + return @call(.always_tail, foo, .{}); } }; S.foo(); @@ -341,6 +341,6 @@ test "inline call doesn't re-evaluate non generic struct" { } }; const ArgTuple = std.meta.ArgsTuple(@TypeOf(S.foo)); - try @call(.{ .modifier = .always_inline }, S.foo, ArgTuple{.{ .a = 123, .b = 45 }}); - comptime try @call(.{ .modifier = .always_inline }, S.foo, ArgTuple{.{ .a = 123, .b = 45 }}); + try @call(.always_inline, S.foo, ArgTuple{.{ .a = 123, .b = 45 }}); + comptime try @call(.always_inline, S.foo, ArgTuple{.{ .a = 123, .b = 45 }}); } diff --git a/test/cases/compile_errors/bad_usage_of_call.zig b/test/cases/compile_errors/bad_usage_of_call.zig index 9e8fb7d188..c0b632bef6 100644 --- a/test/cases/compile_errors/bad_usage_of_call.zig +++ b/test/cases/compile_errors/bad_usage_of_call.zig @@ -1,22 +1,22 @@ export fn entry1() void { - @call(.{}, foo, {}); + @call(.auto, foo, {}); } export fn entry2() void { - comptime @call(.{ .modifier = .never_inline }, foo, .{}); + comptime @call(.never_inline, foo, .{}); } export fn entry3() void { - comptime @call(.{ .modifier = .never_tail }, foo, .{}); + comptime @call(.never_tail, foo, .{}); } export fn entry4() void { - @call(.{ .modifier = .never_inline }, bar, .{}); + @call(.never_inline, bar, .{}); } export fn entry5(c: bool) void { var baz = if (c) &baz1 else &baz2; - @call(.{ .modifier = .compile_time }, baz, .{}); + @call(.compile_time, baz, .{}); } pub export fn entry() void { var call_me: *const fn () void = undefined; - @call(.{ .modifier = .always_inline }, call_me, .{}); + @call(.always_inline, call_me, .{}); } fn foo() void {} fn bar() callconv(.Inline) void {} @@ -27,9 +27,10 @@ fn baz2() void {} // backend=stage2 // target=native // -// :2:21: error: expected a tuple, found 'void' -// :5:33: error: unable to perform 'never_inline' call at compile-time -// :8:33: error: unable to perform 'never_tail' call at compile-time +// :2:23: error: expected a tuple, found 'void' +// :5:21: error: unable to perform 'never_inline' call at compile-time +// :8:21: error: unable to perform 'never_tail' call at compile-time // :11:5: error: no-inline call of inline function -// :15:43: error: modifier 'compile_time' requires a comptime-known function -// :19:44: error: modifier 'always_inline' requires a comptime-known function +// :15:26: error: modifier 'compile_time' requires a comptime-known function +// :19:27: error: modifier 'always_inline' requires a comptime-known function + diff --git a/test/cases/compile_errors/error_in_call_builtin_args.zig b/test/cases/compile_errors/error_in_call_builtin_args.zig index ca46f7fe77..304fd031f1 100644 --- a/test/cases/compile_errors/error_in_call_builtin_args.zig +++ b/test/cases/compile_errors/error_in_call_builtin_args.zig @@ -1,15 +1,15 @@ fn foo(_: u32, _: u32) void {} pub export fn entry() void { - @call(.{}, foo, .{ 12, 12.34 }); + @call(.auto, foo, .{ 12, 12.34 }); } pub export fn entry1() void { const args = .{ 12, 12.34 }; - @call(.{}, foo, args); + @call(.auto, foo, args); } // error // backend=stage2 // target=native // -// :3:28: error: fractional component prevents float value '12.34' from coercion to type 'u32' -// :7:21: error: fractional component prevents float value '12.34' from coercion to type 'u32' +// :3:30: error: fractional component prevents float value '12.34' from coercion to type 'u32' +// :7:23: error: fractional component prevents float value '12.34' from coercion to type 'u32' diff --git a/test/cases/compile_errors/invalid_tail_call.zig b/test/cases/compile_errors/invalid_tail_call.zig index cdeb9df930..e3ce28709a 100644 --- a/test/cases/compile_errors/invalid_tail_call.zig +++ b/test/cases/compile_errors/invalid_tail_call.zig @@ -2,7 +2,7 @@ fn myFn(_: usize) void { return; } pub export fn entry() void { - @call(.{ .modifier = .always_tail }, myFn, .{0}); + @call(.always_tail, myFn, .{0}); } // error diff --git a/test/cases/taill_call_noreturn.zig b/test/cases/taill_call_noreturn.zig index fabb9e729b..5cd716dd30 100644 --- a/test/cases/taill_call_noreturn.zig +++ b/test/cases/taill_call_noreturn.zig @@ -1,7 +1,7 @@ const std = @import("std"); const builtin = std.builtin; pub fn foo(message: []const u8, stack_trace: ?*builtin.StackTrace) noreturn { - @call(.{ .modifier = .always_tail }, bar, .{ message, stack_trace }); + @call(.always_tail, bar, .{ message, stack_trace }); } pub fn bar(message: []const u8, stack_trace: ?*builtin.StackTrace) noreturn { _ = message;