Commit 87744a7ea9

Daniele Cocca <daniele.cocca@gmail.com>
2022-03-13 01:39:10
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 parent 2036af9
Changed files (1)
src
codegen
src/codegen/c.zig
@@ -839,10 +839,13 @@ pub const DeclGen = struct {
         try w.writeAll("(");
         const param_len = dg.decl.ty.fnParamLen();
 
+        const target = dg.module.getTarget();
         var index: usize = 0;
         var params_written: usize = 0;
         while (index < param_len) : (index += 1) {
-            if (dg.decl.ty.fnParamType(index).zigTypeTag() == .Void) continue;
+            const param_type = dg.decl.ty.fnParamType(index);
+            if (param_type.zigTypeTag() == .Void) continue;
+            if (param_type.isInt() and param_type.intInfo(target).bits == 0) continue;
             if (params_written > 0) {
                 try w.writeAll(", ");
             }