authorgravatar for git@vexu.euVeikka Tuominen <git@vexu.eu> 2020-08-09 16:26:18+03:00
committergravatar for git@vexu.euVeikka Tuominen <git@vexu.eu> 2020-08-11 12:24:45+03:00
logdfcac3cd76c899c412fa3b78946ebce4f42f2ae8
tree20d982e86db3fd1840bd551c570c1e8d66c741c0
parent20510d209be44590f390c370f9e477d84ab46454
signaturelock-open Commit is signed but in an unrecognized format.

translate-c: always add extern token for functions without body


2 files changed, 8 insertions(+), 8 deletions(-)

src-self-hosted/translate_c.zig+1-1
......@@ -4907,7 +4907,7 @@ fn finishTransFnProto(
49074907 const pub_tok = if (is_pub) try appendToken(rp.c, .Keyword_pub, "pub") else null;
49084908 const extern_export_inline_tok = if (is_export)
49094909 try appendToken(rp.c, .Keyword_export, "export")
4910 else if (cc == .C and is_extern)
4910 else if (is_extern)
49114911 try appendToken(rp.c, .Keyword_extern, "extern")
49124912 else
49134913 null;
test/translate_c.zig+7-7
......@@ -1260,11 +1260,11 @@ pub fn addCases(cases: *tests.TranslateCContext) void {
12601260 \\void __attribute__((cdecl)) foo4(float *a);
12611261 \\void __attribute__((thiscall)) foo5(float *a);
12621262 , &[_][]const u8{
1263 \\pub fn foo1(a: [*c]f32) callconv(.Fastcall) void;
1264 \\pub fn foo2(a: [*c]f32) callconv(.Stdcall) void;
1265 \\pub fn foo3(a: [*c]f32) callconv(.Vectorcall) void;
1263 \\pub extern fn foo1(a: [*c]f32) callconv(.Fastcall) void;
1264 \\pub extern fn foo2(a: [*c]f32) callconv(.Stdcall) void;
1265 \\pub extern fn foo3(a: [*c]f32) callconv(.Vectorcall) void;
12661266 \\pub extern fn foo4(a: [*c]f32) void;
1267 \\pub fn foo5(a: [*c]f32) callconv(.Thiscall) void;
1267 \\pub extern fn foo5(a: [*c]f32) callconv(.Thiscall) void;
12681268 });
12691269
12701270 cases.addWithTarget("Calling convention", CrossTarget.parse(.{
......@@ -1274,8 +1274,8 @@ pub fn addCases(cases: *tests.TranslateCContext) void {
12741274 \\void __attribute__((pcs("aapcs"))) foo1(float *a);
12751275 \\void __attribute__((pcs("aapcs-vfp"))) foo2(float *a);
12761276 , &[_][]const u8{
1277 \\pub fn foo1(a: [*c]f32) callconv(.AAPCS) void;
1278 \\pub fn foo2(a: [*c]f32) callconv(.AAPCSVFP) void;
1277 \\pub extern fn foo1(a: [*c]f32) callconv(.AAPCS) void;
1278 \\pub extern fn foo2(a: [*c]f32) callconv(.AAPCSVFP) void;
12791279 });
12801280
12811281 cases.addWithTarget("Calling convention", CrossTarget.parse(.{
......@@ -1284,7 +1284,7 @@ pub fn addCases(cases: *tests.TranslateCContext) void {
12841284 }) catch unreachable,
12851285 \\void __attribute__((aarch64_vector_pcs)) foo1(float *a);
12861286 , &[_][]const u8{
1287 \\pub fn foo1(a: [*c]f32) callconv(.Vectorcall) void;
1287 \\pub extern fn foo1(a: [*c]f32) callconv(.Vectorcall) void;
12881288 });
12891289
12901290 cases.add("Parameterless function prototypes",