authorgravatar for jacobly@ziglang.orgJacob Young <jacobly@ziglang.org> 2022-10-05 04:57:27-04:00
committergravatar for jacobly@ziglang.orgJacob Young <jacobly@ziglang.org> 2022-10-25 05:11:28-04:00
log61bf43d790d0f56f9c030afd8ec761a0f043a8a5
tree499e967674f184bce295c39065fc725ba9033679
parentda939b032e90795c25f23efa68a9a1c50397fb48

c: fix switch on bool warning


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

src/codegen/c.zig+1
...@@ -3180,6 +3180,7 @@ fn airSwitchBr(f: *Function, inst: Air.Inst.Index) !CValue {...@@ -3180,6 +3180,7 @@ fn airSwitchBr(f: *Function, inst: Air.Inst.Index) !CValue {
3180 const writer = f.object.writer();3180 const writer = f.object.writer();
31813181
3182 try writer.writeAll("switch (");3182 try writer.writeAll("switch (");
3183 if (condition_ty.tag() == .bool) try writer.writeAll("(int)");
3183 try f.writeCValue(writer, condition);3184 try f.writeCValue(writer, condition);
3184 try writer.writeAll(") {");3185 try writer.writeAll(") {");
3185 f.object.indent_writer.pushIndent();3186 f.object.indent_writer.pushIndent();