commit 61bf43d790d0f56f9c030afd8ec761a0f043a8a5 (tree)
parent da939b032e90795c25f23efa68a9a1c50397fb48
Author: Jacob Young <jacobly0@users.noreply.github.com>
Date: Wed, 5 Oct 2022 04:57:27 -0400
c: fix switch on bool warning
Diffstat:
1 file changed, 1 insertion(+), 0 deletions(-)
diff --git a/src/codegen/c.zig b/src/codegen/c.zig
@@ -3180,6 +3180,7 @@ fn airSwitchBr(f: *Function, inst: Air.Inst.Index) !CValue {
const writer = f.object.writer();
try writer.writeAll("switch (");
+ if (condition_ty.tag() == .bool) try writer.writeAll("(int)");
try f.writeCValue(writer, condition);
try writer.writeAll(") {");
f.object.indent_writer.pushIndent();