diff options
| author | Andrew Kelley <andrew@ziglang.org> | 2021-02-11 16:01:58 -0800 |
|---|---|---|
| committer | GitHub <noreply@github.com> | 2021-02-11 16:01:58 -0800 |
| commit | d3565ed6b48c9c66128f181e7b90b5348504cb3f (patch) | |
| tree | 99a03080830c1f9433046427feb18f90cade6c09 /test | |
| parent | d98f09e4f67fb2848be6052466db035450326605 (diff) | |
| parent | bb4f4c043e7dde4e8b9fcbf0af9329d3fd08ff7b (diff) | |
| download | zig-d3565ed6b48c9c66128f181e7b90b5348504cb3f.tar.gz zig-d3565ed6b48c9c66128f181e7b90b5348504cb3f.zip | |
Merge pull request #7749 from tadeokondrak/6429-callconv-inline
Replace inline fn with callconv(.Inline)
Diffstat (limited to 'test')
| -rw-r--r-- | test/cli.zig | 2 | ||||
| -rw-r--r-- | test/compile_errors.zig | 12 | ||||
| -rw-r--r-- | test/stage1/behavior/fn.zig | 2 | ||||
| -rw-r--r-- | test/stage2/cbe.zig | 2 | ||||
| -rw-r--r-- | test/stage2/test.zig | 10 | ||||
| -rw-r--r-- | test/translate_c.zig | 32 |
6 files changed, 30 insertions, 30 deletions
diff --git a/test/cli.zig b/test/cli.zig index 8dbef06887..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 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) 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 2097e17323..95969a2f72 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; \\} }); @@ -2310,7 +2310,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); \\} }); @@ -2872,7 +2872,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))); \\} , @@ -2914,11 +2914,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; \\} }); @@ -3106,7 +3106,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; \\} }); |
