| ... | ... | @@ -550,7 +550,7 @@ fn visitFnDecl(c: *Context, fn_decl: *const clang.FunctionDecl) Error!void { |
| 550 | 550 | const fn_decl_loc = fn_decl.getLocation(); |
| 551 | 551 | const has_body = fn_decl.hasBody(); |
| 552 | 552 | const storage_class = fn_decl.getStorageClass(); |
| 553 | | const decl_ctx = FnDeclContext{ |
| 553 | var decl_ctx = FnDeclContext{ |
| 554 | 554 | .fn_name = fn_name, |
| 555 | 555 | .has_body = has_body, |
| 556 | 556 | .storage_class = storage_class, |
| ... | ... | @@ -584,6 +584,12 @@ fn visitFnDecl(c: *Context, fn_decl: *const clang.FunctionDecl) Error!void { |
| 584 | 584 | const proto_node = switch (fn_type.getTypeClass()) { |
| 585 | 585 | .FunctionProto => blk: { |
| 586 | 586 | const fn_proto_type = @ptrCast(*const clang.FunctionProtoType, fn_type); |
| 587 | if (has_body and fn_proto_type.isVariadic()) { |
| 588 | decl_ctx.has_body = false; |
| 589 | decl_ctx.storage_class = .Extern; |
| 590 | decl_ctx.is_export = false; |
| 591 | try emitWarning(c, fn_decl_loc, "TODO unable to translate variadic function, demoted to declaration", .{}); |
| 592 | } |
| 587 | 593 | break :blk transFnProto(rp, fn_decl, fn_proto_type, fn_decl_loc, decl_ctx, true) catch |err| switch (err) { |
| 588 | 594 | error.UnsupportedType => { |
| 589 | 595 | return failDecl(c, fn_decl_loc, fn_name, "unable to resolve prototype of function", .{}); |