From 1480c428065c01c6feff22ce84021c2e0e30aa9b Mon Sep 17 00:00:00 2001 From: Jonathan Marler Date: Sun, 3 Jan 2021 02:20:37 -0700 Subject: require specifier for arrayish types --- test/cli.zig | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) (limited to 'test/cli.zig') diff --git a/test/cli.zig b/test/cli.zig index 33dbc2d62b..8dbef06887 100644 --- a/test/cli.zig +++ b/test/cli.zig @@ -51,9 +51,9 @@ fn unwrapArg(arg: UnwrapArgError![]u8) UnwrapArgError![]u8 { } fn printCmd(cwd: []const u8, argv: []const []const u8) void { - std.debug.warn("cd {} && ", .{cwd}); + std.debug.warn("cd {s} && ", .{cwd}); for (argv) |arg| { - std.debug.warn("{} ", .{arg}); + std.debug.warn("{s} ", .{arg}); } std.debug.warn("\n", .{}); } @@ -75,14 +75,14 @@ fn exec(cwd: []const u8, expect_0: bool, argv: []const []const u8) !ChildProcess if ((code != 0) == expect_0) { std.debug.warn("The following command exited with error code {}:\n", .{code}); printCmd(cwd, argv); - std.debug.warn("stderr:\n{}\n", .{result.stderr}); + std.debug.warn("stderr:\n{s}\n", .{result.stderr}); return error.CommandFailed; } }, else => { std.debug.warn("The following command terminated unexpectedly:\n", .{}); printCmd(cwd, argv); - std.debug.warn("stderr:\n{}\n", .{result.stderr}); + std.debug.warn("stderr:\n{s}\n", .{result.stderr}); return error.CommandFailed; }, } -- cgit v1.2.3 From 5dfe0e7e8fabd3cfc3fdf5c7099791da98899903 Mon Sep 17 00:00:00 2001 From: Tadeo Kondrak Date: Mon, 11 Jan 2021 08:03:09 -0700 Subject: Convert inline fn to callconv(.Inline) everywhere --- doc/langref.html.in | 4 +- lib/std/c/builtins.zig | 98 +++++++++++++++++------------------ lib/std/compress/deflate.zig | 2 +- lib/std/crypto/25519/curve25519.zig | 4 +- lib/std/crypto/25519/edwards25519.zig | 6 +-- lib/std/crypto/25519/field.zig | 28 +++++----- lib/std/crypto/25519/ristretto255.zig | 8 +-- lib/std/crypto/25519/scalar.zig | 2 +- lib/std/crypto/aegis.zig | 4 +- lib/std/crypto/aes/aesni.zig | 32 ++++++------ lib/std/crypto/aes/armcrypto.zig | 32 ++++++------ lib/std/crypto/aes/soft.zig | 20 +++---- lib/std/crypto/blake3.zig | 6 +-- lib/std/crypto/chacha20.zig | 12 ++--- lib/std/crypto/ghash.zig | 4 +- lib/std/crypto/gimli.zig | 4 +- lib/std/crypto/salsa20.zig | 6 +-- lib/std/elf.zig | 16 +++--- lib/std/fmt/parse_float.zig | 8 +-- lib/std/hash/cityhash.zig | 2 +- lib/std/os/bits/freebsd.zig | 8 +-- lib/std/os/bits/netbsd.zig | 8 +-- lib/std/os/linux.zig | 2 +- lib/std/os/linux/tls.zig | 2 +- lib/std/os/windows.zig | 2 +- lib/std/start.zig | 4 +- lib/std/zig/parser_test.zig | 6 +-- lib/std/zig/system/x86.zig | 4 +- src/link/MachO.zig | 2 +- src/tracy.zig | 2 +- test/cli.zig | 2 +- test/compile_errors.zig | 12 ++--- test/stage1/behavior/fn.zig | 2 +- test/stage2/cbe.zig | 2 +- test/stage2/test.zig | 10 ++-- test/translate_c.zig | 32 ++++++------ 36 files changed, 199 insertions(+), 199 deletions(-) (limited to 'test/cli.zig') diff --git a/doc/langref.html.in b/doc/langref.html.in index 7759e26f3b..f43abfe1e6 100644 --- a/doc/langref.html.in +++ b/doc/langref.html.in @@ -4240,9 +4240,9 @@ fn _start() callconv(.Naked) noreturn { abort(); } -// The inline specifier forces a function to be inlined at all call sites. +// The inline calling convention forces a function to be inlined at all call sites. // If the function cannot be inlined, it is a compile-time error. -inline fn shiftLeftOne(a: u32) u32 { +fn shiftLeftOne(a: u32) callconv(.Inline) u32 { return a << 1; } diff --git a/lib/std/c/builtins.zig b/lib/std/c/builtins.zig index 43f5ed0588..2b386c82f4 100644 --- a/lib/std/c/builtins.zig +++ b/lib/std/c/builtins.zig @@ -6,70 +6,70 @@ const std = @import("std"); -pub inline fn __builtin_bswap16(val: u16) callconv(.C) u16 { return @byteSwap(u16, val); } -pub inline fn __builtin_bswap32(val: u32) callconv(.C) u32 { return @byteSwap(u32, val); } -pub inline fn __builtin_bswap64(val: u64) callconv(.C) u64 { return @byteSwap(u64, val); } +pub fn __builtin_bswap16(val: u16) callconv(.Inline) u16 { return @byteSwap(u16, val); } +pub fn __builtin_bswap32(val: u32) callconv(.Inline) u32 { return @byteSwap(u32, val); } +pub fn __builtin_bswap64(val: u64) callconv(.Inline) u64 { return @byteSwap(u64, val); } -pub inline fn __builtin_signbit(val: f64) callconv(.C) c_int { return @boolToInt(std.math.signbit(val)); } -pub inline fn __builtin_signbitf(val: f32) callconv(.C) c_int { return @boolToInt(std.math.signbit(val)); } +pub fn __builtin_signbit(val: f64) callconv(.Inline) c_int { return @boolToInt(std.math.signbit(val)); } +pub fn __builtin_signbitf(val: f32) callconv(.Inline) c_int { return @boolToInt(std.math.signbit(val)); } -pub inline fn __builtin_popcount(val: c_uint) callconv(.C) c_int { +pub fn __builtin_popcount(val: c_uint) callconv(.Inline) c_int { // popcount of a c_uint will never exceed the capacity of a c_int @setRuntimeSafety(false); return @bitCast(c_int, @as(c_uint, @popCount(c_uint, val))); } -pub inline fn __builtin_ctz(val: c_uint) callconv(.C) c_int { +pub fn __builtin_ctz(val: c_uint) callconv(.Inline) c_int { // Returns the number of trailing 0-bits in val, starting at the least significant bit position. // In C if `val` is 0, the result is undefined; in zig it's the number of bits in a c_uint @setRuntimeSafety(false); return @bitCast(c_int, @as(c_uint, @ctz(c_uint, val))); } -pub inline fn __builtin_clz(val: c_uint) callconv(.C) c_int { +pub fn __builtin_clz(val: c_uint) callconv(.Inline) c_int { // Returns the number of leading 0-bits in x, starting at the most significant bit position. // In C if `val` is 0, the result is undefined; in zig it's the number of bits in a c_uint @setRuntimeSafety(false); return @bitCast(c_int, @as(c_uint, @clz(c_uint, val))); } -pub inline fn __builtin_sqrt(val: f64) callconv(.C) f64 { return @sqrt(val); } -pub inline fn __builtin_sqrtf(val: f32) callconv(.C) f32 { return @sqrt(val); } - -pub inline fn __builtin_sin(val: f64) callconv(.C) f64 { return @sin(val); } -pub inline fn __builtin_sinf(val: f32) callconv(.C) f32 { return @sin(val); } -pub inline fn __builtin_cos(val: f64) callconv(.C) f64 { return @cos(val); } -pub inline fn __builtin_cosf(val: f32) callconv(.C) f32 { return @cos(val); } - -pub inline fn __builtin_exp(val: f64) callconv(.C) f64 { return @exp(val); } -pub inline fn __builtin_expf(val: f32) callconv(.C) f32 { return @exp(val); } -pub inline fn __builtin_exp2(val: f64) callconv(.C) f64 { return @exp2(val); } -pub inline fn __builtin_exp2f(val: f32) callconv(.C) f32 { return @exp2(val); } -pub inline fn __builtin_log(val: f64) callconv(.C) f64 { return @log(val); } -pub inline fn __builtin_logf(val: f32) callconv(.C) f32 { return @log(val); } -pub inline fn __builtin_log2(val: f64) callconv(.C) f64 { return @log2(val); } -pub inline fn __builtin_log2f(val: f32) callconv(.C) f32 { return @log2(val); } -pub inline fn __builtin_log10(val: f64) callconv(.C) f64 { return @log10(val); } -pub inline fn __builtin_log10f(val: f32) callconv(.C) f32 { return @log10(val); } +pub fn __builtin_sqrt(val: f64) callconv(.Inline) f64 { return @sqrt(val); } +pub fn __builtin_sqrtf(val: f32) callconv(.Inline) f32 { return @sqrt(val); } + +pub fn __builtin_sin(val: f64) callconv(.Inline) f64 { return @sin(val); } +pub fn __builtin_sinf(val: f32) callconv(.Inline) f32 { return @sin(val); } +pub fn __builtin_cos(val: f64) callconv(.Inline) f64 { return @cos(val); } +pub fn __builtin_cosf(val: f32) callconv(.Inline) f32 { return @cos(val); } + +pub fn __builtin_exp(val: f64) callconv(.Inline) f64 { return @exp(val); } +pub fn __builtin_expf(val: f32) callconv(.Inline) f32 { return @exp(val); } +pub fn __builtin_exp2(val: f64) callconv(.Inline) f64 { return @exp2(val); } +pub fn __builtin_exp2f(val: f32) callconv(.Inline) f32 { return @exp2(val); } +pub fn __builtin_log(val: f64) callconv(.Inline) f64 { return @log(val); } +pub fn __builtin_logf(val: f32) callconv(.Inline) f32 { return @log(val); } +pub fn __builtin_log2(val: f64) callconv(.Inline) f64 { return @log2(val); } +pub fn __builtin_log2f(val: f32) callconv(.Inline) f32 { return @log2(val); } +pub fn __builtin_log10(val: f64) callconv(.Inline) f64 { return @log10(val); } +pub fn __builtin_log10f(val: f32) callconv(.Inline) f32 { return @log10(val); } // Standard C Library bug: The absolute value of the most negative integer remains negative. -pub inline fn __builtin_abs(val: c_int) callconv(.C) c_int { return std.math.absInt(val) catch std.math.minInt(c_int); } -pub inline fn __builtin_fabs(val: f64) callconv(.C) f64 { return @fabs(val); } -pub inline fn __builtin_fabsf(val: f32) callconv(.C) f32 { return @fabs(val); } - -pub inline fn __builtin_floor(val: f64) callconv(.C) f64 { return @floor(val); } -pub inline fn __builtin_floorf(val: f32) callconv(.C) f32 { return @floor(val); } -pub inline fn __builtin_ceil(val: f64) callconv(.C) f64 { return @ceil(val); } -pub inline fn __builtin_ceilf(val: f32) callconv(.C) f32 { return @ceil(val); } -pub inline fn __builtin_trunc(val: f64) callconv(.C) f64 { return @trunc(val); } -pub inline fn __builtin_truncf(val: f32) callconv(.C) f32 { return @trunc(val); } -pub inline fn __builtin_round(val: f64) callconv(.C) f64 { return @round(val); } -pub inline fn __builtin_roundf(val: f32) callconv(.C) f32 { return @round(val); } - -pub inline fn __builtin_strlen(s: [*c]const u8) callconv(.C) usize { return std.mem.lenZ(s); } -pub inline fn __builtin_strcmp(s1: [*c]const u8, s2: [*c]const u8) callconv(.C) c_int { +pub fn __builtin_abs(val: c_int) callconv(.Inline) c_int { return std.math.absInt(val) catch std.math.minInt(c_int); } +pub fn __builtin_fabs(val: f64) callconv(.Inline) f64 { return @fabs(val); } +pub fn __builtin_fabsf(val: f32) callconv(.Inline) f32 { return @fabs(val); } + +pub fn __builtin_floor(val: f64) callconv(.Inline) f64 { return @floor(val); } +pub fn __builtin_floorf(val: f32) callconv(.Inline) f32 { return @floor(val); } +pub fn __builtin_ceil(val: f64) callconv(.Inline) f64 { return @ceil(val); } +pub fn __builtin_ceilf(val: f32) callconv(.Inline) f32 { return @ceil(val); } +pub fn __builtin_trunc(val: f64) callconv(.Inline) f64 { return @trunc(val); } +pub fn __builtin_truncf(val: f32) callconv(.Inline) f32 { return @trunc(val); } +pub fn __builtin_round(val: f64) callconv(.Inline) f64 { return @round(val); } +pub fn __builtin_roundf(val: f32) callconv(.Inline) f32 { return @round(val); } + +pub fn __builtin_strlen(s: [*c]const u8) callconv(.Inline) usize { return std.mem.lenZ(s); } +pub fn __builtin_strcmp(s1: [*c]const u8, s2: [*c]const u8) callconv(.Inline) c_int { return @as(c_int, std.cstr.cmp(s1, s2)); } -pub inline fn __builtin_object_size(ptr: ?*const c_void, ty: c_int) callconv(.C) usize { +pub fn __builtin_object_size(ptr: ?*const c_void, ty: c_int) callconv(.Inline) usize { // clang semantics match gcc's: https://gcc.gnu.org/onlinedocs/gcc/Object-Size-Checking.html // If it is not possible to determine which objects ptr points to at compile time, // __builtin_object_size should return (size_t) -1 for type 0 or 1 and (size_t) 0 @@ -79,37 +79,37 @@ pub inline fn __builtin_object_size(ptr: ?*const c_void, ty: c_int) callconv(.C) unreachable; } -pub inline fn __builtin___memset_chk( +pub fn __builtin___memset_chk( dst: ?*c_void, val: c_int, len: usize, remaining: usize, -) callconv(.C) ?*c_void { +) callconv(.Inline) ?*c_void { if (len > remaining) @panic("std.c.builtins.memset_chk called with len > remaining"); return __builtin_memset(dst, val, len); } -pub inline fn __builtin_memset(dst: ?*c_void, val: c_int, len: usize) callconv(.C) ?*c_void { +pub fn __builtin_memset(dst: ?*c_void, val: c_int, len: usize) callconv(.Inline) ?*c_void { const dst_cast = @ptrCast([*c]u8, dst); @memset(dst_cast, @bitCast(u8, @truncate(i8, val)), len); return dst; } -pub inline fn __builtin___memcpy_chk( +pub fn __builtin___memcpy_chk( noalias dst: ?*c_void, noalias src: ?*const c_void, len: usize, remaining: usize, -) callconv(.C) ?*c_void { +) callconv(.Inline) ?*c_void { if (len > remaining) @panic("std.c.builtins.memcpy_chk called with len > remaining"); return __builtin_memcpy(dst, src, len); } -pub inline fn __builtin_memcpy( +pub fn __builtin_memcpy( noalias dst: ?*c_void, noalias src: ?*const c_void, len: usize, -) callconv(.C) ?*c_void { +) callconv(.Inline) ?*c_void { const dst_cast = @ptrCast([*c]u8, dst); const src_cast = @ptrCast([*c]const u8, src); diff --git a/lib/std/compress/deflate.zig b/lib/std/compress/deflate.zig index 3f920c08b6..e680dc9e6f 100644 --- a/lib/std/compress/deflate.zig +++ b/lib/std/compress/deflate.zig @@ -209,7 +209,7 @@ pub fn InflateStream(comptime ReaderType: type) type { // Insert a single byte into the window. // Assumes there's enough space. - inline fn appendUnsafe(self: *WSelf, value: u8) void { + fn appendUnsafe(self: *WSelf, value: u8) callconv(.Inline) void { self.buf[self.wi] = value; self.wi = (self.wi + 1) & (self.buf.len - 1); self.el += 1; diff --git a/lib/std/crypto/25519/curve25519.zig b/lib/std/crypto/25519/curve25519.zig index 14ad0444f5..765ffa1629 100644 --- a/lib/std/crypto/25519/curve25519.zig +++ b/lib/std/crypto/25519/curve25519.zig @@ -15,12 +15,12 @@ pub const Curve25519 = struct { x: Fe, /// Decode a Curve25519 point from its compressed (X) coordinates. - pub inline fn fromBytes(s: [32]u8) Curve25519 { + pub fn fromBytes(s: [32]u8) callconv(.Inline) Curve25519 { return .{ .x = Fe.fromBytes(s) }; } /// Encode a Curve25519 point. - pub inline fn toBytes(p: Curve25519) [32]u8 { + pub fn toBytes(p: Curve25519) callconv(.Inline) [32]u8 { return p.x.toBytes(); } diff --git a/lib/std/crypto/25519/edwards25519.zig b/lib/std/crypto/25519/edwards25519.zig index 8c0a783083..d4238f87bb 100644 --- a/lib/std/crypto/25519/edwards25519.zig +++ b/lib/std/crypto/25519/edwards25519.zig @@ -92,7 +92,7 @@ pub const Edwards25519 = struct { } /// Flip the sign of the X coordinate. - pub inline fn neg(p: Edwards25519) Edwards25519 { + pub fn neg(p: Edwards25519) callconv(.Inline) Edwards25519 { return .{ .x = p.x.neg(), .y = p.y, .z = p.z, .t = p.t.neg() }; } @@ -137,14 +137,14 @@ pub const Edwards25519 = struct { return p.add(q.neg()); } - inline fn cMov(p: *Edwards25519, a: Edwards25519, c: u64) void { + fn cMov(p: *Edwards25519, a: Edwards25519, c: u64) callconv(.Inline) void { p.x.cMov(a.x, c); p.y.cMov(a.y, c); p.z.cMov(a.z, c); p.t.cMov(a.t, c); } - inline fn pcSelect(comptime n: usize, pc: [n]Edwards25519, b: u8) Edwards25519 { + fn pcSelect(comptime n: usize, pc: [n]Edwards25519, b: u8) callconv(.Inline) Edwards25519 { var t = Edwards25519.identityElement; comptime var i: u8 = 1; inline while (i < pc.len) : (i += 1) { diff --git a/lib/std/crypto/25519/field.zig b/lib/std/crypto/25519/field.zig index 12c7f06d39..320cb1bb51 100644 --- a/lib/std/crypto/25519/field.zig +++ b/lib/std/crypto/25519/field.zig @@ -52,7 +52,7 @@ pub const Fe = struct { pub const edwards25519sqrtam2 = Fe{ .limbs = .{ 1693982333959686, 608509411481997, 2235573344831311, 947681270984193, 266558006233600 } }; /// Return true if the field element is zero - pub inline fn isZero(fe: Fe) bool { + pub fn isZero(fe: Fe) callconv(.Inline) bool { var reduced = fe; reduced.reduce(); const limbs = reduced.limbs; @@ -60,7 +60,7 @@ pub const Fe = struct { } /// Return true if both field elements are equivalent - pub inline fn equivalent(a: Fe, b: Fe) bool { + pub fn equivalent(a: Fe, b: Fe) callconv(.Inline) bool { return a.sub(b).isZero(); } @@ -164,7 +164,7 @@ pub const Fe = struct { } /// Add a field element - pub inline fn add(a: Fe, b: Fe) Fe { + pub fn add(a: Fe, b: Fe) callconv(.Inline) Fe { var fe: Fe = undefined; comptime var i = 0; inline while (i < 5) : (i += 1) { @@ -174,7 +174,7 @@ pub const Fe = struct { } /// Substract a field elememnt - pub inline fn sub(a: Fe, b: Fe) Fe { + pub fn sub(a: Fe, b: Fe) callconv(.Inline) Fe { var fe = b; comptime var i = 0; inline while (i < 4) : (i += 1) { @@ -193,17 +193,17 @@ pub const Fe = struct { } /// Negate a field element - pub inline fn neg(a: Fe) Fe { + pub fn neg(a: Fe) callconv(.Inline) Fe { return zero.sub(a); } /// Return true if a field element is negative - pub inline fn isNegative(a: Fe) bool { + pub fn isNegative(a: Fe) callconv(.Inline) bool { return (a.toBytes()[0] & 1) != 0; } /// Conditonally replace a field element with `a` if `c` is positive - pub inline fn cMov(fe: *Fe, a: Fe, c: u64) void { + pub fn cMov(fe: *Fe, a: Fe, c: u64) callconv(.Inline) void { const mask: u64 = 0 -% c; var x = fe.*; comptime var i = 0; @@ -244,7 +244,7 @@ pub const Fe = struct { } } - inline fn _carry128(r: *[5]u128) Fe { + fn _carry128(r: *[5]u128) callconv(.Inline) Fe { var rs: [5]u64 = undefined; comptime var i = 0; inline while (i < 4) : (i += 1) { @@ -265,7 +265,7 @@ pub const Fe = struct { } /// Multiply two field elements - pub inline fn mul(a: Fe, b: Fe) Fe { + pub fn mul(a: Fe, b: Fe) callconv(.Inline) Fe { var ax: [5]u128 = undefined; var bx: [5]u128 = undefined; var a19: [5]u128 = undefined; @@ -288,7 +288,7 @@ pub const Fe = struct { return _carry128(&r); } - inline fn _sq(a: Fe, double: comptime bool) Fe { + fn _sq(a: Fe, double: comptime bool) callconv(.Inline) Fe { var ax: [5]u128 = undefined; var r: [5]u128 = undefined; comptime var i = 0; @@ -317,17 +317,17 @@ pub const Fe = struct { } /// Square a field element - pub inline fn sq(a: Fe) Fe { + pub fn sq(a: Fe) callconv(.Inline) Fe { return _sq(a, false); } /// Square and double a field element - pub inline fn sq2(a: Fe) Fe { + pub fn sq2(a: Fe) callconv(.Inline) Fe { return _sq(a, true); } /// Multiply a field element with a small (32-bit) integer - pub inline fn mul32(a: Fe, comptime n: u32) Fe { + pub fn mul32(a: Fe, comptime n: u32) callconv(.Inline) Fe { const sn = @intCast(u128, n); var fe: Fe = undefined; var x: u128 = 0; @@ -342,7 +342,7 @@ pub const Fe = struct { } /// Square a field element `n` times - inline fn sqn(a: Fe, comptime n: comptime_int) Fe { + fn sqn(a: Fe, comptime n: comptime_int) callconv(.Inline) Fe { var i: usize = 0; var fe = a; while (i < n) : (i += 1) { diff --git a/lib/std/crypto/25519/ristretto255.zig b/lib/std/crypto/25519/ristretto255.zig index 35dd6ea76c..68fb938103 100644 --- a/lib/std/crypto/25519/ristretto255.zig +++ b/lib/std/crypto/25519/ristretto255.zig @@ -42,7 +42,7 @@ pub const Ristretto255 = struct { } /// Reject the neutral element. - pub inline fn rejectIdentity(p: Ristretto255) !void { + pub fn rejectIdentity(p: Ristretto255) callconv(.Inline) !void { return p.p.rejectIdentity(); } @@ -141,19 +141,19 @@ pub const Ristretto255 = struct { } /// Double a Ristretto255 element. - pub inline fn dbl(p: Ristretto255) Ristretto255 { + pub fn dbl(p: Ristretto255) callconv(.Inline) Ristretto255 { return .{ .p = p.p.dbl() }; } /// Add two Ristretto255 elements. - pub inline fn add(p: Ristretto255, q: Ristretto255) Ristretto255 { + pub fn add(p: Ristretto255, q: Ristretto255) callconv(.Inline) Ristretto255 { return .{ .p = p.p.add(q.p) }; } /// Multiply a Ristretto255 element with a scalar. /// Return error.WeakPublicKey if the resulting element is /// the identity element. - pub inline fn mul(p: Ristretto255, s: [encoded_length]u8) !Ristretto255 { + pub fn mul(p: Ristretto255, s: [encoded_length]u8) callconv(.Inline) !Ristretto255 { return Ristretto255{ .p = try p.p.mul(s) }; } diff --git a/lib/std/crypto/25519/scalar.zig b/lib/std/crypto/25519/scalar.zig index d00f147274..ceff153bff 100644 --- a/lib/std/crypto/25519/scalar.zig +++ b/lib/std/crypto/25519/scalar.zig @@ -46,7 +46,7 @@ pub fn reduce64(s: [64]u8) [32]u8 { /// Perform the X25519 "clamping" operation. /// The scalar is then guaranteed to be a multiple of the cofactor. -pub inline fn clamp(s: *[32]u8) void { +pub fn clamp(s: *[32]u8) callconv(.Inline) void { s[0] &= 248; s[31] = (s[31] & 127) | 64; } diff --git a/lib/std/crypto/aegis.zig b/lib/std/crypto/aegis.zig index 234b439708..089dc06be4 100644 --- a/lib/std/crypto/aegis.zig +++ b/lib/std/crypto/aegis.zig @@ -35,7 +35,7 @@ const State128L = struct { return state; } - inline fn update(state: *State128L, d1: AesBlock, d2: AesBlock) void { + fn update(state: *State128L, d1: AesBlock, d2: AesBlock) callconv(.Inline) void { const blocks = &state.blocks; const tmp = blocks[7]; comptime var i: usize = 7; @@ -207,7 +207,7 @@ const State256 = struct { return state; } - inline fn update(state: *State256, d: AesBlock) void { + fn update(state: *State256, d: AesBlock) callconv(.Inline) void { const blocks = &state.blocks; const tmp = blocks[5].encrypt(blocks[0]); comptime var i: usize = 5; diff --git a/lib/std/crypto/aes/aesni.zig b/lib/std/crypto/aes/aesni.zig index 231bf5dbe8..13b3f8e527 100644 --- a/lib/std/crypto/aes/aesni.zig +++ b/lib/std/crypto/aes/aesni.zig @@ -19,24 +19,24 @@ pub const Block = struct { repr: BlockVec, /// Convert a byte sequence into an internal representation. - pub inline fn fromBytes(bytes: *const [16]u8) Block { + pub fn fromBytes(bytes: *const [16]u8) callconv(.Inline) Block { const repr = mem.bytesToValue(BlockVec, bytes); return Block{ .repr = repr }; } /// Convert the internal representation of a block into a byte sequence. - pub inline fn toBytes(block: Block) [16]u8 { + pub fn toBytes(block: Block) callconv(.Inline) [16]u8 { return mem.toBytes(block.repr); } /// XOR the block with a byte sequence. - pub inline fn xorBytes(block: Block, bytes: *const [16]u8) [16]u8 { + pub fn xorBytes(block: Block, bytes: *const [16]u8) callconv(.Inline) [16]u8 { const x = block.repr ^ fromBytes(bytes).repr; return mem.toBytes(x); } /// Encrypt a block with a round key. - pub inline fn encrypt(block: Block, round_key: Block) Block { + pub fn encrypt(block: Block, round_key: Block) callconv(.Inline) Block { return Block{ .repr = asm ( \\ vaesenc %[rk], %[in], %[out] @@ -48,7 +48,7 @@ pub const Block = struct { } /// Encrypt a block with the last round key. - pub inline fn encryptLast(block: Block, round_key: Block) Block { + pub fn encryptLast(block: Block, round_key: Block) callconv(.Inline) Block { return Block{ .repr = asm ( \\ vaesenclast %[rk], %[in], %[out] @@ -60,7 +60,7 @@ pub const Block = struct { } /// Decrypt a block with a round key. - pub inline fn decrypt(block: Block, inv_round_key: Block) Block { + pub fn decrypt(block: Block, inv_round_key: Block) callconv(.Inline) Block { return Block{ .repr = asm ( \\ vaesdec %[rk], %[in], %[out] @@ -72,7 +72,7 @@ pub const Block = struct { } /// Decrypt a block with the last round key. - pub inline fn decryptLast(block: Block, inv_round_key: Block) Block { + pub fn decryptLast(block: Block, inv_round_key: Block) callconv(.Inline) Block { return Block{ .repr = asm ( \\ vaesdeclast %[rk], %[in], %[out] @@ -84,17 +84,17 @@ pub const Block = struct { } /// Apply the bitwise XOR operation to the content of two blocks. - pub inline fn xorBlocks(block1: Block, block2: Block) Block { + pub fn xorBlocks(block1: Block, block2: Block) callconv(.Inline) Block { return Block{ .repr = block1.repr ^ block2.repr }; } /// Apply the bitwise AND operation to the content of two blocks. - pub inline fn andBlocks(block1: Block, block2: Block) Block { + pub fn andBlocks(block1: Block, block2: Block) callconv(.Inline) Block { return Block{ .repr = block1.repr & block2.repr }; } /// Apply the bitwise OR operation to the content of two blocks. - pub inline fn orBlocks(block1: Block, block2: Block) Block { + pub fn orBlocks(block1: Block, block2: Block) callconv(.Inline) Block { return Block{ .repr = block1.repr | block2.repr }; } @@ -114,7 +114,7 @@ pub const Block = struct { }; /// Encrypt multiple blocks in parallel, each their own round key. - pub inline fn encryptParallel(comptime count: usize, blocks: [count]Block, round_keys: [count]Block) [count]Block { + pub fn encryptParallel(comptime count: usize, blocks: [count]Block, round_keys: [count]Block) callconv(.Inline) [count]Block { comptime var i = 0; var out: [count]Block = undefined; inline while (i < count) : (i += 1) { @@ -124,7 +124,7 @@ pub const Block = struct { } /// Decrypt multiple blocks in parallel, each their own round key. - pub inline fn decryptParallel(comptime count: usize, blocks: [count]Block, round_keys: [count]Block) [count]Block { + pub fn decryptParallel(comptime count: usize, blocks: [count]Block, round_keys: [count]Block) callconv(.Inline) [count]Block { comptime var i = 0; var out: [count]Block = undefined; inline while (i < count) : (i += 1) { @@ -134,7 +134,7 @@ pub const Block = struct { } /// Encrypt multiple blocks in parallel with the same round key. - pub inline fn encryptWide(comptime count: usize, blocks: [count]Block, round_key: Block) [count]Block { + pub fn encryptWide(comptime count: usize, blocks: [count]Block, round_key: Block) callconv(.Inline) [count]Block { comptime var i = 0; var out: [count]Block = undefined; inline while (i < count) : (i += 1) { @@ -144,7 +144,7 @@ pub const Block = struct { } /// Decrypt multiple blocks in parallel with the same round key. - pub inline fn decryptWide(comptime count: usize, blocks: [count]Block, round_key: Block) [count]Block { + pub fn decryptWide(comptime count: usize, blocks: [count]Block, round_key: Block) callconv(.Inline) [count]Block { comptime var i = 0; var out: [count]Block = undefined; inline while (i < count) : (i += 1) { @@ -154,7 +154,7 @@ pub const Block = struct { } /// Encrypt multiple blocks in parallel with the same last round key. - pub inline fn encryptLastWide(comptime count: usize, blocks: [count]Block, round_key: Block) [count]Block { + pub fn encryptLastWide(comptime count: usize, blocks: [count]Block, round_key: Block) callconv(.Inline) [count]Block { comptime var i = 0; var out: [count]Block = undefined; inline while (i < count) : (i += 1) { @@ -164,7 +164,7 @@ pub const Block = struct { } /// Decrypt multiple blocks in parallel with the same last round key. - pub inline fn decryptLastWide(comptime count: usize, blocks: [count]Block, round_key: Block) [count]Block { + pub fn decryptLastWide(comptime count: usize, blocks: [count]Block, round_key: Block) callconv(.Inline) [count]Block { comptime var i = 0; var out: [count]Block = undefined; inline while (i < count) : (i += 1) { diff --git a/lib/std/crypto/aes/armcrypto.zig b/lib/std/crypto/aes/armcrypto.zig index cb8387a2c6..d331783284 100644 --- a/lib/std/crypto/aes/armcrypto.zig +++ b/lib/std/crypto/aes/armcrypto.zig @@ -19,18 +19,18 @@ pub const Block = struct { repr: BlockVec, /// Convert a byte sequence into an internal representation. - pub inline fn fromBytes(bytes: *const [16]u8) Block { + pub fn fromBytes(bytes: *const [16]u8) callconv(.Inline) Block { const repr = mem.bytesToValue(BlockVec, bytes); return Block{ .repr = repr }; } /// Convert the internal representation of a block into a byte sequence. - pub inline fn toBytes(block: Block) [16]u8 { + pub fn toBytes(block: Block) callconv(.Inline) [16]u8 { return mem.toBytes(block.repr); } /// XOR the block with a byte sequence. - pub inline fn xorBytes(block: Block, bytes: *const [16]u8) [16]u8 { + pub fn xorBytes(block: Block, bytes: *const [16]u8) callconv(.Inline) [16]u8 { const x = block.repr ^ fromBytes(bytes).repr; return mem.toBytes(x); } @@ -38,7 +38,7 @@ pub const Block = struct { const zero = Vector(2, u64){ 0, 0 }; /// Encrypt a block with a round key. - pub inline fn encrypt(block: Block, round_key: Block) Block { + pub fn encrypt(block: Block, round_key: Block) callconv(.Inline) Block { return Block{ .repr = asm ( \\ mov %[out].16b, %[in].16b @@ -54,7 +54,7 @@ pub const Block = struct { } /// Encrypt a block with the last round key. - pub inline fn encryptLast(block: Block, round_key: Block) Block { + pub fn encryptLast(block: Block, round_key: Block) callconv(.Inline) Block { return Block{ .repr = asm ( \\ mov %[out].16b, %[in].16b @@ -69,7 +69,7 @@ pub const Block = struct { } /// Decrypt a block with a round key. - pub inline fn decrypt(block: Block, inv_round_key: Block) Block { + pub fn decrypt(block: Block, inv_round_key: Block) callconv(.Inline) Block { return Block{ .repr = asm ( \\ mov %[out].16b, %[in].16b @@ -85,7 +85,7 @@ pub const Block = struct { } /// Decrypt a block with the last round key. - pub inline fn decryptLast(block: Block, inv_round_key: Block) Block { + pub fn decryptLast(block: Block, inv_round_key: Block) callconv(.Inline) Block { return Block{ .repr = asm ( \\ mov %[out].16b, %[in].16b @@ -100,17 +100,17 @@ pub const Block = struct { } /// Apply the bitwise XOR operation to the content of two blocks. - pub inline fn xorBlocks(block1: Block, block2: Block) Block { + pub fn xorBlocks(block1: Block, block2: Block) callconv(.Inline) Block { return Block{ .repr = block1.repr ^ block2.repr }; } /// Apply the bitwise AND operation to the content of two blocks. - pub inline fn andBlocks(block1: Block, block2: Block) Block { + pub fn andBlocks(block1: Block, block2: Block) callconv(.Inline) Block { return Block{ .repr = block1.repr & block2.repr }; } /// Apply the bitwise OR operation to the content of two blocks. - pub inline fn orBlocks(block1: Block, block2: Block) Block { + pub fn orBlocks(block1: Block, block2: Block) callconv(.Inline) Block { return Block{ .repr = block1.repr | block2.repr }; } @@ -120,7 +120,7 @@ pub const Block = struct { pub const optimal_parallel_blocks = 8; /// Encrypt multiple blocks in parallel, each their own round key. - pub inline fn encryptParallel(comptime count: usize, blocks: [count]Block, round_keys: [count]Block) [count]Block { + pub fn encryptParallel(comptime count: usize, blocks: [count]Block, round_keys: [count]Block) callconv(.Inline) [count]Block { comptime var i = 0; var out: [count]Block = undefined; inline while (i < count) : (i += 1) { @@ -130,7 +130,7 @@ pub const Block = struct { } /// Decrypt multiple blocks in parallel, each their own round key. - pub inline fn decryptParallel(comptime count: usize, blocks: [count]Block, round_keys: [count]Block) [count]Block { + pub fn decryptParallel(comptime count: usize, blocks: [count]Block, round_keys: [count]Block) callconv(.Inline) [count]Block { comptime var i = 0; var out: [count]Block = undefined; inline while (i < count) : (i += 1) { @@ -140,7 +140,7 @@ pub const Block = struct { } /// Encrypt multiple blocks in parallel with the same round key. - pub inline fn encryptWide(comptime count: usize, blocks: [count]Block, round_key: Block) [count]Block { + pub fn encryptWide(comptime count: usize, blocks: [count]Block, round_key: Block) callconv(.Inline) [count]Block { comptime var i = 0; var out: [count]Block = undefined; inline while (i < count) : (i += 1) { @@ -150,7 +150,7 @@ pub const Block = struct { } /// Decrypt multiple blocks in parallel with the same round key. - pub inline fn decryptWide(comptime count: usize, blocks: [count]Block, round_key: Block) [count]Block { + pub fn decryptWide(comptime count: usize, blocks: [count]Block, round_key: Block) callconv(.Inline) [count]Block { comptime var i = 0; var out: [count]Block = undefined; inline while (i < count) : (i += 1) { @@ -160,7 +160,7 @@ pub const Block = struct { } /// Encrypt multiple blocks in parallel with the same last round key. - pub inline fn encryptLastWide(comptime count: usize, blocks: [count]Block, round_key: Block) [count]Block { + pub fn encryptLastWide(comptime count: usize, blocks: [count]Block, round_key: Block) callconv(.Inline) [count]Block { comptime var i = 0; var out: [count]Block = undefined; inline while (i < count) : (i += 1) { @@ -170,7 +170,7 @@ pub const Block = struct { } /// Decrypt multiple blocks in parallel with the same last round key. - pub inline fn decryptLastWide(comptime count: usize, blocks: [count]Block, round_key: Block) [count]Block { + pub fn decryptLastWide(comptime count: usize, blocks: [count]Block, round_key: Block) callconv(.Inline) [count]Block { comptime var i = 0; var out: [count]Block = undefined; inline while (i < count) : (i += 1) { diff --git a/lib/std/crypto/aes/soft.zig b/lib/std/crypto/aes/soft.zig index 5eda9557ee..6f305b4050 100644 --- a/lib/std/crypto/aes/soft.zig +++ b/lib/std/crypto/aes/soft.zig @@ -18,7 +18,7 @@ pub const Block = struct { repr: BlockVec align(16), /// Convert a byte sequence into an internal representation. - pub inline fn fromBytes(bytes: *const [16]u8) Block { + pub fn fromBytes(bytes: *const [16]u8) callconv(.Inline) Block { const s0 = mem.readIntBig(u32, bytes[0..4]); const s1 = mem.readIntBig(u32, bytes[4..8]); const s2 = mem.readIntBig(u32, bytes[8..12]); @@ -27,7 +27,7 @@ pub const Block = struct { } /// Convert the internal representation of a block into a byte sequence. - pub inline fn toBytes(block: Block) [16]u8 { + pub fn toBytes(block: Block) callconv(.Inline) [16]u8 { var bytes: [16]u8 = undefined; mem.writeIntBig(u32, bytes[0..4], block.repr[0]); mem.writeIntBig(u32, bytes[4..8], block.repr[1]); @@ -37,7 +37,7 @@ pub const Block = struct { } /// XOR the block with a byte sequence. - pub inline fn xorBytes(block: Block, bytes: *const [16]u8) [16]u8 { + pub fn xorBytes(block: Block, bytes: *const [16]u8) callconv(.Inline) [16]u8 { const block_bytes = block.toBytes(); var x: [16]u8 = undefined; comptime var i: usize = 0; @@ -48,7 +48,7 @@ pub const Block = struct { } /// Encrypt a block with a round key. - pub inline fn encrypt(block: Block, round_key: Block) Block { + pub fn encrypt(block: Block, round_key: Block) callconv(.Inline) Block { const src = &block.repr; const s0 = block.repr[0]; @@ -65,7 +65,7 @@ pub const Block = struct { } /// Encrypt a block with the last round key. - pub inline fn encryptLast(block: Block, round_key: Block) Block { + pub fn encryptLast(block: Block, round_key: Block) callconv(.Inline) Block { const src = &block.repr; const t0 = block.repr[0]; @@ -87,7 +87,7 @@ pub const Block = struct { } /// Decrypt a block with a round key. - pub inline fn decrypt(block: Block, round_key: Block) Block { + pub fn decrypt(block: Block, round_key: Block) callconv(.Inline) Block { const src = &block.repr; const s0 = block.repr[0]; @@ -104,7 +104,7 @@ pub const Block = struct { } /// Decrypt a block with the last round key. - pub inline fn decryptLast(block: Block, round_key: Block) Block { + pub fn decryptLast(block: Block, round_key: Block) callconv(.Inline) Block { const src = &block.repr; const t0 = block.repr[0]; @@ -126,7 +126,7 @@ pub const Block = struct { } /// Apply the bitwise XOR operation to the content of two blocks. - pub inline fn xorBlocks(block1: Block, block2: Block) Block { + pub fn xorBlocks(block1: Block, block2: Block) callconv(.Inline) Block { var x: BlockVec = undefined; comptime var i = 0; inline while (i < 4) : (i += 1) { @@ -136,7 +136,7 @@ pub const Block = struct { } /// Apply the bitwise AND operation to the content of two blocks. - pub inline fn andBlocks(block1: Block, block2: Block) Block { + pub fn andBlocks(block1: Block, block2: Block) callconv(.Inline) Block { var x: BlockVec = undefined; comptime var i = 0; inline while (i < 4) : (i += 1) { @@ -146,7 +146,7 @@ pub const Block = struct { } /// Apply the bitwise OR operation to the content of two blocks. - pub inline fn orBlocks(block1: Block, block2: Block) Block { + pub fn orBlocks(block1: Block, block2: Block) callconv(.Inline) Block { var x: BlockVec = undefined; comptime var i = 0; inline while (i < 4) : (i += 1) { diff --git a/lib/std/crypto/blake3.zig b/lib/std/crypto/blake3.zig index e3d3192bf8..7a65487135 100644 --- a/lib/std/crypto/blake3.zig +++ b/lib/std/crypto/blake3.zig @@ -66,7 +66,7 @@ const CompressVectorized = struct { const Lane = Vector(4, u32); const Rows = [4]Lane; - inline fn g(comptime even: bool, rows: *Rows, m: Lane) void { + fn g(comptime even: bool, rows: *Rows, m: Lane) callconv(.Inline) void { rows[0] +%= rows[1] +% m; rows[3] ^= rows[0]; rows[3] = math.rotr(Lane, rows[3], if (even) 8 else 16); @@ -75,13 +75,13 @@ const CompressVectorized = struct { rows[1] = math.rotr(Lane, rows[1], if (even) 7 else 12); } - inline fn diagonalize(rows: *Rows) void { + fn diagonalize(rows: *Rows) callconv(.Inline) void { rows[0] = @shuffle(u32, rows[0], undefined, [_]i32{ 3, 0, 1, 2 }); rows[3] = @shuffle(u32, rows[3], undefined, [_]i32{ 2, 3, 0, 1 }); rows[2] = @shuffle(u32, rows[2], undefined, [_]i32{ 1, 2, 3, 0 }); } - inline fn undiagonalize(rows: *Rows) void { + fn undiagonalize(rows: *Rows) callconv(.Inline) void { rows[0] = @shuffle(u32, rows[0], undefined, [_]i32{ 1, 2, 3, 0 }); rows[3] = @shuffle(u32, rows[3], undefined, [_]i32{ 2, 3, 0, 1 }); rows[2] = @shuffle(u32, rows[2], undefined, [_]i32{ 3, 0, 1, 2 }); diff --git a/lib/std/crypto/chacha20.zig b/lib/std/crypto/chacha20.zig index 8923bac26f..0f79707279 100644 --- a/lib/std/crypto/chacha20.zig +++ b/lib/std/crypto/chacha20.zig @@ -35,7 +35,7 @@ const ChaCha20VecImpl = struct { }; } - inline fn chacha20Core(x: *BlockVec, input: BlockVec) void { + fn chacha20Core(x: *BlockVec, input: BlockVec) callconv(.Inline) void { x.* = input; var r: usize = 0; @@ -80,7 +80,7 @@ const ChaCha20VecImpl = struct { } } - inline fn hashToBytes(out: *[64]u8, x: BlockVec) void { + fn hashToBytes(out: *[64]u8, x: BlockVec) callconv(.Inline) void { var i: usize = 0; while (i < 4) : (i += 1) { mem.writeIntLittle(u32, out[16 * i + 0 ..][0..4], x[i][0]); @@ -90,7 +90,7 @@ const ChaCha20VecImpl = struct { } } - inline fn contextFeedback(x: *BlockVec, ctx: BlockVec) void { + fn contextFeedback(x: *BlockVec, ctx: BlockVec) callconv(.Inline) void { x[0] +%= ctx[0]; x[1] +%= ctx[1]; x[2] +%= ctx[2]; @@ -190,7 +190,7 @@ const ChaCha20NonVecImpl = struct { }; } - inline fn chacha20Core(x: *BlockVec, input: BlockVec) void { + fn chacha20Core(x: *BlockVec, input: BlockVec) callconv(.Inline) void { x.* = input; const rounds = comptime [_]QuarterRound{ @@ -219,7 +219,7 @@ const ChaCha20NonVecImpl = struct { } } - inline fn hashToBytes(out: *[64]u8, x: BlockVec) void { + fn hashToBytes(out: *[64]u8, x: BlockVec) callconv(.Inline) void { var i: usize = 0; while (i < 4) : (i += 1) { mem.writeIntLittle(u32, out[16 * i + 0 ..][0..4], x[i * 4 + 0]); @@ -229,7 +229,7 @@ const ChaCha20NonVecImpl = struct { } } - inline fn contextFeedback(x: *BlockVec, ctx: BlockVec) void { + fn contextFeedback(x: *BlockVec, ctx: BlockVec) callconv(.Inline) void { var i: usize = 0; while (i < 16) : (i += 1) { x[i] +%= ctx[i]; diff --git a/lib/std/crypto/ghash.zig b/lib/std/crypto/ghash.zig index 3d56469d8e..ffc9ef41ae 100644 --- a/lib/std/crypto/ghash.zig +++ b/lib/std/crypto/ghash.zig @@ -95,7 +95,7 @@ pub const Ghash = struct { } } - inline fn clmul_pclmul(x: u64, y: u64) u64 { + fn clmul_pclmul(x: u64, y: u64) callconv(.Inline) u64 { const Vector = std.meta.Vector; const product = asm ( \\ vpclmulqdq $0x00, %[x], %[y], %[out] @@ -106,7 +106,7 @@ pub const Ghash = struct { return product[0]; } - inline fn clmul_pmull(x: u64, y: u64) u64 { + fn clmul_pmull(x: u64, y: u64) callconv(.Inline) u64 { const Vector = std.meta.Vector; const product = asm ( \\ pmull %[out].1q, %[x].1d, %[y].1d diff --git a/lib/std/crypto/gimli.zig b/lib/std/crypto/gimli.zig index a5a7fb8c59..4809b9b6f7 100644 --- a/lib/std/crypto/gimli.zig +++ b/lib/std/crypto/gimli.zig @@ -48,7 +48,7 @@ pub const State = struct { return mem.asBytes(&self.data); } - inline fn endianSwap(self: *Self) void { + fn endianSwap(self: *Self) callconv(.Inline) void { for (self.data) |*w| { w.* = mem.littleToNative(u32, w.*); } @@ -116,7 +116,7 @@ pub const State = struct { const Lane = Vector(4, u32); - inline fn shift(x: Lane, comptime n: comptime_int) Lane { + fn shift(x: Lane, comptime n: comptime_int) callconv(.Inline) Lane { return x << @splat(4, @as(u5, n)); } diff --git a/lib/std/crypto/salsa20.zig b/lib/std/crypto/salsa20.zig index 14505865cf..e22668f998 100644 --- a/lib/std/crypto/salsa20.zig +++ b/lib/std/crypto/salsa20.zig @@ -37,7 +37,7 @@ const Salsa20VecImpl = struct { }; } - inline fn salsa20Core(x: *BlockVec, input: BlockVec, comptime feedback: bool) void { + fn salsa20Core(x: *BlockVec, input: BlockVec, comptime feedback: bool) callconv(.Inline) void { const n1n2n3n0 = Lane{ input[3][1], input[3][2], input[3][3], input[3][0] }; const n1n2 = Half{ n1n2n3n0[0], n1n2n3n0[1] }; const n3n0 = Half{ n1n2n3n0[2], n1n2n3n0[3] }; @@ -211,7 +211,7 @@ const Salsa20NonVecImpl = struct { d: u6, }; - inline fn Rp(a: usize, b: usize, c: usize, d: u6) QuarterRound { + fn Rp(a: usize, b: usize, c: usize, d: u6) callconv(.Inline) QuarterRound { return QuarterRound{ .a = a, .b = b, @@ -220,7 +220,7 @@ const Salsa20NonVecImpl = struct { }; } - inline fn salsa20Core(x: *BlockVec, input: BlockVec, comptime feedback: bool) void { + fn salsa20Core(x: *BlockVec, input: BlockVec, comptime feedback: bool) callconv(.Inline) void { const arx_steps = comptime [_]QuarterRound{ Rp(4, 0, 12, 7), Rp(8, 4, 0, 9), Rp(12, 8, 4, 13), Rp(0, 12, 8, 18), Rp(9, 5, 1, 7), Rp(13, 9, 5, 9), Rp(1, 13, 9, 13), Rp(5, 1, 13, 18), diff --git a/lib/std/elf.zig b/lib/std/elf.zig index 6dfa373414..cfb6b448c0 100644 --- a/lib/std/elf.zig +++ b/lib/std/elf.zig @@ -720,10 +720,10 @@ pub const Elf32_Rel = extern struct { r_offset: Elf32_Addr, r_info: Elf32_Word, - pub inline fn r_sym(self: @This()) u24 { + pub fn r_sym(self: @This()) callconv(.Inline) u24 { return @truncate(u24, self.r_info >> 8); } - pub inline fn r_type(self: @This()) u8 { + pub fn r_type(self: @This()) callconv(.Inline) u8 { return @truncate(u8, self.r_info & 0xff); } }; @@ -731,10 +731,10 @@ pub const Elf64_Rel = extern struct { r_offset: Elf64_Addr, r_info: Elf64_Xword, - pub inline fn r_sym(self: @This()) u32 { + pub fn r_sym(self: @This()) callconv(.Inline) u32 { return @truncate(u32, self.r_info >> 32); } - pub inline fn r_type(self: @This()) u32 { + pub fn r_type(self: @This()) callconv(.Inline) u32 { return @truncate(u32, self.r_info & 0xffffffff); } }; @@ -743,10 +743,10 @@ pub const Elf32_Rela = extern struct { r_info: Elf32_Word, r_addend: Elf32_Sword, - pub inline fn r_sym(self: @This()) u24 { + pub fn r_sym(self: @This()) callconv(.Inline) u24 { return @truncate(u24, self.r_info >> 8); } - pub inline fn r_type(self: @This()) u8 { + pub fn r_type(self: @This()) callconv(.Inline) u8 { return @truncate(u8, self.r_info & 0xff); } }; @@ -755,10 +755,10 @@ pub const Elf64_Rela = extern struct { r_info: Elf64_Xword, r_addend: Elf64_Sxword, - pub inline fn r_sym(self: @This()) u32 { + pub fn r_sym(self: @This()) callconv(.Inline) u32 { return @truncate(u32, self.r_info >> 32); } - pub inline fn r_type(self: @This()) u32 { + pub fn r_type(self: @This()) callconv(.Inline) u32 { return @truncate(u32, self.r_info & 0xffffffff); } }; diff --git a/lib/std/fmt/parse_float.zig b/lib/std/fmt/parse_float.zig index caa88520ac..324b06898e 100644 --- a/lib/std/fmt/parse_float.zig +++ b/lib/std/fmt/parse_float.zig @@ -52,21 +52,21 @@ const Z96 = struct { d2: u32, // d = s >> 1 - inline fn shiftRight1(d: *Z96, s: Z96) void { + fn shiftRight1(d: *Z96, s: Z96) callconv(.Inline) void { d.d0 = (s.d0 >> 1) | ((s.d1 & 1) << 31); d.d1 = (s.d1 >> 1) | ((s.d2 & 1) << 31); d.d2 = s.d2 >> 1; } // d = s << 1 - inline fn shiftLeft1(d: *Z96, s: Z96) void { + fn shiftLeft1(d: *Z96, s: Z96) callconv(.Inline) void { d.d2 = (s.d2 << 1) | ((s.d1 & (1 << 31)) >> 31); d.d1 = (s.d1 << 1) | ((s.d0 & (1 << 31)) >> 31); d.d0 = s.d0 << 1; } // d += s - inline fn add(d: *Z96, s: Z96) void { + fn add(d: *Z96, s: Z96) callconv(.Inline) void { var w = @as(u64, d.d0) + @as(u64, s.d0); d.d0 = @truncate(u32, w); @@ -80,7 +80,7 @@ const Z96 = struct { } // d -= s - inline fn sub(d: *Z96, s: Z96) void { + fn sub(d: *Z96, s: Z96) callconv(.Inline) void { var w = @as(u64, d.d0) -% @as(u64, s.d0); d.d0 = @truncate(u32, w); diff --git a/lib/std/hash/cityhash.zig b/lib/std/hash/cityhash.zig index c2e7db4d49..d7f2f1a9eb 100644 --- a/lib/std/hash/cityhash.zig +++ b/lib/std/hash/cityhash.zig @@ -6,7 +6,7 @@ const std = @import("std"); const builtin = @import("builtin"); -inline fn offsetPtr(ptr: [*]const u8, offset: usize) [*]const u8 { +fn offsetPtr(ptr: [*]const u8, offset: usize) callconv(.Inline) [*]const u8 { // ptr + offset doesn't work at comptime so we need this instead. return @ptrCast([*]const u8, &ptr[offset]); } diff --git a/lib/std/os/bits/freebsd.zig b/lib/std/os/bits/freebsd.zig index e2c4eb055b..8529c5e3db 100644 --- a/lib/std/os/bits/freebsd.zig +++ b/lib/std/os/bits/freebsd.zig @@ -815,16 +815,16 @@ pub const sigval = extern union { pub const _SIG_WORDS = 4; pub const _SIG_MAXSIG = 128; -pub inline fn _SIG_IDX(sig: usize) usize { +pub fn _SIG_IDX(sig: usize) callconv(.Inline) usize { return sig - 1; } -pub inline fn _SIG_WORD(sig: usize) usize { +pub fn _SIG_WORD(sig: usize) callconv(.Inline) usize { return_SIG_IDX(sig) >> 5; } -pub inline fn _SIG_BIT(sig: usize) usize { +pub fn _SIG_BIT(sig: usize) callconv(.Inline) usize { return 1 << (_SIG_IDX(sig) & 31); } -pub inline fn _SIG_VALID(sig: usize) usize { +pub fn _SIG_VALID(sig: usize) callconv(.Inline) usize { return sig <= _SIG_MAXSIG and sig > 0; } diff --git a/lib/std/os/bits/netbsd.zig b/lib/std/os/bits/netbsd.zig index 1780255aac..f8b950ea86 100644 --- a/lib/std/os/bits/netbsd.zig +++ b/lib/std/os/bits/netbsd.zig @@ -796,16 +796,16 @@ pub const _ksiginfo = extern struct { pub const _SIG_WORDS = 4; pub const _SIG_MAXSIG = 128; -pub inline fn _SIG_IDX(sig: usize) usize { +pub fn _SIG_IDX(sig: usize) callconv(.Inline) usize { return sig - 1; } -pub inline fn _SIG_WORD(sig: usize) usize { +pub fn _SIG_WORD(sig: usize) callconv(.Inline) usize { return_SIG_IDX(sig) >> 5; } -pub inline fn _SIG_BIT(sig: usize) usize { +pub fn _SIG_BIT(sig: usize) callconv(.Inline) usize { return 1 << (_SIG_IDX(sig) & 31); } -pub inline fn _SIG_VALID(sig: usize) usize { +pub fn _SIG_VALID(sig: usize) callconv(.Inline) usize { return sig <= _SIG_MAXSIG and sig > 0; } diff --git a/lib/std/os/linux.zig b/lib/std/os/linux.zig index ffc1029708..b7534db191 100644 --- a/lib/std/os/linux.zig +++ b/lib/std/os/linux.zig @@ -126,7 +126,7 @@ pub fn fork() usize { /// It is advised to avoid this function and use clone instead, because /// 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 { +pub fn vfork() callconv(.Inline) usize { return @call(.{ .modifier = .always_inline }, syscall0, .{.vfork}); } diff --git a/lib/std/os/linux/tls.zig b/lib/std/os/linux/tls.zig index a9c0f6cb56..614f5b4395 100644 --- a/lib/std/os/linux/tls.zig +++ b/lib/std/os/linux/tls.zig @@ -300,7 +300,7 @@ fn initTLS() void { }; } -inline fn alignPtrCast(comptime T: type, ptr: [*]u8) *T { +fn alignPtrCast(comptime T: type, ptr: [*]u8) callconv(.Inline) *T { return @ptrCast(*T, @alignCast(@alignOf(*T), ptr)); } diff --git a/lib/std/os/windows.zig b/lib/std/os/windows.zig index e1e325d9f6..6f67b65252 100644 --- a/lib/std/os/windows.zig +++ b/lib/std/os/windows.zig @@ -1669,7 +1669,7 @@ pub fn wToPrefixedFileW(s: []const u16) !PathSpace { return path_space; } -inline fn MAKELANGID(p: c_ushort, s: c_ushort) LANGID { +fn MAKELANGID(p: c_ushort, s: c_ushort) callconv(.Inline) LANGID { return (s << 10) | p; } diff --git a/lib/std/start.zig b/lib/std/start.zig index 718d48130e..0fb96c768f 100644 --- a/lib/std/start.zig +++ b/lib/std/start.zig @@ -262,7 +262,7 @@ const bad_main_ret = "expected return type of main to be 'void', '!void', 'noret // 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. -inline fn initEventLoopAndCallMain() u8 { +fn initEventLoopAndCallMain() callconv(.Inline) u8 { if (std.event.Loop.instance) |loop| { if (!@hasDecl(root, "event_loop")) { loop.init() catch |err| { @@ -291,7 +291,7 @@ inline fn initEventLoopAndCallMain() u8 { // and we want fewer call frames in stack traces. // TODO This function is duplicated from initEventLoopAndCallMain instead of using generics // because it is working around stage1 compiler bugs. -inline fn initEventLoopAndCallWinMain() std.os.windows.INT { +fn initEventLoopAndCallWinMain() callconv(.Inline) std.os.windows.INT { if (std.event.Loop.instance) |loop| { if (!@hasDecl(root, "event_loop")) { loop.init() catch |err| { diff --git a/lib/std/zig/parser_test.zig b/lib/std/zig/parser_test.zig index 2f0b7ff082..822e9006c4 100644 --- a/lib/std/zig/parser_test.zig +++ b/lib/std/zig/parser_test.zig @@ -2355,17 +2355,17 @@ test "zig fmt: functions" { \\extern fn puts(s: *const u8) c_int; \\extern "c" fn puts(s: *const u8) c_int; \\export fn puts(s: *const u8) c_int; - \\inline fn puts(s: *const u8) c_int; + \\fn puts(s: *const u8) callconv(.Inline) c_int; \\noinline fn puts(s: *const u8) c_int; \\pub extern fn puts(s: *const u8) c_int; \\pub extern "c" fn puts(s: *const u8) c_int; \\pub export fn puts(s: *const u8) c_int; - \\pub inline fn puts(s: *const u8) c_int; + \\pub fn puts(s: *const u8) callconv(.Inline) c_int; \\pub noinline fn puts(s: *const u8) c_int; \\pub extern fn puts(s: *const u8) align(2 + 2) c_int; \\pub extern "c" fn puts(s: *const u8) align(2 + 2) c_int; \\pub export fn puts(s: *const u8) align(2 + 2) c_int; - \\pub inline fn puts(s: *const u8) align(2 + 2) c_int; + \\pub fn puts(s: *const u8) align(2 + 2) callconv(.Inline) c_int; \\pub noinline fn puts(s: *const u8) align(2 + 2) c_int; \\ ); diff --git a/lib/std/zig/system/x86.zig b/lib/std/zig/system/x86.zig index 24aebb5a61..bda9a17c95 100644 --- a/lib/std/zig/system/x86.zig +++ b/lib/std/zig/system/x86.zig @@ -19,11 +19,11 @@ fn setFeature(cpu: *Target.Cpu, feature: Target.x86.Feature, enabled: bool) void if (enabled) cpu.features.addFeature(idx) else cpu.features.removeFeature(idx); } -inline fn bit(input: u32, offset: u5) bool { +fn bit(input: u32, offset: u5) callconv(.Inline) bool { return (input >> offset) & 1 != 0; } -inline fn hasMask(input: u32, mask: u32) bool { +fn hasMask(input: u32, mask: u32) callconv(.Inline) bool { return (input & mask) == mask; } diff --git a/src/link/MachO.zig b/src/link/MachO.zig index eee5841903..fd1c53cb67 100644 --- a/src/link/MachO.zig +++ b/src/link/MachO.zig @@ -2366,7 +2366,7 @@ fn allocatedSizeLinkedit(self: *MachO, start: u64) u64 { return min_pos - start; } -inline fn checkForCollision(start: u64, end: u64, off: u64, size: u64) ?u64 { +fn checkForCollision(start: u64, end: u64, off: u64, size: u64) callconv(.Inline) ?u64 { const increased_size = padToIdeal(size); const test_end = off + increased_size; if (end > off and start < test_end) { diff --git a/src/tracy.zig b/src/tracy.zig index 6f56a87ce6..3f6cf56588 100644 --- a/src/tracy.zig +++ b/src/tracy.zig @@ -31,7 +31,7 @@ pub const Ctx = if (enable) ___tracy_c_zone_context else struct { pub fn end(self: Ctx) void {} }; -pub inline fn trace(comptime src: std.builtin.SourceLocation) Ctx { +pub fn trace(comptime src: std.builtin.SourceLocation) callconv(.Inline) Ctx { if (!enable) return .{}; const loc: ___tracy_source_location_data = .{ diff --git a/test/cli.zig b/test/cli.zig index 8dbef06887..8787dab277 100644 --- a/test/cli.zig +++ b/test/cli.zig @@ -113,7 +113,7 @@ fn testGodboltApi(zig_exe: []const u8, dir_path: []const u8) anyerror!void { \\ return num * num; \\} \\extern fn zig_panic() noreturn; - \\pub inline fn panic(msg: []const u8, error_return_trace: ?*@import("builtin").StackTrace) noreturn { + \\pub fn panic(msg: []const u8, error_return_trace: ?*@import("builtin").StackTrace) callconv(.Inline) noreturn { \\ zig_panic(); \\} ); diff --git a/test/compile_errors.zig b/test/compile_errors.zig index 3b4eb61195..2fb4c36ed4 100644 --- a/test/compile_errors.zig +++ b/test/compile_errors.zig @@ -1648,7 +1648,7 @@ pub fn addCases(cases: *tests.CompileErrorContext) void { \\ @call(.{ .modifier = .compile_time }, baz, .{}); \\} \\fn foo() void {} - \\inline fn bar() void {} + \\fn bar() callconv(.Inline) void {} \\fn baz1() void {} \\fn baz2() void {} , &[_][]const u8{ @@ -3944,7 +3944,7 @@ pub fn addCases(cases: *tests.CompileErrorContext) void { \\export fn entry() void { \\ var a = b; \\} - \\inline fn b() void { } + \\fn b() callconv(.Inline) void { } , &[_][]const u8{ "tmp.zig:2:5: error: functions marked inline must be stored in const or comptime var", "tmp.zig:4:1: note: declared here", @@ -6782,11 +6782,11 @@ pub fn addCases(cases: *tests.CompileErrorContext) void { // \\export fn foo() void { // \\ bar(); // \\} - // \\inline fn bar() void { + // \\fn bar() callconv(.Inline) void { // \\ baz(); // \\ quux(); // \\} - // \\inline fn baz() void { + // \\fn baz() callconv(.Inline) void { // \\ bar(); // \\ quux(); // \\} @@ -6799,7 +6799,7 @@ pub fn addCases(cases: *tests.CompileErrorContext) void { // \\export fn foo() void { // \\ quux(@ptrToInt(bar)); // \\} - // \\inline fn bar() void { } + // \\fn bar() callconv(.Inline) void { } // \\extern fn quux(usize) void; //, &[_][]const u8{ // "tmp.zig:4:1: error: unable to inline function", @@ -7207,7 +7207,7 @@ pub fn addCases(cases: *tests.CompileErrorContext) void { \\export fn entry() void { \\ foo(); \\} - \\inline fn foo() void { + \\fn foo() callconv(.Inline) void { \\ @setAlignStack(16); \\} , &[_][]const u8{ diff --git a/test/stage1/behavior/fn.zig b/test/stage1/behavior/fn.zig index dd69d00c60..a1e726c565 100644 --- a/test/stage1/behavior/fn.zig +++ b/test/stage1/behavior/fn.zig @@ -113,7 +113,7 @@ test "assign inline fn to const variable" { a(); } -inline fn inlineFn() void {} +fn inlineFn() callconv(.Inline) void {} test "pass by non-copying value" { expect(addPointCoords(Point{ .x = 1, .y = 2 }) == 3); diff --git a/test/stage2/cbe.zig b/test/stage2/cbe.zig index 0eb2cf68b4..35ae1dbf12 100644 --- a/test/stage2/cbe.zig +++ b/test/stage2/cbe.zig @@ -179,7 +179,7 @@ pub fn addCases(ctx: *TestContext) !void { \\ return y - 1; \\} \\ - \\inline fn rec(n: usize) usize { + \\fn rec(n: usize) callconv(.Inline) usize { \\ if (n <= 1) return n; \\ return rec(n - 1); \\} diff --git a/test/stage2/test.zig b/test/stage2/test.zig index 78d7eba262..486edeb864 100644 --- a/test/stage2/test.zig +++ b/test/stage2/test.zig @@ -255,7 +255,7 @@ pub fn addCases(ctx: *TestContext) !void { \\ exit(y - 6); \\} \\ - \\inline fn add(a: usize, b: usize, c: usize) usize { + \\fn add(a: usize, b: usize, c: usize) callconv(.Inline) usize { \\ return a + b + c; \\} \\ @@ -1228,7 +1228,7 @@ pub fn addCases(ctx: *TestContext) !void { \\ exit(y - 6); \\} \\ - \\inline fn add(a: usize, b: usize, c: usize) usize { + \\fn add(a: usize, b: usize, c: usize) callconv(.Inline) usize { \\ if (a == 10) @compileError("bad"); \\ return a + b + c; \\} @@ -1251,7 +1251,7 @@ pub fn addCases(ctx: *TestContext) !void { \\ exit(y - 6); \\} \\ - \\inline fn add(a: usize, b: usize, c: usize) usize { + \\fn add(a: usize, b: usize, c: usize) callconv(.Inline) usize { \\ if (a == 10) @compileError("bad"); \\ return a + b + c; \\} @@ -1277,7 +1277,7 @@ pub fn addCases(ctx: *TestContext) !void { \\ exit(y - 21); \\} \\ - \\inline fn fibonacci(n: usize) usize { + \\fn fibonacci(n: usize) callconv(.Inline) usize { \\ if (n <= 2) return n; \\ return fibonacci(n - 2) + fibonacci(n - 1); \\} @@ -1300,7 +1300,7 @@ pub fn addCases(ctx: *TestContext) !void { \\ exit(y - 21); \\} \\ - \\inline fn fibonacci(n: usize) usize { + \\fn fibonacci(n: usize) callconv(.Inline) usize { \\ if (n <= 2) return n; \\ return fibonacci(n - 2) + fibonacci(n - 1); \\} diff --git a/test/translate_c.zig b/test/translate_c.zig index 03ca87d5f6..b8e00a690b 100644 --- a/test/translate_c.zig +++ b/test/translate_c.zig @@ -43,7 +43,7 @@ pub fn addCases(cases: *tests.TranslateCContext) void { , \\pub const VALUE = ((((1 + (2 * 3)) + (4 * 5)) + 6) << 7) | @boolToInt(8 == 9); , - \\pub inline fn _AL_READ3BYTES(p: anytype) @TypeOf(((@import("std").meta.cast([*c]u8, p)).* | (((@import("std").meta.cast([*c]u8, p)) + 1).* << 8)) | (((@import("std").meta.cast([*c]u8, p)) + 2).* << 16)) { + \\pub fn _AL_READ3BYTES(p: anytype) callconv(.Inline) @TypeOf(((@import("std").meta.cast([*c]u8, p)).* | (((@import("std").meta.cast([*c]u8, p)) + 1).* << 8)) | (((@import("std").meta.cast([*c]u8, p)) + 2).* << 16)) { \\ return ((@import("std").meta.cast([*c]u8, p)).* | (((@import("std").meta.cast([*c]u8, p)) + 1).* << 8)) | (((@import("std").meta.cast([*c]u8, p)) + 2).* << 16); \\} }); @@ -116,7 +116,7 @@ pub fn addCases(cases: *tests.TranslateCContext) void { \\}; \\pub const Color = struct_Color; , - \\pub inline fn CLITERAL(type_1: anytype) @TypeOf(type_1) { + \\pub fn CLITERAL(type_1: anytype) callconv(.Inline) @TypeOf(type_1) { \\ return type_1; \\} , @@ -148,7 +148,7 @@ pub fn addCases(cases: *tests.TranslateCContext) void { cases.add("correct semicolon after infixop", \\#define __ferror_unlocked_body(_fp) (((_fp)->_flags & _IO_ERR_SEEN) != 0) , &[_][]const u8{ - \\pub inline fn __ferror_unlocked_body(_fp: anytype) @TypeOf(((_fp.*._flags) & _IO_ERR_SEEN) != 0) { + \\pub fn __ferror_unlocked_body(_fp: anytype) callconv(.Inline) @TypeOf(((_fp.*._flags) & _IO_ERR_SEEN) != 0) { \\ return ((_fp.*._flags) & _IO_ERR_SEEN) != 0; \\} }); @@ -157,7 +157,7 @@ pub fn addCases(cases: *tests.TranslateCContext) void { \\#define FOO(x) ((x >= 0) + (x >= 0)) \\#define BAR 1 && 2 > 4 , &[_][]const u8{ - \\pub inline fn FOO(x: anytype) @TypeOf(@boolToInt(x >= 0) + @boolToInt(x >= 0)) { + \\pub fn FOO(x: anytype) callconv(.Inline) @TypeOf(@boolToInt(x >= 0) + @boolToInt(x >= 0)) { \\ return @boolToInt(x >= 0) + @boolToInt(x >= 0); \\} , @@ -208,7 +208,7 @@ pub fn addCases(cases: *tests.TranslateCContext) void { \\ break :blk bar; \\}; , - \\pub inline fn bar(x: anytype) @TypeOf(baz(1, 2)) { + \\pub fn bar(x: anytype) callconv(.Inline) @TypeOf(baz(1, 2)) { \\ return blk: { \\ _ = &x; \\ _ = 3; @@ -1590,13 +1590,13 @@ pub fn addCases(cases: *tests.TranslateCContext) void { , &[_][]const u8{ \\pub extern var fn_ptr: ?fn () callconv(.C) void; , - \\pub inline fn foo() void { + \\pub fn foo() callconv(.Inline) void { \\ return fn_ptr.?(); \\} , \\pub extern var fn_ptr2: ?fn (c_int, f32) callconv(.C) u8; , - \\pub inline fn bar(arg_1: c_int, arg_2: f32) u8 { + \\pub fn bar(arg_1: c_int, arg_2: f32) callconv(.Inline) u8 { \\ return fn_ptr2.?(arg_1, arg_2); \\} }); @@ -1629,7 +1629,7 @@ pub fn addCases(cases: *tests.TranslateCContext) void { , \\pub const glClearPFN = PFNGLCLEARPROC; , - \\pub inline fn glClearUnion(arg_2: GLbitfield) void { + \\pub fn glClearUnion(arg_2: GLbitfield) callconv(.Inline) void { \\ return glProcs.gl.Clear.?(arg_2); \\} , @@ -1650,15 +1650,15 @@ pub fn addCases(cases: *tests.TranslateCContext) void { , &[_][]const u8{ \\pub extern var c: c_int; , - \\pub inline fn BASIC(c_1: anytype) @TypeOf(c_1 * 2) { + \\pub fn BASIC(c_1: anytype) callconv(.Inline) @TypeOf(c_1 * 2) { \\ return c_1 * 2; \\} , - \\pub inline fn FOO(L: anytype, b: anytype) @TypeOf(L + b) { + \\pub fn FOO(L: anytype, b: anytype) callconv(.Inline) @TypeOf(L + b) { \\ return L + b; \\} , - \\pub inline fn BAR() @TypeOf(c * c) { + \\pub fn BAR() callconv(.Inline) @TypeOf(c * c) { \\ return c * c; \\} }); @@ -2298,7 +2298,7 @@ pub fn addCases(cases: *tests.TranslateCContext) void { cases.add("macro call", \\#define CALL(arg) bar(arg) , &[_][]const u8{ - \\pub inline fn CALL(arg: anytype) @TypeOf(bar(arg)) { + \\pub fn CALL(arg: anytype) callconv(.Inline) @TypeOf(bar(arg)) { \\ return bar(arg); \\} }); @@ -2860,7 +2860,7 @@ pub fn addCases(cases: *tests.TranslateCContext) void { \\#define BAR (void*) a \\#define BAZ (uint32_t)(2) , &[_][]const u8{ - \\pub inline fn FOO(bar: anytype) @TypeOf(baz((@import("std").meta.cast(?*c_void, baz)))) { + \\pub fn FOO(bar: anytype) callconv(.Inline) @TypeOf(baz((@import("std").meta.cast(?*c_void, baz)))) { \\ return baz((@import("std").meta.cast(?*c_void, baz))); \\} , @@ -2902,11 +2902,11 @@ pub fn addCases(cases: *tests.TranslateCContext) void { \\#define MIN(a, b) ((b) < (a) ? (b) : (a)) \\#define MAX(a, b) ((b) > (a) ? (b) : (a)) , &[_][]const u8{ - \\pub inline fn MIN(a: anytype, b: anytype) @TypeOf(if (b < a) b else a) { + \\pub fn MIN(a: anytype, b: anytype) callconv(.Inline) @TypeOf(if (b < a) b else a) { \\ return if (b < a) b else a; \\} , - \\pub inline fn MAX(a: anytype, b: anytype) @TypeOf(if (b > a) b else a) { + \\pub fn MAX(a: anytype, b: anytype) callconv(.Inline) @TypeOf(if (b > a) b else a) { \\ return if (b > a) b else a; \\} }); @@ -3094,7 +3094,7 @@ pub fn addCases(cases: *tests.TranslateCContext) void { \\#define DefaultScreen(dpy) (((_XPrivDisplay)(dpy))->default_screen) \\ , &[_][]const u8{ - \\pub inline fn DefaultScreen(dpy: anytype) @TypeOf((@import("std").meta.cast(_XPrivDisplay, dpy)).*.default_screen) { + \\pub fn DefaultScreen(dpy: anytype) callconv(.Inline) @TypeOf((@import("std").meta.cast(_XPrivDisplay, dpy)).*.default_screen) { \\ return (@import("std").meta.cast(_XPrivDisplay, dpy)).*.default_screen; \\} }); -- cgit v1.2.3 From bb4f4c043e7dde4e8b9fcbf0af9329d3fd08ff7b Mon Sep 17 00:00:00 2001 From: Tadeo Kondrak Date: Tue, 9 Feb 2021 23:44:33 -0700 Subject: test/cli.zig: Remove inline from panic function in testGodboltApi Might add another line to stack traces there. --- test/cli.zig | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'test/cli.zig') diff --git a/test/cli.zig b/test/cli.zig index 8787dab277..c0702fa54c 100644 --- a/test/cli.zig +++ b/test/cli.zig @@ -113,7 +113,7 @@ fn testGodboltApi(zig_exe: []const u8, dir_path: []const u8) anyerror!void { \\ return num * num; \\} \\extern fn zig_panic() noreturn; - \\pub fn panic(msg: []const u8, error_return_trace: ?*@import("builtin").StackTrace) callconv(.Inline) noreturn { + \\pub fn panic(msg: []const u8, error_return_trace: ?*@import("builtin").StackTrace) noreturn { \\ zig_panic(); \\} ); -- cgit v1.2.3