| ... | ... | @@ -295,9 +295,9 @@ pub fn addCases(cases: *tests.TranslateCContext) void { |
| 295 | 295 | \\ lws_callback_function *callback_http; |
| 296 | 296 | \\}; |
| 297 | 297 | , &[_][]const u8{ |
| 298 | | \\pub const lws_callback_function = extern fn () void; |
| 298 | \\pub const lws_callback_function = fn () callconv(.C) void; |
| 299 | 299 | \\pub const struct_Foo = extern struct { |
| 300 | | \\ func: ?extern fn () void, |
| 300 | \\ func: ?fn () callconv(.C) void, |
| 301 | 301 | \\ callback_http: ?lws_callback_function, |
| 302 | 302 | \\}; |
| 303 | 303 | }); |
| ... | ... | @@ -377,7 +377,7 @@ pub fn addCases(cases: *tests.TranslateCContext) void { |
| 377 | 377 | \\}; |
| 378 | 378 | , &[_][]const u8{ |
| 379 | 379 | \\pub const struct_Foo = extern struct { |
| 380 | | \\ derp: ?extern fn ([*c]struct_Foo) void, |
| 380 | \\ derp: ?fn ([*c]struct_Foo) callconv(.C) void, |
| 381 | 381 | \\}; |
| 382 | 382 | , |
| 383 | 383 | \\pub const Foo = struct_Foo; |
| ... | ... | @@ -611,7 +611,7 @@ pub fn addCases(cases: *tests.TranslateCContext) void { |
| 611 | 611 | cases.add("__cdecl doesn't mess up function pointers", |
| 612 | 612 | \\void foo(void (__cdecl *fn_ptr)(void)); |
| 613 | 613 | , &[_][]const u8{ |
| 614 | | \\pub extern fn foo(fn_ptr: ?extern fn () void) void; |
| 614 | \\pub extern fn foo(fn_ptr: ?fn () callconv(.C) void) void; |
| 615 | 615 | }); |
| 616 | 616 | |
| 617 | 617 | cases.add("void cast", |
| ... | ... | @@ -953,8 +953,8 @@ pub fn addCases(cases: *tests.TranslateCContext) void { |
| 953 | 953 | \\typedef void (*fn0)(); |
| 954 | 954 | \\typedef void (*fn1)(char); |
| 955 | 955 | , &[_][]const u8{ |
| 956 | | \\pub const fn0 = ?extern fn (...) void; |
| 957 | | \\pub const fn1 = ?extern fn (u8) void; |
| 956 | \\pub const fn0 = ?fn (...) callconv(.C) void; |
| 957 | \\pub const fn1 = ?fn (u8) callconv(.C) void; |
| 958 | 958 | }); |
| 959 | 959 | |
| 960 | 960 | cases.addWithTarget("Calling convention", tests.Target{ |
| ... | ... | @@ -1157,13 +1157,13 @@ pub fn addCases(cases: *tests.TranslateCContext) void { |
| 1157 | 1157 | \\extern char (*fn_ptr2)(int, float); |
| 1158 | 1158 | \\#define bar fn_ptr2 |
| 1159 | 1159 | , &[_][]const u8{ |
| 1160 | | \\pub extern var fn_ptr: ?extern fn () void; |
| 1160 | \\pub extern var fn_ptr: ?fn () callconv(.C) void; |
| 1161 | 1161 | , |
| 1162 | 1162 | \\pub inline fn foo() void { |
| 1163 | 1163 | \\ return fn_ptr.?(); |
| 1164 | 1164 | \\} |
| 1165 | 1165 | , |
| 1166 | | \\pub extern var fn_ptr2: ?extern fn (c_int, f32) u8; |
| 1166 | \\pub extern var fn_ptr2: ?fn (c_int, f32) callconv(.C) u8; |
| 1167 | 1167 | , |
| 1168 | 1168 | \\pub inline fn bar(arg_1: c_int, arg_2: f32) u8 { |
| 1169 | 1169 | \\ return fn_ptr2.?(arg_1, arg_2); |
| ... | ... | @@ -1185,8 +1185,8 @@ pub fn addCases(cases: *tests.TranslateCContext) void { |
| 1185 | 1185 | \\#define glClearPFN PFNGLCLEARPROC |
| 1186 | 1186 | , &[_][]const u8{ |
| 1187 | 1187 | \\pub const GLbitfield = c_uint; |
| 1188 | | \\pub const PFNGLCLEARPROC = ?extern fn (GLbitfield) void; |
| 1189 | | \\pub const OpenGLProc = ?extern fn () void; |
| 1188 | \\pub const PFNGLCLEARPROC = ?fn (GLbitfield) callconv(.C) void; |
| 1189 | \\pub const OpenGLProc = ?fn () callconv(.C) void; |
| 1190 | 1190 | \\const struct_unnamed_1 = extern struct { |
| 1191 | 1191 | \\ Clear: PFNGLCLEARPROC, |
| 1192 | 1192 | \\}; |
| ... | ... | @@ -1976,8 +1976,8 @@ pub fn addCases(cases: *tests.TranslateCContext) void { |
| 1976 | 1976 | \\ return 0; |
| 1977 | 1977 | \\} |
| 1978 | 1978 | \\pub export fn bar() void { |
| 1979 | | \\ var f: ?extern fn () void = foo; |
| 1980 | | \\ var b: ?extern fn () c_int = baz; |
| 1979 | \\ var f: ?fn () callconv(.C) void = foo; |
| 1980 | \\ var b: ?fn () callconv(.C) c_int = baz; |
| 1981 | 1981 | \\ f.?(); |
| 1982 | 1982 | \\ (f).?(); |
| 1983 | 1983 | \\ foo(); |