authorgravatar for daniele.cocca@gmail.comDaniele Cocca <daniele.cocca@gmail.com> 2022-03-13 00:39:10+00:00
committergravatar for daniele.cocca@gmail.comDaniele Cocca <daniele.cocca@gmail.com> 2022-03-13 09:59:15+00:00
log87744a7ea9a2449764a110da4210d7750e3938ee
tree0ef36de421b84b5a6c5eadafde0409d9c2a8b15b
parent2036af94e97f0ac16293556423c144ec9e1b8226

CBE: skip 0 bit integers from function signatures

This was already done for void types, and needs to be done for 0 bit integer types as well to align the rendered function signatures with the effective size of extra.data.args_len as seen by airCall().

1 files changed, 4 insertions(+), 1 deletions(-)

src/codegen/c.zig+4-1
...@@ -839,10 +839,13 @@ pub const DeclGen = struct {...@@ -839,10 +839,13 @@ pub const DeclGen = struct {
839 try w.writeAll("(");839 try w.writeAll("(");
840 const param_len = dg.decl.ty.fnParamLen();840 const param_len = dg.decl.ty.fnParamLen();
841841
842 const target = dg.module.getTarget();
842 var index: usize = 0;843 var index: usize = 0;
843 var params_written: usize = 0;844 var params_written: usize = 0;
844 while (index < param_len) : (index += 1) {845 while (index < param_len) : (index += 1) {
845 if (dg.decl.ty.fnParamType(index).zigTypeTag() == .Void) continue;846 const param_type = dg.decl.ty.fnParamType(index);
847 if (param_type.zigTypeTag() == .Void) continue;
848 if (param_type.isInt() and param_type.intInfo(target).bits == 0) continue;
846 if (params_written > 0) {849 if (params_written > 0) {
847 try w.writeAll(", ");850 try w.writeAll(", ");
848 }851 }